From 20a9d9006a3dd6ab8a77ab8d7deda54acf5fe705 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Fri, 13 Nov 2026 00:17:23 +0900 Subject: [PATCH] =?UTF-8?q?test(storybook):=20tooltip=20hover=20=EC=8B=9C?= =?UTF-8?q?=ED=97=98=EC=9D=B4=20hover=EA=B0=80=20=EC=9C=A0=EC=A7=80?= =?UTF-8?q?=EB=90=98=EB=8A=94=EC=A7=80=EB=A5=BC=20=EC=A7=81=EC=A0=91=20?= =?UTF-8?q?=EB=B3=B8=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tooltip hover 시험의 마지막 단언은 opacity가 1인지 poll로 본다. 숨김은 100ms 동안 흐려지므로, hover를 잃은 직후에 읽으면 결함이 있어도 1이 나와 통과할 수 있다(확인 리뷰). 고른 방법: 포인터를 틈과 tooltip 위로 옮길 때마다 tooltip을 감싼 요소가 :hover인지 본다. 보이는 것은 이 hover가 정한다. opacity 단언은 그대로 둔다. 검증: tooltip의 틈 다리(::before)를 지운 변이에서 새 단언이 실패하고 원래 코드에서 통과한다(desktop, PR 본문). Refs: 1112/05-06 --- tests/storybook/galleries.spec.ts | 7 +++++++ 1 file changed, 7 insertions(+) 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"); });