Tests: the lightbox viewer's first open waits for its chunk; reference index lists the performance spec and the lab helper

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 14:07:07 +01:00
co-authored by Claude Opus 5.5
parent 9bac7e7bf0
commit beef517c23
3 changed files with 18 additions and 1 deletions
+13
View File
@@ -107,6 +107,19 @@ describe('lightbox helpers', () => {
})
describe('lightbox behaviour', () => {
test('the viewer is loaded on the first open (a separate chunk since 1.18.0), then opens at once', async () => {
render(gallery())
click(triggers()[0])
expect(dialog()).toBeNull() // the first open waits for the viewer's code
await act(async () => {
await new Promise((resolve) => setTimeout(resolve, 0))
})
expect(dialog()).not.toBeNull()
click(dialog()!.querySelector('[data-ipal="lightbox-close"]'))
click(triggers()[1])
expect(dialog()).not.toBeNull() // loaded: every later open is immediate
})
test('nothing in the DOM until opened; triggers are labelled buttons', () => {
render(gallery())
expect(dialog()).toBeNull()