File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -332,4 +332,9 @@ class _MockNavigatorState extends NavigatorState {
332332 arguments: arguments,
333333 );
334334 }
335+
336+ @override
337+ void removeRouteBelow (Route <dynamic > anchorRoute) {
338+ return _navigator.removeRouteBelow (anchorRoute);
339+ }
335340}
Original file line number Diff line number Diff line change @@ -453,5 +453,21 @@ void main() {
453453 ),
454454 ).called (1 );
455455 });
456+
457+ testWidgets ('mocks .removeRouteBelow calls' , (tester) async {
458+ when (() => navigator.removeRouteBelow (any ())).thenAnswer ((_) {});
459+
460+ await tester.pumpTest (
461+ navigator: navigator,
462+ builder: (context) => TextButton (
463+ onPressed: () => Navigator .of (context).removeRouteBelow (testRoute),
464+ child: const Text ('Trigger' ),
465+ ),
466+ );
467+
468+ await tester.tap (find.byType (TextButton ));
469+
470+ verify (() => navigator.removeRouteBelow (testRoute)).called (1 );
471+ });
456472 });
457473}
You can’t perform that action at this time.
0 commit comments