Files
govoplan-campaign/webui/tests/recipient-search-ui-structure.test.mjs
zemion 11598b7b5b fix(ui): align campaign tables, recipient sizing and contextual help
Verified with the coordinated workspace changes by devkit full run
2026-09-08T225814-186389-0000-3e3ed7cd (all seven phases passed).
This shared UI pass does not mark the individual module reviews complete.
2026-09-09 02:03:36 +02:00

43 lines
1.8 KiB
JavaScript

import { readFileSync } from "node:fs";
const source = [
"../src/features/campaigns/RecipientDataPage.tsx",
"../src/features/campaigns/recipients/RecipientAddressEditor.tsx",
"../src/features/campaigns/recipients/recipientProfileColumns.tsx"
]
.map((path) => readFileSync(new URL(path, import.meta.url), "utf8"))
.join("\n")
.replace(/\s+/g, " ");
function assertIncludes(fragment, message) {
if (!source.includes(fragment.replace(/\s+/g, " "))) throw new Error(message);
}
for (const field of ["from", "reply_to", "to", "cc", "bcc"]) {
assertIncludes(`key: "${field}"`, `recipient search must retain the ${field} address category`);
}
assertIncludes(
"recipientAddressOverlayColumns. flatMap((column) => getEntryAddresses(entry, column.key))",
"recipient filtering must search every configured address category"
);
assertIncludes(
"onQueryChange={setRecipientProfilesQuery}",
"the recipient page must observe the shared DataGrid filter"
);
assertIncludes(
"Matched in {hiddenMatch.label}: {hiddenMatch.address}",
"a row must explain when its match came from a hidden address"
);
assertIncludes("version && draft && !source.type", "recipient grids wait for the initial draft before restoring column widths");
const profileColumns = readFileSync(new URL("../src/features/campaigns/recipients/recipientProfileColumns.tsx", import.meta.url), "utf8");
for (const id of ["recipients", "delivery"]) {
const start = profileColumns.indexOf(`id: "${id}"`);
const declarations = profileColumns.slice(start, profileColumns.indexOf("render:", start));
if (!declarations.includes("resizable: true") || declarations.includes("maxWidth:")) {
throw new Error(`${id} remains user-expandable without an arbitrary hard display cap`);
}
}
console.log("Campaign recipient search covers and explains hidden address matches.");