Skip to content

Commit acb728a

Browse files
nohliadsonpleal
authored andcommitted
[url_launcher] Fix PlatformException introduced in nnbd release (flutter#3333)
1 parent 79aafe8 commit acb728a

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

packages/url_launcher/url_launcher/test/url_launcher_test.dart

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,38 @@ void main() {
191191
throwsA(isA<PlatformException>()));
192192
});
193193

194+
test('send e-mail', () async {
195+
await launch('mailto:[email protected]?subject=Hello');
196+
expect(
197+
verify(await mock.launch(
198+
any,
199+
useSafariVC: anyNamed('useSafariVC'),
200+
useWebView: anyNamed('useWebView'),
201+
enableJavaScript: anyNamed('enableJavaScript'),
202+
enableDomStorage: anyNamed('enableDomStorage'),
203+
universalLinksOnly: anyNamed('universalLinksOnly'),
204+
headers: anyNamed('headers'),
205+
)),
206+
isInstanceOf<VerificationResult>(),
207+
);
208+
});
209+
210+
test('cannot send e-mail with forceSafariVC: true', () async {
211+
expect(
212+
() async => await launch(
213+
'mailto:[email protected]?subject=Hello',
214+
forceSafariVC: true),
215+
throwsA(isA<PlatformException>()));
216+
});
217+
218+
test('cannot send e-mail with forceWebView: true', () async {
219+
expect(
220+
() async => await launch(
221+
'mailto:[email protected]?subject=Hello',
222+
forceWebView: true),
223+
throwsA(isA<PlatformException>()));
224+
});
225+
194226
test('controls system UI when changing statusBarBrightness', () async {
195227
final TestWidgetsFlutterBinding binding =
196228
TestWidgetsFlutterBinding.ensureInitialized();

0 commit comments

Comments
 (0)