|
@@ -1,5 +1,6 @@
|
|
|
import 'package:appflowy_editor/appflowy_editor.dart';
|
|
|
import 'package:appflowy_editor/src/extensions/text_node_extensions.dart';
|
|
|
+import 'package:flutter/services.dart';
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
import '../../infra/test_editor.dart';
|
|
|
|
|
@@ -67,5 +68,61 @@ void main() async {
|
|
|
expect(node.allSatisfyUnderlineInSelection(selection), true);
|
|
|
expect(node.allSatisfyStrikethroughInSelection(selection), true);
|
|
|
});
|
|
|
+
|
|
|
+ // https://github.com/AppFlowy-IO/AppFlowy/issues/1763
|
|
|
+ // [Bug] Mouse unable to click a certain area #1763
|
|
|
+ testWidgets('insert a new checkbox after an exsiting checkbox',
|
|
|
+ (tester) async {
|
|
|
+ // Before
|
|
|
+ //
|
|
|
+ // [checkbox] Welcome to Appflowy 😁
|
|
|
+ //
|
|
|
+ // After
|
|
|
+ //
|
|
|
+ // [checkbox] Welcome to Appflowy 😁
|
|
|
+ //
|
|
|
+ // [checkbox] Welcome to Appflowy 😁
|
|
|
+ //
|
|
|
+ const text = 'Welcome to Appflowy 😁';
|
|
|
+ final editor = tester.editor
|
|
|
+ ..insertTextNode(
|
|
|
+ '',
|
|
|
+ attributes: {
|
|
|
+ BuiltInAttributeKey.subtype: BuiltInAttributeKey.checkbox,
|
|
|
+ BuiltInAttributeKey.checkbox: false,
|
|
|
+ },
|
|
|
+ delta: Delta(
|
|
|
+ operations: [TextInsert(text)],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ await editor.startTesting();
|
|
|
+ await editor.updateSelection(
|
|
|
+ Selection.single(path: [0], startOffset: text.length),
|
|
|
+ );
|
|
|
+
|
|
|
+ await editor.pressLogicKey(LogicalKeyboardKey.enter);
|
|
|
+ await editor.pressLogicKey(LogicalKeyboardKey.enter);
|
|
|
+ await editor.pressLogicKey(LogicalKeyboardKey.enter);
|
|
|
+
|
|
|
+ expect(
|
|
|
+ editor.documentSelection,
|
|
|
+ Selection.single(path: [2], startOffset: 0),
|
|
|
+ );
|
|
|
+
|
|
|
+ await editor.pressLogicKey(LogicalKeyboardKey.slash);
|
|
|
+ await tester.pumpAndSettle(const Duration(milliseconds: 1000));
|
|
|
+
|
|
|
+ expect(
|
|
|
+ find.byType(SelectionMenuWidget, skipOffstage: false),
|
|
|
+ findsOneWidget,
|
|
|
+ );
|
|
|
+
|
|
|
+ final checkboxMenuItem = find.text('Checkbox', findRichText: true);
|
|
|
+ await tester.tap(checkboxMenuItem);
|
|
|
+ await tester.pumpAndSettle();
|
|
|
+
|
|
|
+ final checkboxNode = editor.nodeAtPath([2]) as TextNode;
|
|
|
+ expect(checkboxNode.subtype, BuiltInAttributeKey.checkbox);
|
|
|
+ });
|
|
|
});
|
|
|
}
|