Skip to content

Commit 5edc2ec

Browse files
committed
refactor(match): use pathMatch instead of fullPath for unnamed params
1 parent b505400 commit 5edc2ec

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/create-matcher.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ function matchRoute (
190190
const val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i]
191191
if (key) {
192192
// Fix #1994: using * with props: true generates a param named 0
193-
params[key.name || 'fullPath'] = val
193+
params[key.name || 'pathMatch'] = val
194194
}
195195
}
196196

test/e2e/specs/route-matching.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ module.exports = {
8383
route.matched[0].path === '/asterisk/*' &&
8484
route.fullPath === '/asterisk/foo' &&
8585
JSON.stringify(route.params) === JSON.stringify({
86-
'fullPath': 'foo'
86+
pathMatch: 'foo'
8787
})
8888
)
8989
}, null, '/asterisk/foo')
@@ -96,7 +96,7 @@ module.exports = {
9696
route.matched[0].path === '/asterisk/*' &&
9797
route.fullPath === '/asterisk/foo/bar' &&
9898
JSON.stringify(route.params) === JSON.stringify({
99-
'fullPath': 'foo/bar'
99+
pathMatch: 'foo/bar'
100100
})
101101
)
102102
}, null, '/asterisk/foo/bar')
@@ -120,7 +120,7 @@ module.exports = {
120120
route.matched[0].path === '/optional-group/(foo/)?bar' &&
121121
route.fullPath === '/optional-group/foo/bar' &&
122122
JSON.stringify(route.params) === JSON.stringify({
123-
0: 'foo/'
123+
pathMatch: 'foo/'
124124
})
125125
)
126126
}, null, '/optional-group/foo/bar')

test/unit/specs/create-matcher.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ describe('Creating Matcher', function () {
3434
expect(console.warn).not.toHaveBeenCalled()
3535
})
3636

37-
it('matches asterisk routes with fullName as the param', function () {
37+
it('matches asterisk routes with a default param name', function () {
3838
const { params } = match({ path: '/not-found' }, routes[0])
39-
expect(params).toEqual({ fullPath: '/not-found' })
39+
expect(params).toEqual({ pathMatch: '/not-found' })
4040
})
4141
})

0 commit comments

Comments
 (0)