|
|
@ -85,7 +85,8 @@ class FakeUnsplash implements Unsplash {
|
|
|
|
const fabKey = Key('fab');
|
|
|
|
const fabKey = Key('fab');
|
|
|
|
|
|
|
|
|
|
|
|
class PhotoSearchModelTester extends StatelessWidget {
|
|
|
|
class PhotoSearchModelTester extends StatelessWidget {
|
|
|
|
const PhotoSearchModelTester(this.query);
|
|
|
|
const PhotoSearchModelTester({required this.query, Key? key})
|
|
|
|
|
|
|
|
: super(key: key);
|
|
|
|
final String query;
|
|
|
|
final String query;
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
@ -110,7 +111,7 @@ void main() {
|
|
|
|
final unsplashSearches = PhotoSearchModel(FakeUnsplash());
|
|
|
|
final unsplashSearches = PhotoSearchModel(FakeUnsplash());
|
|
|
|
final testWidget = ChangeNotifierProvider<PhotoSearchModel>(
|
|
|
|
final testWidget = ChangeNotifierProvider<PhotoSearchModel>(
|
|
|
|
create: (context) => unsplashSearches,
|
|
|
|
create: (context) => unsplashSearches,
|
|
|
|
child: const PhotoSearchModelTester('clouds'),
|
|
|
|
child: const PhotoSearchModelTester(query: 'clouds'),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
await tester.pumpWidget(testWidget);
|
|
|
|
await tester.pumpWidget(testWidget);
|
|
|
|
expect(unsplashSearches.entries.length, 0);
|
|
|
|
expect(unsplashSearches.entries.length, 0);
|
|
|
@ -120,7 +121,7 @@ void main() {
|
|
|
|
final unsplashSearches = PhotoSearchModel(FakeUnsplash());
|
|
|
|
final unsplashSearches = PhotoSearchModel(FakeUnsplash());
|
|
|
|
final testWidget = ChangeNotifierProvider<PhotoSearchModel>(
|
|
|
|
final testWidget = ChangeNotifierProvider<PhotoSearchModel>(
|
|
|
|
create: (context) => unsplashSearches,
|
|
|
|
create: (context) => unsplashSearches,
|
|
|
|
child: const PhotoSearchModelTester('clouds'),
|
|
|
|
child: const PhotoSearchModelTester(query: 'clouds'),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
await tester.pumpWidget(testWidget);
|
|
|
|
await tester.pumpWidget(testWidget);
|
|
|
|
await tester.tap(find.byKey(fabKey));
|
|
|
|
await tester.tap(find.byKey(fabKey));
|
|
|
|