mirror of https://github.com/flutter/pinball.git
parent
6f51e968a6
commit
7e82316824
@ -0,0 +1,27 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
|
import 'helpers.dart';
|
||||||
|
|
||||||
|
Future<void> expectNavigatesTo<Type>(WidgetTester tester, Route route) async {
|
||||||
|
// ignore: avoid_dynamic_calls
|
||||||
|
await tester.pumpApp(
|
||||||
|
Scaffold(
|
||||||
|
body: Builder(
|
||||||
|
builder: (context) {
|
||||||
|
return ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).push<void>(route);
|
||||||
|
},
|
||||||
|
child: const Text('Tap me'),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
await tester.tap(find.text('Tap me'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
expect(find.byType(Type), findsOneWidget);
|
||||||
|
}
|
Loading…
Reference in new issue