From 99f0fad74c5028b1ea79fe809368a990a694ee57 Mon Sep 17 00:00:00 2001 From: GouravShDev <74348508+GouravShDev@users.noreply.github.com> Date: Mon, 6 Mar 2023 08:07:10 +0530 Subject: [PATCH] feat: add test for appflowy_editor path (#1926) --- .../test/core/document/path_test.dart | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) 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); + }, + ); }); }