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

@@ -30,6 +30,11 @@ from apps.lyric.models import User
class TrayTest(FunctionalTest): class TrayTest(FunctionalTest):
def setUp(self):
super().setUp()
# Portrait viewport for T1T5; landscape tests (T6, T7) override this.
self.browser.set_window_size(768, 1024)
def _simulate_drag(self, btn, offset_x): def _simulate_drag(self, btn, offset_x):
"""Dispatch JS pointer events directly — more reliable than GeckoDriver drag.""" """Dispatch JS pointer events directly — more reliable than GeckoDriver drag."""
start_x = btn.rect['x'] + btn.rect['width'] / 2 start_x = btn.rect['x'] + btn.rect['width'] / 2

View File

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