FTs.test_room_tray.TrayTest now contains setUp() helper to set default window size for methods which don't otherwise define a specific media query; several new Jasmine methods test drawer snap-to-close & wobble functionality
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Disco DeDisco
2026-03-28 22:50:43 -04:00
parent c08b5b764e
commit de99b538d2
2 changed files with 33 additions and 2 deletions

View File

@@ -84,13 +84,26 @@ describe("Tray", () => {
describe("close()", () => {
beforeEach(() => Tray.open());
it("hides #id_tray after the slide transition completes", () => {
it("hides #id_tray after slide + snap both complete", () => {
Tray.close();
// display:none is deferred until transitionend — fire it manually.
wrap.dispatchEvent(new TransitionEvent("transitionend", { propertyName: "left" }));
wrap.dispatchEvent(new Event("animationend"));
expect(tray.style.display).toBe("none");
});
it("adds .snap to wrap after slide transition completes", () => {
Tray.close();
wrap.dispatchEvent(new TransitionEvent("transitionend", { propertyName: "left" }));
expect(wrap.classList.contains("snap")).toBe(true);
});
it("removes .snap from wrap once animationend fires", () => {
Tray.close();
wrap.dispatchEvent(new TransitionEvent("transitionend", { propertyName: "left" }));
wrap.dispatchEvent(new Event("animationend"));
expect(wrap.classList.contains("snap")).toBe(false);
});
it("removes .open from #id_tray_btn", () => {
Tray.close();
expect(btn.classList.contains("open")).toBe(false);
@@ -267,6 +280,19 @@ describe("Tray", () => {
const closedTop = parseInt(wrap.style.top, 10);
expect(closedTop).toBeLessThan(openTop);
});
it("adds .snap to wrap after top transition completes", () => {
Tray.close();
wrap.dispatchEvent(new TransitionEvent("transitionend", { propertyName: "top" }));
expect(wrap.classList.contains("snap")).toBe(true);
});
it("removes .snap from wrap once animationend fires", () => {
Tray.close();
wrap.dispatchEvent(new TransitionEvent("transitionend", { propertyName: "top" }));
wrap.dispatchEvent(new Event("animationend"));
expect(wrap.classList.contains("snap")).toBe(false);
});
});
// ── drag — Y axis ──────────────────────────────────────────────── //