Render circuit protection values
This commit is contained in:
@@ -146,6 +146,13 @@ function makeVisibleGridRow(
|
|||||||
value = getDeviceValue(device, column.key);
|
value = getDeviceValue(device, column.key);
|
||||||
} else if (kind === "circuitField" && circuit) {
|
} else if (kind === "circuitField" && circuit) {
|
||||||
value = getCircuitValue(circuit, column.key);
|
value = getCircuitValue(circuit, column.key);
|
||||||
|
} else if (
|
||||||
|
kind === "computed" &&
|
||||||
|
rowType !== "deviceRow" &&
|
||||||
|
circuit &&
|
||||||
|
circuitOnlyColumns.has(column.key)
|
||||||
|
) {
|
||||||
|
value = getCircuitValue(circuit, column.key);
|
||||||
} else if (column.key === "rowTotalPower" && device) {
|
} else if (column.key === "rowTotalPower" && device) {
|
||||||
value = device.rowTotalPower;
|
value = device.rowTotalPower;
|
||||||
} else if (column.key === "rowTotalPower" && circuit) {
|
} else if (column.key === "rowTotalPower" && circuit) {
|
||||||
|
|||||||
@@ -177,6 +177,42 @@ describe("circuit grid projection", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("shows circuit protection once on each visible circuit row", () => {
|
||||||
|
const protectedSections = sections.map((section) => ({
|
||||||
|
...section,
|
||||||
|
circuits: section.circuits.map((circuit) => ({
|
||||||
|
...circuit,
|
||||||
|
protectionDevice: {
|
||||||
|
type: "FI_LS" as const,
|
||||||
|
ratedCurrentA: 16,
|
||||||
|
tripCharacteristic: "B" as const,
|
||||||
|
rcdType: "A" as const,
|
||||||
|
ratedResidualCurrentMa: 30,
|
||||||
|
},
|
||||||
|
})),
|
||||||
|
}));
|
||||||
|
const rows = buildVisibleGridRows(protectedSections);
|
||||||
|
const protectionValue = (rowType: string) =>
|
||||||
|
rows
|
||||||
|
.find((row) => row.rowType === rowType)
|
||||||
|
?.cells.find((cell) => cell.cellKey === "protectionSummary")
|
||||||
|
?.value;
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
protectionValue("circuitCompact"),
|
||||||
|
"FI/LS · 16 A · B · Typ A · 30 mA"
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
protectionValue("circuitSummary"),
|
||||||
|
"FI/LS · 16 A · B · Typ A · 30 mA"
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
protectionValue("reserveCircuit"),
|
||||||
|
"FI/LS · 16 A · B · Typ A · 30 mA"
|
||||||
|
);
|
||||||
|
assert.equal(protectionValue("deviceRow"), undefined);
|
||||||
|
});
|
||||||
|
|
||||||
it("normalizes structural component rows around complete circuit groups", () => {
|
it("normalizes structural component rows around complete circuit groups", () => {
|
||||||
const component = {
|
const component = {
|
||||||
circuitListId: "list-1",
|
circuitListId: "list-1",
|
||||||
|
|||||||
Reference in New Issue
Block a user