Skip to content

Commit b46ee98

Browse files
committed
test
1 parent dd17d14 commit b46ee98

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<a href="#/focus/a#p">click me!</a>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<button>button 1</button>
2+
<button>button 2</button>
3+
<p id="p">cannot be focused</p>
4+
<button id="button3">button 3</button>

packages/kit/test/apps/hash-based-routing/test/test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,15 @@ test.describe('hash based navigation', () => {
115115
await page.goForward();
116116
expect(page.locator('p')).toHaveText('b');
117117
});
118+
119+
test('sequential focus navigation point is set correctly', async ({ page, browserName }) => {
120+
const tab = browserName === 'webkit' ? 'Alt+Tab' : 'Tab';
121+
await page.goto('/#/focus');
122+
await page.locator('a[href="#/focus/a#p"]').click();
123+
await page.waitForURL('#/focus/a#p');
124+
expect(await page.evaluate(() => (document.activeElement || {}).nodeName)).toBe('BODY');
125+
await page.keyboard.press(tab);
126+
await expect(page.locator('#button3')).toBeFocused();
127+
await expect(page.locator('button[id="button3"]')).toBeFocused();
128+
});
118129
});

0 commit comments

Comments
 (0)