From 01184cd1aa856323d3b7b5b83250cc2c19d21eb9 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 22 Jul 2021 13:28:17 -0400 Subject: [PATCH] tests: Remove unnecessary `includeJquery` parameter --- src/tests/frontend/helper.js | 14 ++++++-------- src/tests/frontend/helper/multipleUsers.js | 10 +++++----- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/tests/frontend/helper.js b/src/tests/frontend/helper.js index b3c8d90db..1f1cc3e71 100644 --- a/src/tests/frontend/helper.js +++ b/src/tests/frontend/helper.js @@ -15,7 +15,7 @@ const helper = {}; return randomstring; }; - const getFrameJQuery = async ($iframe, includeJquery = false, includeSendkeys = false) => { + const getFrameJQuery = async ($iframe, includeSendkeys = false) => { const win = $iframe[0].contentWindow; const doc = win.document; @@ -36,7 +36,7 @@ const helper = {}; await p; }; - if (!win.$ && includeJquery) await load('../../static/js/vendors/jquery.js'); + if (!win.$) await load('../../static/js/vendors/jquery.js'); if (!win.bililiteRange && includeSendkeys) await load('../tests/frontend/lib/sendkeys.js'); win.$.window = win; @@ -121,7 +121,7 @@ const helper = {}; // set new iframe $('#iframe-container').append($iframe); await new Promise((resolve) => $iframe.one('load', resolve)); - helper.padChrome$ = await getFrameJQuery($('#iframe-container iframe'), true, true); + helper.padChrome$ = await getFrameJQuery($('#iframe-container iframe'), true); helper.padChrome$.padeditor = helper.padChrome$.window.require('ep_etherpad-lite/static/js/pad_editor').padeditor; if (opts.clearCookies) { @@ -137,10 +137,8 @@ const helper = {}; if (opts._retry++ >= 4) throw new Error('Pad never loaded'); return await helper.aNewPad(opts); } - helper.padOuter$ = await getFrameJQuery( - helper.padChrome$('iframe[name="ace_outer"]'), true, false); - helper.padInner$ = await getFrameJQuery( - helper.padOuter$('iframe[name="ace_inner"]'), true, true); + helper.padOuter$ = await getFrameJQuery(helper.padChrome$('iframe[name="ace_outer"]'), false); + helper.padInner$ = await getFrameJQuery(helper.padOuter$('iframe[name="ace_inner"]'), true); // disable all animations, this makes tests faster and easier helper.padChrome$.fx.off = true; @@ -183,7 +181,7 @@ const helper = {}; // set new iframe $('#iframe-container').append($iframe); $iframe.one('load', async () => { - helper.admin$ = await getFrameJQuery($('#iframe-container iframe'), true, false); + helper.admin$ = await getFrameJQuery($('#iframe-container iframe'), false); }); }; diff --git a/src/tests/frontend/helper/multipleUsers.js b/src/tests/frontend/helper/multipleUsers.js index 9266bbe28..206913265 100644 --- a/src/tests/frontend/helper/multipleUsers.js +++ b/src/tests/frontend/helper/multipleUsers.js @@ -34,11 +34,11 @@ helper.multipleUsers = { }, async _loadJQueryForUser1Frame() { - this._user1.padChrome$ = await getFrameJQuery(this._user1.$frame, true, true); + this._user1.padChrome$ = await getFrameJQuery(this._user1.$frame, true); this._user1.padOuter$ = - await getFrameJQuery(this._user1.padChrome$('iframe[name="ace_outer"]'), true, false); + await getFrameJQuery(this._user1.padChrome$('iframe[name="ace_outer"]'), false); this._user1.padInner$ = - await getFrameJQuery(this._user1.padOuter$('iframe[name="ace_inner"]'), true, true); + await getFrameJQuery(this._user1.padOuter$('iframe[name="ace_inner"]'), true); // update helper vars now that they are available helper.padChrome$ = this._user1.padChrome$; @@ -80,7 +80,7 @@ helper.multipleUsers = { }; // copied from helper.js -const getFrameJQuery = async ($iframe, includeJquery = false, includeSendkeys = false) => { +const getFrameJQuery = async ($iframe, includeSendkeys = false) => { const win = $iframe[0].contentWindow; const doc = win.document; @@ -101,7 +101,7 @@ const getFrameJQuery = async ($iframe, includeJquery = false, includeSendkeys = await p; }; - if (!win.$ && includeJquery) await load('../../static/js/vendors/jquery.js'); + if (!win.$) await load('../../static/js/vendors/jquery.js'); if (!win.bililiteRange && includeSendkeys) await load('../tests/frontend/lib/sendkeys.js'); win.$.window = win;