46 lines
1.5 KiB
JavaScript
46 lines
1.5 KiB
JavaScript
import { readFileSync } from "node:fs";
|
|
|
|
function assert(condition, message) {
|
|
if (!condition) throw new Error(message);
|
|
}
|
|
|
|
const overlaySource = readFileSync(
|
|
"src/features/campaigns/components/MessagePreviewOverlay.tsx",
|
|
"utf8"
|
|
);
|
|
const styles = readFileSync("src/styles/campaign-workspace.css", "utf8");
|
|
|
|
assert(
|
|
overlaySource.includes("overlay-backdrop message-preview-backdrop"),
|
|
"message previews expose their responsive backdrop hook"
|
|
);
|
|
assert(
|
|
overlaySource.includes("<Dialog") &&
|
|
overlaySource.includes("closeLabel={closeLabel}") &&
|
|
overlaySource.includes('dataset.dialogStackState !== "topmost"'),
|
|
"message previews use the central stacked Dialog with an accessible close label"
|
|
);
|
|
assert(
|
|
styles.includes("height: min(780px, calc(100dvh - 48px));"),
|
|
"desktop previews use a stable responsive height"
|
|
);
|
|
assert(
|
|
styles.includes("flex: 1 1 auto;") &&
|
|
styles.includes("min-height: 0;") &&
|
|
styles.includes("overflow: auto;") &&
|
|
styles.includes("scrollbar-gutter: stable;"),
|
|
"the preview body owns scrolling without moving the surrounding actions"
|
|
);
|
|
assert(
|
|
styles.includes(".message-preview-modal .modal-footer") &&
|
|
styles.includes("min-height: 68px;"),
|
|
"the preview footer keeps a stable desktop action area"
|
|
);
|
|
assert(
|
|
styles.includes("height: calc(100dvh - 16px);") &&
|
|
styles.includes("height: clamp(210px, 38dvh, 360px);"),
|
|
"small viewports use their available dynamic height"
|
|
);
|
|
|
|
console.log("Message preview overlay structure checks passed.");
|