补齐 UI 编辑器整树渲染定位验收并收口六条验收
- tests/previewWorkspaceZoom.test.tsx 新增「树层按 root.offset.min 定位,原图与子节点随之一起移动」:断言树层 style.left/top 等于 root.offset.min 且根与子节点都挂在该层 - 变异验证:层偏移兜底改成 [0,0] 后只有该用例变红(1 failed / 9 passed) - 里程碑第 2 条勾选,6 条验收全部有变异验证过的自动化证据(当前四套 77 passed);实施计划同步更新,剩余只有真机目视验收
This commit is contained in:
@@ -287,4 +287,32 @@ describe('PreviewWorkspace quick zoom', () => {
|
||||
);
|
||||
expect(logicalViewportScale(joint.container)).toBe(jointScale);
|
||||
});
|
||||
it('树层按 root.offset.min 定位,原图与子节点随之一起移动', () => {
|
||||
const child: UiNode = {
|
||||
...structuredClone(root),
|
||||
id: 'child',
|
||||
offset: { min: [10, 20], max: [210, 220] },
|
||||
};
|
||||
const movedRoot: UiNode = {
|
||||
...structuredClone(root),
|
||||
offset: { min: [40, 60], max: [1240, 860] },
|
||||
children: [child],
|
||||
};
|
||||
const view = render(
|
||||
<PreviewWorkspace
|
||||
canvas={createCanvas({
|
||||
uiTrees: [{ src_ui_design: 'page-1', root: movedRoot }],
|
||||
})}
|
||||
/>,
|
||||
);
|
||||
|
||||
const layer = view.container.querySelector(
|
||||
'[data-tree-id="page-1"]',
|
||||
) as HTMLElement;
|
||||
expect(layer.style.left).toBe('40px');
|
||||
expect(layer.style.top).toBe('60px');
|
||||
// 原图与全部子节点都挂在这一层里:整树平移由这一层统一承担,子节点不必各自改坐标。
|
||||
expect(layer.querySelector('[data-node-id="root"]')).toBeTruthy();
|
||||
expect(layer.querySelector('[data-node-id="child"]')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user