Github user tony-- commented on a diff in the pull request:
https://github.com/apache/cordova-ios/pull/232#discussion_r73358362
--- Diff: tests/CordovaLibTests/CDVWhitelistTests.m ---
@@ -295,6 +295,37 @@ - (void)testAllowIntentsAndNavigations
XCTAssertEqual([CDVIntentAndNavigationFilter filterUrl:[NSURL
URLWithString:@"https://google.com"] intentsWhitelist:intentsWhitelist
navigationsWhitelist:navigationsWhitelist],
CDVIntentAndNavigationFilterValueIntentAllowed);
// Test http (not allowed in either)
XCTAssertEqual([CDVIntentAndNavigationFilter filterUrl:[NSURL
URLWithString:@"http://google.com"] intentsWhitelist:intentsWhitelist
navigationsWhitelist:navigationsWhitelist],
CDVIntentAndNavigationFilterValueNoneAllowed);
+
+
+ NSURL* telUrl = [NSURL URLWithString:@"tel:5555555"];
+ NSMutableURLRequest* telRequest = [NSMutableURLRequest
requestWithURL:telUrl];
+ telRequest.mainDocumentURL = telUrl;
+
+ // mainDocumentURL and URL are the same in the NSURLRequest
+ // Only UIWebViewNavigationTypeLinkClicked and
UIWebViewNavigationTypeOther should return YES
+ XCTAssertTrue([CDVIntentAndNavigationFilter
shouldOpenURLRequest:telRequest
navigationType:UIWebViewNavigationTypeLinkClicked]);
+ XCTAssertTrue([CDVIntentAndNavigationFilter
shouldOpenURLRequest:telRequest navigationType:UIWebViewNavigationTypeOther]);
+ XCTAssertFalse([CDVIntentAndNavigationFilter
shouldOpenURLRequest:telRequest navigationType:UIWebViewNavigationTypeReload]);
+ XCTAssertFalse([CDVIntentAndNavigationFilter
shouldOpenURLRequest:telRequest
navigationType:UIWebViewNavigationTypeBackForward]);
+ XCTAssertFalse([CDVIntentAndNavigationFilter
shouldOpenURLRequest:telRequest
navigationType:UIWebViewNavigationTypeFormSubmitted]);
+ XCTAssertFalse([CDVIntentAndNavigationFilter
shouldOpenURLRequest:telRequest
navigationType:UIWebViewNavigationTypeFormResubmitted]);
+
--- End diff --
Would it make sense to test the intent-allowed case? This currently fails
- see comment in comments section.
```
// Only CDVIntentAndNavigationFilterValueIntentAllowed and
CDVIntentAndNavigationFilterValueNavigationAllowed should return YES
XCTAssertTrue([CDVIntentAndNavigationFilter
shouldOverrideLoadWithRequest:telRequest
navigationType:UIWebViewNavigationTypeOther
filterValue:CDVIntentAndNavigationFilterValueNavigationAllowed]);
XCTAssertTrue([CDVIntentAndNavigationFilter
shouldOverrideLoadWithRequest:telRequest
navigationType:UIWebViewNavigationTypeOther
filterValue:CDVIntentAndNavigationFilterValueIntentAllowed]);
XCTAssertFalse([CDVIntentAndNavigationFilter
shouldOverrideLoadWithRequest:telRequest
navigationType:UIWebViewNavigationTypeOther
filterValue:CDVIntentAndNavigationFilterValueNoneAllowed]);
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]