Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
GingerAdonis committed Aug 10, 2023
1 parent ebbe28e commit dae4ecc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
export let data;
</script>

<ul>
<li><a href="/routing/trailing-slash-server/always">/always</a></li>
<li><a href="/routing/trailing-slash-server/ignore">/ignore</a></li>
<li><a href="/routing/trailing-slash-server/ignore/">/ignore/</a></li>
<li><a href="/routing/trailing-slash-server/never/">/never/</a></li>
</ul>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const trailingSlash = 'ignore';
23 changes: 23 additions & 0 deletions packages/kit/test/apps/basics/test/cross-platform/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,29 @@ test.describe('Routing', () => {
);
});

test('trailing slash server with config ignore and no trailing slash in URL', async ({ page, clicknav }) => {
await page.goto('/routing/trailing-slash-server');
await clicknav('[href="/routing/trailing-slash-server/ignore"]');
expect(await page.textContent('[data-test-id="pathname-store"]')).toBe(
'/routing/trailing-slash-server/ignore'
);
expect(await page.textContent('[data-test-id="pathname-data"]')).toBe(
'/routing/trailing-slash-server/ignore'
);
});

test('trailing slash server with config ignore and trailing slash in URL', async ({ page, clicknav }) => {
await page.goto('/routing/trailing-slash-server');
await clicknav('[href="/routing/trailing-slash-server/ignore/"]');
expect(await page.textContent('[data-test-id="pathname-store"]')).toBe(
'/routing/trailing-slash-server/ignore/'
);
expect(await page.textContent('[data-test-id="pathname-data"]')).toBe(
'/routing/trailing-slash-server/ignore/'
);

});

test('trailing slash server with config never', async ({ page, clicknav }) => {
await page.goto('/routing/trailing-slash-server');
await clicknav('[href="/routing/trailing-slash-server/never/"]');
Expand Down

0 comments on commit dae4ecc

Please sign in to comment.