31 lines
1.6 KiB
JavaScript
31 lines
1.6 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { readFile } from "node:fs/promises";
|
|
import test from "node:test";
|
|
|
|
test("Objects menu treats each binding as a persisted visibility layer", async () => {
|
|
const preview = await readFile(new URL("../apps/catalog/src/MapFixturePreview.tsx", import.meta.url), "utf8");
|
|
|
|
assert.match(preview, /const toggleSubjectVisibility = \(bindingId: string\)/);
|
|
assert.match(preview, /role="menuitemcheckbox"/);
|
|
assert.match(preview, /aria-checked=\{visible\}/);
|
|
assert.match(preview, /onClick=\{\(\) => toggleSubjectVisibility\(summary\.bindingId\)\}/);
|
|
assert.match(preview, /visible: !state\.visible/);
|
|
assert.match(preview, /слой скрыт · \$\{summary\.total\} объектов/);
|
|
});
|
|
|
|
test("a subject window exists only when the presentation profile exposes controls", async () => {
|
|
const preview = await readFile(new URL("../apps/catalog/src/MapFixturePreview.tsx", import.meta.url), "utf8");
|
|
|
|
assert.match(preview, /function hasSubjectWindowControls\(profile: MapPresentationProfile\)/);
|
|
assert.match(preview, /\{hasControls \? \(/);
|
|
assert.match(preview, /if \(!state\?\.window\.open \|\| !hasSubjectWindowControls\(summary\.profile\)\) return null/);
|
|
assert.match(preview, /window: \{ \.\.\.state\.window, open: false \}/);
|
|
});
|
|
|
|
test("hidden and visible layers have an explicit visual state", async () => {
|
|
const styles = await readFile(new URL("../apps/catalog/src/styles.css", import.meta.url), "utf8");
|
|
|
|
assert.match(styles, /\.catalog-map-fixture__objects-menu-item\[data-visible\]/);
|
|
assert.match(styles, /\.catalog-map-fixture__objects-menu-item:not\(\[data-visible\]\)/);
|
|
});
|