Forráskód Böngészése

test: add flowy_editor_test into github workflows

Lucas.Xu 2 éve
szülő
commit
07ab4c2680

+ 0 - 6
.github/workflows/dart_test.yml

@@ -78,9 +78,3 @@ jobs:
         run: |
           flutter pub get
           flutter test
-
-      - name: Run FlowyEditor tests
-        working-directory: frontend/app_flowy/packages/flowy_editor
-        run: |
-          flutter pub get
-          flutter test

+ 37 - 0
.github/workflows/flowy_editor_test.yml

@@ -0,0 +1,37 @@
+name: FlowyEditor test
+
+on:
+  push:
+    branches:
+      - "main"
+
+  pull_request:
+    branches:
+      - "main"
+      - "feat/flowy_editor"
+
+env:
+  CARGO_TERM_COLOR: always
+
+jobs:
+  tests:
+    strategy:
+      matrix:
+        os: [macos-latest, ubuntu-latest, windows-latest]
+
+    runs-on: ${{ matrix.os }}
+
+    steps:
+      - uses: actions/checkout@v2
+
+      - uses: subosito/flutter-action@v2
+        with:
+          channel: 'stable'
+          flutter-version: '3.0.5'
+          cache: true
+
+      - name: Run FlowyEditor tests
+        working-directory: frontend/app_flowy/packages/flowy_editor
+        run: |
+          flutter pub get
+          flutter test

+ 1 - 1
frontend/app_flowy/packages/flowy_editor/lib/src/service/internal_key_event_handlers/enter_without_shift_in_text_node_handler.dart

@@ -86,7 +86,7 @@ FlowyKeyEventHandler enterWithoutShiftInTextNodesHandler =
       );
       TransactionBuilder(editorState)
         ..insertNode(
-          textNode.path.next,
+          textNode.path,
           TextNode.empty(),
         )
         ..afterSelection = afterSelection

+ 0 - 4
frontend/app_flowy/packages/flowy_editor/test/editor/key_event_tests/enter_without_shift_in_text_node_handler_test.dart

@@ -71,10 +71,6 @@ void main() async {
       expect(lastNode != null, true);
       expect(lastNode is TextNode, true);
       lastNode = lastNode as TextNode;
-      for (final node in editor.root.children) {
-        print(
-            'path = ${node.path}, text = ${(node as TextNode).toRawString()}');
-      }
       expect(lastNode.delta.toRawString(), text);
       expect((lastNode.previous as TextNode).delta.toRawString(), '');
       expect(