Skip to content

Commit

Permalink
test(core): supplemental test details #WIK-6050
Browse files Browse the repository at this point in the history
  • Loading branch information
huanhuanwa committed Mar 21, 2022
1 parent 046212c commit 3f8c404
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/src/plugins/with-angular.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,14 @@ describe('with-angular', () => {
});
flush();
const oldPath = angularEditor.selection.anchor.path;
const newPath = Path.next(oldPath.slice(0, 2));
const newPath = [...Path.next(oldPath.slice(0, 2)), 0, 0];
let firstItem = Node.get(angularEditor, oldPath) as any;
let lastItem = Node.get(angularEditor, newPath) as any;
expect(firstItem.text).toBe('a');
expect(lastItem.text).toBe('');
Transforms.moveNodes(angularEditor, {
at: oldPath, // [1, 0, 0, 0]
to: [...newPath, 0], // [1, 1, 0]
to: newPath, // [1, 1, 0, 0]
});
let matches = [];
const commonPath = getCommonPath(oldPath, newPath);
Expand All @@ -137,7 +141,11 @@ describe('with-angular', () => {
matches = getOldPathMatches(angularEditor, oldPath, matches);
expect(matches.length).toBe(4); // []、[1] 、[1, 0]、[1, 0, 0]
matches = getNewPathMatches(angularEditor, commonPath, newPath, matches);
expect(matches.length).toBe(4);
expect(matches.length).toBe(6); // []、[1] 、[1, 0]、[1, 0, 0]、[1, 1]、[1, 1, 0]
firstItem = Node.get(angularEditor, oldPath) as any;
lastItem = Node.get(angularEditor, newPath) as any;
expect(firstItem.text).toBe('');
expect(lastItem.text).toBe('a');
expect(angularEditor.children.length).toBe(4);
}));
it('move node to sibling when there is no common parent', fakeAsync(() => {
Expand Down

0 comments on commit 3f8c404

Please sign in to comment.