1
0
mirror of synced 2026-03-23 02:58:34 +08:00

feat(editor): editorService.add支持添加多个组件

This commit is contained in:
roymondchen
2022-08-11 14:24:33 +08:00
committed by jia000
parent 5ccb5f1ec9
commit b6fa064b0b
6 changed files with 118 additions and 135 deletions

View File

@@ -208,7 +208,9 @@ describe('add', () => {
// 添加后会选中这个节点
const node = editorService.get('node');
const parent = editorService.get('parent');
expect(node.id).toBe(newNode.id);
if (!Array.isArray(newNode)) {
expect(node.id).toBe(newNode.id);
}
expect(parent.items).toHaveLength(3);
});
@@ -222,7 +224,9 @@ describe('add', () => {
});
const node = editorService.get('node');
const parent = editorService.get('parent');
expect(node.id).toBe(newNode.id);
if (!Array.isArray(newNode)) {
expect(node.id).toBe(newNode.id);
}
expect(parent.items).toHaveLength(3);
});
@@ -237,7 +241,9 @@ describe('add', () => {
rootNode,
);
const node = editorService.get('node');
expect(node.id).toBe(newNode.id);
if (!Array.isArray(newNode)) {
expect(node.id).toBe(newNode.id);
}
expect(rootNode.items.length).toBe(2);
});