aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2020-06-05 22:24:32 +0530
committerAkshay Nair <phenax5@gmail.com>2020-06-05 22:24:32 +0530
commit44537a023d1083005b3ec5044364e66175a8b1fd (patch)
treeeec4c1d85e2ebca993f2c64be8920ecae090dfb5
parent85439db6695ccba5560ddca5e24e7c8144a23773 (diff)
downloaddaft-launcher-0.0.1.tar.gz
daft-launcher-0.0.1.zip
some test case changes0.0.1
-rw-r--r--test/components/SearchableAppList_test.dart33
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));
+ });
}