Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

[url_launcher] Fix PlatformException introduced in nnbd release #3333

Merged
merged 7 commits into from
Feb 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions packages/url_launcher/url_launcher/test/url_launcher_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,38 @@ void main() {
throwsA(isA<PlatformException>()));
});

test('send e-mail', () async {
await launch('mailto:[email protected]?subject=Hello');
expect(
verify(await mock.launch(
any,
useSafariVC: anyNamed('useSafariVC'),
useWebView: anyNamed('useWebView'),
enableJavaScript: anyNamed('enableJavaScript'),
enableDomStorage: anyNamed('enableDomStorage'),
universalLinksOnly: anyNamed('universalLinksOnly'),
headers: anyNamed('headers'),
)),
isInstanceOf<VerificationResult>(),
);
});

test('cannot send e-mail with forceSafariVC: true', () async {
expect(
() async => await launch(
'mailto:[email protected]?subject=Hello',
forceSafariVC: true),
throwsA(isA<PlatformException>()));
});

test('cannot send e-mail with forceWebView: true', () async {
expect(
() async => await launch(
'mailto:[email protected]?subject=Hello',
forceWebView: true),
throwsA(isA<PlatformException>()));
});

test('controls system UI when changing statusBarBrightness', () async {
final TestWidgetsFlutterBinding binding =
TestWidgetsFlutterBinding.ensureInitialized();
Expand Down