فهرست منبع

chore: add node tests (#1943)

GouravShDev 2 سال پیش
والد
کامیت
0dac41b114
1فایلهای تغییر یافته به همراه18 افزوده شده و 0 حذف شده
  1. 18 0
      frontend/appflowy_flutter/packages/appflowy_editor/test/core/document/node_test.dart

+ 18 - 0
frontend/appflowy_flutter/packages/appflowy_editor/test/core/document/node_test.dart

@@ -228,5 +228,23 @@ void main() async {
       final textNode = TextNode.empty()..delta = (Delta()..insert('AppFlowy'));
       expect(textNode.toPlainText(), 'AppFlowy');
     });
+    test('test node id', () {
+      final nodeA = Node(
+        type: 'example',
+        children: LinkedList(),
+        attributes: {},
+      );
+      final nodeAId = nodeA.id;
+      expect(nodeAId, 'example');
+      final nodeB = Node(
+        type: 'example',
+        children: LinkedList(),
+        attributes: {
+          'subtype': 'exampleSubtype',
+        },
+      );
+      final nodeBId = nodeB.id;
+      expect(nodeBId, 'example/exampleSubtype');
+    });
   });
 }