Skip to content

Commit

Permalink
[url_launcher] Fix PlatformException introduced in nnbd release (flut…
Browse files Browse the repository at this point in the history
  • Loading branch information
nohli authored and adsonpleal committed Feb 26, 2021
1 parent 79aafe8 commit acb728a
Showing 1 changed file with 32 additions and 0 deletions.
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:gmail-noreply@google.com?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:gmail-noreply@google.com?subject=Hello',
forceSafariVC: true),
throwsA(isA<PlatformException>()));
});

test('cannot send e-mail with forceWebView: true', () async {
expect(
() async => await launch(
'mailto:gmail-noreply@google.com?subject=Hello',
forceWebView: true),
throwsA(isA<PlatformException>()));
});

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

0 comments on commit acb728a

Please sign in to comment.