Add estimate row project device handoff
This commit is contained in:
parent
8b1923e8ec
commit
a6500e2b26
9 changed files with 434 additions and 21 deletions
|
|
@ -3,7 +3,11 @@ import { describe, it } from "node:test";
|
|||
import { createElement } from "react";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { ProjectVersionHistory } from "../src/frontend/components/project-version-history.js";
|
||||
import { ProjectDeviceModal } from "../src/frontend/components/project-device-modal.js";
|
||||
import {
|
||||
hasExistingProjectDeviceName,
|
||||
isProjectDeviceNumberInRange,
|
||||
ProjectDeviceModal,
|
||||
} from "../src/frontend/components/project-device-modal.js";
|
||||
import { ProjectSettingsModal } from "../src/frontend/components/project-settings-modal.js";
|
||||
import type {
|
||||
ProjectRevisionSummaryDto,
|
||||
|
|
@ -324,6 +328,42 @@ describe("project device modal presentation", () => {
|
|||
assert.match(markup, /1-phasig/);
|
||||
assert.match(markup, /3-phasig/);
|
||||
});
|
||||
|
||||
it("rejects empty required numbers while keeping zero valid", () => {
|
||||
assert.equal(isProjectDeviceNumberInRange("", 0), false);
|
||||
assert.equal(isProjectDeviceNumberInRange(" ", 0), false);
|
||||
assert.equal(isProjectDeviceNumberInRange("0", 0), true);
|
||||
assert.equal(isProjectDeviceNumberInRange("0,8", 0, 1), true);
|
||||
});
|
||||
|
||||
it("renders blank area values as invalid and warns about duplicate names", () => {
|
||||
const markup = renderToStaticMarkup(
|
||||
createElement(ProjectDeviceModal, {
|
||||
existingDevices: [{ name: "Bürofläche", displayName: "Bürofläche" }],
|
||||
globalDevices: [],
|
||||
initialValues: {
|
||||
name: "Bürofläche",
|
||||
displayName: "Bürofläche",
|
||||
quantity: null,
|
||||
powerPerUnit: null,
|
||||
},
|
||||
isSaving: false,
|
||||
onClose: () => undefined,
|
||||
onImportGlobal: async () => undefined,
|
||||
onSave: async () => undefined,
|
||||
})
|
||||
);
|
||||
assert.match(markup, /gleichem internen Namen oder Anzeigenamen/);
|
||||
assert.match(markup, /id="device-quantity"[^>]*value=""/);
|
||||
assert.match(markup, /id="device-power"[^>]*value=""/);
|
||||
assert.match(markup, /<button class="btn btn-primary" disabled="" type="submit">/);
|
||||
assert.equal(
|
||||
hasExistingProjectDeviceName(" bürofläche ", "", [
|
||||
{ name: "BÜROFLÄCHE", displayName: "Fläche" },
|
||||
]),
|
||||
true
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("project version history API", () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue