zijlijn concepten beter geplaatst
This commit is contained in:
@@ -218,3 +218,34 @@ test("moving a concept also moves connected concepts that link to another CMap",
|
||||
linked: [500, 140]
|
||||
});
|
||||
});
|
||||
|
||||
test("moving a concept schedules one boundary-reference geometry refresh", async () => {
|
||||
const factory = await loadEditorFactory();
|
||||
const frames = [];
|
||||
global.window.requestAnimationFrame = (callback) => frames.push(callback);
|
||||
const map = {
|
||||
onSelection() {},
|
||||
onActivation() {},
|
||||
node: (attributes) => fakeNode(attributes)
|
||||
};
|
||||
const canvas = {
|
||||
addEventListener() {},
|
||||
querySelector: () => null,
|
||||
clientWidth: 1200,
|
||||
clientHeight: 800,
|
||||
scrollLeft: 0,
|
||||
scrollTop: 0,
|
||||
isConnected: true
|
||||
};
|
||||
const editor = factory.createEditor(canvas, { createDiagramEngine: () => map });
|
||||
const concept = editor.addItem({ id: 1, label: "Inside concept", x: 100, y: 100 });
|
||||
let refreshCount = 0;
|
||||
editor.refreshBoundaryReferences = () => { refreshCount += 1; };
|
||||
|
||||
editor.handleItemMove(concept, 150, 130);
|
||||
editor.handleItemMove(concept, 170, 140);
|
||||
|
||||
assert.equal(frames.length, 1, "pointer moves in one frame are coalesced");
|
||||
frames[0]();
|
||||
assert.equal(refreshCount, 1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user