Skip to content

Commit 15086b4

Browse files
committed
Revert "remove test for removed feature"
This reverts commit b0c38f2.
1 parent 06af3db commit 15086b4

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<script>
2+
let n = 0;
3+
</script>
4+
5+
<button on:click={() => n += 1}>
6+
clicks: {n}
7+
</button>
8+
9+
<a href="/no-router/a">a</a>
10+
<a href="/no-router/b">b</a>
11+
12+
<slot></slot>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<script context="module">
2+
export const router = false;
3+
</script>
4+
5+
<h1>a</h1>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<h1>b</h1>

packages/kit/test/apps/basics/test/test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,27 @@ test.describe.parallel('Page options', () => {
11401140
}
11411141
});
11421142

1143+
test('disables router if router=false', async ({ page, clicknav, javaScriptEnabled }) => {
1144+
await page.goto('/no-router/a');
1145+
1146+
if (javaScriptEnabled) {
1147+
await page.click('button');
1148+
expect(await page.textContent('button')).toBe('clicks: 1');
1149+
1150+
await Promise.all([page.click('[href="/no-router/b"]'), page.waitForNavigation()]);
1151+
expect(await page.textContent('button')).toBe('clicks: 0');
1152+
1153+
await page.click('button');
1154+
expect(await page.textContent('button')).toBe('clicks: 1');
1155+
1156+
await clicknav('[href="/no-router/a"]');
1157+
expect(await page.textContent('button')).toBe('clicks: 1');
1158+
1159+
await Promise.all([page.click('[href="/no-router/b"]'), page.waitForNavigation()]);
1160+
expect(await page.textContent('button')).toBe('clicks: 0');
1161+
}
1162+
});
1163+
11431164
test('does not SSR page with ssr=false', async ({ page, javaScriptEnabled }) => {
11441165
await page.goto('/no-ssr');
11451166

0 commit comments

Comments
 (0)