22 lines
1.4 KiB
JavaScript
22 lines
1.4 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const pagePath = fileURLToPath(new URL("../src/features/addressbook/AddressBookPage.tsx", import.meta.url));
|
|
const stylesPath = fileURLToPath(new URL("../src/styles/addresses.css", import.meta.url));
|
|
const page = readFileSync(pagePath, "utf8");
|
|
const styles = readFileSync(stylesPath, "utf8");
|
|
|
|
assert.match(page, /SegmentedControl,[\s\S]*SelectionList,[\s\S]*SelectionListItem,[\s\S]*from "@govoplan\/core-webui"/);
|
|
assert.match(page, /<SelectionList label="Contacts" className="address-contact-selection-list">/);
|
|
assert.match(page, /<SelectionListItem[\s\S]*selected=\{selected\}[\s\S]*className=\{`address-contact-row/);
|
|
assert.match(page, /draggable=\{!contact\.deleted_at && !saving\}/);
|
|
assert.match(page, /<SelectionList label="Discovered CardDAV address books" className="address-sync-result-list">/);
|
|
assert.match(page, /selected=\{cardDavForm\.collection_url === item\.collection_url\}/);
|
|
assert.match(page, /<SegmentedControl<ConflictMergeChoice>[\s\S]*role="group"[\s\S]*value=\{conflictMergeChoices\[row\.field\] \?\? "local"\}/);
|
|
assert.doesNotMatch(page, /<button[\s\S]{0,160}(?:address-contact-row|address-sync-result-row)/);
|
|
assert.doesNotMatch(styles, /\.address-conflict-choice button/);
|
|
assert.doesNotMatch(styles, /\.address-contact-row:(?:hover|focus-visible)/);
|
|
|
|
console.log("Address-book flat selections use central components.");
|