]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
test(__tests__/RouterLink.spec): add not match repeated params test (#373)
authoruuoocckk-983 <799754081@qq.com>
Thu, 16 Jul 2020 10:13:02 +0000 (18:13 +0800)
committerGitHub <noreply@github.com>
Thu, 16 Jul 2020 10:13:02 +0000 (12:13 +0200)
* test(__tests__/RouterLink.spec): add not match repeated params test

* Update __tests__/RouterLink.spec.ts [skip ci]

Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com>
__tests__/RouterLink.spec.ts

index 0372124ab42b15db6acb6dcb59fcd2d625b21967..5dbc426f0d489ea769f490cdb7c40baa4e7836fd 100644 (file)
@@ -129,6 +129,21 @@ const locations = createLocations({
       name: undefined,
     },
   },
+  anotherRepeatedParams2: {
+    string: '/p/1/3',
+    normalized: {
+      fullPath: '/p/1/3',
+      href: '/p/1/3',
+      path: '/p/1/3',
+      params: { p: ['1', '3'] },
+      meta: {},
+      query: {},
+      hash: '',
+      matched: [records.home],
+      redirectedFrom: undefined,
+      name: undefined,
+    },
+  },
   repeatedParams3: {
     string: '/p/1/2/3',
     normalized: {
@@ -515,6 +530,15 @@ describe('RouterLink', () => {
     expect(wrapper.find('a')!.className).toBe('')
   })
 
+  it('is not active with different repeated params', async () => {
+    const { wrapper } = await factory(
+      locations.repeatedParams2.normalized,
+      { to: locations.anotherRepeatedParams2.string },
+      locations.anotherRepeatedParams2.normalized
+    )
+    expect(wrapper.find('a')!.className).toBe('')
+  })
+
   it('is not active with more repeated params', async () => {
     const { wrapper } = await factory(
       locations.repeatedParams2.normalized,