]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
test(router-link): add not active with different params type and delete repeat test...
authorImJustAMan <42199549+ImJustAMan@users.noreply.github.com>
Thu, 9 Jul 2020 18:35:50 +0000 (02:35 +0800)
committerGitHub <noreply@github.com>
Thu, 9 Jul 2020 18:35:50 +0000 (20:35 +0200)
__tests__/RouterLink.spec.ts

index 5757779a402d3c67bbc378256b98eb10c10aacf9..0372124ab42b15db6acb6dcb59fcd2d625b21967 100644 (file)
@@ -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,