From 3f8c4047150a0bc5061b0e56754abcdede854bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=84=95?= <2323666215@qq.com> Date: Mon, 21 Mar 2022 17:12:18 +0800 Subject: [PATCH] test(core): supplemental test details #WIK-6050 --- packages/src/plugins/with-angular.spec.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/src/plugins/with-angular.spec.ts b/packages/src/plugins/with-angular.spec.ts index fe159432..2594cfde 100644 --- a/packages/src/plugins/with-angular.spec.ts +++ b/packages/src/plugins/with-angular.spec.ts @@ -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); @@ -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(() => {