fix(webui): anchor floating surface animations (#6722)
* fix(webui): anchor floating surface animations * test(webui): assert the dispatched file menu click coordinate
This commit is contained in:
1 parent
eb82ab84cc
commit
32bba3a16c
7 files changed
+80
-4
No files matched your search
@@ -53,6 +53,30 @@ test("model picker keyboard Escape returns visible focus to its trigger", async
|
||||
expect(await trigger.evaluate((node) => node.matches(":focus-visible"))).toBe(true);
|
||||
});
|
||||
|
||||
test("the model picker enters from the trigger after flipping below it", async () => {
|
||||
await page.setViewportSize({ width: 390, height: 720 });
|
||||
const trigger = page.getByRole("button", { name: "First model", exact: true });
|
||||
// Leave no room above the trigger so the preferred top placement must flip.
|
||||
await trigger.evaluate(node => Object.assign(node.style, { position: "fixed", top: "4px" }));
|
||||
await page.evaluate(() => {
|
||||
document.addEventListener("animationstart", event => {
|
||||
const node = event.target;
|
||||
if (!(node instanceof HTMLElement) || node.getAttribute("role") !== "dialog") return;
|
||||
const entry = node.getAnimations().find(animation => animation instanceof CSSAnimation);
|
||||
if (!entry) return;
|
||||
entry.pause();
|
||||
entry.currentTime = 0;
|
||||
});
|
||||
});
|
||||
await trigger.click();
|
||||
const picker = page.getByRole("dialog");
|
||||
await expect(picker).toHaveAttribute("data-side", "bottom");
|
||||
await expect.poll(() => picker.evaluate(node => {
|
||||
const transform = getComputedStyle(node).transform;
|
||||
return transform === "none" ? 0 : new DOMMatrixReadOnly(transform).m42;
|
||||
})).toBeLessThan(0);
|
||||
});
|
||||
|
||||
test("model picker management handoff keeps focus in the new dialog", async () => {
|
||||
await page.getByRole("button", { name: "First model", exact: true }).click();
|
||||
await settleClose(() => page.getByRole("button", { name: "Manage presets" }).click());
|
||||
|
||||
Reference in new issue
Block a user