From: ImJustAMan <42199549+ImJustAMan@users.noreply.github.com> Date: Thu, 9 Jul 2020 18:35:50 +0000 (+0800) Subject: test(router-link): add not active with different params type and delete repeat test... X-Git-Tag: v4.0.0-beta.3~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ffac68f3d03045bf75bfeac94fd48355ae11cfd;p=thirdparty%2Fvuejs%2Frouter.git test(router-link): add not active with different params type and delete repeat test (#363) --- diff --git a/__tests__/RouterLink.spec.ts b/__tests__/RouterLink.spec.ts index 5757779a..0372124a 100644 --- a/__tests__/RouterLink.spec.ts +++ b/__tests__/RouterLink.spec.ts @@ -99,6 +99,21 @@ const locations = createLocations({ name: undefined, }, }, + singleStringParams: { + string: '/p/1', + normalized: { + fullPath: '/p/1', + href: '/p/1', + path: '/p/1', + params: { p: '1' }, + meta: {}, + query: {}, + hash: '', + matched: [records.home], + redirectedFrom: undefined, + name: undefined, + }, + }, repeatedParams2: { string: '/p/1/2', normalized: { @@ -362,15 +377,6 @@ describe('RouterLink', () => { expect(wrapper.find('a')!.getAttribute('href')).toBe('/home') }) - it('displays a link with a string prop', async () => { - const { wrapper } = await factory( - START_LOCATION_NORMALIZED, - { to: locations.basic.string }, - locations.basic.normalized - ) - expect(wrapper.find('a')!.getAttribute('href')).toBe('/home') - }) - it('can change the value', async () => { const { wrapper, router } = await factory( START_LOCATION_NORMALIZED, @@ -500,6 +506,15 @@ describe('RouterLink', () => { expect(wrapper.find('a')!.className).toBe('') }) + it('is not active with different params type', async () => { + const { wrapper } = await factory( + locations.repeatedParams2.normalized, + { to: locations.singleStringParams.string }, + locations.singleStringParams.normalized + ) + expect(wrapper.find('a')!.className).toBe('') + }) + it('is not active with more repeated params', async () => { const { wrapper } = await factory( locations.repeatedParams2.normalized,