Support decimal commas and cell units

This commit is contained in:
2026-07-31 14:33:47 +02:00
parent 734a2bcfc4
commit 5fb81bab04
4 changed files with 36 additions and 10 deletions
+6
View File
@@ -5,6 +5,7 @@ import {
buildCircuitEditPatch,
buildDeviceRowEditPatch,
formatValue,
formatCellValue,
getCircuitSectionLabel,
getProjectColumnLayoutStorageKey,
isGridEditorControlTarget,
@@ -173,6 +174,10 @@ describe("circuit grid model", () => {
assert.equal(formatValue(16, "protectionRatedCurrent"), "16");
assert.equal(formatValue("single_phase", "phaseType"), "1-phasig");
assert.equal(formatValue("three_phase", "phaseType"), "3-phasig");
assert.equal(formatCellValue(2, "quantity"), "2 St.");
assert.equal(formatCellValue(0.123456, "powerPerUnit"), "0,123 kW");
assert.equal(formatCellValue(1.25, "rowTotalPower"), "1,25 kW");
assert.equal(formatCellValue(undefined, "circuitTotalPower"), "-");
});
it("uses circuit display values for block sorting and falls back to the first device", () => {
@@ -183,6 +188,7 @@ describe("circuit grid model", () => {
it("parses numeric drafts and rejects invalid values", () => {
assert.equal(parseNumeric("quantity", " 2.5 "), 2.5);
assert.equal(parseNumeric("powerPerUnit", " 1,25 "), 1.25);
assert.equal(parseNumeric("quantity", ""), undefined);
assert.throws(() => parseNumeric("quantity", "two"), /Ungültiger Zahlenwert/);
});