diff --git a/tests/storybook/galleries.spec.ts b/tests/storybook/galleries.spec.ts index db3bb936..16164ece 100644 --- a/tests/storybook/galleries.spec.ts +++ b/tests/storybook/galleries.spec.ts @@ -32,8 +32,15 @@ test("keeps a tooltip shown while the pointer moves onto it", async ({ page }) = const box = await tooltip.boundingBox(); if (!box) throw new Error("expected the tooltip box"); + // The hover that shows it holds in the gap and over the tooltip itself: + // read where it is decided, not only the opacity, which fades over 100 ms + // and still reads 1 the moment the hover is lost. + const stillHovered = () => + tooltip.evaluate((element) => element.closest(".ui-tooltip")?.matches(":hover") ?? false); await page.mouse.move(box.x + box.width / 2, box.y + box.height + 2, { steps: 4 }); + expect(await stillHovered()).toBe(true); await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2, { steps: 4 }); + expect(await stillHovered()).toBe(true); await expect.poll(() => tooltip.evaluate((element) => getComputedStyle(element).opacity)).toBe("1"); });