Fix the losing of state when pushing opaque routes (#5624)
Fixes https://github.com/flutter/flutter/issues/5283 Other changes in this patch: Rename OffStage to Offstage. Fixes https://github.com/flutter/flutter/issues/5378 Add a lot of docs. Some minor punctuation and whitespace fixes.
This commit is contained in:
@@ -15,7 +15,7 @@ void main() {
|
||||
testWidgets('fails with a descriptive message', (WidgetTester tester) async {
|
||||
TestFailure failure;
|
||||
try {
|
||||
expect(find.text('foo'), findsOneWidget);
|
||||
expect(find.text('foo', skipOffstage: false), findsOneWidget);
|
||||
} catch(e) {
|
||||
failure = e;
|
||||
}
|
||||
@@ -38,7 +38,7 @@ void main() {
|
||||
|
||||
TestFailure failure;
|
||||
try {
|
||||
expect(find.text('foo'), findsNothing);
|
||||
expect(find.text('foo', skipOffstage: false), findsNothing);
|
||||
} catch(e) {
|
||||
failure = e;
|
||||
}
|
||||
@@ -50,6 +50,24 @@ void main() {
|
||||
expect(message, contains('Actual: ?:<exactly one widget with text "foo": Text("foo")>\n'));
|
||||
expect(message, contains('Which: means one was found but none were expected\n'));
|
||||
});
|
||||
|
||||
testWidgets('fails with a descriptive message when skipping', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(new Text('foo'));
|
||||
|
||||
TestFailure failure;
|
||||
try {
|
||||
expect(find.text('foo'), findsNothing);
|
||||
} catch(e) {
|
||||
failure = e;
|
||||
}
|
||||
|
||||
expect(failure, isNotNull);
|
||||
String message = failure.message;
|
||||
|
||||
expect(message, contains('Expected: no matching nodes in the widget tree\n'));
|
||||
expect(message, contains('Actual: ?:<exactly one widget with text "foo" (ignoring offstage widgets): Text("foo")>\n'));
|
||||
expect(message, contains('Which: means one was found but none were expected\n'));
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user