From df73bcb77943a4144d980dd354916b161626cbcd Mon Sep 17 00:00:00 2001 From: Alan Mantoux Date: Thu, 19 Dec 2024 11:59:45 +0100 Subject: [PATCH] Test --- .../test/widgets/editable_text_test.dart | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/fleather/test/widgets/editable_text_test.dart b/packages/fleather/test/widgets/editable_text_test.dart index 107a8755..77725b3f 100644 --- a/packages/fleather/test/widgets/editable_text_test.dart +++ b/packages/fleather/test/widgets/editable_text_test.dart @@ -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')