iosWebViewFix/example/integration_test/chrome_safari_browser/custom_menu_item.dart

31 lines
1.0 KiB
Dart
Raw Normal View History

part of 'main.dart';
2022-04-28 21:23:38 +00:00
void customMenuItem() {
2022-04-29 00:07:01 +00:00
final shouldSkip = kIsWeb
? true
2022-10-19 14:54:54 +00:00
: ![TargetPlatform.android, TargetPlatform.iOS]
.contains(defaultTargetPlatform);
2022-04-28 21:23:38 +00:00
skippableTest('add custom menu item', () async {
2022-10-08 17:07:50 +00:00
var chromeSafariBrowser = MyChromeSafariBrowser();
2022-04-28 21:23:38 +00:00
chromeSafariBrowser.addMenuItem(ChromeSafariBrowserMenuItem(
2022-10-26 15:52:35 +00:00
id: 2,
label: 'Custom item menu 1',
image: UIImage(systemName: "pencil"),
onClick: (url, title) {}));
2022-04-28 21:23:38 +00:00
expect(chromeSafariBrowser.isOpened(), false);
2022-04-29 00:07:01 +00:00
await chromeSafariBrowser.open(url: TEST_URL_1);
await chromeSafariBrowser.opened.future;
2022-04-28 21:23:38 +00:00
expect(chromeSafariBrowser.isOpened(), true);
expect(() async {
await chromeSafariBrowser.open(url: TEST_CROSS_PLATFORM_URL_1);
}, throwsAssertionError);
2022-04-28 21:23:38 +00:00
await expectLater(chromeSafariBrowser.firstPageLoaded.future, completes);
await chromeSafariBrowser.close();
await chromeSafariBrowser.closed.future;
2022-04-28 21:23:38 +00:00
expect(chromeSafariBrowser.isOpened(), false);
}, skip: shouldSkip);
}