removed duplicate hide method in ios source and add jasmine test cases

This commit is contained in:
Frank Stingl 2016-10-19 11:36:20 +02:00
parent df8bcaf751
commit 20c21f39df
2 changed files with 10 additions and 25 deletions

View File

@ -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];

View File

@ -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 () {