Skip to content

Commit c747559

Browse files
committed
test: update behaviour
1 parent bb491de commit c747559

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

tests/interactions.spec.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,24 @@ test.describe('Search Pages', () => {
1212
const firstResult = page.locator('[data-result-index="0"]').first()
1313
await expect(firstResult).toBeVisible()
1414

15+
// First result is selected by default, Enter navigates to it
16+
// URL is /vue not /package/vue (cleaner URLs)
1517
await page.keyboard.press('Enter')
16-
await expect(page).toHaveURL(/\/package\//)
18+
await expect(page).toHaveURL(/\/vue/)
1719

1820
await page.goBack()
21+
// Search input is autofocused on mount
1922
await expect(searchInput).toBeFocused()
2023
await expect(page.locator('text=/found \\d+/i')).toBeVisible()
2124

25+
// ArrowDown changes visual selection but keeps focus in input
2226
await page.keyboard.press('ArrowDown')
23-
const secondResult = page.locator('[data-result-index="1"]').first()
24-
await expect(secondResult).toBeFocused()
27+
await expect(searchInput).toBeFocused()
2528

29+
// Enter navigates to the now-selected second result
2630
await page.keyboard.press('Enter')
27-
await expect(page).toHaveURL(/\/package\//)
31+
// Second result could be vue-router, vuex, etc - just check we navigated away
32+
await expect(page).not.toHaveURL(/\/search/)
2833
})
2934

3035
test('/search?q=vue → "/" focuses the search input from results', async ({ page, goto }) => {

0 commit comments

Comments
 (0)