Showing
1 changed file
with
42 additions
and
0 deletions
test/dialog_test.dart
0 → 100644
1 | +import 'package:flutter/material.dart'; | ||
2 | +import 'package:flutter_test/flutter_test.dart'; | ||
3 | +import 'package:get/get.dart'; | ||
4 | + | ||
5 | +import 'util/wrapper.dart'; | ||
6 | + | ||
7 | +void main() { | ||
8 | + testWidgets("Get.defaultDialog smoke test", (tester) async { | ||
9 | + await tester.pumpWidget( | ||
10 | + Wrapper(child: Container()), | ||
11 | + ); | ||
12 | + | ||
13 | + Get.defaultDialog( | ||
14 | + onConfirm: () => print("Ok"), | ||
15 | + middleText: "Dialog made in 3 lines of code"); | ||
16 | + | ||
17 | + await tester.pumpAndSettle(); | ||
18 | + | ||
19 | + expect(find.text("Ok"), findsOneWidget); | ||
20 | + }); | ||
21 | + | ||
22 | + testWidgets("Get.dialog smoke test", (tester) async { | ||
23 | + await tester.pumpWidget( | ||
24 | + Wrapper(child: Container()), | ||
25 | + ); | ||
26 | + | ||
27 | + Get.dialog(YourDialogWidget()); | ||
28 | + | ||
29 | + await tester.pumpAndSettle(); | ||
30 | + | ||
31 | + expect(find.byType(YourDialogWidget), findsOneWidget); | ||
32 | + }); | ||
33 | +} | ||
34 | + | ||
35 | +class YourDialogWidget extends StatelessWidget { | ||
36 | + const YourDialogWidget({Key key}) : super(key: key); | ||
37 | + | ||
38 | + @override | ||
39 | + Widget build(BuildContext context) { | ||
40 | + return Container(); | ||
41 | + } | ||
42 | +} |
-
Please register or login to post a comment