Show placeholders in empty circuit lists

This commit is contained in:
2026-07-23 17:49:50 +02:00
parent b2034c7dfb
commit ff84d85eb3
2 changed files with 36 additions and 1 deletions
+35
View File
@@ -78,6 +78,41 @@ const sections: CircuitTreeSectionDto[] = [
];
describe("circuit grid projection", () => {
it("keeps empty sections and their free placeholders when no filter is active", () => {
const emptySections: CircuitTreeSectionDto[] = [
{
id: "empty-lighting",
key: "lighting",
displayName: "Lighting",
prefix: "-1F",
sortOrder: 10,
circuits: [],
},
{
id: "empty-single-phase",
key: "single_phase",
displayName: "Single-phase circuits",
prefix: "-2F",
sortOrder: 20,
circuits: [],
},
];
const projectedSections = filterAndSortCircuitSections(emptySections, {}, null);
const rows = buildVisibleGridRows(projectedSections);
assert.equal(projectedSections.length, 2);
assert.deepEqual(
rows.map((row) => row.rowKey),
[
"section:empty-lighting",
"placeholder:empty-lighting",
"section:empty-single-phase",
"placeholder:empty-single-phase",
]
);
});
it("keeps every device row in a circuit block when one device matches a filter", () => {
const result = filterAndSortCircuitSections(sections, { roomNumberSnapshot: ["1.01"] }, null);