Adjust test to reflect custom context menu implementation

pull/1320/head
operatorultra 2 years ago
parent f8fbdb8e33
commit 9113e84da9
  1. 27
      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);
});
});
}

Loading…
Cancel
Save