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");
|
||||
|
||||
Reference in New Issue
Block a user