From cd368b5f8eed0813f904cf8b070126853e1cea68 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Sat, 3 Nov 2012 23:48:10 +0000 Subject: [PATCH] Various improvments of the helper --- tests/frontend/helper.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/tests/frontend/helper.js b/tests/frontend/helper.js index 57a1b0d52..ee57c8690 100644 --- a/tests/frontend/helper.js +++ b/tests/frontend/helper.js @@ -52,7 +52,24 @@ var helper = {}; 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); $iframe = $(""); @@ -69,8 +86,13 @@ var helper = {}; helper.padChrome$ = getFrameJQuery( $('#iframe-container iframe')); helper.padOuter$ = getFrameJQuery(helper.padChrome$('iframe.[name="ace_outer"]')); helper.padInner$ = getFrameJQuery( helper.padOuter$('iframe.[name="ace_inner"]')); + + //disable all animations, this makes tests faster and easier + helper.padChrome$.fx.off = true; + helper.padOuter$.fx.off = true; + helper.padInner$.fx.off = true; - cb(); + opts.cb(); }).fail(function(){ throw new Error("Pad never loaded"); });