fix: on ui event reset selection type (#555)
* fix: on ui event reset selection type * test: add test
This commit is contained in:
parent
5b9b6d80f5
commit
7336274ff9
1 changed files with 26 additions and 37 deletions
|
|
@ -160,5 +160,29 @@ void main() async {
|
|||
|
||||
await editor.dispose();
|
||||
});
|
||||
|
||||
testWidgets('Block selection and then single tap', (tester) async {
|
||||
const text = 'Welcome to Appflowy 😁';
|
||||
final editor = tester.editor..addParagraph(initialText: text);
|
||||
await editor.startTesting();
|
||||
|
||||
final firstNode = editor.nodeAtPath([0]);
|
||||
final finder = find.byKey(firstNode!.key);
|
||||
|
||||
final rect = tester.getRect(finder);
|
||||
|
||||
editor.editorState.selectionType = SelectionType.block;
|
||||
|
||||
// tap at the beginning
|
||||
await tester.tapAt(rect.centerLeft);
|
||||
expect(
|
||||
editor.selection,
|
||||
Selection.single(path: [0], startOffset: 0),
|
||||
);
|
||||
|
||||
expect(editor.editorState.selectionType, SelectionType.inline);
|
||||
|
||||
await editor.dispose();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue