From 6ffac68f3d03045bf75bfeac94fd48355ae11cfd Mon Sep 17 00:00:00 2001 From: ImJustAMan <42199549+ImJustAMan@users.noreply.github.com> Date: Fri, 10 Jul 2020 02:35:50 +0800 Subject: [PATCH] test(router-link): add not active with different params type and delete repeat test (#363) --- __tests__/RouterLink.spec.ts | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) 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, -- 2.39.5