1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-10 14:58:34 +00:00

Add provider_shopper (#87)

This is the code for the sample at https://flutter.dev/docs/development/data-and-backend/state-mgmt/simple.
This commit is contained in:
Filip Hracek
2019-07-23 15:40:43 -07:00
committed by GitHub
parent 3016594e5d
commit 086a77b1b8
65 changed files with 2164 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
// Copyright 2019 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:provider_shopper/main.dart';
void main() {
testWidgets('smoke test', (tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Check that shopping cart is empty at start.
await tester.tap(find.byIcon(Icons.shopping_cart));
await tester.pumpAndSettle();
expect(find.text('\$0'), findsOneWidget);
// Buy an item.
await tester.pageBack();
await tester.pumpAndSettle();
await tester.tap(find.text('ADD').first);
// Check that the shopping cart is not empty anymore.
await tester.tap(find.byIcon(Icons.shopping_cart));
await tester.pumpAndSettle();
expect(find.text('\$0'), findsNothing);
});
}