CupertinoTabScaffold/CupertinoTabController: Add interactive examples (#103196)
* `CupertinoTabScaffold`/`CupertinoTabController`: Add interactive examples * fix class name in the test * Kick tests
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
// Copyright 2014 The Flutter 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/cupertino.dart';
|
||||
import 'package:flutter_api_samples/cupertino/tab_scaffold/cupertino_tab_controller.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Can switch tabs using CupertinoTabController', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.TabControllerApp(),
|
||||
);
|
||||
|
||||
expect(find.text('Content of tab 0'), findsOneWidget);
|
||||
await tester.tap(find.byIcon(CupertinoIcons.star_circle_fill));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Content of tab 1'), findsOneWidget);
|
||||
|
||||
await tester.tap(find.text('Go to first tab'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Content of tab 0'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// Copyright 2014 The Flutter 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/cupertino.dart';
|
||||
import 'package:flutter_api_samples/cupertino/tab_scaffold/cupertino_tab_scaffold.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Can use CupertinoTabView as the root widget', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.TabScaffoldApp(),
|
||||
);
|
||||
|
||||
expect(find.text('Page 1 of tab 0'), findsOneWidget);
|
||||
await tester.tap(find.byIcon(CupertinoIcons.search_circle_fill));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Page 1 of tab 1'), findsOneWidget);
|
||||
|
||||
await tester.tap(find.text('Next page'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Page 2 of tab 1'), findsOneWidget);
|
||||
await tester.tap(find.text('Back'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Page 1 of tab 1'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user