diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/core/document/path_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/core/document/path_test.dart index cf11a96dd6..fa2725db97 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/core/document/path_test.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/core/document/path_test.dart @@ -29,5 +29,43 @@ void main() async { expect(p2 <= p1, true); expect(p1.equals(p2), true); }); + test( + "test path next, previous and parent getters", + () { + var p1 = [0, 0]; + var p2 = [0, 1]; + + expect(p1.next.equals(p2), true); + expect(p1.previous.equals(p2), false); + expect(p1.parent.equals(p2), false); + + p1 = [0, 1, 0]; + p2 = [0, 1, 1]; + + expect(p2.next.equals(p1), false); + expect(p2.previous.equals(p1), true); + expect(p2.parent.equals(p1), false); + + p1 = [0, 1, 1]; + p2 = [0, 1, 1]; + + expect(p1.next.equals(p2), false); + expect(p1.previous.equals(p2), false); + expect(p1.parent.equals(p2), false); + + p1 = []; + p2 = []; + + expect(p1.next.equals(p2), true); + expect(p2.previous.equals(p1), true); + expect(p1.parent.equals(p2), true); + + p1 = [1, 0, 2]; + p2 = [1, 0]; + + expect(p1.parent.equals(p2), true); + expect(p2.parent.equals(p1), false); + }, + ); }); }