style: correct dart format

pull/1979/head
n7484443j 10 months ago
parent 7f7efbddc9
commit 64fe22a3e2
  1. 3
      lib/src/widgets/others/delegate.dart
  2. 222
      test/bug_fix_test.dart

@ -324,7 +324,8 @@ class EditorTextSelectionGestureDetectorBuilder {
/// * [EditorTextSelectionGestureDetector.onDragSelectionUpdate], /// * [EditorTextSelectionGestureDetector.onDragSelectionUpdate],
/// which triggers this callback./lib/src/material/text_field.dart /// which triggers this callback./lib/src/material/text_field.dart
@protected @protected
void onDragSelectionUpdate(//DragStartDetails startDetails, void onDragSelectionUpdate(
//DragStartDetails startDetails,
DragUpdateDetails updateDetails) { DragUpdateDetails updateDetails) {
renderEditor!.extendSelection( renderEditor!.extendSelection(
updateDetails.globalPosition, updateDetails.globalPosition,

@ -8,51 +8,51 @@ void main() {
group('Bug fix', () { group('Bug fix', () {
group( group(
'1266 - QuillToolbar.basic() custom buttons do not have correct fill' '1266 - QuillToolbar.basic() custom buttons do not have correct fill'
'color set', () { 'color set', () {
testWidgets('fillColor of custom buttons and builtin buttons match', testWidgets('fillColor of custom buttons and builtin buttons match',
(tester) async { (tester) async {
const tooltip = 'custom button'; const tooltip = 'custom button';
final controller = QuillController.basic(); final controller = QuillController.basic();
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
home: Scaffold( home: Scaffold(
body: QuillSimpleToolbar( body: QuillSimpleToolbar(
configurations: QuillSimpleToolbarConfigurations( configurations: QuillSimpleToolbarConfigurations(
controller: controller, controller: controller,
showRedo: false, showRedo: false,
customButtons: const [ customButtons: const [
QuillToolbarCustomButtonOptions( QuillToolbarCustomButtonOptions(
tooltip: tooltip, tooltip: tooltip,
) )
], ],
),
),
), ),
), ),
); ),
),
final builtinFinder = find.descendant( );
of: find.byType(QuillToolbarHistoryButton),
matching: find.byType(QuillToolbarIconButton), final builtinFinder = find.descendant(
matchRoot: true, of: find.byType(QuillToolbarHistoryButton),
); matching: find.byType(QuillToolbarIconButton),
expect(builtinFinder, findsOneWidget); matchRoot: true,
// final builtinButton = );
// builtinFinder.evaluate().first.widget as QuillToolbarIconButton; expect(builtinFinder, findsOneWidget);
// final builtinButton =
final customFinder = find.descendant( // builtinFinder.evaluate().first.widget as QuillToolbarIconButton;
of: find.byType(QuillToolbar),
matching: find.byWidgetPredicate((widget) => final customFinder = find.descendant(
of: find.byType(QuillToolbar),
matching: find.byWidgetPredicate((widget) =>
widget is QuillToolbarIconButton && widget.tooltip == tooltip), widget is QuillToolbarIconButton && widget.tooltip == tooltip),
matchRoot: true); matchRoot: true);
expect(customFinder, findsOneWidget); expect(customFinder, findsOneWidget);
// final customButton = // final customButton =
// customFinder.evaluate().first.widget as QuillToolbarIconButton; // customFinder.evaluate().first.widget as QuillToolbarIconButton;
// expect(customButton.fillColor, equals(builtinButton.fillColor)); // expect(customButton.fillColor, equals(builtinButton.fillColor));
}); });
}); });
group('1189 - The provided text position is not in the current node', () { group('1189 - The provided text position is not in the current node', () {
@ -75,41 +75,41 @@ void main() {
}); });
testWidgets('Refocus editor after controller clears document', testWidgets('Refocus editor after controller clears document',
(tester) async { (tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
home: Column( home: Column(
children: [editor], children: [editor],
), ),
), ),
); );
await tester.quillEnterText(find.byType(QuillEditor), 'test\n'); await tester.quillEnterText(find.byType(QuillEditor), 'test\n');
editor.focusNode.unfocus(); editor.focusNode.unfocus();
await tester.pump(); await tester.pump();
controller.clear(); controller.clear();
editor.focusNode.requestFocus(); editor.focusNode.requestFocus();
await tester.pump(); await tester.pump();
expect(tester.takeException(), isNull); expect(tester.takeException(), isNull);
}); });
testWidgets('Refocus editor after removing block attribute', testWidgets('Refocus editor after removing block attribute',
(tester) async { (tester) async {
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
home: Column( home: Column(
children: [editor], children: [editor],
), ),
)); ));
await tester.quillEnterText(find.byType(QuillEditor), 'test\n'); await tester.quillEnterText(find.byType(QuillEditor), 'test\n');
controller.formatSelection(Attribute.ul); controller.formatSelection(Attribute.ul);
editor.focusNode.unfocus(); editor.focusNode.unfocus();
await tester.pump(); await tester.pump();
controller.formatSelection(const ListAttribute(null)); controller.formatSelection(const ListAttribute(null));
editor.focusNode.requestFocus(); editor.focusNode.requestFocus();
await tester.pump(); await tester.pump();
expect(tester.takeException(), isNull); expect(tester.takeException(), isNull);
}); });
testWidgets('Tap checkbox in unfocused editor', (tester) async { testWidgets('Tap checkbox in unfocused editor', (tester) async {
await tester.pumpWidget( await tester.pumpWidget(
@ -144,46 +144,46 @@ void main() {
for (final device in [PointerDeviceKind.mouse, PointerDeviceKind.touch]) { for (final device in [PointerDeviceKind.mouse, PointerDeviceKind.touch]) {
testWidgets( testWidgets(
'1742 - Disable context menu after selection for desktop platform $device', '1742 - Disable context menu after selection for desktop platform $device',
(tester) async { (tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
home: QuillEditor( home: QuillEditor(
focusNode: FocusNode(), focusNode: FocusNode(),
scrollController: ScrollController(), scrollController: ScrollController(),
// ignore: avoid_redundant_argument_values // ignore: avoid_redundant_argument_values
configurations: QuillEditorConfigurations( configurations: QuillEditorConfigurations(
controller: controller, controller: controller,
// ignore: avoid_redundant_argument_values // ignore: avoid_redundant_argument_values
autoFocus: true, autoFocus: true,
expands: true, expands: true,
),
),
), ),
); ),
if (device == PointerDeviceKind.mouse) { ),
expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); );
// Long press to show menu if (device == PointerDeviceKind.mouse) {
await tester.longPress(find.byType(QuillEditor), kind: device); expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing);
await tester.pumpAndSettle(); // Long press to show menu
await tester.longPress(find.byType(QuillEditor), kind: device);
// Verify custom widget not shows await tester.pumpAndSettle();
expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing);
// Verify custom widget not shows
await tester.tap(find.byType(QuillEditor), expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing);
buttons: kSecondaryButton, kind: device);
await tester.pumpAndSettle(); await tester.tap(find.byType(QuillEditor),
buttons: kSecondaryButton, kind: device);
// Verify custom widget shows await tester.pumpAndSettle();
expect(find.byType(AdaptiveTextSelectionToolbar), findsAny);
} else { // Verify custom widget shows
// Long press to show menu expect(find.byType(AdaptiveTextSelectionToolbar), findsAny);
await tester.longPress(find.byType(QuillEditor), kind: device); } else {
await tester.pumpAndSettle(); // Long press to show menu
await tester.longPress(find.byType(QuillEditor), kind: device);
// Verify custom widget shows await tester.pumpAndSettle();
expect(find.byType(AdaptiveTextSelectionToolbar), findsAny);
} // Verify custom widget shows
}); expect(find.byType(AdaptiveTextSelectionToolbar), findsAny);
}
});
} }
}); });
} }

Loading…
Cancel
Save