Improve editor totals and formatting
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
allColumns,
|
||||
buildCircuitEditPatch,
|
||||
buildDeviceRowEditPatch,
|
||||
formatValue,
|
||||
getBlockSortValue,
|
||||
getCellKind,
|
||||
getCircuitValue,
|
||||
@@ -76,6 +77,13 @@ describe("circuit grid model", () => {
|
||||
assert.equal(getCircuitValue(circuit, "cableSummary"), "NYM-J, 1.5 mm², 20 m");
|
||||
});
|
||||
|
||||
it("formats displayed numeric values without changing their stored precision", () => {
|
||||
assert.equal(formatValue(0.123456, "powerPerUnit"), "0,123");
|
||||
assert.equal(formatValue(0.87654, "simultaneityFactor"), "0,88");
|
||||
assert.equal(formatValue(230.4, "voltage"), "230");
|
||||
assert.equal(formatValue(16, "protectionRatedCurrent"), "16");
|
||||
});
|
||||
|
||||
it("uses circuit display values for block sorting and falls back to the first device", () => {
|
||||
assert.equal(getBlockSortValue(circuit, "displayName"), "Lighting circuit");
|
||||
assert.equal(getBlockSortValue({ ...circuit, displayName: undefined }, "displayName"), "Office light");
|
||||
|
||||
@@ -164,6 +164,15 @@ describe("circuit grid projection", () => {
|
||||
rows.at(-1)?.cells.find((cell) => cell.cellKey === "equipmentIdentifier")?.value,
|
||||
"-frei-"
|
||||
);
|
||||
const circuitSummary = rows.find((row) => row.rowType === "circuitSummary");
|
||||
assert.equal(
|
||||
circuitSummary?.cells.find((cell) => cell.cellKey === "rowTotalPower")?.value,
|
||||
multiDeviceCircuit.circuitTotalPower
|
||||
);
|
||||
assert.equal(
|
||||
circuitSummary?.cells.some((cell) => cell.cellKey === "circuitTotalPower"),
|
||||
false
|
||||
);
|
||||
});
|
||||
|
||||
it("collects filter options from both circuit and device values", () => {
|
||||
|
||||
Reference in New Issue
Block a user