]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
test(resolve): empty string params
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 24 Apr 2023 07:50:57 +0000 (09:50 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 24 Apr 2023 07:50:57 +0000 (09:50 +0200)
packages/router/__tests__/router.spec.ts

index df6b371467995680eda8a55140922339cad69b77..03766994bf871e798091d70509c9e1e38e2e1950 100644 (file)
@@ -314,11 +314,25 @@ describe('Router', () => {
     expect(route2.path).toBe('/optional')
     expect(route2.params).toEqual({})
 
+    // but keeps empty strings
+    const route3 = router.resolve({
+      name: 'optional',
+      params: { p: '' },
+    })
+    expect(route3.path).toBe('/optional')
+    expect(route3.params).toEqual({ p: '' })
+
     await router.push({ name: 'optional', params: { p: null } })
     expect(router.currentRoute.value.params).toEqual({})
     await router.push({ name: 'optional', params: {} })
   })
 
+  it('keeps empty strings', async () => {
+    const { router } = await newRouter()
+    const route1 = router.resolve({ name: 'optional', params: { p: '' } })
+    expect(route1.params).toEqual({ p: '' })
+  })
+
   it('navigates to same route record but different query', async () => {
     const { router } = await newRouter()
     await router.push('/?q=1')