Skip to content

Commit 9f96add

Browse files
cdervclaude
andcommitted
Add test verifying search highlight listeners register after delay
Complements the persistence test by confirming that quarto-hrChanged does clear marks after the 1000ms registration delay elapses. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0eec348 commit 9f96add

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎tests/integration/playwright/tests/html-search-highlight.spec.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,21 @@ test('Search highlights persist after page load', async ({ page }) => {
1818
await expect(marks.first()).toBeVisible();
1919
await expect(marks.first()).toContainText(/special/i);
2020
});
21+
22+
test('Search highlights are cleared by scroll after delay', async ({ page }) => {
23+
await page.goto('./html/search-highlight/_site/index.html?q=special');
24+
const marks = page.locator('mark');
25+
26+
// Marks should exist after page load
27+
await expect(marks.first()).toBeVisible({ timeout: 5000 });
28+
29+
// Wait for the delayed listener registration (1000ms in quarto-search.js)
30+
await page.waitForTimeout(1500);
31+
32+
// Now quarto-hrChanged should clear marks (listener is registered)
33+
await page.evaluate(() => {
34+
window.dispatchEvent(new CustomEvent('quarto-hrChanged'));
35+
});
36+
37+
await expect(marks).toHaveCount(0);
38+
});

0 commit comments

Comments
 (0)