removed duplicate hide method in ios source and add jasmine test cases
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/commit/20c21f39 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/20c21f39 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/20c21f39 Branch: refs/heads/master Commit: 20c21f39dffa1cff76ce6703e6ddb5e45f54dbd0 Parents: df8bcaf Author: Frank Stingl <stingl.fr...@inside-online.de> Authored: Wed Oct 19 11:36:20 2016 +0200 Committer: Frank Stingl <stingl.fr...@inside-online.de> Committed: Wed Oct 19 11:36:20 2016 +0200 ---------------------------------------------------------------------- src/ios/CDVInAppBrowser.m | 24 ------------------------ tests/tests.js | 11 ++++++++++- 2 files changed, 10 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/20c21f39/src/ios/CDVInAppBrowser.m ---------------------------------------------------------------------- diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index a114799..4646972 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -267,30 +267,6 @@ }); } -- (void)hide:(CDVInvokedUrlCommand*)command -{ - if (self.inAppBrowserViewController == nil) { - NSLog(@"Tried to hide IAB after it was closed."); - return; - - - } - if (_previousStatusBarStyle == -1) { - NSLog(@"Tried to hide IAB while already hidden"); - return; - } - - _previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle; - - // Run later to avoid the "took a long time" log message. - dispatch_async(dispatch_get_main_queue(), ^{ - if (self.inAppBrowserViewController != nil) { - _previousStatusBarStyle = -1; - [self.viewController dismissViewControllerAnimated:YES completion:nil]; - } - }); -} - - (void)openInCordovaWebView:(NSURL*)url withOptions:(NSString*)options { NSURLRequest* request = [NSURLRequest requestWithURL:url]; http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/20c21f39/tests/tests.js ---------------------------------------------------------------------- diff --git a/tests/tests.js b/tests/tests.js index a5645aa..de0c090 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -98,6 +98,7 @@ exports.defineAutoTests = function () { expect(iabInstance.removeEventListener).toEqual(jasmine.any(Function)); expect(iabInstance.close).toEqual(jasmine.any(Function)); expect(iabInstance.show).toEqual(jasmine.any(Function)); + expect(iabInstance.hide).toEqual(jasmine.any(Function)); expect(iabInstance.executeScript).toEqual(jasmine.any(Function)); expect(iabInstance.insertCSS).toEqual(jasmine.any(Function)); }); @@ -421,7 +422,9 @@ exports.defineManualTests = function (contentEl, createActionButton) { '<p/> <div id="closeHidden"></div>' + 'Expected result: no output. But click on "show hidden" again and nothing should be shown.' + '<p/> <div id="openHiddenShow"></div>' + - 'Expected result: open successfully in InAppBrowser to https://www.google.co.uk'; + 'Expected result: open successfully in InAppBrowser to https://www.google.co.uk' + + '<p/> <div id="openVisibleAndHide"></div>' + + 'Expected result: open successfully in InAppBrowser to https://www.google.co.uk. Hide after 2 seconds'; var clearing_cache_tests = '<h1>Clearing Cache</h1>' + '<div id="openClearCache"></div>' + @@ -620,6 +623,12 @@ exports.defineManualTests = function (contentEl, createActionButton) { createActionButton('google.co.uk Not Hidden', function () { openHidden('https://www.google.co.uk', false); }, 'openHiddenShow'); + createActionButton('google.co.uk shown for 2 seconds than hidden', function () { + var iab = doOpen('https://www.google.co.uk/', 'random_sting'); + setTimeout(function () { + iab.hide(); + }, 2000); + }, 'openVisibleAndHide'); //Clearing cache createActionButton('Clear Browser Cache', function () { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org