flutter_flutter/packages/flutter/test/material/back_button_test.dart
Alexandre Ardhuin 83fce211a3 More const immutable classes (#9544)
* more widget const constructors

* prefer const constructors

* address review comments
2017-04-23 22:37:29 +02:00

36 lines
969 B
Dart

// Copyright 2016 The Chromium Authors. 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';
void main() {
testWidgets('BackButton control test', (WidgetTester tester) async {
await tester.pumpWidget(
new MaterialApp(
home: const Material(child: const Text('Home')),
routes: <String, WidgetBuilder>{
'/next': (BuildContext context) {
return const Material(
child: const Center(
child: const BackButton(),
)
);
},
}
)
);
tester.state<NavigatorState>(find.byType(Navigator)).pushNamed('/next');
await tester.pumpAndSettle();
await tester.tap(find.byType(BackButton));
await tester.pumpAndSettle();
expect(find.text('Home'), findsOneWidget);
});
}