test: add drawer.tsx to hook-driven files list

This commit is contained in:
2026-05-24 22:12:29 -04:00
parent 3845ed337c
commit db92f99542

View File

@@ -4,55 +4,54 @@ import { readFileSync } from "node:fs";
const RESPONSIVE_PREFIX_PATTERN = /\b(?:max-sm|sm:|md:|lg:|xl:|2xl:)/; const RESPONSIVE_PREFIX_PATTERN = /\b(?:max-sm|sm:|md:|lg:|xl:|2xl:)/;
const HOOK_DRIVEN_FILES = [ const HOOK_DRIVEN_FILES = [
"src/app/page.tsx", "src/app/page.tsx",
"src/app/demo/combined-date-picker/page.tsx", "src/app/demo/combined-date-picker/page.tsx",
"src/components/ai-toolbar.tsx", "src/components/ai-toolbar.tsx",
"src/components/event-dialog.tsx", "src/components/event-dialog.tsx",
"src/components/settings-panel.tsx", "src/components/settings-panel.tsx",
"src/components/ui/calendar.tsx", "src/components/ui/calendar.tsx",
"src/components/ui/date-picker.tsx", "src/components/ui/date-picker.tsx",
"src/components/ui/dialog.tsx", "src/components/ui/dialog.tsx",
"src/components/ui/input-group.tsx", "src/components/ui/drawer.tsx",
"src/components/ui/textarea.tsx", "src/components/ui/input-group.tsx",
"src/lib/ui-shell-contract.ts", "src/components/ui/textarea.tsx",
"src/lib/ui-shell-contract.ts",
]; ];
const DIRECT_HOOK_FILES = [ const DIRECT_HOOK_FILES = [
"src/app/page.tsx", "src/app/page.tsx",
"src/app/demo/combined-date-picker/page.tsx", "src/app/demo/combined-date-picker/page.tsx",
"src/components/ai-toolbar.tsx", "src/components/ai-toolbar.tsx",
"src/components/event-dialog.tsx", "src/components/event-dialog.tsx",
"src/components/settings-panel.tsx", "src/components/settings-panel.tsx",
"src/components/ui/calendar.tsx", "src/components/ui/calendar.tsx",
"src/components/ui/date-picker.tsx", "src/components/ui/date-picker.tsx",
"src/components/ui/dialog.tsx", "src/components/ui/dialog.tsx",
"src/components/ui/input-group.tsx", "src/components/ui/input-group.tsx",
"src/components/ui/textarea.tsx", "src/components/ui/textarea.tsx",
]; ];
const BOOLEAN_HELPER_FILES = [ const BOOLEAN_HELPER_FILES = ["src/lib/ui-shell-contract.ts"];
"src/lib/ui-shell-contract.ts",
];
describe("mobile hook adoption", () => { describe("mobile hook adoption", () => {
test("responsive source files stop using Tailwind breakpoint prefixes for mobile behavior", () => { test("responsive source files stop using Tailwind breakpoint prefixes for mobile behavior", () => {
for (const filePath of HOOK_DRIVEN_FILES) { for (const filePath of HOOK_DRIVEN_FILES) {
const source = readFileSync(filePath, "utf8"); const source = readFileSync(filePath, "utf8");
expect(source).not.toMatch(RESPONSIVE_PREFIX_PATTERN); expect(source).not.toMatch(RESPONSIVE_PREFIX_PATTERN);
} }
}); });
test("mobile-responsive component files explicitly depend on the shared useIsMobile hook", () => { test("mobile-responsive component files explicitly depend on the shared useIsMobile hook", () => {
for (const filePath of DIRECT_HOOK_FILES) { for (const filePath of DIRECT_HOOK_FILES) {
const source = readFileSync(filePath, "utf8"); const source = readFileSync(filePath, "utf8");
expect(source).toContain("useIsMobile"); expect(source).toContain("useIsMobile");
} }
}); });
test("utility files accept isMobile booleans instead of embedding breakpoint strings", () => { test("utility files accept isMobile booleans instead of embedding breakpoint strings", () => {
for (const filePath of BOOLEAN_HELPER_FILES) { for (const filePath of BOOLEAN_HELPER_FILES) {
const source = readFileSync(filePath, "utf8"); const source = readFileSync(filePath, "utf8");
expect(source).toContain("isMobile"); expect(source).toContain("isMobile");
} }
}); });
}); });