Merge commit 'fa62a5fc4cdf127b919c90ca7451d24f7e25817c' into 1.0.0.0/IIAA-XYZ-agents365-lifecycle-002
# Conflicts: # scripts/src/authoring/ir-to-drawio.ts
This commit is contained in:
@@ -3,6 +3,7 @@ import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "no
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import test from "node:test";
|
||||
import { JSDOM } from "jsdom";
|
||||
|
||||
import { parseAllPages } from "../../services/drawio-parser/parser.js";
|
||||
import { run } from "./action.js";
|
||||
@@ -101,3 +102,45 @@ test("build serializes every v2 page and honors explicit geometry and waypoints"
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("build emits parseable XML when generic model attributes collide with fixed attributes", () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), "drawio-build-model-attributes-test-"));
|
||||
const input = join(dir, "model-attributes.yaml");
|
||||
const output = join(dir, "model-attributes.drawio");
|
||||
try {
|
||||
writeFileSync(input, `version: 2
|
||||
pages:
|
||||
- id: page
|
||||
title: Page
|
||||
layout: { type: manual, gridSize: 20 }
|
||||
extensions:
|
||||
$drawio:
|
||||
attributes:
|
||||
model:grid: "0"
|
||||
model:gridSize: "99"
|
||||
model:page: "0"
|
||||
model:pageWidth: "1"
|
||||
model:pageHeight: "2"
|
||||
model:background: "#ffffff"
|
||||
nodes:
|
||||
- { id: node, label: Node, geometry: { x: 0, y: 0, width: 100, height: 60 } }
|
||||
edges: []
|
||||
`, "utf8");
|
||||
run(input, 0, output);
|
||||
|
||||
const xml = readFileSync(output, "utf8");
|
||||
const dom = new JSDOM("<!DOCTYPE html><html><body></body></html>");
|
||||
const document = new dom.window.DOMParser().parseFromString(xml, "text/xml");
|
||||
assert.equal(document.querySelector("parsererror"), null);
|
||||
const model = document.querySelector("mxGraphModel");
|
||||
assert.ok(model);
|
||||
assert.equal(model.getAttribute("grid"), "1");
|
||||
assert.equal(model.getAttribute("gridSize"), "20");
|
||||
assert.equal(model.getAttribute("page"), "1");
|
||||
assert.equal(model.getAttribute("pageWidth"), "1169");
|
||||
assert.equal(model.getAttribute("pageHeight"), "827");
|
||||
assert.equal(model.getAttribute("background"), "#ffffff");
|
||||
} finally {
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user