expanded margin of position spots on gatekeeper; cleaned up #id_tray scripts & styles
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Disco DeDisco
2026-03-29 15:22:00 -04:00
parent 39db59c71a
commit 6c91ec0385
5 changed files with 184 additions and 38 deletions

View File

@@ -358,5 +358,68 @@ describe("Tray", () => {
const top = parseInt(wrap.style.top, 10);
expect(top).toBeLessThan(0);
});
// ── resize closes landscape tray ─────────────────────────────── //
describe("resize closes the tray", () => {
it("closes when landscape tray is open", () => {
Tray.open();
window.dispatchEvent(new Event("resize"));
expect(Tray.isOpen()).toBe(false);
});
it("removes .open from btn on resize", () => {
Tray.open();
window.dispatchEvent(new Event("resize"));
expect(btn.classList.contains("open")).toBe(false);
});
it("resets wrap to closed top position on resize", () => {
Tray.open();
window.dispatchEvent(new Event("resize"));
expect(parseInt(wrap.style.top, 10)).toBeLessThan(0);
});
it("does not re-open a closed tray on resize", () => {
window.dispatchEvent(new Event("resize"));
expect(Tray.isOpen()).toBe(false);
});
});
});
// ---------------------------------------------------------------------- //
// window resize — portrait //
// ---------------------------------------------------------------------- //
describe("window resize (portrait)", () => {
it("closes the tray when open", () => {
Tray.open();
window.dispatchEvent(new Event("resize"));
expect(Tray.isOpen()).toBe(false);
});
it("removes .open from btn on resize", () => {
Tray.open();
window.dispatchEvent(new Event("resize"));
expect(btn.classList.contains("open")).toBe(false);
});
it("hides the tray panel on resize", () => {
Tray.open();
window.dispatchEvent(new Event("resize"));
expect(tray.style.display).toBe("none");
});
it("resets wrap to closed left position on resize", () => {
Tray.open();
expect(wrap.style.left).toBe("0px");
window.dispatchEvent(new Event("resize"));
expect(parseInt(wrap.style.left, 10)).toBeGreaterThan(0);
});
it("does not re-open a closed tray on resize", () => {
window.dispatchEvent(new Event("resize"));
expect(Tray.isOpen()).toBe(false);
});
});
});