Skip to content

Commit

Permalink
test: add regression test for nuxt-modules#2525
Browse files Browse the repository at this point in the history
  • Loading branch information
BobbieGoede committed Nov 6, 2023
1 parent 0f30774 commit 782de88
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 25 deletions.
15 changes: 0 additions & 15 deletions specs/basic_usage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,3 @@ test('(#2525) localePath should keep hash', async () => {
expect(await page.locator('#link-about-query-hash').getAttribute('href')).toEqual('/nl/about?foo=bar#my-hash')
expect(await page.locator('#link-about-query-hash-object').getAttribute('href')).toEqual('/nl/about?foo=bar#my-hash')
})

test('(#2523) localePath should not double encode paths', async () => {
const { page } = await renderPage('/')
const encodedPath = encodeURI('page with spaces')

expect(await page.locator('#link-page-with-spaces').getAttribute('href')).toEqual(`/${encodedPath}`)
expect(await page.locator('#link-page-with-spaces-encoded').getAttribute('href')).toEqual(`/${encodedPath}`)

// click `nl` lang switch with `<NuxtLink>`
await page.locator('#switch-locale-path-usages .switch-to-nl a').click()
await waitForURL(page, '/nl')

expect(await page.locator('#link-page-with-spaces').getAttribute('href')).toEqual(`/nl/${encodedPath}`)
expect(await page.locator('#link-page-with-spaces-encoded').getAttribute('href')).toEqual(`/nl/${encodedPath}`)
})
10 changes: 0 additions & 10 deletions specs/fixtures/basic_usage/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,6 @@ useHead({
{{ $t('about') }}
</NuxtLink>
</li>
<li class="path-spaces">
<NuxtLink id="link-page-with-spaces" :to="localePath({ name: 'page with spaces' })">
To the page with spaces!
</NuxtLink>
</li>
<li class="path-spaces-encoded">
<NuxtLink id="link-page-with-spaces-encoded" :to="localePath(`/${encodeURI('page with spaces')}`)">
To the page with spaces!
</NuxtLink>
</li>
</ul>
</section>
<section id="nuxt-link-locale-usages">
Expand Down

0 comments on commit 782de88

Please sign in to comment.