Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

feat: add test for appflowy_editor path (#1926)

GouravShDev99f0fad74c50
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);
+ },
+ );
});
}