CupertinoActionSheet: Update sample (#98356)

This commit is contained in:
Taha Tesser
2022-02-15 02:10:08 +02:00
committed by GitHub
parent 4d9e6d9b3e
commit 7d21dbf5e0
3 changed files with 111 additions and 45 deletions

View File

@@ -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/dialog/cupertino_action_sheet.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Perform an action on CupertinoActionSheet', (WidgetTester tester) async {
const String actionText = 'Destructive Action';
await tester.pumpWidget(
const example.MyApp(),
);
// Launch the CupertinoActionSheet.
await tester.tap(find.byType(CupertinoButton));
await tester.pump();
await tester.pumpAndSettle();
expect(find.text(actionText), findsOneWidget);
// Tap on an action to close the CupertinoActionSheet.
await tester.tap(find.text(actionText));
await tester.pumpAndSettle();
expect(find.text(actionText), findsNothing);
});
}