Files
govoplan-mail/webui/scripts/test-mailbox-icon-button-structure.mjs

26 lines
976 B
JavaScript

import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const webuiDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const source = fs.readFileSync(path.join(webuiDir, "src/features/mail/MailboxPage.tsx"), "utf8");
const styles = fs.readFileSync(path.join(webuiDir, "src/styles/mail-profiles.css"), "utf8");
function assert(condition, message) {
if (!condition) throw new Error(message);
}
assert(source.includes("IconButton,"), "MailboxPage must import the central IconButton");
assert(
source.includes('<IconButton label="i18n:govoplan-mail.clear_message_search.cc9f2800"'),
"the clear-search action must use the central IconButton"
);
assert(
!source.includes('<button type="button" onClick={() => setMessageQuery("")}'),
"the raw clear-search button must not return"
);
assert(
!styles.includes(".mailbox-search-field button"),
"Mail must not redefine the central icon-button appearance"
);