Skip to content

Commit 4b1f484

Browse files
committed
content test: Test tap-link behavior when invalid URL
Thanks Zixuan for noticing we haven't been covering this: zulip#1410 (comment)
1 parent ae4586d commit 4b1f484

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/widgets/content_test.dart

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,18 @@ void main() {
872872
.single.equals((url: Uri.parse('https://a/'), mode: LaunchMode.inAppBrowserView));
873873
});
874874

875-
testWidgets('error dialog if invalid link', (tester) async {
875+
testWidgets('error dialog if invalid URL', (tester) async {
876+
await prepare(tester,
877+
'<p><a href="::invalid::">word</a></p>');
878+
await tapText(tester, find.text('word'));
879+
await tester.pump();
880+
check(testBinding.takeLaunchUrlCalls()).isEmpty();
881+
checkErrorDialog(tester,
882+
expectedTitle: 'Unable to open link',
883+
expectedMessage: 'Link could not be opened: ::invalid::');
884+
});
885+
886+
testWidgets('error dialog if platform cannot open link', (tester) async {
876887
await prepare(tester,
877888
'<p><a href="file:///etc/bad">word</a></p>');
878889
testBinding.launchUrlResult = false;

0 commit comments

Comments
 (0)