Skip to content

Commit 8818e60

Browse files
Add test for scaffold_state.show_bottom_sheet.0.dart (flutter#152731)
Contributes to flutter#130459 It adds a test for - `examples/api/lib/material/scaffold/scaffold_state.show_bottom_sheet.0.dart`
1 parent a1a3b2c commit 8818e60

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

dev/bots/check_code_samples.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ final Set<String> _knownMissingTests = <String>{
320320
'examples/api/test/material/platform_menu_bar/platform_menu_bar.0_test.dart',
321321
'examples/api/test/material/flexible_space_bar/flexible_space_bar.0_test.dart',
322322
'examples/api/test/material/selection_area/selection_area.0_test.dart',
323-
'examples/api/test/material/scaffold/scaffold_state.show_bottom_sheet.0_test.dart',
324323
'examples/api/test/material/scaffold/scaffold_messenger_state.show_material_banner.0_test.dart',
325324
'examples/api/test/material/scaffold/scaffold_messenger_state.show_snack_bar.0_test.dart',
326325
'examples/api/test/material/app_bar/sliver_app_bar.2_test.dart',
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'package:flutter/material.dart';
6+
import 'package:flutter_api_samples/material/scaffold/scaffold_state.show_bottom_sheet.0.dart' as example;
7+
import 'package:flutter_test/flutter_test.dart';
8+
9+
void main() {
10+
testWidgets('The button should show a bottom sheet when pressed', (WidgetTester tester) async {
11+
await tester.pumpWidget(
12+
const example.ShowBottomSheetExampleApp(),
13+
);
14+
15+
expect(find.widgetWithText(AppBar, 'ScaffoldState Sample'), findsOne);
16+
await tester.tap(find.widgetWithText(ElevatedButton, 'showBottomSheet'));
17+
await tester.pumpAndSettle();
18+
19+
expect(find.widgetWithText(BottomSheet, 'BottomSheet'), findsOne);
20+
21+
await tester.tap(find.widgetWithText(ElevatedButton, 'Close BottomSheet'));
22+
await tester.pumpAndSettle();
23+
24+
expect(find.widgetWithText(BottomSheet, 'BottomSheet'), findsNothing);
25+
});
26+
}

0 commit comments

Comments
 (0)