diff --git a/src/create-matcher.js b/src/create-matcher.js index 5463d4348..0da8e60c5 100644 --- a/src/create-matcher.js +++ b/src/create-matcher.js @@ -190,7 +190,7 @@ function matchRoute ( const val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i] if (key) { // Fix #1994: using * with props: true generates a param named 0 - params[key.name || 'fullPath'] = val + params[key.name || 'unnamed'] = val } } diff --git a/test/e2e/specs/route-matching.js b/test/e2e/specs/route-matching.js index 065b10827..1849e77a5 100644 --- a/test/e2e/specs/route-matching.js +++ b/test/e2e/specs/route-matching.js @@ -83,7 +83,7 @@ module.exports = { route.matched[0].path === '/asterisk/*' && route.fullPath === '/asterisk/foo' && JSON.stringify(route.params) === JSON.stringify({ - 'fullPath': 'foo' + unnamed: 'foo' }) ) }, null, '/asterisk/foo') @@ -96,7 +96,7 @@ module.exports = { route.matched[0].path === '/asterisk/*' && route.fullPath === '/asterisk/foo/bar' && JSON.stringify(route.params) === JSON.stringify({ - 'fullPath': 'foo/bar' + unnamed: 'foo/bar' }) ) }, null, '/asterisk/foo/bar') @@ -120,7 +120,7 @@ module.exports = { route.matched[0].path === '/optional-group/(foo/)?bar' && route.fullPath === '/optional-group/foo/bar' && JSON.stringify(route.params) === JSON.stringify({ - 0: 'foo/' + unnamed: 'foo/' }) ) }, null, '/optional-group/foo/bar') diff --git a/test/unit/specs/create-matcher.spec.js b/test/unit/specs/create-matcher.spec.js index 6c13fb5b0..ebdda39d4 100644 --- a/test/unit/specs/create-matcher.spec.js +++ b/test/unit/specs/create-matcher.spec.js @@ -34,8 +34,8 @@ describe('Creating Matcher', function () { expect(console.warn).not.toHaveBeenCalled() }) - it('matches asterisk routes with fullName as the param', function () { + it('matches asterisk routes with a default param name', function () { const { params } = match({ path: '/not-found' }, routes[0]) - expect(params).toEqual({ fullPath: '/not-found' }) + expect(params).toEqual({ unnamed: '/not-found' }) }) })