This is an automated email from the ASF dual-hosted git repository.

brodybits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git


The following commit(s) were added to refs/heads/master by this push:
     new 4ac1552  style: remove extra space from Objective-C test modules (#794)
4ac1552 is described below

commit 4ac155251e78b59ea74c91f29ab0353721dba475
Author: Chris Brody <[email protected]>
AuthorDate: Tue Feb 18 20:02:33 2020 -0500

    style: remove extra space from Objective-C test modules (#794)
    
    * remove trailing whitespace from tests/CordovaLibTests/*.m
    
    * remove extra blank lines from tests/CordovaLibTests/CDVWhitelistTests.m
---
 tests/CordovaLibTests/CDVStartPageTests.m     |  2 +-
 tests/CordovaLibTests/CDVViewControllerTest.m | 12 +++----
 tests/CordovaLibTests/CDVWebViewEngineTest.m  | 48 +++++++++++++--------------
 tests/CordovaLibTests/CDVWhitelistTests.m     | 20 +++++------
 4 files changed, 40 insertions(+), 42 deletions(-)

diff --git a/tests/CordovaLibTests/CDVStartPageTests.m 
b/tests/CordovaLibTests/CDVStartPageTests.m
index 5f72d88..99d73b2 100644
--- a/tests/CordovaLibTests/CDVStartPageTests.m
+++ b/tests/CordovaLibTests/CDVStartPageTests.m
@@ -91,7 +91,7 @@
     [self waitForConditionName:@"getting href" block:^{
         NSURL* vc1URL = vc1WebViewEngine.URL;
         NSURL* vc2URL = vc2WebViewEngine.URL;
-        
+
         return
         (BOOL)(
                (vc1URL != nil && ![[vc1URL absoluteString] 
isEqualToString:@"about:blank"] && ![[vc1URL absoluteString] 
isEqualToString:@""]) &&
diff --git a/tests/CordovaLibTests/CDVViewControllerTest.m 
b/tests/CordovaLibTests/CDVViewControllerTest.m
index 9e13a88..b9276fe 100644
--- a/tests/CordovaLibTests/CDVViewControllerTest.m
+++ b/tests/CordovaLibTests/CDVViewControllerTest.m
@@ -50,10 +50,10 @@
     }else{
         // Do not specify config file ==> fallback to default config.xml
     }
-    
+
     // Trigger -viewDidLoad
     [viewController view];
-    
+
     // Assert that the proper file was actually loaded, checking the value of 
a test setting it must contain
     NSString* settingValue = [viewController.settings 
objectForKey:CDVViewControllerTestSettingKey];
     XCTAssertEqualObjects(settingValue, value);
@@ -75,18 +75,18 @@
 
 -(void)testColorFromColorString{
     CDVViewController* viewController = [self viewController];
-    
+
     // Comparison values: #FFAABB and #99FFAABB
     UIColor* referenceColor = [UIColor colorWithRed:255.0/255.0 
green:170.0/255.0 blue:187.0/255.0 alpha:1.0];
     UIColor* referenceColorAlpha = [UIColor colorWithRed:255.0/255.0 
green:170.0/255.0 blue:187.0/255.0 alpha:0.6];
-    
+
     // Valid values
     XCTAssertTrue([[viewController colorFromColorString:@"#FAB"] 
isEqual:referenceColor]);
     XCTAssertTrue([[viewController colorFromColorString:@"#FFAABB"] 
isEqual:referenceColor]);
     XCTAssertTrue([[viewController colorFromColorString:@"0xFFAABB"] 
isEqual:referenceColor]);
     XCTAssertTrue([[viewController colorFromColorString:@"#99FFAABB"] 
isEqual:referenceColorAlpha]);
     XCTAssertTrue([[viewController colorFromColorString:@"0x99FFAABB"] 
isEqual:referenceColorAlpha]);
-    
+
     // Invalid values
     XCTAssertNil([viewController colorFromColorString:nil]);
     XCTAssertNil([viewController colorFromColorString:@"black"]);
@@ -107,7 +107,7 @@
 
 -(void)testIfItLoadsAppUrlIfCurrentViewIsBlank{
     CDVViewController* viewController = [self viewController];
-    
+
     NSString* appUrl = @"about:blank";
     NSString* html = @"<html><body></body></html>";
     [viewController.webViewEngine loadHTMLString:html baseURL:[NSURL 
URLWithString:appUrl]];
diff --git a/tests/CordovaLibTests/CDVWebViewEngineTest.m 
b/tests/CordovaLibTests/CDVWebViewEngineTest.m
index e21efc4..c3334b8 100644
--- a/tests/CordovaLibTests/CDVWebViewEngineTest.m
+++ b/tests/CordovaLibTests/CDVWebViewEngineTest.m
@@ -6,9 +6,9 @@
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
- 
+
  http://www.apache.org/licenses/LICENSE-2.0
- 
+
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -51,10 +51,10 @@
 - (void)setUp {
     [super setUp];
     // Put setup code here. This method is called before the invocation of 
each test method in the class.
-    
+
     // NOTE: no app settings are set, so it will rely on default 
WKWebViewConfiguration settings
     self.plugin = [[CDVWebViewEngine alloc] initWithFrame:CGRectMake(0, 0, 
100, 100)];
-    
+
     XCTAssert([self.plugin 
conformsToProtocol:@protocol(CDVWebViewEngineProtocol)], @"Plugin does not 
conform to CDVWebViewEngineProtocol");
 }
 
@@ -68,14 +68,14 @@
     NSURLRequest* httpUrlRequest = [NSURLRequest requestWithURL:[NSURL 
URLWithString:@"http://apache.org";]];
     NSURLRequest* miscUrlRequest = [NSURLRequest requestWithURL:[NSURL 
URLWithString:@"foo://bar"]];
     id<CDVWebViewEngineProtocol> webViewEngineProtocol = self.plugin;
-    
+
     SEL wk_sel = NSSelectorFromString(@"loadFileURL:allowingReadAccessToURL:");
     if ([self.plugin.engineWebView respondsToSelector:wk_sel]) {
         XCTAssertTrue([webViewEngineProtocol canLoadRequest:fileUrlRequest]);
     } else {
         XCTAssertFalse([webViewEngineProtocol canLoadRequest:fileUrlRequest]);
     }
-    
+
     XCTAssertTrue([webViewEngineProtocol canLoadRequest:httpUrlRequest]);
     XCTAssertTrue([webViewEngineProtocol canLoadRequest:miscUrlRequest]);
 }
@@ -83,10 +83,10 @@
 - (void) testUpdateInfo {
     // Add -ObjC to Other Linker Flags to test project, to load Categories
     // Update objc test template generator as well
-    
+
     id<CDVWebViewEngineProtocol> webViewEngineProtocol = self.plugin;
     WKWebView* wkWebView = (WKWebView*)self.plugin.engineWebView;
-    
+
     NSDictionary* preferences = @{
                                [@"MinimumFontSize" lowercaseString] : @1.1, // 
default is 0.0
                                [@"AllowInlineMediaPlayback" lowercaseString] : 
@YES, // default is NO
@@ -100,16 +100,16 @@
                            kCDVWebViewEngineWebViewPreferences : preferences
                            };
     [webViewEngineProtocol updateWithInfo:info];
-    
+
     // the only preference we can set, we **can** change this during runtime
     
XCTAssertEqualWithAccuracy(wkWebView.configuration.preferences.minimumFontSize, 
1.1, 0.0001);
-    
+
     // the WKWebViewConfiguration properties, we **cannot** change outside of 
initialization
     
XCTAssertTrue(wkWebView.configuration.mediaTypesRequiringUserActionForPlayback);
     XCTAssertFalse(wkWebView.configuration.allowsInlineMediaPlayback);
     XCTAssertFalse(wkWebView.configuration.suppressesIncrementalRendering);
     XCTAssertTrue(wkWebView.configuration.mediaPlaybackAllowsAirPlay);
-    
+
     // in the test above, DisallowOverscroll is YES, so no bounce
     if ([wkWebView respondsToSelector:@selector(scrollView)]) {
         XCTAssertFalse(((UIScrollView*)[wkWebView scrollView]).bounces);
@@ -120,7 +120,7 @@
             }
         }
     }
-    
+
     XCTAssertTrue(wkWebView.scrollView.decelerationRate == 
UIScrollViewDecelerationRateFast);
 }
 
@@ -128,7 +128,7 @@
     // we need to re-set the plugin from the "setup" to take in the app 
settings we need
     self.plugin = [[CDVWebViewEngine alloc] initWithFrame:CGRectMake(0, 0, 
100, 100)];
     self.viewController = [[CDVViewController alloc] init];
-    
+
     // generate the app settings
     NSDictionary* settings = @{
                                   [@"MinimumFontSize" lowercaseString] : @1.1, 
// default is 0.0
@@ -141,24 +141,24 @@
                                   };
     // this can be set because of the Category at the top of the file
     self.viewController.settings = [settings mutableCopy];
-    
+
     // app settings are read after you register the plugin
     [self.viewController registerPlugin:self.plugin 
withClassName:NSStringFromClass([self.plugin class])];
     XCTAssert([self.plugin 
conformsToProtocol:@protocol(CDVWebViewEngineProtocol)], @"Plugin does not 
conform to CDVWebViewEngineProtocol");
-    
+
     // after registering (thus plugin initialization), we can grab the webview 
configuration
     WKWebView* wkWebView = (WKWebView*)self.plugin.engineWebView;
-    
+
     // the only preference we can set, we **can** change this during runtime
     
XCTAssertEqualWithAccuracy(wkWebView.configuration.preferences.minimumFontSize, 
1.1, 0.0001);
-    
+
     // the WKWebViewConfiguration properties, we **cannot** change outside of 
initialization
     
XCTAssertTrue(wkWebView.configuration.mediaTypesRequiringUserActionForPlayback);
     XCTAssertTrue(wkWebView.configuration.allowsInlineMediaPlayback);
     XCTAssertTrue(wkWebView.configuration.suppressesIncrementalRendering);
     // The test case below is in a separate test 
"testConfigurationWithMediaPlaybackAllowsAirPlay" (Apple bug)
     // XCTAssertFalse(wkWebView.configuration.mediaPlaybackAllowsAirPlay);
-    
+
     // in the test above, DisallowOverscroll is YES, so no bounce
     if ([wkWebView respondsToSelector:@selector(scrollView)]) {
         XCTAssertFalse(((UIScrollView*)[wkWebView scrollView]).bounces);
@@ -169,17 +169,17 @@
             }
         }
     }
-    
+
     XCTAssertTrue(wkWebView.scrollView.decelerationRate == 
UIScrollViewDecelerationRateFast);
 }
 
 - (void) testShouldReloadWebView {
     WKWebView* wkWebView = (WKWebView*)self.plugin.engineWebView;
-    
+
     NSURL* about_blank = [NSURL URLWithString:@"about:blank"];
     NSURL* real_site = [NSURL URLWithString:@"https://cordova.apache.org";];
     NSString* empty_title_document = 
@"<html><head><title></title></head></html>";
-    
+
     // about:blank should reload
     [wkWebView loadRequest:[NSURLRequest requestWithURL:about_blank]];
     XCTAssertTrue([self.plugin shouldReloadWebView]);
@@ -187,7 +187,7 @@
     // a network location should *not* reload
     [wkWebView loadRequest:[NSURLRequest requestWithURL:real_site]];
     XCTAssertFalse([self.plugin shouldReloadWebView]);
-    
+
     // document with empty title should *not* reload
     // baseURL:nil results in about:blank, so we use a dummy here
     [wkWebView loadHTMLString:empty_title_document baseURL:[NSURL 
URLWithString:@"about:"]];
@@ -197,10 +197,10 @@
     // the title is nil, should always reload
     XCTAssertTrue([self.plugin shouldReloadWebView:about_blank title:nil]);
     XCTAssertTrue([self.plugin shouldReloadWebView:real_site title:nil]);
-    
+
     // about:blank should always reload
     XCTAssertTrue([self.plugin shouldReloadWebView:about_blank title:@"some 
title"]);
-    
+
     // non about:blank with a non-nil title should **not** reload
     XCTAssertFalse([self.plugin shouldReloadWebView:real_site title:@""]);
 }
diff --git a/tests/CordovaLibTests/CDVWhitelistTests.m 
b/tests/CordovaLibTests/CDVWhitelistTests.m
index bd25418..15f5dbf 100644
--- a/tests/CordovaLibTests/CDVWhitelistTests.m
+++ b/tests/CordovaLibTests/CDVWhitelistTests.m
@@ -91,9 +91,9 @@
                              @"tel:*",
                              @"sms:*",
                              nil];
-    
+
     CDVWhitelist* whitelist = [[CDVWhitelist alloc] 
initWithArray:allowedHosts];
-    
+
     XCTAssertTrue([whitelist URLIsAllowed:[NSURL 
URLWithString:@"tel:1234567890"]]);
     XCTAssertTrue([whitelist URLIsAllowed:[NSURL 
URLWithString:@"sms:1234567890"]]);
 }
@@ -162,17 +162,17 @@
         @"192.168.1.*",
         @"192.168.2.*",
         nil];
-    
+
     CDVWhitelist* whitelist = [[CDVWhitelist alloc] 
initWithArray:allowedHosts];
 
     XCTAssertFalse([whitelist URLIsAllowed:[NSURL 
URLWithString:@"http://apache.org";]]);
-    
+
     // Ever since Cordova 3.1, whitelist wildcards are simplified, only "*" 
and "*.apache.org" (subdomain example) are allowed. Therefore the next four 
tests should fail
     XCTAssertFalse([whitelist URLIsAllowed:[NSURL 
URLWithString:@"http://192.168.1.1";]]);
     XCTAssertFalse([whitelist URLIsAllowed:[NSURL 
URLWithString:@"http://192.168.1.2";]]);
     XCTAssertFalse([whitelist URLIsAllowed:[NSURL 
URLWithString:@"http://192.168.2.1";]]);
     XCTAssertFalse([whitelist URLIsAllowed:[NSURL 
URLWithString:@"http://192.168.2.2";]]);
-    
+
     XCTAssertFalse([whitelist URLIsAllowed:[NSURL 
URLWithString:@"http://192.168.3.1";]]);
 }
 
@@ -252,7 +252,7 @@
 
     XCTAssertFalse([whitelist URLIsAllowed:[NSURL 
URLWithString:@"http://apache.org";]]);
     XCTAssertFalse([whitelist URLIsAllowed:[NSURL 
URLWithString:@"gopher://testtt.com";]]);
-    
+
     XCTAssertTrue([whitelist URLIsAllowed:[NSURL 
URLWithString:@"gopher://test.com";]]);
     XCTAssertTrue([whitelist URLIsAllowed:[NSURL 
URLWithString:@"http://test.com";]]);
     XCTAssertTrue([whitelist URLIsAllowed:[NSURL 
URLWithString:@"http://my.test.com";]]);
@@ -285,22 +285,20 @@
 {
     NSArray* allowIntents = @[ @"https://*"; ];
     NSArray* allowNavigations = @[ @"https://*.apache.org"; ];
-    
+
     CDVWhitelist* intentsWhitelist = [[CDVWhitelist alloc] 
initWithArray:allowIntents];
     CDVWhitelist* navigationsWhitelist = [[CDVWhitelist alloc] 
initWithArray:allowNavigations];
-    
+
     // Test allow-navigation superceding allow-intent
     XCTAssertEqual([CDVIntentAndNavigationFilter filterUrl:[NSURL 
URLWithString:@"https://apache.org/foo.html";] intentsWhitelist:intentsWhitelist 
navigationsWhitelist:navigationsWhitelist], 
CDVIntentAndNavigationFilterValueNavigationAllowed);
     // Test wildcard https as allow-intent
     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;
 }
 
-
 @end


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to