Remove need to pass in spies to initConverse

They aren't used anymore.
This commit is contained in:
JC Brand 2019-10-11 16:38:01 +02:00
parent 9d77a4ef97
commit 877e07775a
31 changed files with 358 additions and 407 deletions

View File

@ -13,7 +13,7 @@
it("shows all autocompletion options when the user presses @",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'tom');
@ -55,7 +55,7 @@
it("autocompletes when the user presses tab",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
@ -166,7 +166,7 @@
it("autocompletes when the user presses backspace",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');

View File

@ -16,7 +16,7 @@
describe("A chat room", function () {
it("can be bookmarked", mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
@ -142,7 +142,7 @@
it("will be automatically opened if 'autojoin' is set on the bookmark", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
@ -186,7 +186,7 @@
describe("when bookmarked", function () {
it("will use the nickname from the bookmark", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
@ -211,7 +211,7 @@
}));
it("displays that it's bookmarked through its bookmark icon", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.waitUntilDiscoConfirmed(
@ -239,7 +239,7 @@
}));
it("can be unbookmarked", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
let sent_stanza, IQ_id;
@ -317,7 +317,7 @@
describe("and when autojoin is set", function () {
it("will be be opened and joined automatically upon login", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilBookmarksReturned(_converse);
@ -346,7 +346,7 @@
describe("Bookmarks", function () {
it("can be pushed from the XMPP server", mock.initConverse(
['send'], ['rosterGroupsFetched', 'connected'], {},
['rosterGroupsFetched', 'connected'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
@ -404,7 +404,7 @@
it("can be retrieved from the XMPP server", mock.initConverse(
null, ['chatBoxesFetched', 'roomsPanelRendered', 'rosterGroupsFetched'], {},
['chatBoxesFetched', 'roomsPanelRendered', 'rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
@ -482,7 +482,7 @@
describe("The rooms panel", function () {
it("shows a list of bookmarks", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
@ -558,7 +558,7 @@
it("remembers the toggle state of the bookmarks list", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.openControlBox();
@ -614,7 +614,7 @@
describe("When hide_open_bookmarks is true and a bookmarked room is opened", function () {
it("can be closed", mock.initConverse(
null, ['rosterGroupsFetched'],
['rosterGroupsFetched'],
{ hide_open_bookmarks: true },
async function (done, _converse) {

View File

@ -16,10 +16,7 @@
describe("A Chatbox", function () {
it("has a /help command to show the available commands",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
it("has a /help command to show the available commands", mock.initConverse(['rosterGroupsFetched', 'chatBoxesFetched'], {}, async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
test_utils.openControlBox();
@ -48,11 +45,7 @@
}));
it("supports the /me command",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
async function (done, _converse) {
it("supports the /me command", mock.initConverse(['rosterGroupsFetched'], {}, async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
await test_utils.waitUntilDiscoConfirmed(_converse, 'montague.lit', [], ['vcard-temp']);
await u.waitUntil(() => _converse.xmppstatus.vcard.get('fullname'));
@ -98,7 +91,7 @@
}));
it("is created when you click on a roster item", mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -128,7 +121,7 @@
}));
it("opens when a new message is received", mock.initConverse(
null, ['rosterGroupsFetched'], {'allow_non_roster_messaging': true},
['rosterGroupsFetched'], {'allow_non_roster_messaging': true},
async function (done, _converse) {
_converse.api.trigger('rosterContactsFetched');
@ -149,7 +142,7 @@
}));
it("doesn't open when a message without body is received", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -168,7 +161,7 @@
}));
it("can be trimmed to conserve space",
mock.initConverse(null, ['rosterGroupsFetched', 'emojisInitialized'], {},
mock.initConverse(['rosterGroupsFetched', 'emojisInitialized'], {},
async function (done, _converse) {
spyOn(_converse.chatboxviews, 'trimChats');
@ -225,7 +218,7 @@
it("can be opened in minimized mode initially",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -243,7 +236,7 @@
it("is focused if its already open and you click on its corresponding roster item",
mock.initConverse(null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
mock.initConverse(['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -269,7 +262,7 @@
it("can be saved to, and retrieved from, browserStorage",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
spyOn(_converse.ChatBoxViews.prototype, 'trimChats');
@ -305,7 +298,7 @@
it("can be closed by clicking a DOM element with class 'close-chatbox-button'",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -340,7 +333,7 @@
it("can be minimized by clicking a DOM element with class 'toggle-chatbox-button'",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -379,7 +372,7 @@
it("will be removed from browserStorage when closed",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
spyOn(_converse.ChatBoxViews.prototype, 'trimChats');
@ -420,7 +413,7 @@
it("can be found on each chat box",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 3);
@ -439,7 +432,7 @@
it("shows the remaining character count if a message_limit is configured",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'message_limit': 200},
['rosterGroupsFetched', 'chatBoxesFetched'], {'message_limit': 200},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 3);
@ -479,7 +472,7 @@
it("does not show a remaining character count if message_limit is zero",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'message_limit': 0},
['rosterGroupsFetched', 'chatBoxesFetched'], {'message_limit': 0},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 3);
@ -495,7 +488,7 @@
it("can contain a button for starting a call",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -530,7 +523,7 @@
it("is ignored when it's a carbon copy of one of my own",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -562,7 +555,7 @@
it("does not open a new chatbox",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -587,7 +580,7 @@
it("is sent when the user opens a chat box",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -609,7 +602,7 @@
}));
it("is sent when the user maximizes a minimized a chat box", mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -643,7 +636,7 @@
it("is sent as soon as the user starts typing a message which is not a command",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -682,7 +675,7 @@
it("is NOT sent out if send_chat_state_notifications doesn't allow it",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'send_chat_state_notifications': []},
['rosterGroupsFetched', 'chatBoxesFetched'], {'send_chat_state_notifications': []},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -706,7 +699,7 @@
it("will be shown if received",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -751,7 +744,7 @@
it("can be a composing carbon message that this user sent from a different client",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, 'montague.lit', [], ['vcard-temp']);
@ -796,7 +789,7 @@
it("is sent if the user has stopped typing since 30 seconds",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -850,7 +843,7 @@
it("will be shown if received",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -878,7 +871,7 @@
it("can be a paused carbon message that this user sent from a different client",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, 'montague.lit', [], ['vcard-temp']);
@ -923,7 +916,7 @@
it("is sent if the user has stopped typing since 2 minutes",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
const sent_stanzas = _converse.connection.sent_stanzas;
@ -986,7 +979,7 @@
it("is sent when the user a minimizes a chat box",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -1007,7 +1000,7 @@
it("is sent if the user closes a chat box",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -1031,7 +1024,7 @@
it("will clear any other chat status notifications",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -1073,7 +1066,7 @@
it("will be shown if received",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 3);
@ -1104,7 +1097,7 @@
it("'/clear' can be used to clear messages in a conversation",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -1146,7 +1139,7 @@
it("is incremented when the message is received and the window is not focused",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
@ -1185,7 +1178,7 @@
it("is cleared when the window is focused",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -1200,7 +1193,7 @@
it("is not incremented when the message is received and the window is focused",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -1226,7 +1219,7 @@
it("is incremented from zero when chatbox was closed after viewing previously received messages and the window is not focused now",
mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -1276,7 +1269,7 @@
it("is incremented when the message is received and ChatBoxView is scrolled up",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -1293,7 +1286,7 @@
it("is not incremented when the message is received and ChatBoxView is scrolled down",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -1309,7 +1302,7 @@
}));
it("is incremeted when message is received, chatbox is scrolled down and the window is not focused",
mock.initConverse(null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
mock.initConverse(['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -1329,7 +1322,7 @@
it("is incremeted when message is received, chatbox is scrolled up and the window is not focused",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -1347,7 +1340,7 @@
it("is cleared when ChatBoxView was scrolled down and the window become focused",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -1366,7 +1359,7 @@
it("is not cleared when ChatBoxView was scrolled up and the windows become focused",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -1389,7 +1382,7 @@
it("is updated when message is received and chatbox is scrolled up",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -1415,7 +1408,7 @@
it("is updated when message is received and chatbox is minimized",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -1445,7 +1438,7 @@
it("is cleared when chatbox is maximzied after receiving messages in minimized mode",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -1471,7 +1464,7 @@
it("is cleared when unread messages are viewed which were received in scrolled-up chatbox",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
test_utils.openControlBox();
@ -1496,7 +1489,7 @@
it("is not cleared after user clicks on roster view when chatbox is already opened and scrolled up",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -1523,7 +1516,7 @@
it("is displayed when scrolled up chatbox is minimized after receiving unread messages",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -1551,7 +1544,7 @@
it("is incremented when message is received and windows is not focused",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -1576,7 +1569,7 @@
it("will render Openstreetmap-URL from geo-URI",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);

View File

@ -12,7 +12,7 @@
it("can be opened by clicking a DOM element with class 'toggle-controlbox'",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
function (done, _converse) {
// This spec will only pass if the controlbox is not currently
@ -38,7 +38,7 @@
it("can be used to add contact and it checks for case-sensivity",
mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'emojisInitialized'], {},
async function (done, _converse) {
spyOn(_converse.api, "trigger").and.callThrough();
@ -66,7 +66,7 @@
it("shows the number of unread mentions received",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'all').openControlBox();
@ -116,7 +116,7 @@
it("shows the user's chat status, which is online by default",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
function (done, _converse) {
test_utils.openControlBox();
@ -128,7 +128,7 @@
it("can be used to set the current user's chat status",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.openControlBox();
@ -157,7 +157,7 @@
it("can be used to set a custom status message",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.openControlBox();
@ -191,7 +191,7 @@
it("opens up an add modal when you click on it",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'all').openControlBox();
@ -226,7 +226,7 @@
it("can be configured to not provide search suggestions",
mock.initConverse(
null, ['rosterGroupsFetched'], {'autocomplete_add_contact': false},
['rosterGroupsFetched'], {'autocomplete_add_contact': false},
async function (done, _converse) {
test_utils.openControlBox();
@ -257,7 +257,7 @@
it("integrates with xhr_user_search_url to search for contacts",
mock.initConverse(
null, ['rosterGroupsFetched'],
['rosterGroupsFetched'],
{ 'xhr_user_search_url': 'http://example.org/?' },
async function (done, _converse) {
@ -314,7 +314,7 @@
it("can be configured to not provide search suggestions for XHR search results",
mock.initConverse(
null, ['rosterGroupsFetched'],
['rosterGroupsFetched'],
{ 'autocomplete_add_contact': false,
'xhr_user_search_url': 'http://example.org/?' },
async function (done, _converse) {

View File

@ -30,7 +30,7 @@
describe("A chat state indication", function () {
it("are sent out when the client becomes or stops being idle",
mock.initConverse(null, ['discoInitialized'], {}, (done, _converse) => {
mock.initConverse(['discoInitialized'], {}, (done, _converse) => {
spyOn(_converse, 'sendCSI').and.callThrough();
let sent_stanza;
@ -215,7 +215,7 @@
it("has a method 'get' which returns wrapped contacts",
mock.initConverse(
null, ['emojisInitialized'], {},
['emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -253,7 +253,7 @@
describe("The \"chats\" API", function() {
it("has a method 'get' which returns the promise that resolves to a chat model", mock.initConverse(
null, ['rosterInitialized', 'chatBoxesInitialized'], {},
['rosterInitialized', 'chatBoxesInitialized'], {},
async (done, _converse) => {
test_utils.openControlBox();
@ -289,7 +289,7 @@
}));
it("has a method 'open' which opens and returns a promise that resolves to a chat model", mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesInitialized'], {},
['rosterGroupsFetched', 'chatBoxesInitialized'], {},
async (done, _converse) => {
test_utils.openControlBox();
@ -321,9 +321,8 @@
});
describe("The \"settings\" API", function() {
it("has methods 'get' and 'set' to set configuration settings", mock.initConverse(
null, null, {'play_sounds': true},
(done, _converse) => {
it("has methods 'get' and 'set' to set configuration settings",
mock.initConverse(null, {'play_sounds': true}, (done, _converse) => {
expect(_.keys(_converse.api.settings)).toEqual(["update", "get", "set"]);
expect(_converse.api.settings.get("play_sounds")).toBe(true);

View File

@ -16,7 +16,7 @@
it("stores the features it receives",
mock.initConverse(
null, ['discoInitialized'], {},
['discoInitialized'], {},
async function (done, _converse) {
const IQ_stanzas = _converse.connection.IQ_stanzas;
@ -179,7 +179,7 @@
describe("Whenever converse.js discovers a new server feature", function () {
it("emits the serviceDiscovered event",
mock.initConverse(
null, ['discoInitialized'], {},
['discoInitialized'], {},
function (done, _converse) {
sinon.spy(_converse.api, "trigger");

View File

@ -14,7 +14,7 @@
it("can be opened by clicking a button in the chat toolbar",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -41,7 +41,7 @@
it("is opened to autocomplete emojis in the textarea",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
@ -109,7 +109,7 @@
it("allows you to search for particular emojis",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
@ -161,7 +161,7 @@
describe("A Chat Message", function () {
it("will display larger if it's only emojis",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {'use_system_emojis': true},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {'use_system_emojis': true},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');

View File

@ -40,7 +40,7 @@
}));
it("will open and display headline messages", mock.initConverse(
null, ['rosterGroupsFetched'], {}, function (done, _converse) {
['rosterGroupsFetched'], {}, function (done, _converse) {
/* <message from='notify.example.com'
* to='romeo@im.example.com'

View File

@ -172,7 +172,7 @@
it("does not appear in private chats",
mock.initConverse(
null, ['emojisInitialized'], {},
['emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 3);
@ -191,7 +191,7 @@
}));
it("does not appear in MUC chats", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async (done, _converse) => {
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
@ -233,7 +233,7 @@
}));
it("appears in MUC chats", mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async (done, _converse) => {
await test_utils.waitUntilDiscoConfirmed(
@ -464,7 +464,7 @@
it("shows an error message if the file is too large",
mock.initConverse(
null, ['emojisInitialized'], {},
['emojisInitialized'], {},
async function (done, _converse) {
const IQ_stanzas = _converse.connection.IQ_stanzas;
@ -587,7 +587,7 @@
describe("While a file is being uploaded", function () {
it("shows a progress bar", mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(

View File

@ -8,7 +8,7 @@
it("contains a checkbox to indicate whether the computer is trusted or not",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ auto_login: false,
allow_registration: false },
async function (done, _converse) {
@ -42,7 +42,7 @@
it("checkbox can be set to false by default",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ auto_login: false,
trusted: false,
allow_registration: false },

View File

@ -17,9 +17,7 @@
describe("The XEP-0313 Archive", function () {
it("is queried when the user enters a new MUC",
mock.initConverse(
null, ['discoInitialized'], {'archived_messages_page_size': 2},
async function (done, _converse) {
mock.initConverse(['discoInitialized'], {'archived_messages_page_size': 2}, async function (done, _converse) {
spyOn(_converse.ChatBox.prototype, 'fetchArchivedMessages').and.callThrough();
const sent_IQs = _converse.connection.IQ_stanzas;
@ -211,7 +209,7 @@
it("is discarded if it doesn't come from the right sender",
mock.initConverse(
null, ['discoInitialized'], {},
['discoInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -267,7 +265,7 @@
it("updates the is_archived value of an already cached version",
mock.initConverse(
null, ['discoInitialized'], {},
['discoInitialized'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'trek-radio@conference.lightwitch.org', 'romeo');
@ -315,7 +313,7 @@
it("isn't shown as duplicate by comparing its stanza id or archive id",
mock.initConverse(
null, ['discoInitialized'], {},
['discoInitialized'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'trek-radio@conference.lightwitch.org', 'jcbrand');
@ -354,7 +352,7 @@
it("isn't shown as duplicate by comparing only the archive id",
mock.initConverse(
null, ['discoInitialized'], {},
['discoInitialized'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'discuss@conference.conversejs.org', 'romeo');
@ -407,9 +405,7 @@
describe("The archive.query API", function () {
it("can be used to query for all archived messages",
mock.initConverse(
null, ['discoInitialized'], {},
async function (done, _converse) {
mock.initConverse(['discoInitialized'], {}, async function (done, _converse) {
const sendIQ = _converse.connection.sendIQ;
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
@ -427,9 +423,7 @@
}));
it("can be used to query for all messages to/from a particular JID",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
let sent_stanza, IQ_id;
@ -458,9 +452,7 @@
}));
it("can be used to query for archived messages from a chat room",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
const room_jid = 'coven@chat.shakespeare.lit';
_converse.api.archive.query({'with': room_jid, 'groupchat': true});
@ -485,9 +477,7 @@
}));
it("checks whether returned MAM messages from a MUC room are from the right JID",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
const room_jid = 'coven@chat.shakespeare.lit';
const promise = _converse.api.archive.query({'with': room_jid, 'groupchat': true, 'max':'10'});
@ -556,9 +546,7 @@
}));
it("can be used to query for all messages in a certain timespan",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
let sent_stanza, IQ_id;
@ -596,9 +584,7 @@
}));
it("throws a TypeError if an invalid date is provided",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
try {
@ -610,9 +596,7 @@
}));
it("can be used to query for all messages after a certain time",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
let sent_stanza, IQ_id;
@ -646,9 +630,7 @@
}));
it("can be used to query for a limited set of results",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
let sent_stanza, IQ_id;
@ -682,9 +664,7 @@
}));
it("can be used to page through results",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
let sent_stanza, IQ_id;
@ -722,9 +702,7 @@
}));
it("accepts \"before\" with an empty string as value to reverse the order",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
let sent_stanza, IQ_id;
@ -754,9 +732,7 @@
}));
it("accepts a _converse.RSM object for the query options",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
let sent_stanza, IQ_id;
@ -798,9 +774,7 @@
}));
it("returns an object which includes the messages and a _converse.RSM object",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, null, [Strophe.NS.MAM]);
let sent_stanza, IQ_id;
@ -886,9 +860,7 @@
describe("The default preference", function () {
it("is set once server support for MAM has been confirmed",
mock.initConverse(
null, [], {},
async function (done, _converse) {
mock.initConverse([], {}, async function (done, _converse) {
const entity = await _converse.api.disco.entities.get(_converse.domain);
let sent_stanza, IQ_id;
@ -969,9 +941,7 @@
describe("A Chatbox", function () {
it("will fetch archived messages once it's opened",
mock.initConverse(
null, ['discoInitialized'], {},
async function (done, _converse) {
mock.initConverse(['discoInitialized'], {}, async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
const contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@montague.lit';
@ -1031,9 +1001,7 @@
}));
it("will show an error message if the MAM query times out",
mock.initConverse(
null, ['discoInitialized'], {},
async function (done, _converse) {
mock.initConverse(['discoInitialized'], {}, async function (done, _converse) {
const sendIQ = _converse.connection.sendIQ;

View File

@ -14,7 +14,7 @@
it("is rejected if it's an unencapsulated forwarded message",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 2);
@ -57,7 +57,7 @@
it("can be sent as a correction by clicking the pencil icon",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -185,7 +185,7 @@
it("can be sent as a correction by using the up arrow",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -344,7 +344,7 @@
it("can be received out of order, and will still be displayed in the right order",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -510,7 +510,7 @@
it("is ignored if it's a malformed headline message",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -546,7 +546,7 @@
it("can be a carbon message, as defined in XEP-0280",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const include_nick = false;
@ -598,7 +598,7 @@
it("can be a carbon message that this user sent from a different client, as defined in XEP-0280",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, 'montague.lit', [], ['vcard-temp']);
@ -644,7 +644,7 @@
it("will be discarded if it's a malicious message meant to look like a carbon copy",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -690,7 +690,7 @@
it("received for a minimized chat box will increment a counter on its header",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
if (_converse.view_mode === 'fullscreen') {
@ -752,7 +752,7 @@
it("will indicate when it has a time difference of more than a day between it and its predecessor",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const include_nick = false;
@ -845,7 +845,7 @@
it("is sanitized to prevent Javascript injection attacks",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -865,7 +865,7 @@
it("can contain hyperlinks, which will be clickable",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -887,7 +887,7 @@
it("will have properly escaped URLs",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -947,7 +947,7 @@
it("will render newlines",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -986,7 +986,7 @@
it("will render images from their URLs",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -1034,7 +1034,7 @@
it("will render the message time as configured",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -1060,7 +1060,7 @@
it("will be correctly identified and rendered as a followup message",
mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -1224,7 +1224,7 @@
it("received may emit a message delivery receipt",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -1251,7 +1251,7 @@
it("carbon received does not emit a message delivery receipt",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
const sender_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@montague.lit';
@ -1283,7 +1283,7 @@
it("can have its delivery acknowledged by a receipt",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -1340,7 +1340,7 @@
it("will appear inside the chatbox it was sent from",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -1362,7 +1362,7 @@
it("will be trimmed of leading and trailing whitespace",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -1383,7 +1383,7 @@
it("will open a chatbox and be displayed inside it",
mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'emojisInitialized'], {},
async function (done, _converse) {
const include_nick = false;
@ -1429,7 +1429,7 @@
it("will be trimmed of leading and trailing whitespace",
mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1, false);
@ -1458,7 +1458,7 @@
it("can be replaced with a correction",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -1523,7 +1523,7 @@
it("the VCard for that user is fetched and the chatbox updated with the results",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
_converse.api.trigger('rosterContactsFetched');
@ -1582,7 +1582,7 @@
it("will open a chatbox and be displayed inside it if allow_non_roster_messaging is true",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
_converse.allow_non_roster_messaging = false;
@ -1643,7 +1643,7 @@
it("will have the error message displayed after itself",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -1761,7 +1761,7 @@
it("will not show to the user an error message for a CSI message",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
// See #1317
@ -1800,7 +1800,7 @@
it("will cause the chat area to be scrolled down only if it was at the bottom originally",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -1854,7 +1854,7 @@
it("is ignored if it's intended for a different resource and filter_by_resource is set to true",
mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'emojisInitialized'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -1904,7 +1904,7 @@
it("will render audio from oob mp3 URLs",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -1956,7 +1956,7 @@
it("will render video from oob mp4 URLs",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -2005,7 +2005,7 @@
it("will render download links for files from oob URLs",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -2035,7 +2035,7 @@
it("will render images from oob URLs",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const base_url = 'https://conversejs.org';
@ -2074,7 +2074,7 @@
it("is sent when a markable message is received from a roster contact",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -2107,7 +2107,7 @@
it("is not sent when a markable message is received from someone not on the roster",
mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'], {'allow_non_roster_messaging': true},
['rosterGroupsFetched', 'emojisInitialized'], {'allow_non_roster_messaging': true},
async function (done, _converse) {
_converse.api.trigger('rosterContactsFetched');
@ -2143,7 +2143,7 @@
it("is ignored if it's a carbon copy of one that I sent from a different client",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current', 1);

View File

@ -10,7 +10,7 @@
it("shows chats that have been minimized",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'current');
@ -45,7 +45,7 @@
it("can be toggled to hide or show minimized chats",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'current');
@ -73,7 +73,7 @@
it("shows the number messages received to minimized chats",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
function (done, _converse) {
test_utils.createContacts(_converse, 'current');
@ -152,7 +152,7 @@
it("shows the number messages received to minimized groupchats",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'kitchen@conference.shakespeare.lit';

View File

@ -11,7 +11,7 @@
it("allows you to set affiliations and roles",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
spyOn(_converse.ChatRoomView.prototype, 'showModeratorToolsModal').and.callThrough();
@ -138,7 +138,7 @@
it("shows an error message if a particular affiliation list may not be retrieved",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
spyOn(_converse.ChatRoomView.prototype, 'showModeratorToolsModal').and.callThrough();

View File

@ -18,7 +18,7 @@
it("has a method 'close' which closes rooms by JID or all rooms when called with no arguments",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
@ -49,7 +49,7 @@
it("has a method 'get' which returns a wrapped groupchat (if it exists)",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'current');
@ -95,7 +95,7 @@
it("has a method 'open' which opens (optionally configures) and returns a wrapped chat box",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
// Mock 'getRoomFeatures', otherwise the room won't be
@ -264,7 +264,7 @@
it("will be created when muc_instant_rooms is set to true",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
const IQ_stanzas = _converse.connection.IQ_stanzas;
@ -350,7 +350,7 @@
it("will fetch the member list if muc_fetch_members is true",
mock.initConverse(
null, ['rosterGroupsFetched'], {'muc_fetch_members': true},
['rosterGroupsFetched'], {'muc_fetch_members': true},
async function (done, _converse) {
const sent_IQs = _converse.connection.IQ_stanzas;
@ -390,7 +390,7 @@
it("gracefully handles being forbidden from fetching the lists for certain affiliations",
mock.initConverse(
null, ['rosterGroupsFetched'], {'muc_fetch_members': true},
['rosterGroupsFetched'], {'muc_fetch_members': true},
async function (done, _converse) {
const sent_IQs = _converse.connection.IQ_stanzas;
@ -473,7 +473,7 @@
it("clears cached messages when it gets closed and clear_messages_on_reconnection is true",
mock.initConverse(
null, ['rosterGroupsFetched'], {'clear_messages_on_reconnection': true},
['rosterGroupsFetched'], {'clear_messages_on_reconnection': true},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
@ -501,7 +501,7 @@
it("is opened when an xmpp: URI is clicked inside another groupchat",
mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'emojisInitialized'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'current');
@ -530,7 +530,7 @@
it("shows a notification if it's not anonymous",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
const muc_jid = 'coven@chat.shakespeare.lit';
@ -576,7 +576,7 @@
it("shows join/leave messages when users enter or exit a groupchat",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.openChatRoom(_converse, "coven", 'chat.shakespeare.lit', 'some1');
@ -851,7 +851,7 @@
it("combines subsequent join/leave messages when users enter or exit a groupchat",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'romeo')
@ -1003,7 +1003,7 @@
it("doesn't show the disconnection status when muc_show_join_leave_status is false",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'muc_show_join_leave_status': false},
['rosterGroupsFetched', 'chatBoxesFetched'], {'muc_show_join_leave_status': false},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'some1');
@ -1078,7 +1078,7 @@
it("role-change messages that follow a MUC leave are left out",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
// See https://github.com/conversejs/converse.js/issues/1259
@ -1140,7 +1140,7 @@
it("shows a new day indicator if a join/leave message is received on a new day",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'romeo');
@ -1302,7 +1302,7 @@
it("supports the /me command",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, 'montague.lit', [], ['vcard-temp']);
@ -1342,7 +1342,7 @@
it("can be configured if you're its owner",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
let sent_IQ, IQ_id;
@ -1562,7 +1562,7 @@
it("shows all members even if they're not currently present in the groupchat",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit'
@ -1650,7 +1650,7 @@
it("shows users currently present in the groupchat",
mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'emojisInitialized'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
@ -1705,7 +1705,7 @@
}));
it("escapes occupant nicknames when rendering them, to avoid JS-injection attacks",
mock.initConverse(null, ['rosterGroupsFetched'], {},
mock.initConverse(['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
@ -1738,7 +1738,7 @@
it("indicates moderators and visitors by means of a special css class and tooltip",
mock.initConverse(
null, ['rosterGroupsFetched'], {'view_mode': 'fullscreen'},
['rosterGroupsFetched'], {'view_mode': 'fullscreen'},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
@ -1804,7 +1804,7 @@
it("properly handles notification that a room has been destroyed",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.openChatRoomViaModal(_converse, 'problematic@muc.montague.lit', 'romeo')
@ -1835,7 +1835,7 @@
it("will use the user's reserved nickname, if it exists",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const IQ_stanzas = _converse.connection.IQ_stanzas;
@ -1930,7 +1930,7 @@
it("allows the user to invite their roster contacts to enter the groupchat",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'view_mode': 'fullscreen'},
['rosterGroupsFetched', 'chatBoxesFetched'], {'view_mode': 'fullscreen'},
async function (done, _converse) {
test_utils.createContacts(_converse, 'current'); // We need roster contacts, so that we have someone to invite
@ -1993,7 +1993,7 @@
it("can be joined automatically, based upon a received invite",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'current'); // We need roster contacts, who can invite us
@ -2026,7 +2026,7 @@
it("shows received groupchat messages",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const text = 'This is a received message';
@ -2059,7 +2059,7 @@
it("shows sent groupchat messages",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
@ -2106,7 +2106,7 @@
it("will cause the chat area to be scrolled down only if it was at the bottom already",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
var message = 'This message is received while the chat area is scrolled up';
@ -2149,7 +2149,7 @@
it("shows the room topic in the header",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'jdev@conference.jabber.org', 'jc');
@ -2185,7 +2185,7 @@
it("escapes the subject before rendering it, to avoid JS-injection attacks",
mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'emojisInitialized'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'jdev@conference.jabber.org', 'jc');
@ -2204,7 +2204,7 @@
it("reconnects when no-acceptable error is returned when sending a message",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'coven@chat.shakespeare.lit';
@ -2258,7 +2258,7 @@
it("informs users if the room configuration has changed",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'coven@chat.shakespeare.lit';
@ -2286,7 +2286,7 @@
it("informs users if their nicknames have been changed.",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
/* The service then sends two presence stanzas to the full JID
@ -2397,7 +2397,7 @@
it("queries for the groupchat information before attempting to join the user",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const IQ_stanzas = _converse.connection.IQ_stanzas;
@ -2470,7 +2470,7 @@
it("updates the shown features when the groupchat configuration has changed",
mock.initConverse(
null, ['rosterGroupsFetched'], {'view_mode': 'fullscreen'},
['rosterGroupsFetched'], {'view_mode': 'fullscreen'},
async function (done, _converse) {
let features = [
@ -2658,7 +2658,7 @@
it("indicates when a room is no longer anonymous",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
let IQ_id;
@ -2707,7 +2707,7 @@
it("informs users if they have been kicked out of the groupchat",
mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'emojisInitialized'], {},
async function (done, _converse) {
/* <presence
@ -2761,7 +2761,7 @@
it("can be saved to, and retrieved from, browserStorage",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.openChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
@ -2793,7 +2793,7 @@
it("can be minimized by clicking a DOM element with class 'toggle-chatbox-button'",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.openChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
@ -2824,7 +2824,7 @@
it("can be closed again by clicking a DOM element with class 'close-chatbox-button'",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.openChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
@ -2842,7 +2842,7 @@
it("informs users of role and affiliation changes",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
@ -2915,7 +2915,7 @@
it("takes /help to show the available commands",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
spyOn(window, 'confirm').and.callFake(() => true);
@ -2990,7 +2990,7 @@
it("takes /help to show the available commands and commands can be disabled by config",
mock.initConverse(
null, ['rosterGroupsFetched'], {muc_disable_slash_commands: ['mute', 'voice']},
['rosterGroupsFetched'], {muc_disable_slash_commands: ['mute', 'voice']},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
@ -3028,7 +3028,7 @@
it("takes /member to make an occupant a member",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
let iq_stanza;
@ -3173,7 +3173,7 @@
it("takes /topic to set the groupchat topic",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
@ -3225,7 +3225,7 @@
it("takes /clear to clear messages",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
@ -3244,7 +3244,7 @@
it("takes /owner to make a user an owner",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
let sent_IQ, IQ_id;
@ -3332,7 +3332,7 @@
it("takes /ban to ban a user",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
let sent_IQ, IQ_id;
@ -3432,7 +3432,7 @@
it("takes a /kick command to kick a user",
mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'emojisInitialized'], {},
async function (done, _converse) {
let sent_IQ, IQ_id;
@ -3524,7 +3524,7 @@
it("takes /op and /deop to make a user a moderator or not",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
@ -3667,7 +3667,7 @@
it("takes /mute and /voice to mute and unmute a user",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
@ -3811,7 +3811,7 @@
it("takes /destroy to destroy a muc",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
@ -3863,7 +3863,7 @@
it("will use the nickname set in the global settings if the user doesn't have a VCard nickname",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'nickname': 'Benedict-Cucumberpatch'},
['rosterGroupsFetched', 'chatBoxesFetched'], {'nickname': 'Benedict-Cucumberpatch'},
async function (done, _converse) {
await test_utils.openChatRoomViaModal(_converse, 'roomy@muc.montague.lit');
@ -3874,7 +3874,7 @@
it("will show an error message if the groupchat requires a password",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
const muc_jid = 'protected';
@ -3910,7 +3910,7 @@
it("will show an error message if the groupchat is members-only and the user not included",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'members-only@muc.montague.lit'
@ -3959,7 +3959,7 @@
it("will show an error message if the user has been banned",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'off-limits@muc.montague.lit'
@ -4005,7 +4005,7 @@
it("will render a nickname form if a nickname conflict happens and muc_nickname_from_jid=false",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'conflicted@muc.montague.lit';
@ -4034,7 +4034,7 @@
it("will automatically choose a new nickname if a nickname conflict happens and muc_nickname_from_jid=true",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const muc_jid = 'conflicting@muc.montague.lit'
@ -4095,7 +4095,7 @@
it("will show an error message if the user is not allowed to have created the groupchat",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'impermissable@muc.montague.lit'
@ -4136,7 +4136,7 @@
it("will show an error message if the user's nickname doesn't conform to groupchat policy",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'conformist@muc.montague.lit'
@ -4178,7 +4178,7 @@
it("will show an error message if the groupchat doesn't yet exist",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'nonexistent@muc.montague.lit'
@ -4220,7 +4220,7 @@
it("will show an error message if the groupchat has reached its maximum number of participants",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'maxed-out@muc.montague.lit'
@ -4265,7 +4265,7 @@
it("will first be added to the member list if the groupchat is members only",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
spyOn(_converse.ChatRoomOccupants.prototype, 'fetchMembers').and.callThrough();
@ -4410,7 +4410,7 @@
it("can be computed in various ways",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.openChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'romeo');
@ -4476,7 +4476,7 @@
it("can be opened from a link in the \"Groupchats\" section of the controlbox",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
test_utils.openControlBox();
@ -4518,7 +4518,7 @@
it("doesn't show the nickname field if locked_muc_nickname is true",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'locked_muc_nickname': true, 'muc_nickname_from_jid': true},
['rosterGroupsFetched', 'chatBoxesFetched'], {'locked_muc_nickname': true, 'muc_nickname_from_jid': true},
async function (done, _converse) {
test_utils.openControlBox();
@ -4541,7 +4541,7 @@
it("uses the JID node if muc_nickname_from_jid is set to true",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'muc_nickname_from_jid': true},
['rosterGroupsFetched', 'chatBoxesFetched'], {'muc_nickname_from_jid': true},
async function (done, _converse) {
test_utils.openControlBox();
@ -4560,7 +4560,7 @@
it("uses the nickname passed in to converse.initialize",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'nickname': 'st.nick'},
['rosterGroupsFetched', 'chatBoxesFetched'], {'nickname': 'st.nick'},
async function (done, _converse) {
test_utils.openControlBox();
@ -4579,7 +4579,7 @@
it("doesn't require the domain when muc_domain is set",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'muc_domain': 'muc.example.org'},
['rosterGroupsFetched', 'chatBoxesFetched'], {'muc_domain': 'muc.example.org'},
async function (done, _converse) {
test_utils.openControlBox();
@ -4619,7 +4619,7 @@
it("only uses the muc_domain is locked_muc_domain is true",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'muc_domain': 'muc.example.org', 'locked_muc_domain': true},
['rosterGroupsFetched', 'chatBoxesFetched'], {'muc_domain': 'muc.example.org', 'locked_muc_domain': true},
async function (done, _converse) {
test_utils.openControlBox();
@ -4661,7 +4661,7 @@
it("can be opened from a link in the \"Groupchats\" section of the controlbox",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
test_utils.openControlBox();
@ -4737,7 +4737,7 @@
it("is pre-filled with the muc_domain",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'],
['rosterGroupsFetched', 'chatBoxesFetched'],
{'muc_domain': 'muc.example.org'},
async function (done, _converse) {
@ -4754,7 +4754,7 @@
it("doesn't let you set the MUC domain if it's locked",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'],
['rosterGroupsFetched', 'chatBoxesFetched'],
{'muc_domain': 'chat.shakespeare.lit', 'locked_muc_domain': true},
async function (done, _converse) {
@ -4805,7 +4805,7 @@
it("shows the number of unread mentions received",
mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'], {'allow_bookmarks': false},
['rosterGroupsFetched', 'emojisInitialized'], {'allow_bookmarks': false},
async function (done, _converse) {
test_utils.openControlBox();
@ -4856,7 +4856,7 @@
it("is is not sent out to a MUC if the user is a visitor in a moderated room",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
spyOn(_converse.ChatRoom.prototype, 'sendChatState').and.callThrough();
@ -4910,7 +4910,7 @@
it("will be shown if received",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'coven@chat.shakespeare.lit';
@ -5062,7 +5062,7 @@
describe("A paused notification", function () {
it("will be shown if received",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.openChatRoom(_converse, "coven", 'chat.shakespeare.lit', 'some1');
@ -5220,7 +5220,7 @@
it("will receive a user-friendly error message when trying to send a message",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const muc_jid = 'trollbox@montague.lit';
@ -5244,7 +5244,7 @@
it("will see an explanatory message instead of a textarea",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const features = [

View File

@ -13,7 +13,7 @@
it("is rejected if it's an unencapsulated forwarded message",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
@ -49,7 +49,7 @@
it("is specially marked when you are mentioned in it",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
@ -72,7 +72,7 @@
it("can not be expected to have a unique id attribute",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
@ -104,7 +104,7 @@
it("is ignored if it has the same stanza-id of an already received on",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'room@muc.example.com';
@ -150,7 +150,7 @@
it("will be discarded if it's a malicious message meant to look like a carbon copy",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -210,7 +210,7 @@
it("keeps track of the sender's role and affiliation",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
@ -338,7 +338,7 @@
it("keeps track whether you are the sender or not",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
@ -358,7 +358,7 @@
it("can be replaced with a correction",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
@ -425,7 +425,7 @@
it("can be sent as a correction by using the up arrow",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
@ -530,7 +530,7 @@
it("will be shown as received upon MUC reflection",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -573,7 +573,7 @@
it("gets updated with its stanza-id upon MUC reflection",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'room@muc.example.com';
@ -609,7 +609,7 @@
it("can cause a delivery receipt to be returned",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -645,7 +645,7 @@
it("can cause a chat marker to be returned",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current');
@ -714,7 +714,7 @@
it("highlights all users mentioned via XEP-0372 references",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
@ -760,7 +760,7 @@
it("gets parsed for mentions which get turned into references",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
@ -842,7 +842,7 @@
it("parses for mentions as indicated with an @ preceded by a space or at the start of the text",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
@ -877,7 +877,7 @@
it("can get corrected and given new references",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';
@ -953,7 +953,7 @@
it("includes XEP-0372 references to that person",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const muc_jid = 'lounge@montague.lit';

View File

@ -14,9 +14,7 @@
describe("an HTML5 Notification", function () {
it("is shown when a new private message is received",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
async (done, _converse) => {
mock.initConverse(['rosterGroupsFetched'], {}, async (done, _converse) => {
await test_utils.waitForRoster(_converse, 'current');
spyOn(_converse, 'showMessageNotification').and.callThrough();
@ -40,9 +38,7 @@
}));
it("is shown when you are mentioned in a groupchat",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
async (done, _converse) => {
mock.initConverse(['rosterGroupsFetched'], {}, async (done, _converse) => {
await test_utils.createContacts(_converse, 'current');
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
@ -82,9 +78,7 @@
}));
it("is shown for headline messages",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
async (done, _converse) => {
mock.initConverse(['rosterGroupsFetched'], {}, async (done, _converse) => {
spyOn(_converse, 'showMessageNotification').and.callThrough();
spyOn(_converse, 'isMessageToHiddenChat').and.returnValue(true);
@ -166,9 +160,7 @@
describe("A notification sound", function () {
it("is played when the current user is mentioned in a groupchat",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
async (done, _converse) => {
mock.initConverse(['rosterGroupsFetched'], {}, async (done, _converse) => {
test_utils.createContacts(_converse, 'current');
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');

View File

@ -77,7 +77,7 @@
it("adds methods for encrypting and decrypting messages via AES GCM",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
const message = 'This message will be encrypted'
@ -94,7 +94,7 @@
it("enables encrypted messages to be sent and received",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
let sent_stanza;
@ -234,7 +234,7 @@
it("enables encrypted groupchat messages to be sent and received",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
// MEMO encryption works only in members only conferences
@ -381,7 +381,7 @@
it("will create a new device based on a received carbon message",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.bare_jid, [], [Strophe.NS.SID]);
@ -472,7 +472,7 @@
it("gracefully handles auth errors when trying to send encrypted groupchat messages",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
// MEMO encryption works only in members only conferences
@ -601,7 +601,7 @@
it("can receive a PreKeySignalMessage",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
_converse.NUM_PREKEYS = 5; // Restrict to 5, otherwise the resulting stanza is too large to easily test
@ -701,7 +701,7 @@
it("updates device lists based on PEP messages",
mock.initConverse(
null, ['rosterGroupsFetched'], {'allow_non_roster_messaging': true},
['rosterGroupsFetched'], {'allow_non_roster_messaging': true},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
@ -875,7 +875,7 @@
it("updates device bundles based on PEP messages",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
@ -1025,7 +1025,7 @@
it("publishes a bundle with which an encrypted session can be created",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
@ -1104,7 +1104,7 @@
it("adds a toolbar button for starting an encrypted chat session",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
@ -1269,7 +1269,7 @@
it("adds a toolbar button for starting an encrypted groupchat session",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'view_mode': 'fullscreen'},
['rosterGroupsFetched', 'chatBoxesFetched'], {'view_mode': 'fullscreen'},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(
@ -1451,7 +1451,7 @@
it("shows OMEMO device fingerprints in the user details modal",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.waitUntilDiscoConfirmed(

View File

@ -15,7 +15,7 @@
it("includes a entity capabilities node",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
(done, _converse) => {
_converse.api.disco.own.identities.clear();
@ -71,7 +71,7 @@
it("includes the saved status message",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async (done, _converse) => {
test_utils.openControlBox();
@ -111,7 +111,7 @@
it("has its priority taken into account",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
(done, _converse) => {
test_utils.openControlBox();

View File

@ -10,7 +10,7 @@
it("shows users currently present in the groupchat",
mock.initConverse(
null, ['rosterGroupsFetched'], {'muc_show_join_leave': false},
['rosterGroupsFetched'], {'muc_show_join_leave': false},
async function (done, _converse) {
test_utils.openControlBox();
@ -37,7 +37,7 @@
xit("adds hundreds of contacts to the roster",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
function (done, _converse) {
_converse.roster_groups = false;
@ -81,7 +81,7 @@
xit("adds hundreds of contacts to the roster, with roster groups",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
function (done, _converse) {
// _converse.show_only_online_users = true;

View File

@ -50,7 +50,7 @@
*/
it("Subscribe to contact, contact accepts and subscribes back",
mock.initConverse(
null, ['rosterGroupsFetched'],
['rosterGroupsFetched'],
{ roster_groups: false },
async function (done, _converse) {
@ -368,7 +368,7 @@
it("Alternate Flow: Contact Declines Subscription Request",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
function (done, _converse) {
/* The process by which a user subscribes to a contact, including
@ -451,7 +451,7 @@
it("Unsubscribe to a contact when subscription is mutual",
mock.initConverse(
null, ['rosterGroupsFetched'],
['rosterGroupsFetched'],
{ roster_groups: false },
async function (done, _converse) {
@ -510,7 +510,7 @@
}));
it("Receiving a subscription request", mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
spyOn(_converse.api, "trigger").and.callThrough();

View File

@ -11,7 +11,7 @@
describe("XEP-0357 Push Notifications", function () {
it("can be enabled",
mock.initConverse(null,
mock.initConverse(
['rosterGroupsFetched'], {
'push_app_servers': [{
'jid': 'push-5@client.example',
@ -49,7 +49,7 @@
}));
it("can be enabled for a MUC domain",
mock.initConverse(null,
mock.initConverse(
['rosterGroupsFetched'], {
'enable_muc_push': true,
'push_app_servers': [{
@ -109,7 +109,7 @@
}));
it("can be disabled",
mock.initConverse(null,
mock.initConverse(
['rosterGroupsFetched'], {
'push_app_servers': [{
'jid': 'push-5@client.example',
@ -145,7 +145,7 @@
it("can require a secret token to be included",
mock.initConverse(null,
mock.initConverse(
['rosterGroupsFetched'], {
'push_app_servers': [{
'jid': 'push-5@client.example',

View File

@ -10,7 +10,7 @@
it("is not available unless allow_registration=true",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ auto_login: false,
allow_registration: false },
async function (done, _converse) {
@ -24,7 +24,7 @@
it("can be opened by clicking on the registration tab",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ auto_login: false,
allow_registration: true },
async function (done, _converse) {
@ -45,7 +45,7 @@
it("allows the user to choose an XMPP provider's domain",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ auto_login: false,
allow_registration: true },
async function (done, _converse) {
@ -81,7 +81,7 @@
it("will render a registration form as received from the XMPP provider",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ auto_login: false,
allow_registration: true },
async function (done, _converse) {
@ -137,7 +137,7 @@
it("will set form_type to legacy and submit it as legacy",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ auto_login: false,
allow_registration: true },
async function (done, _converse) {
@ -194,7 +194,7 @@
it("will set form_type to xform and submit it as xform",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ auto_login: false,
allow_registration: true },
async function (done, _converse) {
@ -267,7 +267,7 @@
it("renders the account registration form",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ auto_login: false,
view_mode: 'fullscreen',
allow_registration: true },

View File

@ -14,7 +14,7 @@
it("allows you to register your nickname in a room",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'auto_register_muc_nickname': true},
['rosterGroupsFetched', 'chatBoxesFetched'], {'auto_register_muc_nickname': true},
async function (done, _converse) {
const muc_jid = 'coven@chat.shakespeare.lit';
@ -71,7 +71,7 @@
it("allows you to automatically register your nickname when joining a room",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'auto_register_muc_nickname': true},
['rosterGroupsFetched', 'chatBoxesFetched'], {'auto_register_muc_nickname': true},
async function (done, _converse) {
const muc_jid = 'coven@chat.shakespeare.lit';

View File

@ -8,7 +8,7 @@
describe("A list of open groupchats", function () {
it("is shown in controlbox", mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'],
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'],
{ allow_bookmarks: false // Makes testing easier, otherwise we
// have to mock stanza traffic.
}, async function (done, _converse) {
@ -53,7 +53,6 @@
it("uses bookmarks to determine groupchat names",
mock.initConverse(
null,
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'],
{'view_mode': 'fullscreen'},
async function (done, _converse) {
@ -114,7 +113,7 @@
describe("A groupchat shown in the groupchats list", function () {
it("is highlighted if it's currently open", mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'],
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'],
{ view_mode: 'fullscreen',
allow_bookmarks: false // Makes testing easier, otherwise we have to mock stanza traffic.
}, async function (done, _converse) {
@ -141,7 +140,7 @@
}));
it("has an info icon which opens a details modal when clicked", mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'],
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'],
{ whitelisted_plugins: ['converse-roomslist'],
allow_bookmarks: false // Makes testing easier, otherwise we
// have to mock stanza traffic.
@ -246,7 +245,7 @@
}));
it("can be closed", mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'],
['rosterGroupsFetched', 'emojisInitialized'],
{ whitelisted_plugins: ['converse-roomslist'],
allow_bookmarks: false // Makes testing easier, otherwise we have to mock stanza traffic.
},
@ -271,7 +270,7 @@
}));
it("shows unread messages directed at the user", mock.initConverse(
null, null,
null,
{ whitelisted_plugins: ['converse-roomslist'],
allow_bookmarks: false // Makes testing easier, otherwise we have to mock stanza traffic.
}, async (done, _converse) => {

View File

@ -30,7 +30,7 @@
it("verifies the origin of roster pushes",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
// See: https://gultsch.de/gajim_roster_push_and_message_interception.html
@ -71,7 +71,7 @@
it("is populated once we have registered a presence handler",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
spyOn(_converse.api, "trigger").and.callThrough();
@ -99,7 +99,7 @@
it("supports roster versioning",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const IQ_stanzas = _converse.connection.IQ_stanzas;
@ -156,7 +156,7 @@
it("will only appear when roster contacts flow over the visible area",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
const filter = _converse.rosterview.el.querySelector('.roster-filter');
@ -177,7 +177,7 @@
it("can be used to filter the contacts shown",
mock.initConverse(
null, ['rosterGroupsFetched'], {'roster_groups': true},
['rosterGroupsFetched'], {'roster_groups': true},
async function (done, _converse) {
test_utils.openControlBox();
@ -230,7 +230,7 @@
it("will also filter out contacts added afterwards",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.openControlBox();
@ -274,7 +274,7 @@
it("can be used to filter the groups shown",
mock.initConverse(
null, ['rosterGroupsFetched'], {'roster_groups': true},
['rosterGroupsFetched'], {'roster_groups': true},
async function (done, _converse) {
test_utils.openControlBox();
@ -316,7 +316,7 @@
it("has a button with which its contents can be cleared",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
_converse.roster_groups = true;
@ -340,7 +340,7 @@
// fails on Travis and I couldn't get it to pass there.
xit("can be used to filter contacts by their chat state",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.createGroupedContacts(_converse);
@ -375,7 +375,7 @@
it("can be used to organize existing contacts",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
_converse.roster_groups = true;
@ -412,7 +412,7 @@
it("gets created when a contact's \"groups\" attribute changes",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
_converse.roster_groups = true;
@ -457,7 +457,7 @@
it("can share contacts with other roster groups",
mock.initConverse(
null, ['rosterGroupsFetched'], {'roster_groups': true},
['rosterGroupsFetched'], {'roster_groups': true},
async function (done, _converse) {
const groups = ['colleagues', 'friends'];
@ -486,7 +486,7 @@
it("remembers whether it is closed or opened",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
_converse.roster_groups = true;
@ -531,7 +531,7 @@
it("can be collapsed under their own header",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await _addContacts(_converse);
@ -545,7 +545,7 @@
it("can be added to the roster",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
function (done, _converse) {
spyOn(_converse.rosterview, 'update').and.callThrough();
@ -562,7 +562,7 @@
it("are shown in the roster when show_only_online_users",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
_converse.show_only_online_users = true;
@ -579,7 +579,7 @@
it("are shown in the roster when hide_offline_users",
mock.initConverse(
null, ['rosterGroupsFetched'], {'hide_offline_users': true},
['rosterGroupsFetched'], {'hide_offline_users': true},
async function (done, _converse) {
spyOn(_converse.rosterview, 'update').and.callThrough();
@ -594,7 +594,7 @@
it("can be removed by the user",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
_addContacts(_converse);
@ -625,7 +625,7 @@
it("do not have a header if there aren't any",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.openControlBox();
@ -663,7 +663,7 @@
it("is shown when a new private message is received",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
_addContacts(_converse);
@ -679,7 +679,7 @@
it("can be added to the roster and they will be sorted alphabetically",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
let i;
@ -712,7 +712,7 @@
it("can be collapsed under their own header",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await _addContacts(_converse);
@ -723,7 +723,7 @@
it("will be hidden when appearing under a collapsed group",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
_converse.roster_groups = false;
@ -746,7 +746,7 @@
it("can be added to the roster and they will be sorted alphabetically",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.openControlBox();
@ -770,7 +770,7 @@
it("can be removed by the user",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await _addContacts(_converse);
@ -799,7 +799,7 @@
it("do not have a header if there aren't any",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.openControlBox();
@ -828,7 +828,7 @@
it("can change their status to online and be sorted alphabetically",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await _addContacts(_converse);
@ -850,7 +850,7 @@
it("can change their status to busy and be sorted alphabetically",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await _addContacts(_converse);
@ -872,7 +872,7 @@
it("can change their status to away and be sorted alphabetically",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await _addContacts(_converse);
@ -894,7 +894,7 @@
it("can change their status to xa and be sorted alphabetically",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await _addContacts(_converse);
@ -918,7 +918,7 @@
it("can change their status to unavailable and be sorted alphabetically",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await _addContacts(_converse);
@ -942,7 +942,7 @@
it("are ordered according to status: online, busy, away, xa, unavailable, offline",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
await _addContacts(_converse);
@ -1033,7 +1033,7 @@
it("can be added to the roster and they will be sorted alphabetically",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.openControlBox();
@ -1066,7 +1066,7 @@
it("do not have a header if there aren't any",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.openControlBox();
@ -1090,7 +1090,7 @@
it("can be collapsed under their own header",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'requesting').openControlBox();
@ -1104,7 +1104,7 @@
it("can have their requests accepted by the user",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.openControlBox();
@ -1128,7 +1128,7 @@
it("can have their requests denied by the user",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'requesting').openControlBox();
@ -1149,7 +1149,7 @@
}));
it("are persisted even if other contacts' change their presence ", mock.initConverse(
null, ['rosterGroupsFetched'], {}, async function (done, _converse) {
['rosterGroupsFetched'], {}, async function (done, _converse) {
/* This is a regression test.
* https://github.com/jcbrand/_converse.js/issues/262
@ -1205,7 +1205,7 @@
it("are saved to, and can be retrieved from browserStorage",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
function (done, _converse) {
test_utils.createContacts(_converse, 'all').openControlBox();
@ -1233,7 +1233,7 @@
it("will show fullname and jid properties on tooltip",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'all').openControlBox();

View File

@ -11,7 +11,7 @@
it("gets enabled with an <enable> stanza and resumed with a <resume> stanza",
mock.initConverse(
null, ['chatBoxesInitialized'],
['chatBoxesInitialized'],
{ 'auto_login': false,
'enable_smacks': true,
'show_controlbox_by_default': true,

View File

@ -11,7 +11,7 @@
it("can be received with a hint",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async (done, _converse) => {
await test_utils.waitForRoster(_converse, 'current');
@ -48,7 +48,7 @@
it("can be received without a hint",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async (done, _converse) => {
await test_utils.waitForRoster(_converse, 'current');
@ -82,7 +82,7 @@
it("can be sent without a hint",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async (done, _converse) => {
await test_utils.waitForRoster(_converse, 'current', 1);
@ -155,7 +155,7 @@
it("can be sent with a hint",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
['rosterGroupsFetched', 'chatBoxesFetched'], {},
async (done, _converse) => {
await test_utils.waitForRoster(_converse, 'current', 1);

View File

@ -50,7 +50,7 @@
it("can be used to replay conversations",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
['rosterGroupsFetched'], {},
async function (done, _converse) {
_converse.allow_non_roster_messaging = true;

View File

@ -12,7 +12,7 @@
it("can be used to remove a contact",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'chatBoxesFetched', 'emojisInitialized'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'current');
@ -45,7 +45,7 @@
it("shows an alert when an error happened while removing the contact",
mock.initConverse(
null, ['rosterGroupsFetched', 'emojisInitialized'], {},
['rosterGroupsFetched', 'emojisInitialized'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'current');

View File

@ -182,7 +182,7 @@
Strophe.Connection = MockConnection;
async function initConverse (settings, spies={}) {
async function initConverse (settings) {
window.localStorage.clear();
window.sessionStorage.clear();
@ -198,10 +198,6 @@
'view_mode': mock.view_mode,
}, settings || {}));
if (spies && spies._converse) {
spies._converse.forEach(method => spyOn(_converse, method).and.callThrough());
}
_converse.ChatBoxViews.prototype.trimChat = function () {};
_converse.api.vcard.get = function (model, force) {
@ -244,15 +240,14 @@
return _converse;
}
mock.initConverse = function (spies={}, promise_names=[], settings=null, func) {
if (_.isFunction(spies)) {
func = spies;
spies = null;
mock.initConverse = function (promise_names=[], settings=null, func) {
if (_.isFunction(promise_names)) {
func = promise_names;
promise_names = []
settings = null;
}
return async done => {
const _converse = await initConverse(settings, spies);
const _converse = await initConverse(settings);
async function _done () {
if (_converse.api.connection.connected()) {
await _converse.api.user.logout();
@ -264,7 +259,12 @@
done();
}
await Promise.all((promise_names || []).map(_converse.api.waitUntil));
func(_done, _converse).catch(e => { fail(e); _done(); });
try {
await func(_done, _converse);
} catch(e) {
fail(e);
_done();
}
}
};
return mock;