diff --git a/index.html b/index.html index 1d6b45e33..67800d495 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,6 @@ - diff --git a/package-lock.json b/package-lock.json index 13164b1f6..30d72cd49 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18823,12 +18823,6 @@ "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", "dev": true }, - "requirejs": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz", - "integrity": "sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==", - "dev": true - }, "requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", diff --git a/package.json b/package.json index 117008463..80901ae8b 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,6 @@ "postcss-clean": "^1.1.0", "postcss-loader": "^3.0.0", "prettierx": "^0.11.2", - "requirejs": "2.3.6", "run-headless-chromium": "^0.1.1", "sass-loader": "^8.0.2", "sinon": "^9.0.2", diff --git a/spec/autocomplete.js b/spec/autocomplete.js index 181d5c6e4..3cb7e9ebc 100644 --- a/spec/autocomplete.js +++ b/spec/autocomplete.js @@ -1,11 +1,6 @@ -(function (root, factory) { - define([ - "jasmine", - "mock", - "test-utils" - ], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const $pres = converse.env.$pres; const $msg = converse.env.$msg; const Strophe = converse.env.Strophe; @@ -219,4 +214,4 @@ done(); })); }); -})); +}); diff --git a/spec/bookmarks.js b/spec/bookmarks.js index 4c05bcd16..20d52cedb 100644 --- a/spec/bookmarks.js +++ b/spec/bookmarks.js @@ -1,11 +1,6 @@ -(function (root, factory) { - define([ - "jasmine", - "mock", - "test-utils" - ], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const $iq = converse.env.$iq, $msg = converse.env.$msg, Strophe = converse.env.Strophe, @@ -618,4 +613,4 @@ done(); })); }); -})); +}); diff --git a/spec/chatbox.js b/spec/chatbox.js index 86ab22e64..f947ebc8d 100644 --- a/spec/chatbox.js +++ b/spec/chatbox.js @@ -1,11 +1,6 @@ -(function (root, factory) { - define([ - "jasmine", - "mock", - "test-utils" - ], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const _ = converse.env._; const $msg = converse.env.$msg; const Strophe = converse.env.Strophe; @@ -1613,4 +1608,4 @@ })); }); }); -})); +}); diff --git a/spec/controlbox.js b/spec/controlbox.js index 3c5165339..6ae4ac5e4 100644 --- a/spec/controlbox.js +++ b/spec/controlbox.js @@ -1,6 +1,6 @@ -(function (root, factory) { - define(["jasmine", "mock", "test-utils"], factory); -} (this, function (jasmine, mock, test_utils) { +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const _ = converse.env._, $msg = converse.env.$msg, u = converse.env.utils, @@ -386,4 +386,4 @@ done(); })); }); -})); +}); diff --git a/spec/converse.js b/spec/converse.js index 6cbaaf065..1407bdfc2 100644 --- a/spec/converse.js +++ b/spec/converse.js @@ -1,9 +1,6 @@ -(function (root, factory) { - define([ - "jasmine", - "mock", - "test-utils"], factory); -} (this, function (jasmine, mock, test_utils) { +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const _ = converse.env._, u = converse.env.utils; @@ -367,4 +364,4 @@ }); }); }); -})); +}); diff --git a/spec/disco.js b/spec/disco.js index 657b854e1..ea76bae59 100644 --- a/spec/disco.js +++ b/spec/disco.js @@ -1,10 +1,6 @@ -(function (root, factory) { - define([ - "jasmine", - "mock", - "test-utils"], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const Strophe = converse.env.Strophe; const $iq = converse.env.$iq; const _ = converse.env._; @@ -191,4 +187,4 @@ })); }); }); -})); +}); diff --git a/spec/emojis.js b/spec/emojis.js index f9f9eed56..6163cc7e0 100644 --- a/spec/emojis.js +++ b/spec/emojis.js @@ -1,11 +1,6 @@ -(function (root, factory) { - define([ - "jasmine", - "mock", - "test-utils" - ], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const { Promise, $msg, $pres, sizzle } = converse.env; const u = converse.env.utils; @@ -240,4 +235,4 @@ })); }); }); -})); +}); diff --git a/spec/eventemitter.js b/spec/eventemitter.js index f6b2960d2..5107cd52b 100644 --- a/spec/eventemitter.js +++ b/spec/eventemitter.js @@ -1,6 +1,5 @@ -(function (root, factory) { - define(["jasmine", "mock"], factory); -} (this, function (jasmine, mock) { +window.addEventListener('converse-loaded', () => { + const mock = window.mock; return describe("The _converse Event Emitter", function() { @@ -61,4 +60,4 @@ done(); })); }); -})); +}); diff --git a/spec/hats.js b/spec/hats.js index 819b61b94..ee3b97c35 100644 --- a/spec/hats.js +++ b/spec/hats.js @@ -1,11 +1,6 @@ -(function (root, factory) { - define([ - "jasmine", - "mock", - "test-utils" - ], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const u = converse.env.utils; describe("A XEP-0317 MUC Hat", function () { @@ -82,4 +77,4 @@ done(); })); }) -})); +}); diff --git a/spec/headline.js b/spec/headline.js index c24f96701..dc1481fa2 100644 --- a/spec/headline.js +++ b/spec/headline.js @@ -1,11 +1,6 @@ -(function (root, factory) { - define([ - "jasmine", - "mock", - "test-utils" - ], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const $msg = converse.env.$msg, _ = converse.env._, u = converse.env.utils; @@ -179,4 +174,4 @@ done(); })); }); -})); +}); diff --git a/spec/http-file-upload.js b/spec/http-file-upload.js index 06d1050af..1ad70c97a 100644 --- a/spec/http-file-upload.js +++ b/spec/http-file-upload.js @@ -1,10 +1,6 @@ -(function (root, factory) { - define([ - "jasmine", - "mock", - "test-utils"], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const Strophe = converse.env.Strophe; const $iq = converse.env.$iq; const _ = converse.env._; @@ -629,4 +625,4 @@ }); }); }); -})); +}); diff --git a/spec/login.js b/spec/login.js index 7cc47fd31..52174910d 100644 --- a/spec/login.js +++ b/spec/login.js @@ -1,7 +1,6 @@ -(function (root, factory) { - define(["jasmine", "mock", "test-utils"], factory); -} (this, function (jasmine, mock, test_utils) { - +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const u = converse.env.utils; describe("The Login Form", function () { @@ -77,4 +76,4 @@ }); })); }); -})); +}); diff --git a/spec/mam.js b/spec/mam.js index 643041972..3e5f69f70 100644 --- a/spec/mam.js +++ b/spec/mam.js @@ -1,7 +1,6 @@ -(function (root, factory) { - define(["jasmine", "mock", "test-utils"], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const Model = converse.env.Model; const Strophe = converse.env.Strophe; const $iq = converse.env.$iq; @@ -1098,4 +1097,4 @@ })); }); }); -})); +}); diff --git a/spec/messages.js b/spec/messages.js index 64f81dff8..bb4078f64 100644 --- a/spec/messages.js +++ b/spec/messages.js @@ -1,11 +1,6 @@ -(function (root, factory) { - define([ - "jasmine", - "mock", - "test-utils" - ], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const { Promise, Strophe, $msg, dayjs, sizzle, _ } = converse.env; const u = converse.env.utils; @@ -2083,4 +2078,4 @@ done(); })); }); -})); +}); diff --git a/spec/minchats.js b/spec/minchats.js index 9ba57e85a..4e05c6118 100644 --- a/spec/minchats.js +++ b/spec/minchats.js @@ -1,6 +1,6 @@ -(function (root, factory) { - define(["jasmine", "mock", "test-utils"], factory); -} (this, function (jasmine, mock, test_utils) { +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const _ = converse.env._; const $msg = converse.env.$msg; const u = converse.env.utils; @@ -164,4 +164,4 @@ done(); })); }); -})); +}); diff --git a/spec/modtools.js b/spec/modtools.js index 8ec6e2a3c..82915a0c8 100644 --- a/spec/modtools.js +++ b/spec/modtools.js @@ -1,6 +1,6 @@ -(function (root, factory) { - define(["jasmine", "mock", "test-utils" ], factory); -} (this, function (jasmine, mock, test_utils) { +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const _ = converse.env._; const $iq = converse.env.$iq; const $pres = converse.env.$pres; @@ -367,4 +367,4 @@ done(); })); }); -})); +}); diff --git a/spec/muc.js b/spec/muc.js index b32688e62..831aa35c3 100644 --- a/spec/muc.js +++ b/spec/muc.js @@ -1,6 +1,6 @@ -(function (root, factory) { - define(["jasmine", "mock", "test-utils" ], factory); -} (this, function (jasmine, mock, test_utils) { +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const _ = converse.env._, $pres = converse.env.$pres, $iq = converse.env.$iq, @@ -5311,4 +5311,4 @@ })); }); }); -})); +}); diff --git a/spec/muc_messages.js b/spec/muc_messages.js index b5b1ab4e4..645450931 100644 --- a/spec/muc_messages.js +++ b/spec/muc_messages.js @@ -1,11 +1,6 @@ -(function (root, factory) { - define([ - "jasmine", - "mock", - "test-utils" - ], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const { Promise, Strophe, $msg, $pres, sizzle, stanza_utils } = converse.env; const u = converse.env.utils; @@ -1254,4 +1249,4 @@ })); }); }); -})); +}); diff --git a/spec/notification.js b/spec/notification.js index e4fe118f3..3c4d9951d 100644 --- a/spec/notification.js +++ b/spec/notification.js @@ -1,7 +1,6 @@ -(function (root, factory) { - define(["jasmine", "mock", "test-utils"], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const _ = converse.env._; const $msg = converse.env.$msg; const u = converse.env.utils; @@ -207,4 +206,4 @@ }); }); }); -})); +}); diff --git a/spec/omemo.js b/spec/omemo.js index 8b65eb891..ff11946c7 100644 --- a/spec/omemo.js +++ b/spec/omemo.js @@ -1,10 +1,9 @@ -(function (root, factory) { - define(["jasmine", "mock", "test-utils"], factory); -} (this, function (jasmine, mock, test_utils) { +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const { $iq, $pres, $msg, _, Strophe } = converse.env; const u = converse.env.utils; - async function deviceListFetched (_converse, jid) { const selector = `iq[to="${jid}"] items[node="eu.siacs.conversations.axolotl.devicelist"]`; const stanza = await u.waitUntil( @@ -1536,4 +1535,4 @@ done(); })); }); -})); +}); diff --git a/spec/ping.js b/spec/ping.js index 8a84df432..6601caeb6 100644 --- a/spec/ping.js +++ b/spec/ping.js @@ -1,7 +1,6 @@ -(function (root, factory) { - define(["jasmine", "mock", "test-utils"], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const Strophe = converse.env.Strophe; const u = converse.env.utils; @@ -34,4 +33,4 @@ })); }); }); -})); +}); diff --git a/spec/presence.js b/spec/presence.js index 74cad97e6..fffff89fd 100644 --- a/spec/presence.js +++ b/spec/presence.js @@ -1,13 +1,6 @@ -/*jshint sub:true*/ -/*eslint dot-notation: "off"*/ -(function (root, factory) { - define([ - "jasmine", - "mock", - "test-utils", - ], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const Strophe = converse.env.Strophe; const u = converse.env.utils; // See: https://xmpp.org/rfcs/rfc3921.html @@ -294,5 +287,4 @@ done(); })); }); -})); - +}); diff --git a/spec/protocol.js b/spec/protocol.js index 43ff250b7..bfe652439 100644 --- a/spec/protocol.js +++ b/spec/protocol.js @@ -1,10 +1,6 @@ -(function (root, factory) { - define([ - "jasmine", - "mock", - "test-utils"], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const $iq = converse.env.$iq; const $pres = converse.env.$pres; const Strophe = converse.env.Strophe; @@ -540,4 +536,4 @@ })); }); }); -})); +}); diff --git a/spec/push.js b/spec/push.js index baa2b911c..ccfc37d46 100644 --- a/spec/push.js +++ b/spec/push.js @@ -1,7 +1,6 @@ -(function (root, factory) { - define(["jasmine", "mock", "test-utils"], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const $iq = converse.env.$iq; const Strophe = converse.env.Strophe; const _ = converse.env._; @@ -189,4 +188,4 @@ done(); })); }); -})); +}); diff --git a/spec/register.js b/spec/register.js index 72c0417d0..3ee5600d0 100644 --- a/spec/register.js +++ b/spec/register.js @@ -1,6 +1,6 @@ -(function (root, factory) { - define(["jasmine", "mock", "test-utils"], factory); -} (this, function (jasmine, mock, test_utils) { +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const Strophe = converse.env.Strophe; const $iq = converse.env.$iq; const { _, sizzle} = converse.env; @@ -362,4 +362,4 @@ done(); })); }); -})); +}); diff --git a/spec/retractions.js b/spec/retractions.js index 9cfbcb8f9..ccabd6d95 100644 --- a/spec/retractions.js +++ b/spec/retractions.js @@ -1,11 +1,6 @@ -(function (root, factory) { - define([ - "jasmine", - "mock", - "test-utils" - ], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const { Strophe, $iq } = converse.env; const u = converse.env.utils; @@ -1157,4 +1152,4 @@ })); }); }) -})); +}); diff --git a/spec/room_registration.js b/spec/room_registration.js index 60cb0664c..b853a8c3d 100644 --- a/spec/room_registration.js +++ b/spec/room_registration.js @@ -1,6 +1,6 @@ -(function (root, factory) { - define(["jasmine", "mock", "test-utils" ], factory); -} (this, function (jasmine, mock, test_utils) { +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const _ = converse.env._, $iq = converse.env.$iq, Strophe = converse.env.Strophe, @@ -118,4 +118,4 @@ })); }); }); -})); +}); diff --git a/spec/roomslist.js b/spec/roomslist.js index 9fc5882ab..a27f36129 100644 --- a/spec/roomslist.js +++ b/spec/roomslist.js @@ -1,6 +1,6 @@ -(function (root, factory) { - define(["jasmine", "mock", "test-utils"], factory); -} (this, function (jasmine, mock, test_utils) { +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const { Strophe, $iq, $msg, $pres, sizzle, _ } = converse.env; const u = converse.env.utils; @@ -330,4 +330,4 @@ done(); })); }); -})); +}); diff --git a/spec/roster.js b/spec/roster.js index f0e0b39aa..839a39461 100644 --- a/spec/roster.js +++ b/spec/roster.js @@ -1,6 +1,6 @@ -(function (root, factory) { - define(["jasmine", "mock", "test-utils"], factory); -} (this, function (jasmine, mock, test_utils) { +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const $iq = converse.env.$iq; const $pres = converse.env.$pres; const Strophe = converse.env.Strophe; @@ -1317,4 +1317,4 @@ })); }); }); -})); +}); diff --git a/spec/smacks.js b/spec/smacks.js index 66b501e75..737199658 100644 --- a/spec/smacks.js +++ b/spec/smacks.js @@ -1,7 +1,6 @@ -(function (root, factory) { - define(["jasmine", "mock", "test-utils"], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const $iq = converse.env.$iq; const $msg = converse.env.$msg; const Strophe = converse.env.Strophe; @@ -280,4 +279,4 @@ done(); })); }); -})); +}); diff --git a/spec/spoilers.js b/spec/spoilers.js index fe5bbf88f..36ee6d78d 100644 --- a/spec/spoilers.js +++ b/spec/spoilers.js @@ -1,6 +1,6 @@ -(function (root, factory) { - define(["jasmine", "mock", "test-utils"], factory); -} (this, function (jasmine, mock, test_utils) { +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const _ = converse.env._; const Strophe = converse.env.Strophe; const $msg = converse.env.$msg; @@ -234,4 +234,4 @@ done(); })); }); -})); +}); diff --git a/spec/user-details-modal.js b/spec/user-details-modal.js index 705a07034..552e88116 100644 --- a/spec/user-details-modal.js +++ b/spec/user-details-modal.js @@ -1,11 +1,6 @@ -(function (root, factory) { - define([ - "jasmine", - "mock", - "test-utils" - ], factory); -} (this, function (jasmine, mock, test_utils) { - "use strict"; +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const u = converse.env.utils; return describe("The User Details Modal", function () { @@ -79,4 +74,4 @@ done(); })); }); -})); +}); diff --git a/spec/utils.js b/spec/utils.js index ccc963cf4..3045a72f0 100644 --- a/spec/utils.js +++ b/spec/utils.js @@ -1,8 +1,6 @@ -(function (root, factory) { - define(["jasmine"], factory); -} (this, function () { - var utils = converse.env.utils, - _ = converse.env._; +window.addEventListener('converse-loaded', () => { + const utils = converse.env.utils; + const _ = converse.env._; return describe("Converse.js Utilities", function() { @@ -61,4 +59,4 @@ expect(context.visible_toolbar_buttons.toggle_occupants).toBeTruthy(); }); }); -})); +}); diff --git a/spec/xmppstatus.js b/spec/xmppstatus.js index 2522195f6..f2ee79438 100644 --- a/spec/xmppstatus.js +++ b/spec/xmppstatus.js @@ -1,6 +1,5 @@ -(function (root, factory) { - define(["jasmine", "mock"], factory); -} (this, function (jasmine, mock) { +window.addEventListener('converse-loaded', () => { + const mock = window.mock; const u = converse.env.utils; return describe("The XMPPStatus model", function () { @@ -21,4 +20,4 @@ done(); })); }); -})); +}); diff --git a/spec/xss.js b/spec/xss.js index ca6375d40..38bbab3d5 100644 --- a/spec/xss.js +++ b/spec/xss.js @@ -1,6 +1,6 @@ -(function (root, factory) { - define(["jasmine", "mock", "test-utils" ], factory); -} (this, function (jasmine, mock, test_utils) { +window.addEventListener('converse-loaded', () => { + const mock = window.mock; + const test_utils = window.test_utils; const $pres = converse.env.$pres; const sizzle = converse.env.sizzle; const u = converse.env.utils; @@ -241,4 +241,4 @@ })); }); }); -})); +}); diff --git a/tests.html b/tests.html index bb0b055bb..898f3b0eb 100644 --- a/tests.html +++ b/tests.html @@ -1,33 +1,140 @@ - - + +
-