From 9113e84da9188ad62b3f54ad9093e699d5326da4 Mon Sep 17 00:00:00 2001 From: operatorultra <105389680+operatorultra@users.noreply.github.com> Date: Fri, 21 Jul 2023 23:31:55 +0200 Subject: [PATCH] Adjust test to reflect custom context menu implementation --- test/widgets/editor_test.dart | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/test/widgets/editor_test.dart b/test/widgets/editor_test.dart index db7b9dc9..dccf85ea 100644 --- a/test/widgets/editor_test.dart +++ b/test/widgets/editor_test.dart @@ -9,6 +9,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { late QuillController controller; + var didCopy = false; setUp(() { controller = QuillController.basic(); @@ -81,7 +82,26 @@ void main() { }); Widget customBuilder(BuildContext context, RawEditorState state) { - return Container(key: const Key('customMenu')); + return AdaptiveTextSelectionToolbar( + anchors: state.contextMenuAnchors, + children: [ + Container( + height: 50, + color: Colors.white, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + IconButton( + onPressed: () { + didCopy = true; + }, + icon: const Icon(Icons.copy), + ), + ], + ), + ), + ], + ); } testWidgets('custom context menu builder', (tester) async { @@ -104,7 +124,10 @@ void main() { await tester.pumpAndSettle(); // Verify custom widget shows - expect(find.byKey(const Key('customMenu')), findsOneWidget); + expect(find.byIcon(Icons.copy), findsOneWidget); + + await tester.tap(find.byIcon(Icons.copy)); + expect(didCopy, isTrue); }); }); }