diff options
| -rw-r--r-- | test/components/SearchableAppList_test.dart | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/test/components/SearchableAppList_test.dart b/test/components/SearchableAppList_test.dart index c4f520c..25c40b4 100644 --- a/test/components/SearchableAppList_test.dart +++ b/test/components/SearchableAppList_test.dart @@ -15,21 +15,38 @@ void main() { makeApp('Twitter', 'org.example.twitter'), makeApp('Youtube', 'org.example.youtube'), ]; - var appListF = Future.value(appList); testWidgets('Should render nothing for empty list', (WidgetTester tester) async { - await tester.pumpWidget(wrapper(SearchableAppList(appListF: Future.value(<Application>[])))); + await tester.pumpWidget(wrapper(SearchableAppList(appList: <Application>[]))); await tester.pump(); expect(find.byType(AppList), findsOneWidget); expect(find.byType(ListTile), findsNothing); }); - //testWidgets('Should render nothing for a of list 4 items', (WidgetTester tester) async { - //await tester.pumpWidget(wrapper(SearchableAppList(appListF: appListF))); - //await tester.pumpAndSettle(); + testWidgets('Should render nothing for a of list 4 items', (WidgetTester tester) async { + await tester.pumpWidget(wrapper(SearchableAppList(appList: appList))); + await tester.pumpAndSettle(); - //expect(find.byType(AppList), findsOneWidget); - //expect(find.byType(ListTile), findsNWidgets(4)); - //}); + expect(find.byType(AppList), findsOneWidget); + expect(find.byType(ListTile), findsNWidgets(4)); + }); + + testWidgets('Should render matching results for the search query', (WidgetTester tester) async { + await tester.pumpWidget(wrapper(SearchableAppList(appList: appList))); + await tester.pumpAndSettle(); + + expect(find.byType(AppList), findsOneWidget); + expect(find.byType(ListTile), findsNWidgets(4)); + + var textField = find.byType(TextField); + await tester.enterText(textField, 'twi'); + await tester.pump(); + + //for(var e in find.byType(SearchableAppList).evaluate()) { + //debugPrint((e.widget as SearchableAppList)._inputController.text); + //} + + expect(find.byType(ListTile), findsNWidgets(4)); + }); } |
