Auto-format Framework (#160545)
This auto-formats all *.dart files in the repository outside of the `engine` subdirectory and enforces that these files stay formatted with a presubmit check. **Reviewers:** Please carefully review all the commits except for the one titled "formatted". The "formatted" commit was auto-generated by running `dev/tools/format.sh -a -f`. The other commits were hand-crafted to prepare the repo for the formatting change. I recommend reviewing the commits one-by-one via the "Commits" tab and avoiding Github's "Files changed" tab as it will likely slow down your browser because of the size of this PR. --------- Co-authored-by: Kate Lovett <katelovett@google.com> Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
8e0993eda8
commit
5491c8c146
@@ -4,23 +4,17 @@
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_api_samples/material/tab_controller/tab_controller.1.dart'
|
||||
as example;
|
||||
import 'package:flutter_api_samples/material/tab_controller/tab_controller.1.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Verify first tab is selected by default', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.TabControllerExampleApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.TabControllerExampleApp());
|
||||
|
||||
final Tab firstTab = example.TabControllerExampleApp.tabs.first;
|
||||
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(TabBarView),
|
||||
matching: find.text('${firstTab.text} Tab'),
|
||||
),
|
||||
find.descendant(of: find.byType(TabBarView), matching: find.text('${firstTab.text} Tab')),
|
||||
findsOneWidget,
|
||||
);
|
||||
});
|
||||
@@ -33,9 +27,7 @@ void main() {
|
||||
log.add(message);
|
||||
};
|
||||
|
||||
await tester.pumpWidget(
|
||||
const example.TabControllerExampleApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.TabControllerExampleApp());
|
||||
|
||||
const List<Tab> tabs = example.TabControllerExampleApp.tabs;
|
||||
final List<Tab> tabsTraversalOrder = <Tab>[];
|
||||
@@ -47,17 +39,11 @@ void main() {
|
||||
|
||||
for (final Tab tab in tabsTraversalOrder) {
|
||||
// Tap on the TabBar's tab to select it.
|
||||
await tester.tap(find.descendant(
|
||||
of: find.byType(TabBar),
|
||||
matching: find.text(tab.text!),
|
||||
));
|
||||
await tester.tap(find.descendant(of: find.byType(TabBar), matching: find.text(tab.text!)));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(TabBarView),
|
||||
matching: find.text('${tab.text} Tab'),
|
||||
),
|
||||
find.descendant(of: find.byType(TabBarView), matching: find.text('${tab.text} Tab')),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
@@ -70,12 +56,11 @@ void main() {
|
||||
debugPrint = originalDebugPrint;
|
||||
});
|
||||
|
||||
testWidgets('DefaultTabControllerListener throws when no DefaultTabController above', (WidgetTester tester) async {
|
||||
testWidgets('DefaultTabControllerListener throws when no DefaultTabController above', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
example.DefaultTabControllerListener(
|
||||
onTabChanged: (_) {},
|
||||
child: const SizedBox.shrink(),
|
||||
),
|
||||
example.DefaultTabControllerListener(onTabChanged: (_) {}, child: const SizedBox.shrink()),
|
||||
);
|
||||
|
||||
final dynamic exception = tester.takeException();
|
||||
|
||||
Reference in New Issue
Block a user