27 lines
1.2 KiB
TypeScript
27 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
DRAWER_CONTENT_MOTION_CLASS,
|
|
MODAL_CONTENT_MOTION_CLASS,
|
|
SHEET_CONTENT_MOTION_CLASS,
|
|
} from "./modal-motion";
|
|
import { CONTEXT_MENU_MOTION_CLASS, HEADLESS_FLOATING_MOTION } from "./floating-motion";
|
|
|
|
describe("app motion contracts", () => {
|
|
it("keeps modern and legacy drawers on the same timing", () => {
|
|
for (const contract of [DRAWER_CONTENT_MOTION_CLASS, SHEET_CONTENT_MOTION_CLASS]) {
|
|
expect(contract).toContain("data-[state=open]:duration-[360ms]");
|
|
expect(contract).toContain("data-[state=closed]:duration-200");
|
|
expect(contract).toContain("motion-reduce:animate-none");
|
|
}
|
|
});
|
|
|
|
it("keeps modal and floating motion reduced-motion safe", () => {
|
|
expect(MODAL_CONTENT_MOTION_CLASS).toContain("motion-reduce:animate-none");
|
|
expect(CONTEXT_MENU_MOTION_CLASS).toContain("data-[state=open]:duration-200");
|
|
expect(CONTEXT_MENU_MOTION_CLASS).toContain("data-[state=closed]:duration-150");
|
|
expect(HEADLESS_FLOATING_MOTION.enter).toContain("duration-200");
|
|
expect(HEADLESS_FLOATING_MOTION.leave).toContain("duration-150");
|
|
expect(HEADLESS_FLOATING_MOTION.enter).toContain("motion-reduce:transition-none");
|
|
});
|
|
});
|