Various improvments of the helper
parent
ebef2d2141
commit
cd368b5f8e
|
@ -52,7 +52,24 @@ var helper = {};
|
||||||
return win.$;
|
return win.$;
|
||||||
}
|
}
|
||||||
|
|
||||||
helper.newPad = function(cb){
|
helper.clearCookies = function(){
|
||||||
|
window.document.cookie = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
helper.newPad = function(){
|
||||||
|
//build opts object
|
||||||
|
var opts = {clearCookies: true}
|
||||||
|
if(typeof arguments[0] === 'function'){
|
||||||
|
opts.cb = arguments[0]
|
||||||
|
} else {
|
||||||
|
opts = _.defaults(arguments[0], opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
//clear cookies
|
||||||
|
if(opts.clearCookies){
|
||||||
|
helper.clearCookies();
|
||||||
|
}
|
||||||
|
|
||||||
var padName = "FRONTEND_TEST_" + helper.randomString(20);
|
var padName = "FRONTEND_TEST_" + helper.randomString(20);
|
||||||
$iframe = $("<iframe src='/p/" + padName + "'></iframe>");
|
$iframe = $("<iframe src='/p/" + padName + "'></iframe>");
|
||||||
|
|
||||||
|
@ -70,7 +87,12 @@ var helper = {};
|
||||||
helper.padOuter$ = getFrameJQuery(helper.padChrome$('iframe.[name="ace_outer"]'));
|
helper.padOuter$ = getFrameJQuery(helper.padChrome$('iframe.[name="ace_outer"]'));
|
||||||
helper.padInner$ = getFrameJQuery( helper.padOuter$('iframe.[name="ace_inner"]'));
|
helper.padInner$ = getFrameJQuery( helper.padOuter$('iframe.[name="ace_inner"]'));
|
||||||
|
|
||||||
cb();
|
//disable all animations, this makes tests faster and easier
|
||||||
|
helper.padChrome$.fx.off = true;
|
||||||
|
helper.padOuter$.fx.off = true;
|
||||||
|
helper.padInner$.fx.off = true;
|
||||||
|
|
||||||
|
opts.cb();
|
||||||
}).fail(function(){
|
}).fail(function(){
|
||||||
throw new Error("Pad never loaded");
|
throw new Error("Pad never loaded");
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue