Update openAndEnterChatRoom
to take JID
This commit is contained in:
parent
da1d87648c
commit
1a3526f537
@ -20,7 +20,7 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'tom');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'tom');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
|
||||
['dick', 'harry'].forEach((nick) => {
|
||||
@ -62,7 +62,7 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
expect(view.model.occupants.length).toBe(1);
|
||||
let presence = $pres({
|
||||
@ -173,7 +173,7 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
expect(view.model.occupants.length).toBe(1);
|
||||
const presence = $pres({
|
||||
|
@ -190,7 +190,7 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async (done, _converse) => {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
test_utils.waitUntilDiscoConfirmed(
|
||||
_converse, _converse.domain,
|
||||
[{'category': 'server', 'type':'IM'}],
|
||||
@ -239,7 +239,7 @@
|
||||
|
||||
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.domain, [], [], ['upload.montague.lit'], 'items');
|
||||
await test_utils.waitUntilDiscoConfirmed(_converse, 'upload.montague.lit', [], [Strophe.NS.HTTPUPLOAD], []);
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
await test_utils.waitUntil(() => _converse.chatboxviews.get('lounge@montague.lit').el.querySelector('.upload-file'));
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
expect(view.el.querySelector('.chat-toolbar .upload-file')).not.toBe(null);
|
||||
@ -365,7 +365,7 @@
|
||||
|
||||
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.domain, [], [], ['upload.montague.tld'], 'items');
|
||||
await test_utils.waitUntilDiscoConfirmed(_converse, 'upload.montague.tld', [], [Strophe.NS.HTTPUPLOAD], []);
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
|
||||
// Wait until MAM query has been sent out
|
||||
const sent_stanzas = _converse.connection.sent_stanzas;
|
||||
|
@ -24,7 +24,7 @@
|
||||
null, ['discoInitialized'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'trek-radio', 'conference.lightwitch.org', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'trek-radio@conference.lightwitch.org', 'romeo');
|
||||
|
||||
const view = _converse.chatboxviews.get('trek-radio@conference.lightwitch.org');
|
||||
let stanza = u.toStanza(
|
||||
@ -72,7 +72,7 @@
|
||||
null, ['discoInitialized'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'trek-radio', 'conference.lightwitch.org', 'jcbrand');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'trek-radio@conference.lightwitch.org', 'jcbrand');
|
||||
const view = _converse.chatboxviews.get('trek-radio@conference.lightwitch.org');
|
||||
let stanza = u.toStanza(
|
||||
`<message xmlns="jabber:client" to="jcbrand@lightwitch.org/converse.js-73057452" type="groupchat" from="trek-radio@conference.lightwitch.org/comndrdukath#0805 (STO)">
|
||||
@ -111,7 +111,7 @@
|
||||
null, ['discoInitialized'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'discuss', 'conference.conversejs.org', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'discuss@conference.conversejs.org', 'romeo');
|
||||
const view = _converse.chatboxviews.get('discuss@conference.conversejs.org');
|
||||
let stanza = u.toStanza(
|
||||
`<message xmlns="jabber:client" to="romeo@montague.lit/orchard" from="discuss@conference.conversejs.org">
|
||||
|
@ -2244,14 +2244,14 @@
|
||||
<message xmlns="jabber:client" to="${contact_jid}" type="chat" from="${_converse.bare_jid}/other-resource">
|
||||
<received xmlns="urn:xmpp:chat-markers:0" id="2e972ea0-0050-44b7-a830-f6638a2595b3"/>
|
||||
<store xmlns="urn:xmpp:hints"/>
|
||||
<stanza-id xmlns="urn:xmpp:sid:0" id="F4TC6CvHwzqRbeHb" by="jc@opkode.com"/>
|
||||
<stanza-id xmlns="urn:xmpp:sid:0" id="F4TC6CvHwzqRbeHb" by="${_converse.bare_jid}"/>
|
||||
</message>
|
||||
</forwarded>
|
||||
</sent>
|
||||
</message>`);
|
||||
spyOn(_converse.api, "trigger").and.callThrough();
|
||||
_converse.connection._dataRecv(test_utils.createRequest(stanza));
|
||||
await test_utils.waitUntil(() => _converse.api.trigger.calls.count() === 1);
|
||||
await test_utils.waitUntil(() => _converse.api.trigger.calls.count(), 500);
|
||||
expect(view.el.querySelectorAll('.chat-msg').length).toBe(1);
|
||||
expect(view.model.messages.length).toBe(1);
|
||||
done();
|
||||
@ -2266,8 +2266,9 @@
|
||||
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
const view = _converse.api.chatviews.get('lounge@montague.lit');
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
if (!view.el.querySelectorAll('.chat-area').length) { view.renderChatArea(); }
|
||||
const message = 'romeo: Your attention is required';
|
||||
const nick = mock.chatroom_names[0],
|
||||
@ -2288,8 +2289,9 @@
|
||||
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
if (!view.el.querySelectorAll('.chat-area').length) { view.renderChatArea(); }
|
||||
const id = u.getUniqueId();
|
||||
let msg = $msg({
|
||||
@ -2319,8 +2321,9 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'room', 'muc.example.com', 'romeo');
|
||||
const view = _converse.chatboxviews.get('room@muc.example.com');
|
||||
const muc_jid = 'room@muc.example.com';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
spyOn(view.model, 'findDuplicateFromStanzaID').and.callThrough();
|
||||
let stanza = u.toStanza(`
|
||||
<message xmlns="jabber:client"
|
||||
@ -2364,8 +2367,9 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
const view = _converse.api.chatviews.get('lounge@montague.lit');
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
let msg = $msg({
|
||||
from: 'lounge@montague.lit/romeo',
|
||||
id: (new Date()).getTime(),
|
||||
@ -2435,8 +2439,9 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
const view = _converse.api.chatviews.get('lounge@montague.lit');
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
const msg = $msg({
|
||||
from: 'lounge@montague.lit/romeo',
|
||||
id: (new Date()).getTime(),
|
||||
@ -2454,10 +2459,9 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
const jid = 'lounge@montague.lit';
|
||||
const room = _converse.api.rooms.get(jid);
|
||||
const view = _converse.api.chatviews.get(jid);
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
const stanza = $pres({
|
||||
to: 'romeo@montague.lit/_converse.js-29092160',
|
||||
from: 'coven@chat.shakespeare.lit/newguy'
|
||||
@ -2522,10 +2526,9 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
const room_jid = 'lounge@montague.lit';
|
||||
const room = _converse.api.rooms.get(room_jid);
|
||||
const view = _converse.api.chatviews.get(room_jid);
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
const textarea = view.el.querySelector('textarea.chat-textarea');
|
||||
expect(textarea.value).toBe('');
|
||||
view.onKeyDown({
|
||||
@ -2593,7 +2596,7 @@
|
||||
|
||||
// Check that messages from other users are skipped
|
||||
await view.model.onMessage($msg({
|
||||
'from': room_jid+'/someone-else',
|
||||
'from': muc_jid+'/someone-else',
|
||||
'id': (new Date()).getTime(),
|
||||
'to': 'romeo@montague.lit',
|
||||
'type': 'groupchat'
|
||||
@ -2629,8 +2632,9 @@
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.waitForRoster(_converse, 'current');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
const textarea = view.el.querySelector('textarea.chat-textarea');
|
||||
textarea.value = 'But soft, what light through yonder airlock breaks?';
|
||||
view.onKeyDown({
|
||||
@ -2670,8 +2674,9 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'room', 'muc.example.com', 'romeo');
|
||||
const view = _converse.chatboxviews.get('room@muc.example.com');
|
||||
const muc_jid = 'room@muc.example.com';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
|
||||
view.model.sendMessage('hello world');
|
||||
await test_utils.waitUntil(() => _converse.api.chats.get().length);
|
||||
@ -2706,8 +2711,9 @@
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.waitForRoster(_converse, 'current');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
const textarea = view.el.querySelector('textarea.chat-textarea');
|
||||
textarea.value = 'But soft, what light through yonder airlock breaks?';
|
||||
view.onKeyDown({
|
||||
@ -2741,8 +2747,9 @@
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.waitForRoster(_converse, 'current');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
const textarea = view.el.querySelector('textarea.chat-textarea');
|
||||
textarea.value = 'But soft, what light through yonder airlock breaks?';
|
||||
view.onKeyDown({
|
||||
@ -2808,8 +2815,9 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'tom');
|
||||
const view = _converse.api.chatviews.get('lounge@montague.lit');
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'tom');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
['z3r0', 'mr.robot', 'gibson', 'sw0rdf1sh'].forEach((nick) => {
|
||||
_converse.connection._dataRecv(test_utils.createRequest(
|
||||
$pres({
|
||||
@ -2853,8 +2861,9 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'tom');
|
||||
const view = _converse.api.chatviews.get('lounge@montague.lit');
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'tom');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
['z3r0', 'mr.robot', 'gibson', 'sw0rdf1sh', 'Link Mauve'].forEach((nick) => {
|
||||
_converse.connection._dataRecv(test_utils.createRequest(
|
||||
$pres({
|
||||
@ -2934,8 +2943,9 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'tom');
|
||||
const view = _converse.api.chatviews.get('lounge@montague.lit');
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'tom');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
['NotAnAdress', 'darnuria'].forEach((nick) => {
|
||||
_converse.connection._dataRecv(test_utils.createRequest(
|
||||
$pres({
|
||||
@ -2968,9 +2978,9 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'tom');
|
||||
|
||||
const view = _converse.api.chatviews.get('lounge@montague.lit');
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'tom');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
['z3r0', 'mr.robot', 'gibson', 'sw0rdf1sh'].forEach((nick) => {
|
||||
_converse.connection._dataRecv(test_utils.createRequest(
|
||||
$pres({
|
||||
@ -3045,8 +3055,9 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'tom');
|
||||
const view = _converse.api.chatviews.get('lounge@montague.lit');
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
['z3r0', 'mr.robot', 'gibson', 'sw0rdf1sh'].forEach((nick) => {
|
||||
_converse.connection._dataRecv(test_utils.createRequest(
|
||||
$pres({
|
||||
|
@ -153,30 +153,26 @@
|
||||
it("shows the number messages received to minimized groupchats",
|
||||
mock.initConverse(
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
function (done, _converse) {
|
||||
async function (done, _converse) {
|
||||
|
||||
const room_jid = 'kitchen@conference.shakespeare.lit';
|
||||
test_utils.openAndEnterChatRoom(
|
||||
_converse, 'kitchen', 'conference.shakespeare.lit', 'fires').then(function () {
|
||||
var view = _converse.chatboxviews.get(room_jid);
|
||||
view.model.set({'minimized': true});
|
||||
|
||||
var contact_jid = mock.cur_names[5].replace(/ /g,'.').toLowerCase() + '@montague.lit';
|
||||
var message = 'fires: Your attention is required';
|
||||
var nick = mock.chatroom_names[0],
|
||||
msg = $msg({
|
||||
from: room_jid+'/'+nick,
|
||||
id: (new Date()).getTime(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').t(message).tree();
|
||||
view.model.onMessage(msg);
|
||||
return test_utils.waitUntil(() => view.model.messages.length);
|
||||
}).then(() => {
|
||||
expect(u.isVisible(_converse.minimized_chats.toggleview.el.querySelector('.unread-message-count'))).toBeTruthy();
|
||||
expect(_converse.minimized_chats.toggleview.el.querySelector('.unread-message-count').textContent).toBe('1');
|
||||
done();
|
||||
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL))
|
||||
const muc_jid = 'kitchen@conference.shakespeare.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'kitchen@conference.shakespeare.lit', 'fires');
|
||||
const view = _converse.chatboxviews.get(muc_jid);
|
||||
view.model.set({'minimized': true});
|
||||
const contact_jid = mock.cur_names[5].replace(/ /g,'.').toLowerCase() + '@montague.lit';
|
||||
const message = 'fires: Your attention is required';
|
||||
const nick = mock.chatroom_names[0];
|
||||
const msg = $msg({
|
||||
from: muc_jid+'/'+nick,
|
||||
id: (new Date()).getTime(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').t(message).tree();
|
||||
view.model.onMessage(msg);
|
||||
await test_utils.waitUntil(() => view.model.messages.length);
|
||||
expect(u.isVisible(_converse.minimized_chats.toggleview.el.querySelector('.unread-message-count'))).toBeTruthy();
|
||||
expect(_converse.minimized_chats.toggleview.el.querySelector('.unread-message-count').textContent).toBe('1');
|
||||
done();
|
||||
}));
|
||||
});
|
||||
}));
|
||||
|
180
spec/muc.js
180
spec/muc.js
@ -21,9 +21,9 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'leisure', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'news', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'leisure@montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'news@montague.lit', 'romeo');
|
||||
expect(u.isVisible(_converse.chatboxviews.get('lounge@montague.lit').el)).toBeTruthy();
|
||||
expect(u.isVisible(_converse.chatboxviews.get('leisure@montague.lit').el)).toBeTruthy();
|
||||
expect(u.isVisible(_converse.chatboxviews.get('news@montague.lit').el)).toBeTruthy();
|
||||
@ -37,8 +37,8 @@
|
||||
expect(_converse.chatboxviews.get('lounge@montague.lit')).toBeUndefined();
|
||||
expect(_converse.chatboxviews.get('leisure@montague.lit')).toBeUndefined();
|
||||
expect(_converse.chatboxviews.get('news@montague.lit')).toBeUndefined();
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'leisure', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'leisure@montague.lit', 'romeo');
|
||||
expect(u.isVisible(_converse.chatboxviews.get('lounge@montague.lit').el)).toBeTruthy();
|
||||
expect(u.isVisible(_converse.chatboxviews.get('leisure@montague.lit').el)).toBeTruthy();
|
||||
_converse.api.roomviews.close();
|
||||
@ -54,7 +54,7 @@
|
||||
|
||||
test_utils.createContacts(_converse, 'current');
|
||||
await test_utils.waitUntil(() => _converse.rosterview.el.querySelectorAll('.roster-group .group-toggle').length, 300);
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'chillout', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'chillout@montague.lit', 'romeo');
|
||||
let jid = 'chillout@montague.lit';
|
||||
let room = _converse.api.rooms.get(jid);
|
||||
expect(room instanceof Object).toBeTruthy();
|
||||
@ -66,7 +66,7 @@
|
||||
chatroomview.close();
|
||||
|
||||
// Test with mixed case
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'Leisure', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'Leisure@montague.lit', 'romeo');
|
||||
jid = 'Leisure@montague.lit';
|
||||
room = _converse.api.rooms.get(jid);
|
||||
expect(room instanceof Object).toBeTruthy();
|
||||
@ -269,7 +269,7 @@
|
||||
|
||||
const IQ_stanzas = _converse.connection.IQ_stanzas;
|
||||
const sendIQ = _converse.connection.sendIQ;
|
||||
const room_jid = 'lounge@montague.lit';
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
let sent_IQ, IQ_id;
|
||||
spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
|
||||
if (iq.nodeTree.getAttribute('to') === 'lounge@montague.lit') {
|
||||
@ -283,7 +283,7 @@
|
||||
let stanza = await test_utils.waitUntil(() => _.filter(
|
||||
IQ_stanzas,
|
||||
iq => iq.querySelector(
|
||||
`iq[to="${room_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
|
||||
`iq[to="${muc_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
|
||||
)).pop());
|
||||
// We pretend this is a new room, so no disco info is returned.
|
||||
|
||||
@ -317,7 +317,7 @@
|
||||
*/
|
||||
stanza = await test_utils.waitUntil(() => _.filter(
|
||||
IQ_stanzas,
|
||||
s => sizzle(`iq[to="${room_jid}"] query[node="x-roomuser-item"]`, s).length
|
||||
s => sizzle(`iq[to="${muc_jid}"] query[node="x-roomuser-item"]`, s).length
|
||||
).pop()
|
||||
);
|
||||
expect(Strophe.serialize(stanza)).toBe(
|
||||
@ -400,7 +400,7 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.waitUntil(() => test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'));
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
const message = 'Hello world',
|
||||
nick = mock.chatroom_names[0],
|
||||
@ -428,7 +428,7 @@
|
||||
async function (done, _converse) {
|
||||
|
||||
test_utils.createContacts(_converse, 'current');
|
||||
await test_utils.waitUntil(() => test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'));
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
if (!view.el.querySelectorAll('.chat-area').length) {
|
||||
view.renderChatArea();
|
||||
@ -770,7 +770,7 @@
|
||||
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'romeo')
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'romeo')
|
||||
const view = _converse.chatboxviews.get('coven@chat.shakespeare.lit');
|
||||
const chat_content = view.el.querySelector('.chat-content');
|
||||
|
||||
@ -922,7 +922,7 @@
|
||||
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'muc_show_join_leave_status': false},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, "coven", 'chat.shakespeare.lit', 'some1');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'some1');
|
||||
const view = _converse.chatboxviews.get('coven@chat.shakespeare.lit');
|
||||
const chat_content = view.el.querySelector('.chat-content');
|
||||
expect(sizzle('div.chat-info', chat_content).pop().textContent).toBe('some1 has entered the groupchat');
|
||||
@ -999,7 +999,7 @@
|
||||
|
||||
// See https://github.com/conversejs/converse.js/issues/1259
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'conversations', 'conference.siacs.eu', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'conversations@conference.siacs.eu', 'romeo');
|
||||
|
||||
const presence = $pres({
|
||||
to: 'romeo@montague.lit/orchard',
|
||||
@ -1059,7 +1059,7 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('coven@chat.shakespeare.lit');
|
||||
const chat_content = view.el.querySelector('.chat-content');
|
||||
let indicator = chat_content.querySelector('.date-separator');
|
||||
@ -1224,7 +1224,7 @@
|
||||
await test_utils.waitUntilDiscoConfirmed(_converse, 'montague.lit', [], ['vcard-temp']);
|
||||
await test_utils.waitUntil(() => _converse.xmppstatus.vcard.get('fullname'));
|
||||
test_utils.createContacts(_converse, 'current');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
if (!view.el.querySelectorAll('.chat-area').length) {
|
||||
view.renderChatArea();
|
||||
@ -1481,7 +1481,7 @@
|
||||
async function (done, _converse) {
|
||||
|
||||
const groupchat_jid = 'lounge@montague.lit'
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get(groupchat_jid);
|
||||
const occupants = view.el.querySelector('.occupant-list');
|
||||
for (let i=0; i<mock.chatroom_names.length; i++) {
|
||||
@ -1559,7 +1559,7 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
var name;
|
||||
var view = _converse.chatboxviews.get('lounge@montague.lit'),
|
||||
occupants = view.el.querySelector('.occupant-list');
|
||||
@ -1617,7 +1617,7 @@
|
||||
mock.initConverse(null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
/* <presence xmlns="jabber:client" to="jc@chat.example.org/converse.js-17184538"
|
||||
* from="oo@conference.chat.example.org/<img src="x" onerror="alert(123)"/>">
|
||||
* <x xmlns="http://jabber.org/protocol/muc#user">
|
||||
@ -1650,7 +1650,7 @@
|
||||
null, ['rosterGroupsFetched'], {'view_mode': 'fullscreen'},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
let contact_jid = mock.cur_names[2].replace(/ /g,'.').toLowerCase() + '@montague.lit';
|
||||
|
||||
@ -1749,14 +1749,14 @@
|
||||
|
||||
const IQ_stanzas = _converse.connection.IQ_stanzas;
|
||||
const sendIQ = _converse.connection.sendIQ;
|
||||
const room_jid = 'lounge@montague.lit';
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
|
||||
await test_utils.openChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
|
||||
let stanza = await test_utils.waitUntil(() => _.filter(
|
||||
IQ_stanzas,
|
||||
iq => iq.querySelector(
|
||||
`iq[to="${room_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
|
||||
`iq[to="${muc_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
|
||||
)).pop()
|
||||
);
|
||||
// We pretend this is a new room, so no disco info is returned.
|
||||
@ -1782,7 +1782,7 @@
|
||||
*/
|
||||
const iq = await test_utils.waitUntil(() => _.filter(
|
||||
IQ_stanzas,
|
||||
s => sizzle(`iq[to="${room_jid}"] query[node="x-roomuser-item"]`, s).length
|
||||
s => sizzle(`iq[to="${muc_jid}"] query[node="x-roomuser-item"]`, s).length
|
||||
).pop()
|
||||
);
|
||||
expect(Strophe.serialize(iq)).toBe(
|
||||
@ -1858,7 +1858,7 @@
|
||||
'muc_unmoderated',
|
||||
'muc_anonymous'
|
||||
]
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo', features);
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo', features);
|
||||
spyOn(_converse.api, "trigger").and.callThrough();
|
||||
spyOn(window, 'prompt').and.callFake(() => "Please join!");
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
@ -1909,13 +1909,13 @@
|
||||
|
||||
test_utils.createContacts(_converse, 'current'); // We need roster contacts, who can invite us
|
||||
spyOn(window, 'confirm').and.callFake(() => true);
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
view.close(); // Hack, otherwise we have to mock stanzas.
|
||||
|
||||
const name = mock.cur_names[0];
|
||||
const from_jid = name.replace(/ /g,'.').toLowerCase() + '@montague.lit';
|
||||
const room_jid = 'lounge@montague.lit';
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
const reason = "Please join this groupchat";
|
||||
|
||||
expect(_converse.chatboxes.models.length).toBe(1);
|
||||
@ -1923,15 +1923,15 @@
|
||||
|
||||
const stanza = u.toStanza(`
|
||||
<message xmlns="jabber:client" to="${_converse.bare_jid}" from="${from_jid}" id="9bceb415-f34b-4fa4-80d5-c0d076a24231">
|
||||
<x xmlns="jabber:x:conference" jid="${room_jid}" reason="${reason}"/>
|
||||
<x xmlns="jabber:x:conference" jid="${muc_jid}" reason="${reason}"/>
|
||||
</message>`);
|
||||
_converse.onDirectMUCInvitation(stanza);
|
||||
expect(window.confirm).toHaveBeenCalledWith(
|
||||
name + ' has invited you to join a groupchat: '+ room_jid +
|
||||
name + ' has invited you to join a groupchat: '+ muc_jid +
|
||||
', and left the following reason: "'+reason+'"');
|
||||
expect(_converse.chatboxes.models.length).toBe(2);
|
||||
expect(_converse.chatboxes.models[0].id).toBe('controlbox');
|
||||
expect(_converse.chatboxes.models[1].id).toBe(room_jid);
|
||||
expect(_converse.chatboxes.models[1].id).toBe(muc_jid);
|
||||
done();
|
||||
}));
|
||||
|
||||
@ -1941,7 +1941,7 @@
|
||||
async function (done, _converse) {
|
||||
|
||||
const text = 'This is a received message';
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
spyOn(_converse.api, "trigger");
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
if (!view.el.querySelectorAll('.chat-area').length) {
|
||||
@ -1973,7 +1973,7 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
spyOn(_converse.api, "trigger");
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
if (!view.el.querySelectorAll('.chat-area').length) {
|
||||
@ -2021,7 +2021,7 @@
|
||||
async function (done, _converse) {
|
||||
|
||||
var message = 'This message is received while the chat area is scrolled up';
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
var view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
spyOn(view, 'scrollDown').and.callThrough();
|
||||
// Create enough messages so that there's a scrollbar.
|
||||
@ -2063,7 +2063,7 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'jdev', 'conference.jabber.org', 'jc');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'jdev@conference.jabber.org', 'jc');
|
||||
const text = 'Jabber/XMPP Development | RFCs and Extensions: https://xmpp.org/ | Protocol and XSF discussions: xsf@muc.xmpp.org';
|
||||
let stanza = u.toStanza(`
|
||||
<message xmlns="jabber:client" to="jc@opkode.com/_converse.js-60429116" type="groupchat" from="jdev@conference.jabber.org/ralphm">
|
||||
@ -2101,7 +2101,7 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'jdev', 'conference.jabber.org', 'jc');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'jdev@conference.jabber.org', 'jc');
|
||||
spyOn(window, 'alert');
|
||||
const subject = '<img src="x" onerror="alert(\'XSS\');"/>';
|
||||
const view = _converse.chatboxviews.get('jdev@conference.jabber.org');
|
||||
@ -2122,7 +2122,7 @@
|
||||
async function (done, _converse) {
|
||||
|
||||
const groupchat_jid = 'coven@chat.shakespeare.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get(groupchat_jid);
|
||||
expect(view.model.get('connection_status')).toBe(converse.ROOMSTATUS.ENTERED);
|
||||
await test_utils.sendMessage(view, 'hello world');
|
||||
@ -2176,7 +2176,7 @@
|
||||
async function (done, _converse) {
|
||||
|
||||
const groupchat_jid = 'coven@chat.shakespeare.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get(groupchat_jid);
|
||||
expect(view.model.get('connection_status')).toBe(converse.ROOMSTATUS.ENTERED);
|
||||
|
||||
@ -2239,7 +2239,7 @@
|
||||
* </presence>
|
||||
*/
|
||||
const __ = _converse.__;
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'oldnick');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'oldnick');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
expect(view.model.get('connection_status')).toBe(converse.ROOMSTATUS.ENTERED);
|
||||
const chat_content = view.el.querySelector('.chat-content');
|
||||
@ -2315,18 +2315,18 @@
|
||||
async function (done, _converse) {
|
||||
|
||||
const IQ_stanzas = _converse.connection.IQ_stanzas;
|
||||
const room_jid = 'coven@chat.shakespeare.lit';
|
||||
const muc_jid = 'coven@chat.shakespeare.lit';
|
||||
|
||||
await _converse.api.rooms.open(room_jid, {'nick': 'some1'});
|
||||
await _converse.api.rooms.open(muc_jid, {'nick': 'some1'});
|
||||
const stanza = await test_utils.waitUntil(() => _.filter(
|
||||
IQ_stanzas,
|
||||
iq => iq.querySelector(
|
||||
`iq[to="${room_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
|
||||
`iq[to="${muc_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
|
||||
)).pop());
|
||||
|
||||
// Check that the groupchat queried for the feautures.
|
||||
expect(Strophe.serialize(stanza)).toBe(
|
||||
`<iq from="romeo@montague.lit/orchard" id="${stanza.getAttribute("id")}" to="${room_jid}" type="get" xmlns="jabber:client">`+
|
||||
`<iq from="romeo@montague.lit/orchard" id="${stanza.getAttribute("id")}" to="${muc_jid}" type="get" xmlns="jabber:client">`+
|
||||
`<query xmlns="http://jabber.org/protocol/disco#info"/>`+
|
||||
`</iq>`);
|
||||
|
||||
@ -2350,7 +2350,7 @@
|
||||
* </iq>
|
||||
*/
|
||||
const features_stanza = $iq({
|
||||
'from': room_jid,
|
||||
'from': muc_jid,
|
||||
'id': stanza.getAttribute('id'),
|
||||
'to': 'romeo@montague.lit/desktop',
|
||||
'type': 'result'
|
||||
@ -2397,7 +2397,7 @@
|
||||
'muc_unmoderated',
|
||||
'muc_nonanonymous'
|
||||
];
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'room', 'conference.example.org', 'romeo', features);
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'room@conference.example.org', 'romeo', features);
|
||||
const jid = 'room@conference.example.org';
|
||||
const chatroomview = _converse.chatboxviews.get(jid);
|
||||
let features_list = chatroomview.el.querySelector('.features-list');
|
||||
@ -2578,7 +2578,7 @@
|
||||
let sent_IQ, IQ_id;
|
||||
const sendIQ = _converse.connection.sendIQ;
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'some1');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'some1');
|
||||
spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
|
||||
sent_IQ = iq;
|
||||
IQ_id = sendIQ.bind(this)(iq, callback, errback);
|
||||
@ -2639,7 +2639,7 @@
|
||||
* </x>
|
||||
* </presence>
|
||||
*/
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
var presence = $pres().attrs({
|
||||
from:'lounge@montague.lit/romeo',
|
||||
to:'romeo@montague.lit/pda',
|
||||
@ -2765,7 +2765,7 @@
|
||||
async function (done, _converse) {
|
||||
|
||||
spyOn(window, 'confirm').and.callFake(() => true);
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
const textarea = view.el.querySelector('.chat-textarea');
|
||||
textarea.value = '/clear';
|
||||
@ -2838,7 +2838,7 @@
|
||||
null, ['rosterGroupsFetched'], {muc_disable_slash_commands: ['mute', 'voice']},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
var textarea = view.el.querySelector('.chat-textarea');
|
||||
const enter = { 'target': textarea, 'preventDefault': _.noop, 'keyCode': 13 };
|
||||
@ -2876,7 +2876,7 @@
|
||||
async function (done, _converse) {
|
||||
|
||||
let iq_stanza;
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'muc.montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@muc.montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@muc.montague.lit');
|
||||
/* We don't show join/leave messages for existing occupants. We
|
||||
* know about them because we receive their presences before we
|
||||
@ -3020,7 +3020,7 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
spyOn(view, 'clearMessages');
|
||||
let sent_stanza;
|
||||
@ -3072,7 +3072,7 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
spyOn(view, 'clearMessages');
|
||||
const textarea = view.el.querySelector('.chat-textarea')
|
||||
@ -3098,7 +3098,7 @@
|
||||
IQ_id = sendIQ.bind(this)(iq, callback, errback);
|
||||
});
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
spyOn(view.model, 'setAffiliation').and.callThrough();
|
||||
spyOn(view, 'showErrorMessage').and.callThrough();
|
||||
@ -3186,7 +3186,7 @@
|
||||
IQ_id = sendIQ.bind(this)(iq, callback, errback);
|
||||
});
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
spyOn(view.model, 'setAffiliation').and.callThrough();
|
||||
spyOn(view, 'showErrorMessage').and.callThrough();
|
||||
@ -3286,8 +3286,9 @@
|
||||
IQ_id = sendIQ.bind(this)(iq, callback, errback);
|
||||
});
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
spyOn(view.model, 'setRole').and.callThrough();
|
||||
spyOn(view, 'showErrorMessage').and.callThrough();
|
||||
spyOn(view, 'validateRoleOrAffiliationChangeArgs').and.callThrough();
|
||||
@ -3370,14 +3371,15 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
var sent_IQ, IQ_id;
|
||||
var sendIQ = _converse.connection.sendIQ;
|
||||
spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
|
||||
sent_IQ = iq;
|
||||
IQ_id = sendIQ.bind(this)(iq, callback, errback);
|
||||
});
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
spyOn(view.model, 'setRole').and.callThrough();
|
||||
spyOn(view, 'showErrorMessage').and.callThrough();
|
||||
spyOn(view, 'showChatEvent').and.callThrough();
|
||||
@ -3512,14 +3514,15 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
var sent_IQ, IQ_id;
|
||||
var sendIQ = _converse.connection.sendIQ;
|
||||
spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
|
||||
sent_IQ = iq;
|
||||
IQ_id = sendIQ.bind(this)(iq, callback, errback);
|
||||
});
|
||||
var view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
spyOn(view.model, 'setRole').and.callThrough();
|
||||
spyOn(view, 'showErrorMessage').and.callThrough();
|
||||
spyOn(view, 'showChatEvent').and.callThrough();
|
||||
@ -3655,14 +3658,15 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
let sent_IQ, IQ_id;
|
||||
const sendIQ = _converse.connection.sendIQ;
|
||||
spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
|
||||
sent_IQ = iq;
|
||||
IQ_id = sendIQ.bind(this)(iq, callback, errback);
|
||||
});
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
const textarea = view.el.querySelector('.chat-textarea');
|
||||
textarea.value = '/destroy bored';
|
||||
view.onFormSubmitted(new Event('submit'));
|
||||
@ -4111,21 +4115,21 @@
|
||||
var sent_IQs = [], IQ_ids = [];
|
||||
const sendIQ = _converse.connection.sendIQ;
|
||||
const IQ_stanzas = _converse.connection.IQ_stanzas;
|
||||
const room_jid = 'coven@chat.shakespeare.lit';
|
||||
const muc_jid = 'coven@chat.shakespeare.lit';
|
||||
spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
|
||||
sent_IQs.push(iq);
|
||||
IQ_ids.push(sendIQ.bind(this)(iq, callback, errback));
|
||||
});
|
||||
|
||||
await _converse.api.rooms.open(room_jid, {'nick': 'romeo'});
|
||||
await _converse.api.rooms.open(muc_jid, {'nick': 'romeo'});
|
||||
let stanza = await test_utils.waitUntil(() => _.filter(
|
||||
IQ_stanzas,
|
||||
iq => iq.querySelector(
|
||||
`iq[to="${room_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
|
||||
`iq[to="${muc_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
|
||||
)).pop());
|
||||
// Check that the groupchat queried for the feautures.
|
||||
expect(Strophe.serialize(stanza)).toBe(
|
||||
`<iq from="romeo@montague.lit/orchard" id="${stanza.getAttribute("id")}" to="${room_jid}" type="get" xmlns="jabber:client">`+
|
||||
`<iq from="romeo@montague.lit/orchard" id="${stanza.getAttribute("id")}" to="${muc_jid}" type="get" xmlns="jabber:client">`+
|
||||
`<query xmlns="http://jabber.org/protocol/disco#info"/>`+
|
||||
`</iq>`);
|
||||
|
||||
@ -4246,7 +4250,7 @@
|
||||
stanza = await test_utils.waitUntil(() => _.filter(
|
||||
IQ_stanzas,
|
||||
iq => iq.querySelector(
|
||||
`iq[to="${room_jid}"] query[xmlns="http://jabber.org/protocol/muc#admin"]`
|
||||
`iq[to="${muc_jid}"] query[xmlns="http://jabber.org/protocol/muc#admin"]`
|
||||
)).pop());
|
||||
expect(stanza.outerHTML,
|
||||
`<iq id="${IQ_ids.pop()}" to="coven@chat.shakespeare.lit" type="set" xmlns="jabber:client">`+
|
||||
@ -4671,20 +4675,20 @@
|
||||
const roomspanel = _converse.chatboxviews.get('controlbox').roomspanel;
|
||||
expect(roomspanel.el.querySelectorAll('.available-room').length).toBe(0);
|
||||
|
||||
const room_jid = 'kitchen@conference.shakespeare.lit';
|
||||
const muc_jid = 'kitchen@conference.shakespeare.lit';
|
||||
const message = 'fires: Your attention is required';
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'kitchen', 'conference.shakespeare.lit', 'fires');
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'fires');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
expect(roomspanel.el.querySelectorAll('.available-room').length).toBe(1);
|
||||
expect(roomspanel.el.querySelectorAll('.msgs-indicator').length).toBe(0);
|
||||
|
||||
const view = _converse.chatboxviews.get(room_jid);
|
||||
view.model.set({'minimized': true});
|
||||
|
||||
const contact_jid = mock.cur_names[5].replace(/ /g,'.').toLowerCase() + '@montague.lit';
|
||||
const nick = mock.chatroom_names[0];
|
||||
|
||||
await view.model.onMessage($msg({
|
||||
from: room_jid+'/'+nick,
|
||||
from: muc_jid+'/'+nick,
|
||||
id: (new Date()).getTime(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
@ -4695,7 +4699,7 @@
|
||||
expect(roomspanel.el.querySelector('.msgs-indicator').textContent).toBe('1');
|
||||
|
||||
await view.model.onMessage($msg({
|
||||
'from': room_jid+'/'+nick,
|
||||
'from': muc_jid+'/'+nick,
|
||||
'id': (new Date()).getTime(),
|
||||
'to': 'romeo@montague.lit',
|
||||
'type': 'groupchat'
|
||||
@ -4720,9 +4724,9 @@
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
const room_jid = 'coven@chat.shakespeare.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'some1');
|
||||
const view = _converse.chatboxviews.get('coven@chat.shakespeare.lit');
|
||||
const muc_jid = 'coven@chat.shakespeare.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'some1');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
const chat_content = view.el.querySelector('.chat-content');
|
||||
|
||||
expect(sizzle('div.chat-info:first', chat_content).pop().textContent)
|
||||
@ -4762,7 +4766,7 @@
|
||||
|
||||
// <composing> state
|
||||
let msg = $msg({
|
||||
from: room_jid+'/newguy',
|
||||
from: muc_jid+'/newguy',
|
||||
id: (new Date()).getTime(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
@ -4787,7 +4791,7 @@
|
||||
|
||||
// Check that it doesn't appear twice
|
||||
msg = $msg({
|
||||
from: room_jid+'/newguy',
|
||||
from: muc_jid+'/newguy',
|
||||
id: (new Date()).getTime(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
@ -4807,7 +4811,7 @@
|
||||
|
||||
// <composing> state for a different occupant
|
||||
msg = $msg({
|
||||
from: room_jid+'/nomorenicks',
|
||||
from: muc_jid+'/nomorenicks',
|
||||
id: (new Date()).getTime(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
@ -4827,7 +4831,7 @@
|
||||
|
||||
// Check that new messages appear under the chat state notifications
|
||||
msg = $msg({
|
||||
from: `${room_jid}/some1`,
|
||||
from: `${muc_jid}/some1`,
|
||||
id: (new Date()).getTime(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
@ -4872,7 +4876,7 @@
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openChatRoom(_converse, "coven", 'chat.shakespeare.lit', 'some1');
|
||||
const room_jid = 'coven@chat.shakespeare.lit';
|
||||
const muc_jid = 'coven@chat.shakespeare.lit';
|
||||
const view = _converse.chatboxviews.get('coven@chat.shakespeare.lit');
|
||||
const chat_content = view.el.querySelector('.chat-content');
|
||||
|
||||
@ -4932,7 +4936,7 @@
|
||||
|
||||
// <composing> state
|
||||
var msg = $msg({
|
||||
from: room_jid+'/newguy',
|
||||
from: muc_jid+'/newguy',
|
||||
id: (new Date()).getTime(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
@ -4953,7 +4957,7 @@
|
||||
|
||||
// Check that it doesn't appear twice
|
||||
msg = $msg({
|
||||
from: room_jid+'/newguy',
|
||||
from: muc_jid+'/newguy',
|
||||
id: (new Date()).getTime(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
@ -4972,7 +4976,7 @@
|
||||
|
||||
// <composing> state for a different occupant
|
||||
msg = $msg({
|
||||
from: room_jid+'/nomorenicks',
|
||||
from: muc_jid+'/nomorenicks',
|
||||
id: (new Date()).getTime(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
@ -4995,7 +4999,7 @@
|
||||
|
||||
// <paused> state from occupant who typed first
|
||||
msg = $msg({
|
||||
from: room_jid+'/newguy',
|
||||
from: muc_jid+'/newguy',
|
||||
id: (new Date()).getTime(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
@ -5029,8 +5033,9 @@
|
||||
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'trollbox', 'montague.lit', 'troll');
|
||||
const view = _converse.chatboxviews.get('trollbox@montague.lit');
|
||||
const muc_jid = 'trollbox@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'troll');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
const textarea = view.el.querySelector('.chat-textarea');
|
||||
textarea.value = 'Hello world';
|
||||
view.onFormSubmitted(new Event('submit'));
|
||||
@ -5058,8 +5063,9 @@
|
||||
Strophe.NS.SID,
|
||||
'muc_moderated',
|
||||
]
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'trollbox', 'montague.lit', 'troll', features);
|
||||
const view = _converse.chatboxviews.get('trollbox@montague.lit');
|
||||
const muc_jid = 'trollbox@montague.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'troll', features);
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
expect(_.isNull(view.el.querySelector('.chat-textarea'))).toBe(false);
|
||||
|
||||
let stanza = u.toStanza(`
|
||||
|
@ -47,7 +47,7 @@
|
||||
async (done, _converse) => {
|
||||
|
||||
await test_utils.createContacts(_converse, 'current');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
const view = _converse.api.chatviews.get('lounge@montague.lit');
|
||||
if (!view.el.querySelectorAll('.chat-area').length) {
|
||||
view.renderChatArea();
|
||||
@ -173,7 +173,7 @@
|
||||
async (done, _converse) => {
|
||||
|
||||
test_utils.createContacts(_converse, 'current');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
_converse.play_sounds = true;
|
||||
spyOn(_converse, 'playSoundNotification');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
|
@ -250,7 +250,7 @@
|
||||
'muc_unmoderated',
|
||||
'muc_nonanonymous'
|
||||
];
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo', features);
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo', features);
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
await test_utils.waitUntil(() => initializedOMEMO(_converse));
|
||||
|
||||
@ -490,7 +490,7 @@
|
||||
'muc_unmoderated',
|
||||
'muc_nonanonymous'
|
||||
];
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo', features);
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo', features);
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
await test_utils.waitUntil(() => initializedOMEMO(_converse));
|
||||
|
||||
@ -1282,7 +1282,7 @@
|
||||
['http://jabber.org/protocol/pubsub#publish-options']
|
||||
);
|
||||
|
||||
// MEMO encryption works only in members-only conferences that are non-anonymous.
|
||||
// MEMO encryption works only in members-only conferences that are non-anonymous.
|
||||
const features = [
|
||||
'http://jabber.org/protocol/muc',
|
||||
'jabber:iq:register',
|
||||
@ -1293,7 +1293,7 @@
|
||||
'muc_unmoderated',
|
||||
'muc_nonanonymous'
|
||||
];
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo', features);
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo', features);
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
await test_utils.waitUntil(() => initializedOMEMO(_converse));
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
async function (done, _converse) {
|
||||
|
||||
test_utils.openControlBox();
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit'),
|
||||
occupants = view.el.querySelector('.occupant-list');
|
||||
_.rangeRight(3000, 0).forEach(i => {
|
||||
|
@ -85,7 +85,7 @@
|
||||
expect(_converse.session.get('push_enabled').length).toBe(1);
|
||||
expect(_.includes(_converse.session.get('push_enabled'), 'romeo@montague.lit')).toBe(true);
|
||||
|
||||
test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'oldhag');
|
||||
test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'oldhag');
|
||||
await test_utils.waitUntilDiscoConfirmed(
|
||||
_converse, 'chat.shakespeare.lit',
|
||||
[{'category': 'account', 'type':'registered'}],
|
||||
|
@ -16,59 +16,54 @@
|
||||
it("allows you to register your nickname in a room",
|
||||
mock.initConverse(
|
||||
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'auto_register_muc_nickname': true},
|
||||
function (done, _converse) {
|
||||
async function (done, _converse) {
|
||||
|
||||
let view;
|
||||
const room_jid = 'coven@chat.shakespeare.lit';
|
||||
test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'romeo')
|
||||
.then(() => {
|
||||
view = _converse.chatboxviews.get(room_jid);
|
||||
const textarea = view.el.querySelector('.chat-textarea')
|
||||
textarea.value = '/register';
|
||||
view.onKeyDown({
|
||||
target: textarea,
|
||||
preventDefault: _.noop,
|
||||
keyCode: 13
|
||||
});
|
||||
return test_utils.waitUntil(() => _.filter(
|
||||
_converse.connection.IQ_stanzas,
|
||||
iq => sizzle(`iq[to="coven@chat.shakespeare.lit"][type="get"] query[xmlns="jabber:iq:register"]`, iq).length
|
||||
).pop());
|
||||
}).then(stanza => {
|
||||
expect(Strophe.serialize(stanza))
|
||||
const muc_jid = 'coven@chat.shakespeare.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo')
|
||||
const view = _converse.chatboxviews.get(muc_jid);
|
||||
const textarea = view.el.querySelector('.chat-textarea')
|
||||
textarea.value = '/register';
|
||||
view.onKeyDown({
|
||||
target: textarea,
|
||||
preventDefault: _.noop,
|
||||
keyCode: 13
|
||||
});
|
||||
let stanza = await test_utils.waitUntil(() => _.filter(
|
||||
_converse.connection.IQ_stanzas,
|
||||
iq => sizzle(`iq[to="${muc_jid}"][type="get"] query[xmlns="jabber:iq:register"]`, iq).length
|
||||
).pop());
|
||||
expect(Strophe.serialize(stanza))
|
||||
.toBe(`<iq from="romeo@montague.lit/orchard" id="${stanza.getAttribute('id')}" to="coven@chat.shakespeare.lit" `+
|
||||
`type="get" xmlns="jabber:client">`+
|
||||
`<query xmlns="jabber:iq:register"/></iq>`);
|
||||
view = _converse.chatboxviews.get(room_jid);
|
||||
const result = $iq({
|
||||
'from': view.model.get('jid'),
|
||||
'id': stanza.getAttribute('id'),
|
||||
'to': _converse.bare_jid,
|
||||
'type': 'result',
|
||||
}).c('query', {'type': 'jabber:iq:register'})
|
||||
.c('x', {'xmlns': 'jabber:x:data', 'type': 'form'})
|
||||
.c('field', {
|
||||
'label': 'Desired Nickname',
|
||||
'type': 'text-single',
|
||||
'var': 'muc#register_roomnick'
|
||||
}).c('required');
|
||||
_converse.connection._dataRecv(test_utils.createRequest(result));
|
||||
return test_utils.waitUntil(() => _.filter(
|
||||
_converse.connection.IQ_stanzas,
|
||||
iq => sizzle(`iq[to="coven@chat.shakespeare.lit"][type="set"] query[xmlns="jabber:iq:register"]`, iq).length
|
||||
).pop());
|
||||
}).then(stanza => {
|
||||
expect(Strophe.serialize(stanza)).toBe(
|
||||
`<iq from="romeo@montague.lit/orchard" id="${stanza.getAttribute('id')}" to="coven@chat.shakespeare.lit" type="set" xmlns="jabber:client">`+
|
||||
`<query xmlns="jabber:iq:register">`+
|
||||
`<x type="submit" xmlns="jabber:x:data">`+
|
||||
`<field var="FORM_TYPE"><value>http://jabber.org/protocol/muc#register</value></field>`+
|
||||
`<field var="muc#register_roomnick"><value>romeo</value></field>`+
|
||||
`</x>`+
|
||||
`</query>`+
|
||||
`</iq>`);
|
||||
done();
|
||||
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
|
||||
const result = $iq({
|
||||
'from': view.model.get('jid'),
|
||||
'id': stanza.getAttribute('id'),
|
||||
'to': _converse.bare_jid,
|
||||
'type': 'result',
|
||||
}).c('query', {'type': 'jabber:iq:register'})
|
||||
.c('x', {'xmlns': 'jabber:x:data', 'type': 'form'})
|
||||
.c('field', {
|
||||
'label': 'Desired Nickname',
|
||||
'type': 'text-single',
|
||||
'var': 'muc#register_roomnick'
|
||||
}).c('required');
|
||||
_converse.connection._dataRecv(test_utils.createRequest(result));
|
||||
stanza = await test_utils.waitUntil(() => _.filter(
|
||||
_converse.connection.IQ_stanzas,
|
||||
iq => sizzle(`iq[to="${muc_jid}"][type="set"] query[xmlns="jabber:iq:register"]`, iq).length
|
||||
).pop());
|
||||
|
||||
expect(Strophe.serialize(stanza)).toBe(
|
||||
`<iq from="romeo@montague.lit/orchard" id="${stanza.getAttribute('id')}" to="coven@chat.shakespeare.lit" type="set" xmlns="jabber:client">`+
|
||||
`<query xmlns="jabber:iq:register">`+
|
||||
`<x type="submit" xmlns="jabber:x:data">`+
|
||||
`<field var="FORM_TYPE"><value>http://jabber.org/protocol/muc#register</value></field>`+
|
||||
`<field var="muc#register_roomnick"><value>romeo</value></field>`+
|
||||
`</x>`+
|
||||
`</query>`+
|
||||
`</iq>`);
|
||||
done();
|
||||
}));
|
||||
|
||||
});
|
||||
@ -81,9 +76,9 @@
|
||||
async function (done, _converse) {
|
||||
|
||||
const IQ_stanzas = _converse.connection.IQ_stanzas;
|
||||
const room_jid = 'coven@chat.shakespeare.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get(room_jid);
|
||||
const muc_jid = 'coven@chat.shakespeare.lit';
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get(muc_jid);
|
||||
|
||||
let stanza = await test_utils.waitUntil(() => _.filter(
|
||||
_converse.connection.IQ_stanzas,
|
||||
|
@ -56,7 +56,7 @@
|
||||
{'connection': ['send']}, ['rosterGroupsFetched', 'chatBoxesFetched'], {'view_mode': 'fullscreen'},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get('lounge@montague.lit');
|
||||
|
||||
const contact_jid = 'newguy@montague.lit';
|
||||
@ -291,7 +291,7 @@
|
||||
test_utils.openControlBox();
|
||||
const room_jid = 'kitchen@conference.shakespeare.lit';
|
||||
await test_utils.waitUntil(() => !_.isUndefined(_converse.rooms_list_view), 500);
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'kitchen', 'conference.shakespeare.lit', 'romeo');
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'kitchen@conference.shakespeare.lit', 'romeo');
|
||||
const view = _converse.chatboxviews.get(room_jid);
|
||||
view.model.set({'minimized': true});
|
||||
const contact_jid = mock.cur_names[5].replace(/ /g,'.').toLowerCase() + '@montague.lit';
|
||||
|
@ -49,32 +49,30 @@
|
||||
return describe("Transcripts of chat logs", function () {
|
||||
|
||||
it("can be used to replay conversations",
|
||||
mock.initConverse(
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
function (done, _converse) {
|
||||
mock.initConverse(
|
||||
null, ['rosterGroupsFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
_converse.allow_non_roster_messaging = true;
|
||||
|
||||
test_utils.openAndEnterChatRoom(_converse, 'discuss', 'conference.conversejs.org', 'romeo').then(function () {
|
||||
spyOn(_converse, 'areDesktopNotificationsEnabled').and.returnValue(true);
|
||||
_.each(transcripts, function (transcript) {
|
||||
var text = transcript();
|
||||
var xml = Strophe.xmlHtmlNode(text);
|
||||
_.each(xml.firstElementChild.children, function (el) {
|
||||
_.each(el.children, function (el) {
|
||||
if (el.nodeType === 3) {
|
||||
return; // Ignore text
|
||||
}
|
||||
if (_.includes(IGNORED_TAGS, el.nodeName.toLowerCase())) {
|
||||
return;
|
||||
}
|
||||
var _stanza = traverseElement(el);
|
||||
_converse.connection._dataRecv(test_utils.createRequest(_stanza));
|
||||
});
|
||||
await test_utils.openAndEnterChatRoom(_converse, 'discuss@conference.conversejs.org', 'romeo');
|
||||
spyOn(_converse, 'areDesktopNotificationsEnabled').and.returnValue(true);
|
||||
_.each(transcripts, function (transcript) {
|
||||
const text = transcript();
|
||||
const xml = Strophe.xmlHtmlNode(text);
|
||||
_.each(xml.firstElementChild.children, function (el) {
|
||||
_.each(el.children, function (el) {
|
||||
if (el.nodeType === 3) {
|
||||
return; // Ignore text
|
||||
}
|
||||
if (_.includes(IGNORED_TAGS, el.nodeName.toLowerCase())) {
|
||||
return;
|
||||
}
|
||||
const _stanza = traverseElement(el);
|
||||
_converse.connection._dataRecv(test_utils.createRequest(_stanza));
|
||||
});
|
||||
});
|
||||
done();
|
||||
});
|
||||
done();
|
||||
}));
|
||||
});
|
||||
}));
|
||||
|
@ -164,7 +164,9 @@
|
||||
_converse.connection._dataRecv(utils.createRequest(features_stanza));
|
||||
};
|
||||
|
||||
utils.openAndEnterChatRoom = async function (_converse, room, server, nick, features=[]) {
|
||||
utils.openAndEnterChatRoom = async function (_converse, muc_jid, nick, features=[]) {
|
||||
const room = Strophe.getNodeFromJid(muc_jid);
|
||||
const server = Strophe.getDomainFromJid(muc_jid);
|
||||
const room_jid = `${room}@${server}`.toLowerCase();
|
||||
const stanzas = _converse.connection.IQ_stanzas;
|
||||
await _converse.api.rooms.open(room_jid);
|
||||
|
Loading…
Reference in New Issue
Block a user