Show placeholders in empty circuit lists
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user