Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
amantoux committed Dec 19, 2024
1 parent 6a44a5a commit df73bcb
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/fleather/test/widgets/editable_text_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,28 @@ void main() {
Operation.insert('\n', {'block': 'cl', 'checked': true}));
});

testWidgets('check list toggle update selection', (tester) async {
const textPreceedingCheckBox = 'some text\n';
final delta = Delta()
..insert(textPreceedingCheckBox)
..insert('an item')
..insert('\n', {'block': 'cl'});
final editor = EditorSandBox(
tester: tester, document: ParchmentDocument.fromDelta(delta));
await editor.pump();
expect(find.byType(FleatherCheckbox), findsOneWidget);
await editor.updateSelection(base: 0, extent: 0);

await tester.tap(find.byType(FleatherCheckbox));
await tester.pumpAndSettle(throttleDuration);
expect(editor.document.toDelta().last,
Operation.insert('\n', {'block': 'cl', 'checked': true}));
expect(
editor.controller.selection,
const TextSelection.collapsed(
offset: textPreceedingCheckBox.length));
});

testWidgets('bullet list', (tester) async {
final delta = Delta()
..insert('an item')
Expand Down

0 comments on commit df73bcb

Please sign in to comment.