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.

test: add flowy_editor_test into github workflows

Lucas.Xu07ab4c2680ef
diff --git a/.github/workflows/dart_test.yml b/.github/workflows/dart_test.yml
index 3ff581c2a3..33cbeb1a3a 100644
--- a/.github/workflows/dart_test.yml
+++ b/.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
diff --git a/.github/workflows/flowy_editor_test.yml b/.github/workflows/flowy_editor_test.yml
new file mode 100644
index 0000000000..80ac4fe5e5
--- /dev/null
+++ b/.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
diff --git a/frontend/app_flowy/packages/flowy_editor/lib/src/service/internal_key_event_handlers/enter_without_shift_in_text_node_handler.dart b/frontend/app_flowy/packages/flowy_editor/lib/src/service/internal_key_event_handlers/enter_without_shift_in_text_node_handler.dart
index 1a25a2531d..39c74d2eab 100644
--- a/frontend/app_flowy/packages/flowy_editor/lib/src/service/internal_key_event_handlers/enter_without_shift_in_text_node_handler.dart
+++ b/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
diff --git a/frontend/app_flowy/packages/flowy_editor/test/editor/key_event_tests/enter_without_shift_in_text_node_handler_test.dart b/frontend/app_flowy/packages/flowy_editor/test/editor/key_event_tests/enter_without_shift_in_text_node_handler_test.dart
index dd722ec0d0..a92391bffd 100644
--- a/frontend/app_flowy/packages/flowy_editor/test/editor/key_event_tests/enter_without_shift_in_text_node_handler_test.dart
+++ b/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(