From 7b61ed228f77322a515b150cc05bf3a29b2acbc3 Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Tue, 28 Mar 2023 16:30:26 +0800 Subject: [PATCH] fix: bold tests failed (#2122) --- .../appflowy_editor/documentation/testing.md | 8 +- .../selection_menu/selection_menu_widget.dart | 1 - .../lib/src/service/keyboard_service.dart | 2 - .../built_in_shortcut_events.dart | 4 +- .../test/infra/test_editor.dart | 11 ++- .../test/infra/test_raw_key_event.dart | 14 ++- .../render/rich_text/checkbox_text_test.dart | 8 +- .../selection_menu_widget_test.dart | 70 +++++++------- .../arrow_keys_handler_test.dart | 94 +++++++++---------- .../backspace_handler_test.dart | 50 +++++----- .../checkbox_event_handler_test.dart | 16 ++-- ...thout_shift_in_text_node_handler_test.dart | 16 ++-- .../exit_editing_mode_handler_test.dart | 2 +- .../format_style_handler_test.dart | 38 ++++---- .../markdown_syntax_to_styled_text_test.dart | 28 +++--- .../page_up_down_handler_test.dart | 8 +- .../redo_undo_handler_test.dart | 10 +- .../select_all_handler_test.dart | 6 +- .../slash_handler_test.dart | 5 +- .../space_on_web_handler_test.dart | 4 +- .../tab_handler_test.dart | 24 ++--- .../white_space_handler_test.dart | 34 +++---- .../shortcut_event/shortcut_event_test.dart | 22 ++--- 23 files changed, 242 insertions(+), 233 deletions(-) diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/documentation/testing.md b/frontend/appflowy_flutter/packages/appflowy_editor/documentation/testing.md index 7e356d9f83..b388edddad 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/documentation/testing.md +++ b/frontend/appflowy_flutter/packages/appflowy_editor/documentation/testing.md @@ -77,10 +77,10 @@ Next we will simulate the input of a shortcut key being pressed that will select ```dart // Meta + A. -await editor.pressLogicKey(LogicalKeyboardKey.keyA, isMetaPressed: true); +await editor.pressLogicKey(key: LogicalKeyboardKey.keyA, isMetaPressed: true); // Meta + shift + S. -await editor.pressLogicKey( - LogicalKeyboardKey.keyS, +await editor.pressLogicKey + key: LogicalKeyboardKey.keyS, isMetaPressed: true, isShiftPressed: true, ); @@ -130,7 +130,7 @@ void main() async { editor.insertTextNode(text); } await editor.startTesting(); - await editor.pressLogicKey(LogicalKeyboardKey.keyA, isMetaPressed: true); + await editor.pressLogicKey(key: LogicalKeyboardKey.keyA, isMetaPressed: true); expect( editor.documentSelection, diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/lib/src/render/selection_menu/selection_menu_widget.dart b/frontend/appflowy_flutter/packages/appflowy_editor/lib/src/render/selection_menu/selection_menu_widget.dart index a212692e20..e8a4eca357 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/lib/src/render/selection_menu/selection_menu_widget.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/lib/src/render/selection_menu/selection_menu_widget.dart @@ -1,7 +1,6 @@ import 'dart:math'; import 'package:appflowy_editor/appflowy_editor.dart'; -import 'package:appflowy_editor/src/render/selection_menu/selection_menu_item_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/lib/src/service/keyboard_service.dart b/frontend/appflowy_flutter/packages/appflowy_editor/lib/src/service/keyboard_service.dart index 2068a2a0f0..bcd0f769fb 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/lib/src/service/keyboard_service.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/lib/src/service/keyboard_service.dart @@ -121,8 +121,6 @@ class _AppFlowyKeyboardState extends State return KeyEventResult.ignored; } - Log.keyboard.debug('on keyboard event $event'); - if (event is! RawKeyDownEvent) { return KeyEventResult.ignored; } diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/lib/src/service/shortcut_event/built_in_shortcut_events.dart b/frontend/appflowy_flutter/packages/appflowy_editor/lib/src/service/shortcut_event/built_in_shortcut_events.dart index d9a0470f3d..3d8fa6839d 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/lib/src/service/shortcut_event/built_in_shortcut_events.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/lib/src/service/shortcut_event/built_in_shortcut_events.dart @@ -289,7 +289,7 @@ List builtInShortcutEvents = [ ), ShortcutEvent( key: 'Double tilde to strikethrough', - command: 'tilde,shift+tilde', + character: '~', handler: doubleTildeToStrikethrough, ), ShortcutEvent( @@ -314,7 +314,7 @@ List builtInShortcutEvents = [ ), ShortcutEvent( key: 'Double underscore to bold', - command: 'shift+underscore', + character: '_', handler: doubleUnderscoreToBoldHandler, ), // https://github.com/flutter/flutter/issues/104944 diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/infra/test_editor.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/infra/test_editor.dart index 69019f889c..910e101b63 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/infra/test_editor.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/infra/test_editor.dart @@ -120,8 +120,9 @@ class EditorWidgetTester { await tester.pumpAndSettle(); } - Future pressLogicKey( - LogicalKeyboardKey key, { + Future pressLogicKey({ + String? character, + LogicalKeyboardKey? key, bool isControlPressed = false, bool isShiftPressed = false, bool isAltPressed = false, @@ -130,11 +131,13 @@ class EditorWidgetTester { if (!isControlPressed && !isShiftPressed && !isAltPressed && - !isMetaPressed) { + !isMetaPressed && + key != null) { await tester.sendKeyDownEvent(key); } else { final testRawKeyEventData = TestRawKeyEventData( - logicalKey: key, + logicalKey: key ?? LogicalKeyboardKey.nonConvert, + character: character, isControlPressed: isControlPressed, isShiftPressed: isShiftPressed, isAltPressed: isAltPressed, diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/infra/test_raw_key_event.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/infra/test_raw_key_event.dart index 0a3d6cd74f..2b62a7022a 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/infra/test_raw_key_event.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/infra/test_raw_key_event.dart @@ -3,6 +3,7 @@ import 'package:flutter/services.dart'; class TestRawKeyEvent extends RawKeyDownEvent { const TestRawKeyEvent({ required super.data, + required super.character, this.isControlPressed = false, this.isShiftPressed = false, this.isAltPressed = false, @@ -24,7 +25,9 @@ class TestRawKeyEvent extends RawKeyDownEvent { class TestRawKeyEventData extends RawKeyEventData { const TestRawKeyEventData({ - required this.logicalKey, + this.logicalKey = + LogicalKeyboardKey.nonConvert, // use nonConvert as placeholder. + this.character, this.isControlPressed = false, this.isShiftPressed = false, this.isAltPressed = false, @@ -46,6 +49,8 @@ class TestRawKeyEventData extends RawKeyEventData { @override final LogicalKeyboardKey logicalKey; + final String? character; + @override PhysicalKeyboardKey get physicalKey => logicalKey.toPhysicalKey; @@ -55,8 +60,10 @@ class TestRawKeyEventData extends RawKeyEventData { } @override - bool isModifierPressed(ModifierKey key, - {KeyboardSide side = KeyboardSide.any}) { + bool isModifierPressed( + ModifierKey key, { + KeyboardSide side = KeyboardSide.any, + }) { throw UnimplementedError(); } @@ -66,6 +73,7 @@ class TestRawKeyEventData extends RawKeyEventData { RawKeyEvent get toKeyEvent { return TestRawKeyEvent( data: this, + character: character, isAltPressed: isAltPressed, isControlPressed: isControlPressed, isMetaPressed: isMetaPressed, diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/render/rich_text/checkbox_text_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/render/rich_text/checkbox_text_test.dart index 576dabf7c4..b3e22f89e6 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/render/rich_text/checkbox_text_test.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/render/rich_text/checkbox_text_test.dart @@ -100,16 +100,16 @@ void main() async { Selection.single(path: [0], startOffset: text.length), ); - await editor.pressLogicKey(LogicalKeyboardKey.enter); - await editor.pressLogicKey(LogicalKeyboardKey.enter); - await editor.pressLogicKey(LogicalKeyboardKey.enter); + await editor.pressLogicKey(key: LogicalKeyboardKey.enter); + await editor.pressLogicKey(key: LogicalKeyboardKey.enter); + await editor.pressLogicKey(key: LogicalKeyboardKey.enter); expect( editor.documentSelection, Selection.single(path: [2], startOffset: 0), ); - await editor.pressLogicKey(LogicalKeyboardKey.slash); + await editor.pressLogicKey(key: LogicalKeyboardKey.slash); await tester.pumpAndSettle(const Duration(milliseconds: 1000)); expect( diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/render/selection_menu/selection_menu_widget_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/render/selection_menu/selection_menu_widget_test.dart index 45bbea120a..188663665e 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/render/selection_menu/selection_menu_widget_test.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/render/selection_menu/selection_menu_widget_test.dart @@ -1,5 +1,4 @@ import 'package:appflowy_editor/appflowy_editor.dart'; -import 'package:appflowy_editor/src/render/selection_menu/selection_menu_item_widget.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; import '../../infra/test_editor.dart'; @@ -22,10 +21,10 @@ void main() async { (tester) async { final editor = await _prepare(tester); for (var j = 0; j < i; j++) { - await editor.pressLogicKey(LogicalKeyboardKey.arrowDown); + await editor.pressLogicKey(key: LogicalKeyboardKey.arrowDown); } - await editor.pressLogicKey(LogicalKeyboardKey.enter); + await editor.pressLogicKey(key: LogicalKeyboardKey.enter); expect( find.byType(SelectionMenuWidget, skipOffstage: false), findsNothing, @@ -52,33 +51,33 @@ void main() async { testWidgets('Search item in selection menu util no results', (tester) async { final editor = await _prepare(tester); - await editor.pressLogicKey(LogicalKeyboardKey.keyT); - await editor.pressLogicKey(LogicalKeyboardKey.keyE); + await editor.pressLogicKey(key: LogicalKeyboardKey.keyT); + await editor.pressLogicKey(key: LogicalKeyboardKey.keyE); expect( find.byType(SelectionMenuItemWidget, skipOffstage: false), findsNWidgets(3), ); - await editor.pressLogicKey(LogicalKeyboardKey.backspace); + await editor.pressLogicKey(key: LogicalKeyboardKey.backspace); expect( find.byType(SelectionMenuItemWidget, skipOffstage: false), findsNWidgets(5), ); - await editor.pressLogicKey(LogicalKeyboardKey.keyE); + await editor.pressLogicKey(key: LogicalKeyboardKey.keyE); expect( find.byType(SelectionMenuItemWidget, skipOffstage: false), findsNWidgets(3), ); - await editor.pressLogicKey(LogicalKeyboardKey.keyX); + await editor.pressLogicKey(key: LogicalKeyboardKey.keyX); expect( find.byType(SelectionMenuItemWidget, skipOffstage: false), findsNWidgets(1), ); - await editor.pressLogicKey(LogicalKeyboardKey.keyT); + await editor.pressLogicKey(key: LogicalKeyboardKey.keyT); expect( find.byType(SelectionMenuItemWidget, skipOffstage: false), findsNWidgets(1), ); - await editor.pressLogicKey(LogicalKeyboardKey.keyT); + await editor.pressLogicKey(key: LogicalKeyboardKey.keyT); expect( find.byType(SelectionMenuItemWidget, skipOffstage: false), findsNothing, @@ -88,13 +87,13 @@ void main() async { testWidgets('Search item in selection menu and presses esc', (tester) async { final editor = await _prepare(tester); - await editor.pressLogicKey(LogicalKeyboardKey.keyT); - await editor.pressLogicKey(LogicalKeyboardKey.keyE); + await editor.pressLogicKey(key: LogicalKeyboardKey.keyT); + await editor.pressLogicKey(key: LogicalKeyboardKey.keyE); expect( find.byType(SelectionMenuItemWidget, skipOffstage: false), findsNWidgets(3), ); - await editor.pressLogicKey(LogicalKeyboardKey.escape); + await editor.pressLogicKey(key: LogicalKeyboardKey.escape); expect( find.byType(SelectionMenuItemWidget, skipOffstage: false), findsNothing, @@ -104,15 +103,15 @@ void main() async { testWidgets('Search item in selection menu and presses backspace', (tester) async { final editor = await _prepare(tester); - await editor.pressLogicKey(LogicalKeyboardKey.keyT); - await editor.pressLogicKey(LogicalKeyboardKey.keyE); + await editor.pressLogicKey(key: LogicalKeyboardKey.keyT); + await editor.pressLogicKey(key: LogicalKeyboardKey.keyE); expect( find.byType(SelectionMenuItemWidget, skipOffstage: false), findsNWidgets(3), ); - await editor.pressLogicKey(LogicalKeyboardKey.backspace); - await editor.pressLogicKey(LogicalKeyboardKey.backspace); - await editor.pressLogicKey(LogicalKeyboardKey.backspace); + await editor.pressLogicKey(key: LogicalKeyboardKey.backspace); + await editor.pressLogicKey(key: LogicalKeyboardKey.backspace); + await editor.pressLogicKey(key: LogicalKeyboardKey.backspace); expect( find.byType(SelectionMenuItemWidget, skipOffstage: false), findsNothing, @@ -120,71 +119,70 @@ void main() async { }); group('tab and arrow keys move selection in desired direction', () { - testWidgets('left and right keys move selection in desired direction', - (tester) async { + (tester) async { final editor = await _prepare(tester); var initialSelection = getSelectedMenuItem(tester); expect(defaultSelectionMenuItems.indexOf(initialSelection.item), 0); - await editor.pressLogicKey(LogicalKeyboardKey.arrowRight); + await editor.pressLogicKey(key: LogicalKeyboardKey.arrowRight); var newSelection = getSelectedMenuItem(tester); expect(defaultSelectionMenuItems.indexOf(newSelection.item), 5); - await editor.pressLogicKey(LogicalKeyboardKey.arrowLeft); + await editor.pressLogicKey(key: LogicalKeyboardKey.arrowLeft); var finalSelection = getSelectedMenuItem(tester); expect(defaultSelectionMenuItems.indexOf(initialSelection.item), 0); }); testWidgets('up and down keys move selection in desired direction', - (tester) async { + (tester) async { final editor = await _prepare(tester); var initialSelection = getSelectedMenuItem(tester); expect(defaultSelectionMenuItems.indexOf(initialSelection.item), 0); - await editor.pressLogicKey(LogicalKeyboardKey.arrowDown); + await editor.pressLogicKey(key: LogicalKeyboardKey.arrowDown); var newSelection = getSelectedMenuItem(tester); expect(defaultSelectionMenuItems.indexOf(newSelection.item), 1); - await editor.pressLogicKey(LogicalKeyboardKey.arrowUp); + await editor.pressLogicKey(key: LogicalKeyboardKey.arrowUp); var finalSelection = getSelectedMenuItem(tester); expect(defaultSelectionMenuItems.indexOf(finalSelection.item), 0); }); - testWidgets('arrow keys and tab move same selection', - (tester) async { + testWidgets('arrow keys and tab move same selection', (tester) async { final editor = await _prepare(tester); var initialSelection = getSelectedMenuItem(tester); expect(defaultSelectionMenuItems.indexOf(initialSelection.item), 0); - await editor.pressLogicKey(LogicalKeyboardKey.arrowDown); + await editor.pressLogicKey(key: LogicalKeyboardKey.arrowDown); var newSelection = getSelectedMenuItem(tester); expect(defaultSelectionMenuItems.indexOf(newSelection.item), 1); - await editor.pressLogicKey(LogicalKeyboardKey.tab); + await editor.pressLogicKey(key: LogicalKeyboardKey.tab); var finalSelection = getSelectedMenuItem(tester); expect(defaultSelectionMenuItems.indexOf(finalSelection.item), 6); }); - testWidgets('tab moves selection to next row Item on reaching end of current row', - (tester) async { + testWidgets( + 'tab moves selection to next row Item on reaching end of current row', + (tester) async { final editor = await _prepare(tester); final initialSelection = getSelectedMenuItem(tester); expect(defaultSelectionMenuItems.indexOf(initialSelection.item), 0); - await editor.pressLogicKey(LogicalKeyboardKey.tab); - await editor.pressLogicKey(LogicalKeyboardKey.tab); + await editor.pressLogicKey(key: LogicalKeyboardKey.tab); + await editor.pressLogicKey(key: LogicalKeyboardKey.tab); final finalSelection = getSelectedMenuItem(tester); @@ -203,7 +201,7 @@ Future _prepare(WidgetTester tester) async { } await editor.startTesting(); await editor.updateSelection(Selection.single(path: [1], startOffset: 0)); - await editor.pressLogicKey(LogicalKeyboardKey.slash); + await editor.pressLogicKey(key: LogicalKeyboardKey.slash); await tester.pumpAndSettle(const Duration(milliseconds: 1000)); @@ -256,6 +254,6 @@ SelectionMenuItemWidget getSelectedMenuItem(WidgetTester tester) { return tester .state(find.byWidgetPredicate( (widget) => widget is SelectionMenuItemWidget && widget.isSelected, - )) + )) .widget as SelectionMenuItemWidget; -} \ No newline at end of file +} diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/arrow_keys_handler_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/arrow_keys_handler_test.dart index 25e633e490..75b6696d29 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/arrow_keys_handler_test.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/arrow_keys_handler_test.dart @@ -25,7 +25,7 @@ void main() async { final textNode = editor.nodeAtPath([0]) as TextNode; for (var i = 0; i < text.length; i++) { - await editor.pressLogicKey(LogicalKeyboardKey.arrowRight); + await editor.pressLogicKey(key: LogicalKeyboardKey.arrowRight); if (i == text.length - 1) { // Wrap to next node if the cursor is at the end of the current node. @@ -73,7 +73,7 @@ void main() async { await editor.updateSelection(selection); for (var i = offset - 1; i >= 0; i--) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowLeft, + key: LogicalKeyboardKey.arrowLeft, isShiftPressed: true, ); expect( @@ -85,7 +85,7 @@ void main() async { } for (var i = text.length; i >= 0; i--) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowLeft, + key: LogicalKeyboardKey.arrowLeft, isShiftPressed: true, ); expect( @@ -97,7 +97,7 @@ void main() async { } for (var i = 1; i <= text.length; i++) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowRight, + key: LogicalKeyboardKey.arrowRight, isShiftPressed: true, ); expect( @@ -109,7 +109,7 @@ void main() async { } for (var i = 0; i < text.length; i++) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowRight, + key: LogicalKeyboardKey.arrowRight, isShiftPressed: true, ); expect( @@ -139,7 +139,7 @@ void main() async { await editor.updateSelection(selection); for (var i = end + 1; i <= text.length; i++) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowRight, + key: LogicalKeyboardKey.arrowRight, isShiftPressed: true, ); expect( @@ -151,7 +151,7 @@ void main() async { } for (var i = text.length - 1; i >= 0; i--) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowLeft, + key: LogicalKeyboardKey.arrowLeft, isShiftPressed: true, ); expect( @@ -181,7 +181,7 @@ void main() async { await editor.updateSelection(selection); for (var i = end - 1; i >= 0; i--) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowLeft, + key: LogicalKeyboardKey.arrowLeft, isShiftPressed: true, ); expect( @@ -193,7 +193,7 @@ void main() async { } for (var i = 1; i <= text.length; i++) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowRight, + key: LogicalKeyboardKey.arrowRight, isShiftPressed: true, ); expect( @@ -238,7 +238,7 @@ void main() async { await editor.updateSelection(selection); for (int i = 0; i < 3; i++) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowUp, + key: LogicalKeyboardKey.arrowUp, isShiftPressed: true, ); } @@ -250,7 +250,7 @@ void main() async { ); for (int i = 0; i < 7; i++) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowDown, + key: LogicalKeyboardKey.arrowDown, isShiftPressed: true, ); } @@ -262,7 +262,7 @@ void main() async { ); for (int i = 0; i < 3; i++) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowUp, + key: LogicalKeyboardKey.arrowUp, isShiftPressed: true, ); } @@ -284,18 +284,18 @@ void main() async { final selection = Selection.single(path: [0], startOffset: 8); await editor.updateSelection(selection); await editor.pressLogicKey( - LogicalKeyboardKey.arrowDown, + key: LogicalKeyboardKey.arrowDown, isShiftPressed: true, ); if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowRight, + key: LogicalKeyboardKey.arrowRight, isShiftPressed: true, isControlPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.arrowRight, + key: LogicalKeyboardKey.arrowRight, isShiftPressed: true, isMetaPressed: true, ); @@ -318,18 +318,18 @@ void main() async { final selection = Selection.single(path: [1], startOffset: 8); await editor.updateSelection(selection); await editor.pressLogicKey( - LogicalKeyboardKey.arrowUp, + key: LogicalKeyboardKey.arrowUp, isShiftPressed: true, ); if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowLeft, + key: LogicalKeyboardKey.arrowLeft, isShiftPressed: true, isControlPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.arrowLeft, + key: LogicalKeyboardKey.arrowLeft, isShiftPressed: true, isMetaPressed: true, ); @@ -352,7 +352,7 @@ void main() async { final selection = Selection.single(path: [1], startOffset: 10); await editor.updateSelection(selection); await editor.pressLogicKey( - LogicalKeyboardKey.arrowLeft, + key: LogicalKeyboardKey.arrowLeft, isShiftPressed: true, isAltPressed: true, ); @@ -364,7 +364,7 @@ void main() async { ), ); await editor.pressLogicKey( - LogicalKeyboardKey.arrowLeft, + key: LogicalKeyboardKey.arrowLeft, isShiftPressed: true, isAltPressed: true, ); @@ -376,7 +376,7 @@ void main() async { ), ); await editor.pressLogicKey( - LogicalKeyboardKey.arrowLeft, + key: LogicalKeyboardKey.arrowLeft, isShiftPressed: true, isAltPressed: true, ); @@ -388,7 +388,7 @@ void main() async { ), ); await editor.pressLogicKey( - LogicalKeyboardKey.arrowLeft, + key: LogicalKeyboardKey.arrowLeft, isShiftPressed: true, isAltPressed: true, ); @@ -412,7 +412,7 @@ void main() async { final selection = Selection.single(path: [0], startOffset: 10); await editor.updateSelection(selection); await editor.pressLogicKey( - LogicalKeyboardKey.arrowRight, + key: LogicalKeyboardKey.arrowRight, isShiftPressed: true, isAltPressed: true, ); @@ -424,7 +424,7 @@ void main() async { ), ); await editor.pressLogicKey( - LogicalKeyboardKey.arrowRight, + key: LogicalKeyboardKey.arrowRight, isShiftPressed: true, isAltPressed: true, ); @@ -436,12 +436,12 @@ void main() async { ), ); await editor.pressLogicKey( - LogicalKeyboardKey.arrowRight, + key: LogicalKeyboardKey.arrowRight, isShiftPressed: true, isAltPressed: true, ); await editor.pressLogicKey( - LogicalKeyboardKey.arrowRight, + key: LogicalKeyboardKey.arrowRight, isShiftPressed: true, isAltPressed: true, ); @@ -453,7 +453,7 @@ void main() async { ), ); await editor.pressLogicKey( - LogicalKeyboardKey.arrowRight, + key: LogicalKeyboardKey.arrowRight, isShiftPressed: true, isAltPressed: true, ); @@ -478,12 +478,12 @@ void main() async { if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.backspace, + key: LogicalKeyboardKey.backspace, isControlPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.backspace, + key: LogicalKeyboardKey.backspace, isMetaPressed: true, ); } @@ -499,12 +499,12 @@ void main() async { if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.backspace, + key: LogicalKeyboardKey.backspace, isControlPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.backspace, + key: LogicalKeyboardKey.backspace, isMetaPressed: true, ); } @@ -521,12 +521,12 @@ void main() async { for (var i = 0; i < words.length; i++) { if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.backspace, + key: LogicalKeyboardKey.backspace, isControlPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.backspace, + key: LogicalKeyboardKey.backspace, isMetaPressed: true, ); } @@ -550,12 +550,12 @@ void main() async { if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.backspace, + key: LogicalKeyboardKey.backspace, isControlPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.backspace, + key: LogicalKeyboardKey.backspace, isMetaPressed: true, ); } @@ -575,12 +575,12 @@ void main() async { if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.backspace, + key: LogicalKeyboardKey.backspace, isControlPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.backspace, + key: LogicalKeyboardKey.backspace, isMetaPressed: true, ); } @@ -610,11 +610,11 @@ Future _testPressArrowKeyInNotCollapsedSelection( end: isBackward ? end : start, ); await editor.updateSelection(selection); - await editor.pressLogicKey(LogicalKeyboardKey.arrowLeft); + await editor.pressLogicKey(key: LogicalKeyboardKey.arrowLeft); expect(editor.documentSelection?.start, start); await editor.updateSelection(selection); - await editor.pressLogicKey(LogicalKeyboardKey.arrowRight); + await editor.pressLogicKey(key: LogicalKeyboardKey.arrowRight); expect(editor.documentSelection?.end, end); } @@ -652,12 +652,12 @@ Future _testPressArrowKeyWithMetaInSelection( await editor.updateSelection(selection); if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowLeft, + key: LogicalKeyboardKey.arrowLeft, isControlPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.arrowLeft, + key: LogicalKeyboardKey.arrowLeft, isMetaPressed: true, ); } @@ -669,12 +669,12 @@ Future _testPressArrowKeyWithMetaInSelection( if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowRight, + key: LogicalKeyboardKey.arrowRight, isControlPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.arrowRight, + key: LogicalKeyboardKey.arrowRight, isMetaPressed: true, ); } @@ -686,12 +686,12 @@ Future _testPressArrowKeyWithMetaInSelection( if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowUp, + key: LogicalKeyboardKey.arrowUp, isControlPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.arrowUp, + key: LogicalKeyboardKey.arrowUp, isMetaPressed: true, ); } @@ -703,12 +703,12 @@ Future _testPressArrowKeyWithMetaInSelection( if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowDown, + key: LogicalKeyboardKey.arrowDown, isControlPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.arrowDown, + key: LogicalKeyboardKey.arrowDown, isMetaPressed: true, ); } diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/backspace_handler_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/backspace_handler_test.dart index e786377de0..b299c18aa4 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/backspace_handler_test.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/backspace_handler_test.dart @@ -30,7 +30,7 @@ void main() async { // Pressing the backspace key continuously. for (int i = 1; i <= 1; i++) { await editor.pressLogicKey( - LogicalKeyboardKey.backspace, + key: LogicalKeyboardKey.backspace, ); expect(editor.documentLength, 1); expect(editor.documentSelection, @@ -112,7 +112,7 @@ void main() async { await editor.updateSelection( Selection.single(path: [0], startOffset: text.length), ); - await editor.pressLogicKey(LogicalKeyboardKey.delete); + await editor.pressLogicKey(key: LogicalKeyboardKey.delete); expect(editor.documentLength, 1); expect(editor.documentSelection, @@ -207,7 +207,7 @@ void main() async { ), ); - await editor.pressLogicKey(LogicalKeyboardKey.backspace); + await editor.pressLogicKey(key: LogicalKeyboardKey.backspace); expect(editor.documentLength, 3); expect(find.byType(ImageNodeWidget), findsNothing); expect( @@ -249,20 +249,20 @@ void main() async { final textNode = editor.nodeAtPath([0]) as TextNode; await editor.insertText(textNode, '#', 0); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); expect( (editor.nodeAtPath([0]) as TextNode).attributes.heading, BuiltInAttributeKey.h1, ); - await editor.pressLogicKey(LogicalKeyboardKey.backspace); + await editor.pressLogicKey(key: LogicalKeyboardKey.backspace); expect( textNode.attributes.heading, null, ); await editor.insertText(textNode, '#', 0); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); expect( (editor.nodeAtPath([0]) as TextNode).attributes.heading, BuiltInAttributeKey.h1, @@ -296,17 +296,17 @@ void main() async { await editor.updateSelection( Selection.single(path: [0, 0, 0], startOffset: 0), ); - await editor.pressLogicKey(LogicalKeyboardKey.backspace); + await editor.pressLogicKey(key: LogicalKeyboardKey.backspace); expect(editor.nodeAtPath([0, 0, 0])?.subtype, null); await editor.updateSelection( Selection.single(path: [0, 0, 0], startOffset: 0), ); - await editor.pressLogicKey(LogicalKeyboardKey.backspace); + await editor.pressLogicKey(key: LogicalKeyboardKey.backspace); expect(editor.nodeAtPath([0, 1]) != null, true); await editor.updateSelection( Selection.single(path: [0, 1], startOffset: 0), ); - await editor.pressLogicKey(LogicalKeyboardKey.backspace); + await editor.pressLogicKey(key: LogicalKeyboardKey.backspace); expect(editor.nodeAtPath([1]) != null, true); await editor.updateSelection( Selection.single(path: [1], startOffset: 0), @@ -314,7 +314,7 @@ void main() async { // * Welcome to Appflowy 😁 // * Welcome to Appflowy 😁Welcome to Appflowy 😁 - await editor.pressLogicKey(LogicalKeyboardKey.backspace); + await editor.pressLogicKey(key: LogicalKeyboardKey.backspace); expect( editor.documentSelection, Selection.single(path: [0, 0], startOffset: text.length), @@ -356,7 +356,7 @@ void main() async { await editor.updateSelection( Selection.single(path: [0, 1], startOffset: 0), ); - await editor.pressLogicKey(LogicalKeyboardKey.backspace); + await editor.pressLogicKey(key: LogicalKeyboardKey.backspace); expect( editor.nodeAtPath([0, 1])!.subtype != BuiltInAttributeKey.bulletedList, true, @@ -382,7 +382,7 @@ void main() async { // * Welcome to Appflowy 😁Welcome to Appflowy 😁 // * Welcome to Appflowy 😁 // * Welcome to Appflowy 😁 - await editor.pressLogicKey(LogicalKeyboardKey.backspace); + await editor.pressLogicKey(key: LogicalKeyboardKey.backspace); expect( editor.nodeAtPath([0, 0])!.subtype == BuiltInAttributeKey.bulletedList, true, @@ -424,7 +424,7 @@ Future _deleteFirstImage(WidgetTester tester, bool isBackward) async { ), ); - await editor.pressLogicKey(LogicalKeyboardKey.backspace); + await editor.pressLogicKey(key: LogicalKeyboardKey.backspace); expect(editor.documentLength, 2); expect(find.byType(ImageNodeWidget), findsNothing); expect(editor.documentSelection, Selection.collapsed(start)); @@ -453,7 +453,7 @@ Future _deleteLastImage(WidgetTester tester, bool isBackward) async { ), ); - await editor.pressLogicKey(LogicalKeyboardKey.backspace); + await editor.pressLogicKey(key: LogicalKeyboardKey.backspace); expect(editor.documentLength, 2); expect(find.byType(ImageNodeWidget), findsNothing); expect(editor.documentSelection, Selection.collapsed(start)); @@ -483,12 +483,12 @@ Future _deleteStyledTextByBackspace( Selection.single(path: [2], startOffset: 0), ); await editor.pressLogicKey( - LogicalKeyboardKey.backspace, + key: LogicalKeyboardKey.backspace, ); expect(editor.documentSelection, Selection.single(path: [2], startOffset: 0)); await editor.pressLogicKey( - LogicalKeyboardKey.backspace, + key: LogicalKeyboardKey.backspace, ); expect(editor.documentLength, 2); expect(editor.documentSelection, @@ -500,7 +500,7 @@ Future _deleteStyledTextByBackspace( Selection.single(path: [1], startOffset: 0), ); await editor.pressLogicKey( - LogicalKeyboardKey.backspace, + key: LogicalKeyboardKey.backspace, ); expect(editor.documentLength, 2); expect(editor.documentSelection, Selection.single(path: [1], startOffset: 0)); @@ -531,7 +531,7 @@ Future _deleteStyledTextByDelete( ); for (var i = 1; i < text.length; i++) { await editor.pressLogicKey( - LogicalKeyboardKey.delete, + key: LogicalKeyboardKey.delete, ); expect( editor.documentSelection, Selection.single(path: [1], startOffset: 0)); @@ -541,7 +541,7 @@ Future _deleteStyledTextByDelete( } await editor.pressLogicKey( - LogicalKeyboardKey.delete, + key: LogicalKeyboardKey.delete, ); expect(editor.documentLength, 2); expect(editor.documentSelection, Selection.single(path: [1], startOffset: 0)); @@ -562,7 +562,7 @@ Future _deleteTextByBackspace( await editor.updateSelection( Selection.single(path: [1], startOffset: 10), ); - await editor.pressLogicKey(LogicalKeyboardKey.backspace); + await editor.pressLogicKey(key: LogicalKeyboardKey.backspace); expect(editor.documentLength, 3); expect(editor.documentSelection, Selection.single(path: [1], startOffset: 9)); @@ -573,7 +573,7 @@ Future _deleteTextByBackspace( await editor.updateSelection( Selection.single(path: [2], startOffset: 8, endOffset: 11), ); - await editor.pressLogicKey(LogicalKeyboardKey.backspace); + await editor.pressLogicKey(key: LogicalKeyboardKey.backspace); expect(editor.documentLength, 3); expect(editor.documentSelection, Selection.single(path: [2], startOffset: 8)); expect((editor.nodeAtPath([2]) as TextNode).toPlainText(), @@ -587,7 +587,7 @@ Future _deleteTextByBackspace( await editor.updateSelection(Selection( start: isBackwardSelection ? start : end, end: isBackwardSelection ? end : start)); - await editor.pressLogicKey(LogicalKeyboardKey.backspace); + await editor.pressLogicKey(key: LogicalKeyboardKey.backspace); expect(editor.documentLength, 1); expect( editor.documentSelection, Selection.single(path: [0], startOffset: 11)); @@ -608,7 +608,7 @@ Future _deleteTextByDelete( await editor.updateSelection( Selection.single(path: [1], startOffset: 9), ); - await editor.pressLogicKey(LogicalKeyboardKey.delete); + await editor.pressLogicKey(key: LogicalKeyboardKey.delete); expect(editor.documentLength, 3); expect(editor.documentSelection, Selection.single(path: [1], startOffset: 9)); @@ -619,7 +619,7 @@ Future _deleteTextByDelete( await editor.updateSelection( Selection.single(path: [2], startOffset: 8, endOffset: 11), ); - await editor.pressLogicKey(LogicalKeyboardKey.delete); + await editor.pressLogicKey(key: LogicalKeyboardKey.delete); expect(editor.documentLength, 3); expect(editor.documentSelection, Selection.single(path: [2], startOffset: 8)); expect((editor.nodeAtPath([2]) as TextNode).toPlainText(), @@ -633,7 +633,7 @@ Future _deleteTextByDelete( await editor.updateSelection(Selection( start: isBackwardSelection ? start : end, end: isBackwardSelection ? end : start)); - await editor.pressLogicKey(LogicalKeyboardKey.delete); + await editor.pressLogicKey(key: LogicalKeyboardKey.delete); expect(editor.documentLength, 1); expect( editor.documentSelection, Selection.single(path: [0], startOffset: 11)); diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/checkbox_event_handler_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/checkbox_event_handler_test.dart index e1fd1f6ccc..03d5c78d04 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/checkbox_event_handler_test.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/checkbox_event_handler_test.dart @@ -47,12 +47,12 @@ void main() async { if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.enter, + key: LogicalKeyboardKey.enter, isControlPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.enter, + key: LogicalKeyboardKey.enter, isMetaPressed: true, ); } @@ -65,12 +65,12 @@ void main() async { if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.enter, + key: LogicalKeyboardKey.enter, isControlPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.enter, + key: LogicalKeyboardKey.enter, isMetaPressed: true, ); } @@ -145,12 +145,12 @@ void main() async { if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.enter, + key: LogicalKeyboardKey.enter, isControlPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.enter, + key: LogicalKeyboardKey.enter, isMetaPressed: true, ); } @@ -223,12 +223,12 @@ void main() async { if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.enter, + key: LogicalKeyboardKey.enter, isControlPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.enter, + key: LogicalKeyboardKey.enter, isMetaPressed: true, ); } diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/enter_without_shift_in_text_node_handler_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/enter_without_shift_in_text_node_handler_test.dart index 74797b8402..9bca3748d6 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/enter_without_shift_in_text_node_handler_test.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/enter_without_shift_in_text_node_handler_test.dart @@ -26,7 +26,7 @@ void main() async { // Pressing the enter key continuously. for (int i = 1; i <= 10; i++) { await editor.pressLogicKey( - LogicalKeyboardKey.enter, + key: LogicalKeyboardKey.enter, ); expect(editor.documentLength, i + 1); expect(editor.documentSelection, @@ -64,7 +64,7 @@ void main() async { Selection.single(path: [lines - 1], startOffset: 0), ); await editor.pressLogicKey( - LogicalKeyboardKey.enter, + key: LogicalKeyboardKey.enter, ); lines += 1; expect(editor.documentLength, lines); @@ -132,7 +132,7 @@ void main() async { await editor.updateSelection( Selection.single(path: [0], startOffset: 0), ); - await editor.pressLogicKey(LogicalKeyboardKey.enter); + await editor.pressLogicKey(key: LogicalKeyboardKey.enter); expect(editor.documentLength, 2); expect((editor.nodeAtPath([1]) as TextNode).toPlainText(), text); }); @@ -159,7 +159,7 @@ Future _testStyleNeedToBeCopy(WidgetTester tester, String style) async { Selection.single(path: [1], startOffset: 0), ); await editor.pressLogicKey( - LogicalKeyboardKey.enter, + key: LogicalKeyboardKey.enter, ); expect(editor.documentSelection, Selection.single(path: [2], startOffset: 0)); @@ -167,7 +167,7 @@ Future _testStyleNeedToBeCopy(WidgetTester tester, String style) async { Selection.single(path: [3], startOffset: text.length), ); await editor.pressLogicKey( - LogicalKeyboardKey.enter, + key: LogicalKeyboardKey.enter, ); expect(editor.documentSelection, Selection.single(path: [4], startOffset: 0)); @@ -176,7 +176,7 @@ Future _testStyleNeedToBeCopy(WidgetTester tester, String style) async { expect(editor.nodeAtPath([4])?.subtype, null); await editor.pressLogicKey( - LogicalKeyboardKey.enter, + key: LogicalKeyboardKey.enter, ); expect( editor.documentSelection, Selection.single(path: [5], startOffset: 0)); @@ -185,7 +185,7 @@ Future _testStyleNeedToBeCopy(WidgetTester tester, String style) async { expect(editor.nodeAtPath([4])?.subtype, style); await editor.pressLogicKey( - LogicalKeyboardKey.enter, + key: LogicalKeyboardKey.enter, ); expect( editor.documentSelection, Selection.single(path: [4], startOffset: 0)); @@ -223,7 +223,7 @@ Future _testMultipleSelection( end: isBackwardSelection ? end : start, )); await editor.pressLogicKey( - LogicalKeyboardKey.enter, + key: LogicalKeyboardKey.enter, ); expect(editor.documentLength, 2); diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/exit_editing_mode_handler_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/exit_editing_mode_handler_test.dart index 119bc652ae..0d264995cc 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/exit_editing_mode_handler_test.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/exit_editing_mode_handler_test.dart @@ -45,6 +45,6 @@ Future _testSelection( EditorWidgetTester editor, Selection selection) async { await editor.updateSelection(selection); expect(editor.documentSelection, selection); - await editor.pressLogicKey(LogicalKeyboardKey.escape); + await editor.pressLogicKey(key: LogicalKeyboardKey.escape); expect(editor.documentSelection, null); } diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/format_style_handler_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/format_style_handler_test.dart index 222a7efe1b..842fcc6768 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/format_style_handler_test.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/format_style_handler_test.dart @@ -95,13 +95,13 @@ Future _testUpdateTextStyleByCommandX( await editor.updateSelection(selection); if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - key, + key: key, isShiftPressed: isShiftPressed, isControlPressed: true, ); } else { await editor.pressLogicKey( - key, + key: key, isShiftPressed: isShiftPressed, isMetaPressed: true, ); @@ -122,13 +122,13 @@ Future _testUpdateTextStyleByCommandX( await editor.updateSelection(selection); if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - key, + key: key, isShiftPressed: isShiftPressed, isControlPressed: true, ); } else { await editor.pressLogicKey( - key, + key: key, isShiftPressed: isShiftPressed, isMetaPressed: true, ); @@ -147,13 +147,13 @@ Future _testUpdateTextStyleByCommandX( await editor.updateSelection(selection); if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - key, + key: key, isShiftPressed: isShiftPressed, isControlPressed: true, ); } else { await editor.pressLogicKey( - key, + key: key, isShiftPressed: isShiftPressed, isMetaPressed: true, ); @@ -169,13 +169,13 @@ Future _testUpdateTextStyleByCommandX( await editor.updateSelection(selection); if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - key, + key: key, isShiftPressed: isShiftPressed, isControlPressed: true, ); } else { await editor.pressLogicKey( - key, + key: key, isShiftPressed: isShiftPressed, isMetaPressed: true, ); @@ -204,13 +204,13 @@ Future _testUpdateTextStyleByCommandX( if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - key, + key: key, isShiftPressed: isShiftPressed, isControlPressed: true, ); } else { await editor.pressLogicKey( - key, + key: key, isShiftPressed: isShiftPressed, isMetaPressed: true, ); @@ -250,9 +250,11 @@ Future _testLinkMenuInSingleTextSelection(WidgetTester tester) async { // trigger the link menu if (Platform.isWindows || Platform.isLinux) { - await editor.pressLogicKey(LogicalKeyboardKey.keyK, isControlPressed: true); + await editor.pressLogicKey( + key: LogicalKeyboardKey.keyK, isControlPressed: true); } else { - await editor.pressLogicKey(LogicalKeyboardKey.keyK, isMetaPressed: true); + await editor.pressLogicKey( + key: LogicalKeyboardKey.keyK, isMetaPressed: true); } expect(find.byType(LinkMenu), findsOneWidget); @@ -273,9 +275,11 @@ Future _testLinkMenuInSingleTextSelection(WidgetTester tester) async { await editor.updateSelection(selection); if (Platform.isWindows || Platform.isLinux) { - await editor.pressLogicKey(LogicalKeyboardKey.keyK, isControlPressed: true); + await editor.pressLogicKey( + key: LogicalKeyboardKey.keyK, isControlPressed: true); } else { - await editor.pressLogicKey(LogicalKeyboardKey.keyK, isMetaPressed: true); + await editor.pressLogicKey( + key: LogicalKeyboardKey.keyK, isMetaPressed: true); } expect(find.byType(LinkMenu), findsOneWidget); expect( @@ -290,9 +294,11 @@ Future _testLinkMenuInSingleTextSelection(WidgetTester tester) async { // Remove link if (Platform.isWindows || Platform.isLinux) { - await editor.pressLogicKey(LogicalKeyboardKey.keyK, isControlPressed: true); + await editor.pressLogicKey( + key: LogicalKeyboardKey.keyK, isControlPressed: true); } else { - await editor.pressLogicKey(LogicalKeyboardKey.keyK, isMetaPressed: true); + await editor.pressLogicKey( + key: LogicalKeyboardKey.keyK, isMetaPressed: true); } final removeLink = find.text('Remove link'); expect(removeLink, findsOneWidget); diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/markdown_syntax_to_styled_text_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/markdown_syntax_to_styled_text_test.dart index 219fd07568..c7bb897034 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/markdown_syntax_to_styled_text_test.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/markdown_syntax_to_styled_text_test.dart @@ -17,7 +17,7 @@ void main() async { }) async { for (var i = 0; i < repeat; i++) { await editor.pressLogicKey( - LogicalKeyboardKey.backquote, + key: LogicalKeyboardKey.backquote, ); } } @@ -99,7 +99,7 @@ void main() async { }) async { for (var i = 0; i < repeat; i++) { await editor.pressLogicKey( - LogicalKeyboardKey.backquote, + key: LogicalKeyboardKey.backquote, ); } } @@ -157,10 +157,7 @@ void main() async { int repeat = 1, }) async { for (var i = 0; i < repeat; i++) { - await editor.pressLogicKey( - LogicalKeyboardKey.tilde, - isShiftPressed: true, - ); + await editor.pressLogicKey(character: '~'); } } @@ -264,10 +261,7 @@ void main() async { int repeat = 1, }) async { for (var i = 0; i < repeat; i++) { - await editor.pressLogicKey( - LogicalKeyboardKey.digit8, - isShiftPressed: true, - ); + await editor.pressLogicKey(character: '*'); } } @@ -358,10 +352,7 @@ void main() async { int repeat = 1, }) async { for (var i = 0; i < repeat; i++) { - await editor.pressLogicKey( - LogicalKeyboardKey.underscore, - isShiftPressed: true, - ); + await editor.pressLogicKey(character: '_'); } } @@ -378,8 +369,13 @@ void main() async { await insertUnderscore(editor); - final allBold = textNode.allSatisfyBoldInSelection(Selection.single( - path: [0], startOffset: 0, endOffset: textNode.toPlainText().length)); + final allBold = textNode.allSatisfyBoldInSelection( + Selection.single( + path: [0], + startOffset: 0, + endOffset: textNode.toPlainText().length, + ), + ); expect(allBold, true); expect(textNode.toPlainText(), 'AppFlowy'); diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/page_up_down_handler_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/page_up_down_handler_test.dart index 465d198e8e..980d1ace20 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/page_up_down_handler_test.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/page_up_down_handler_test.dart @@ -38,7 +38,7 @@ void main() async { var currentOffsetY = 0.0; for (int i = 1; i <= page!; i++) { await editor.pressLogicKey( - LogicalKeyboardKey.pageDown, + key: LogicalKeyboardKey.pageDown, ); if (i == page) { currentOffsetY = scrollService.maxScrollExtent; @@ -51,7 +51,7 @@ void main() async { for (int i = 1; i <= 5; i++) { await editor.pressLogicKey( - LogicalKeyboardKey.pageDown, + key: LogicalKeyboardKey.pageDown, ); final dy = scrollService.dy; expect(dy == scrollService.maxScrollExtent, true); @@ -60,7 +60,7 @@ void main() async { // Pressing the pageUp key continuously. for (int i = page; i >= 1; i--) { await editor.pressLogicKey( - LogicalKeyboardKey.pageUp, + key: LogicalKeyboardKey.pageUp, ); if (i == 1) { currentOffsetY = scrollService.minScrollExtent; @@ -73,7 +73,7 @@ void main() async { for (int i = 1; i <= 5; i++) { await editor.pressLogicKey( - LogicalKeyboardKey.pageUp, + key: LogicalKeyboardKey.pageUp, ); final dy = scrollService.dy; expect(dy == scrollService.minScrollExtent, true); diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/redo_undo_handler_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/redo_undo_handler_test.dart index 5e4260a4a1..d2a0bcbe2d 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/redo_undo_handler_test.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/redo_undo_handler_test.dart @@ -40,17 +40,17 @@ Future _testBackspaceUndoRedo( end: isDownwardSelection ? end : start, ); await editor.updateSelection(selection); - await editor.pressLogicKey(LogicalKeyboardKey.backspace); + await editor.pressLogicKey(key: LogicalKeyboardKey.backspace); expect(editor.documentLength, 2); if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.keyZ, + key: LogicalKeyboardKey.keyZ, isControlPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.keyZ, + key: LogicalKeyboardKey.keyZ, isMetaPressed: true, ); } @@ -61,13 +61,13 @@ Future _testBackspaceUndoRedo( if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.keyZ, + key: LogicalKeyboardKey.keyZ, isControlPressed: true, isShiftPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.keyZ, + key: LogicalKeyboardKey.keyZ, isMetaPressed: true, isShiftPressed: true, ); diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/select_all_handler_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/select_all_handler_test.dart index 937988da58..25a38fd435 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/select_all_handler_test.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/select_all_handler_test.dart @@ -29,9 +29,11 @@ Future _testSelectAllHandler(WidgetTester tester, int lines) async { } await editor.startTesting(); if (Platform.isWindows || Platform.isLinux) { - await editor.pressLogicKey(LogicalKeyboardKey.keyA, isControlPressed: true); + await editor.pressLogicKey( + key: LogicalKeyboardKey.keyA, isControlPressed: true); } else { - await editor.pressLogicKey(LogicalKeyboardKey.keyA, isMetaPressed: true); + await editor.pressLogicKey( + key: LogicalKeyboardKey.keyA, isMetaPressed: true); } expect( diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/slash_handler_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/slash_handler_test.dart index fd45401acf..d998022beb 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/slash_handler_test.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/slash_handler_test.dart @@ -1,5 +1,4 @@ import 'package:appflowy_editor/appflowy_editor.dart'; -import 'package:appflowy_editor/src/render/selection_menu/selection_menu_item_widget.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; import '../../infra/test_editor.dart'; @@ -20,7 +19,7 @@ void main() async { } await editor.startTesting(); await editor.updateSelection(Selection.single(path: [1], startOffset: 0)); - await editor.pressLogicKey(LogicalKeyboardKey.slash); + await editor.pressLogicKey(key: LogicalKeyboardKey.slash); await tester.pumpAndSettle(const Duration(milliseconds: 1000)); @@ -53,7 +52,7 @@ void main() async { } await editor.startTesting(); await editor.updateSelection(Selection.single(path: [1], startOffset: 5)); - await editor.pressLogicKey(LogicalKeyboardKey.slash); + await editor.pressLogicKey(key: LogicalKeyboardKey.slash); await tester.pumpAndSettle(const Duration(milliseconds: 1000)); diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/space_on_web_handler_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/space_on_web_handler_test.dart index a49d882fa3..4e326efa74 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/space_on_web_handler_test.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/space_on_web_handler_test.dart @@ -24,7 +24,7 @@ void main() async { await editor.updateSelection( Selection.single(path: [i], startOffset: 1), ); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); expect( (editor.nodeAtPath([i]) as TextNode).toPlainText(), 'W elcome to Appflowy 😁', @@ -34,7 +34,7 @@ void main() async { await editor.updateSelection( Selection.single(path: [i], startOffset: text.length + 1), ); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); expect( (editor.nodeAtPath([i]) as TextNode).toPlainText(), 'W elcome to Appflowy 😁 ', diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/tab_handler_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/tab_handler_test.dart index 4b88960c38..5ef746a2d0 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/tab_handler_test.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/tab_handler_test.dart @@ -18,7 +18,7 @@ void main() async { var selection = Selection.single(path: [0], startOffset: 0); await editor.updateSelection(selection); - await editor.pressLogicKey(LogicalKeyboardKey.tab); + await editor.pressLogicKey(key: LogicalKeyboardKey.tab); expect( editor.documentSelection, @@ -27,7 +27,7 @@ void main() async { selection = Selection.single(path: [1], startOffset: 0); await editor.updateSelection(selection); - await editor.pressLogicKey(LogicalKeyboardKey.tab); + await editor.pressLogicKey(key: LogicalKeyboardKey.tab); expect( editor.documentSelection, @@ -61,7 +61,7 @@ void main() async { var selection = Selection.single(path: [0], startOffset: 0); await editor.updateSelection(selection); - await editor.pressLogicKey(LogicalKeyboardKey.tab); + await editor.pressLogicKey(key: LogicalKeyboardKey.tab); // nothing happens expect( @@ -82,7 +82,7 @@ void main() async { selection = Selection.single(path: [1], startOffset: 0); await editor.updateSelection(selection); - await editor.pressLogicKey(LogicalKeyboardKey.tab); + await editor.pressLogicKey(key: LogicalKeyboardKey.tab); expect( editor.documentSelection, @@ -96,7 +96,7 @@ void main() async { selection = Selection.single(path: [1], startOffset: 0); await editor.updateSelection(selection); - await editor.pressLogicKey(LogicalKeyboardKey.tab); + await editor.pressLogicKey(key: LogicalKeyboardKey.tab); expect( editor.documentSelection, @@ -121,7 +121,7 @@ void main() async { document = editor.document; selection = Selection.single(path: [0, 0], startOffset: 0); await editor.updateSelection(selection); - await editor.pressLogicKey(LogicalKeyboardKey.tab); + await editor.pressLogicKey(key: LogicalKeyboardKey.tab); expect( editor.documentSelection, @@ -131,7 +131,7 @@ void main() async { selection = Selection.single(path: [0, 1], startOffset: 0); await editor.updateSelection(selection); - await editor.pressLogicKey(LogicalKeyboardKey.tab); + await editor.pressLogicKey(key: LogicalKeyboardKey.tab); expect( editor.documentSelection, @@ -182,7 +182,7 @@ void main() async { var selection = Selection.single(path: [0], startOffset: 0); await editor.updateSelection(selection); - await editor.pressLogicKey(LogicalKeyboardKey.tab); + await editor.pressLogicKey(key: LogicalKeyboardKey.tab); // nothing happens expect( @@ -203,7 +203,7 @@ void main() async { selection = Selection.single(path: [1], startOffset: 0); await editor.updateSelection(selection); - await editor.pressLogicKey(LogicalKeyboardKey.tab); + await editor.pressLogicKey(key: LogicalKeyboardKey.tab); expect( editor.documentSelection, @@ -216,7 +216,7 @@ void main() async { selection = Selection.single(path: [1], startOffset: 0); await editor.updateSelection(selection); - await editor.pressLogicKey(LogicalKeyboardKey.tab); + await editor.pressLogicKey(key: LogicalKeyboardKey.tab); expect( editor.documentSelection, @@ -239,7 +239,7 @@ void main() async { document = editor.document; selection = Selection.single(path: [0, 0], startOffset: 0); await editor.updateSelection(selection); - await editor.pressLogicKey(LogicalKeyboardKey.tab); + await editor.pressLogicKey(key: LogicalKeyboardKey.tab); expect( editor.documentSelection, @@ -249,7 +249,7 @@ void main() async { selection = Selection.single(path: [0, 1], startOffset: 0); await editor.updateSelection(selection); - await editor.pressLogicKey(LogicalKeyboardKey.tab); + await editor.pressLogicKey(key: LogicalKeyboardKey.tab); expect( editor.documentSelection, diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/white_space_handler_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/white_space_handler_test.dart index 4349dc7a79..4418c4ed61 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/white_space_handler_test.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/internal_key_event_handlers/white_space_handler_test.dart @@ -40,7 +40,7 @@ void main() async { await editor.updateSelection( Selection.single(path: [i - 1], startOffset: i), ); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); final textNode = (editor.nodeAtPath([i - 1]) as TextNode); @@ -80,7 +80,7 @@ void main() async { await editor.updateSelection( Selection.single(path: [i - 1], startOffset: i), ); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); final textNode = (editor.nodeAtPath([i - 1]) as TextNode); @@ -114,7 +114,7 @@ void main() async { final textNode = (editor.nodeAtPath([0]) as TextNode); await editor.insertText(textNode, '#' * i, 0); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); expect(textNode.subtype, BuiltInAttributeKey.heading); // BuiltInAttributeKey.h2 ~ BuiltInAttributeKey.h6 @@ -134,7 +134,7 @@ void main() async { Selection.single(path: [0], startOffset: 0), ); await editor.insertText(textNode, symbol, 0); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); expect(textNode.subtype, BuiltInAttributeKey.checkbox); expect(textNode.attributes.check, false); } @@ -152,7 +152,7 @@ void main() async { Selection.single(path: [0], startOffset: 0), ); await editor.insertText(textNode, symbol, 0); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); expect(textNode.subtype, BuiltInAttributeKey.checkbox); expect(textNode.attributes.check, true); } @@ -169,7 +169,7 @@ void main() async { Selection.single(path: [0], startOffset: 0), ); await editor.insertText(textNode, symbol, 0); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); expect(textNode.subtype, BuiltInAttributeKey.bulletedList); } }); @@ -185,34 +185,34 @@ void main() async { ); await editor.insertText(textNode, '>', 0); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); expect(textNode.subtype, BuiltInAttributeKey.quote); await editor.insertText(textNode, '*', 0); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); expect(textNode.subtype, BuiltInAttributeKey.bulletedList); await editor.insertText(textNode, '[]', 0); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); expect(textNode.subtype, BuiltInAttributeKey.checkbox); expect(textNode.attributes.check, false); await editor.insertText(textNode, '1.', 0); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); expect(textNode.subtype, BuiltInAttributeKey.numberList); await editor.insertText(textNode, '#', 0); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); expect(textNode.subtype, BuiltInAttributeKey.heading); await editor.insertText(textNode, '[x]', 0); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); expect(textNode.subtype, BuiltInAttributeKey.checkbox); expect(textNode.attributes.check, true); const insertedText = '[]AppFlowy'; await editor.insertText(textNode, insertedText, 0); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); expect(textNode.subtype, BuiltInAttributeKey.checkbox); expect(textNode.attributes.check, true); expect(textNode.toPlainText(), insertedText); @@ -227,7 +227,7 @@ void main() async { await editor.updateSelection( Selection.single(path: [0], startOffset: text.length), ); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); expect(textNode.subtype, null); expect(textNode.toPlainText(), text); }); @@ -243,7 +243,7 @@ void main() async { final textNode = editor.nodeAtPath([0]) as TextNode; await editor.insertText(textNode, '>', 0); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); expect(textNode.subtype, BuiltInAttributeKey.quote); for (var i = 0; i < text.length; i++) { await editor.insertText(textNode, text[i], i); @@ -263,7 +263,7 @@ void main() async { for (var i = 0; i < text.length; i++) { await editor.insertText(textNode, text[i], i); } - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); final isQuote = textNode.subtype == BuiltInAttributeKey.quote; expect(isQuote, false); expect(textNode.toPlainText(), text); @@ -284,7 +284,7 @@ void main() async { Selection.single(path: [0], startOffset: 0), ); await editor.insertText(textNode, '>', 0); - await editor.pressLogicKey(LogicalKeyboardKey.space); + await editor.pressLogicKey(key: LogicalKeyboardKey.space); final isQuote = textNode.subtype == BuiltInAttributeKey.quote; expect(isQuote, true); diff --git a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/shortcut_event/shortcut_event_test.dart b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/shortcut_event/shortcut_event_test.dart index 034d91a93e..a8a827140d 100644 --- a/frontend/appflowy_flutter/packages/appflowy_editor/test/service/shortcut_event/shortcut_event_test.dart +++ b/frontend/appflowy_flutter/packages/appflowy_editor/test/service/shortcut_event/shortcut_event_test.dart @@ -41,12 +41,12 @@ void main() async { ); if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowLeft, + key: LogicalKeyboardKey.arrowLeft, isControlPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.arrowLeft, + key: LogicalKeyboardKey.arrowLeft, isMetaPressed: true, ); } @@ -69,12 +69,12 @@ void main() async { } if (Platform.isWindows || Platform.isMacOS || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowLeft, + key: LogicalKeyboardKey.arrowLeft, isAltPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.arrowLeft, + key: LogicalKeyboardKey.arrowLeft, isMetaPressed: true, ); } @@ -97,12 +97,12 @@ void main() async { ); if (Platform.isWindows || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.arrowRight, + key: LogicalKeyboardKey.arrowRight, isControlPressed: true, ); } else { await editor.pressLogicKey( - LogicalKeyboardKey.arrowRight, + key: LogicalKeyboardKey.arrowRight, isMetaPressed: true, ); } @@ -124,7 +124,7 @@ void main() async { } } await editor.pressLogicKey( - LogicalKeyboardKey.arrowRight, + key: LogicalKeyboardKey.arrowRight, isAltPressed: true, ); expect( @@ -145,7 +145,7 @@ void main() async { ); if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) { await editor.pressLogicKey( - LogicalKeyboardKey.home, + key: LogicalKeyboardKey.home, ); } @@ -168,7 +168,7 @@ void main() async { } if (Platform.isWindows || Platform.isMacOS || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.home, + key: LogicalKeyboardKey.home, ); } expect( @@ -188,7 +188,7 @@ void main() async { ); if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) { await editor.pressLogicKey( - LogicalKeyboardKey.end, + key: LogicalKeyboardKey.end, ); } @@ -211,7 +211,7 @@ void main() async { } if (Platform.isWindows || Platform.isMacOS || Platform.isLinux) { await editor.pressLogicKey( - LogicalKeyboardKey.end, + key: LogicalKeyboardKey.end, ); } expect(