From: Eduardo San Martin Morote Date: Mon, 24 Apr 2023 07:50:38 +0000 (+0200) Subject: test(matcher): empty string optional param resolve X-Git-Tag: v4.2.0~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e77e2b3138302e955e587fd895a887b36ca9a09;p=thirdparty%2Fvuejs%2Frouter.git test(matcher): empty string optional param resolve --- diff --git a/packages/router/__tests__/matcher/resolve.spec.ts b/packages/router/__tests__/matcher/resolve.spec.ts index d51622d4..359a3daa 100644 --- a/packages/router/__tests__/matcher/resolve.spec.ts +++ b/packages/router/__tests__/matcher/resolve.spec.ts @@ -807,6 +807,21 @@ describe('RouterMatcher.resolve', () => { ) }) + it('keeps optional params passed as empty strings', () => { + assertRecordMatch( + { path: '/:a/:b?', name: 'p', components }, + { name: 'p', params: { a: 'b', b: '' } }, + { name: 'p', path: '/b', params: { a: 'b', b: '' } }, + { + params: { a: 'a', b: '' }, + path: '/a', + matched: [], + meta: {}, + name: undefined, + } + ) + }) + it('resolves root path with optional params', () => { assertRecordMatch( { path: '/:tab?', name: 'h', components },