tests: Use u.getUniqueId
instead of time for message ids
This commit is contained in:
parent
fb9fe280ac
commit
0653505a40
@ -37,7 +37,7 @@
|
||||
from: contact_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('body').t('hello world').tree();
|
||||
await _converse.handleMessageStanza(msg);
|
||||
await u.waitUntil(() => view.content.querySelectorAll('.chat-msg').length);
|
||||
@ -58,7 +58,7 @@
|
||||
from: sender_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('body').t(message).up()
|
||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree();
|
||||
|
||||
@ -535,7 +535,7 @@
|
||||
'from': sender_jid,
|
||||
'to': _converse.connection.jid,
|
||||
'type': 'chat',
|
||||
'id': (new Date()).getTime()
|
||||
'id': u.getUniqueId()
|
||||
}).c('composing', {'xmlns': Strophe.NS.CHATSTATES}).tree();
|
||||
|
||||
spyOn(_converse.api, "trigger").and.callThrough();
|
||||
@ -685,7 +685,7 @@
|
||||
from: sender_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('composing', {'xmlns': Strophe.NS.CHATSTATES}).tree();
|
||||
|
||||
spyOn(_converse.api, "trigger").and.callThrough();
|
||||
@ -703,7 +703,7 @@
|
||||
from: sender_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('composing', {'xmlns': Strophe.NS.CHATSTATES}).tree();
|
||||
await _converse.handleMessageStanza(msg);
|
||||
const events = view.el.querySelectorAll('.chat-state-notification');
|
||||
@ -725,7 +725,7 @@
|
||||
const view = await test_utils.openChatBoxFor(_converse, recipient_jid);
|
||||
const msg = $msg({
|
||||
'from': _converse.bare_jid,
|
||||
'id': (new Date()).getTime(),
|
||||
'id': u.getUniqueId(),
|
||||
'to': _converse.connection.jid,
|
||||
'type': 'chat',
|
||||
'xmlns': 'jabber:client'
|
||||
@ -829,7 +829,7 @@
|
||||
from: sender_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('paused', {'xmlns': Strophe.NS.CHATSTATES}).tree();
|
||||
await _converse.handleMessageStanza(msg);
|
||||
expect(_converse.api.trigger).toHaveBeenCalledWith('message', jasmine.any(Object));
|
||||
@ -852,7 +852,7 @@
|
||||
const view = await test_utils.openChatBoxFor(_converse, recipient_jid);
|
||||
const msg = $msg({
|
||||
'from': _converse.bare_jid,
|
||||
'id': (new Date()).getTime(),
|
||||
'id': u.getUniqueId(),
|
||||
'to': _converse.connection.jid,
|
||||
'type': 'chat',
|
||||
'xmlns': 'jabber:client'
|
||||
@ -1021,7 +1021,7 @@
|
||||
from: sender_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('inactive', {'xmlns': Strophe.NS.CHATSTATES}).tree();
|
||||
await _converse.handleMessageStanza(msg);
|
||||
await u.waitUntil(() => (view.model.messages.length > 1));
|
||||
@ -1048,7 +1048,7 @@
|
||||
from: sender_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('body').c('gone', {'xmlns': Strophe.NS.CHATSTATES}).tree();
|
||||
await _converse.handleMessageStanza(msg);
|
||||
expect(_converse.api.trigger).toHaveBeenCalledWith('message', jasmine.any(Object));
|
||||
@ -1128,7 +1128,7 @@
|
||||
from: sender_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('body').t(message).up()
|
||||
.c('active', {'xmlns': Strophe.NS.CHATSTATES}).tree();
|
||||
_converse.windowState = 'hidden';
|
||||
@ -1179,7 +1179,7 @@
|
||||
from: sender_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('body').t(message).up()
|
||||
.c('active', {'xmlns': Strophe.NS.CHATSTATES}).tree();
|
||||
await _converse.handleMessageStanza(msg);
|
||||
@ -1203,7 +1203,7 @@
|
||||
from: sender_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
})
|
||||
.c('body').t(message).up()
|
||||
.c('active', {'xmlns': Strophe.NS.CHATSTATES})
|
||||
|
@ -85,7 +85,7 @@
|
||||
from: sender_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('body').t('hello').up()
|
||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree();
|
||||
_converse.handleMessageStanza(msg);
|
||||
@ -98,7 +98,7 @@
|
||||
from: sender_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('body').t('hello again').up()
|
||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree();
|
||||
_converse.handleMessageStanza(msg);
|
||||
|
@ -155,7 +155,7 @@
|
||||
'from': contact_jid,
|
||||
'to': _converse.connection.jid,
|
||||
'type': 'chat',
|
||||
'id': (new Date()).getTime()
|
||||
'id': u.getUniqueId()
|
||||
}).c('body').t('Hello').up()
|
||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree()
|
||||
);
|
||||
@ -525,7 +525,7 @@
|
||||
from: 'montague.lit',
|
||||
to: _converse.bare_jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('body').t("This headline message will not be shown").tree();
|
||||
await _converse.handleMessageStanza(msg);
|
||||
expect(converse.env.log.info.calledWith(
|
||||
@ -556,7 +556,7 @@
|
||||
const sender_jid = mock.cur_names[1].replace(/ /g,'.').toLowerCase() + '@montague.lit';
|
||||
const msg = $msg({
|
||||
'from': _converse.bare_jid,
|
||||
'id': (new Date()).getTime(),
|
||||
'id': u.getUniqueId(),
|
||||
'to': _converse.connection.jid,
|
||||
'type': 'chat',
|
||||
'xmlns': 'jabber:client'
|
||||
@ -607,7 +607,7 @@
|
||||
const recipient_jid = mock.cur_names[5].replace(/ /g,'.').toLowerCase() + '@montague.lit';
|
||||
const msg = $msg({
|
||||
'from': _converse.bare_jid,
|
||||
'id': (new Date()).getTime(),
|
||||
'id': u.getUniqueId(),
|
||||
'to': _converse.connection.jid,
|
||||
'type': 'chat',
|
||||
'xmlns': 'jabber:client'
|
||||
@ -663,7 +663,7 @@
|
||||
const impersonated_jid = mock.cur_names[2].replace(/ /g,'.').toLowerCase() + '@montague.lit';
|
||||
const msg = $msg({
|
||||
'from': sender_jid,
|
||||
'id': (new Date()).getTime(),
|
||||
'id': u.getUniqueId(),
|
||||
'to': _converse.connection.jid,
|
||||
'type': 'chat',
|
||||
'xmlns': 'jabber:client'
|
||||
@ -714,7 +714,7 @@
|
||||
from: sender_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('body').t(message).up()
|
||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree();
|
||||
await _converse.handleMessageStanza(msg);
|
||||
@ -733,7 +733,7 @@
|
||||
from: mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@montague.lit',
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('body').t('This message is also sent to a minimized chatbox').up()
|
||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree()
|
||||
);
|
||||
@ -1076,7 +1076,7 @@
|
||||
'from': sender_jid,
|
||||
'to': _converse.connection.jid,
|
||||
'type': 'chat',
|
||||
'id': (new Date()).getTime()
|
||||
'id': u.getUniqueId()
|
||||
}).c('body').t('A message').up()
|
||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree());
|
||||
await new Promise(resolve => _converse.on('chatBoxViewInitialized', resolve));
|
||||
@ -1088,7 +1088,7 @@
|
||||
'from': sender_jid,
|
||||
'to': _converse.connection.jid,
|
||||
'type': 'chat',
|
||||
'id': (new Date()).getTime()
|
||||
'id': u.getUniqueId()
|
||||
}).c('body').t("Another message 3 minutes later").up()
|
||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree());
|
||||
await new Promise(resolve => view.once('messageInserted', resolve));
|
||||
@ -1098,7 +1098,7 @@
|
||||
'from': sender_jid,
|
||||
'to': _converse.connection.jid,
|
||||
'type': 'chat',
|
||||
'id': (new Date()).getTime()
|
||||
'id': u.getUniqueId()
|
||||
}).c('body').t("Another message 14 minutes since we started").up()
|
||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree());
|
||||
await new Promise(resolve => view.once('messageInserted', resolve));
|
||||
@ -1395,7 +1395,7 @@
|
||||
'from': sender_jid,
|
||||
'to': _converse.connection.jid,
|
||||
'type': 'chat',
|
||||
'id': (new Date()).getTime()
|
||||
'id': u.getUniqueId()
|
||||
}).c('body').t(message).up()
|
||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree()
|
||||
);
|
||||
@ -1436,7 +1436,7 @@
|
||||
'from': sender_jid,
|
||||
'to': _converse.connection.jid,
|
||||
'type': 'chat',
|
||||
'id': (new Date()).getTime()
|
||||
'id': u.getUniqueId()
|
||||
}).c('body').t(message).up()
|
||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree()
|
||||
);
|
||||
@ -1537,7 +1537,7 @@
|
||||
from: sender_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('body').t(message).up()
|
||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree();
|
||||
|
||||
@ -1585,7 +1585,7 @@
|
||||
from: sender_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('body').t(message).up()
|
||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree();
|
||||
|
||||
@ -1823,7 +1823,7 @@
|
||||
from: sender_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('body').t(message).up()
|
||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree());
|
||||
await new Promise(resolve => view.once('messageInserted', resolve));
|
||||
@ -1858,7 +1858,7 @@
|
||||
from: sender_jid,
|
||||
to: _converse.bare_jid+"/some-other-resource",
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('body').t("This message will not be shown").up()
|
||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree();
|
||||
await _converse.handleMessageStanza(msg);
|
||||
|
102
spec/minchats.js
102
spec/minchats.js
@ -70,7 +70,7 @@
|
||||
['rosterGroupsFetched', 'chatBoxesFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.waitForRoster(_converse, 'current');
|
||||
await test_utils.waitForRoster(_converse, 'current', 4);
|
||||
await test_utils.openControlBox(_converse);
|
||||
_converse.minimized_chats.initToggle();
|
||||
|
||||
@ -84,61 +84,61 @@
|
||||
contact_jid = mock.cur_names[i].replace(/ /g,'.').toLowerCase() + '@montague.lit';
|
||||
test_utils.openChatBoxFor(_converse, contact_jid);
|
||||
}
|
||||
u.waitUntil(() => _converse.chatboxes.length == 4).then(() => {
|
||||
for (i=0; i<3; i++) {
|
||||
chatview = _converse.chatboxviews.get(contact_jid);
|
||||
chatview.model.set({'minimized': true});
|
||||
msg = $msg({
|
||||
from: contact_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
}).c('body').t('This message is sent to a minimized chatbox').up()
|
||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree();
|
||||
_converse.handleMessageStanza(msg);
|
||||
}
|
||||
return u.waitUntil(() => chatview.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((3).toString());
|
||||
// Chat state notifications don't increment the unread messages counter
|
||||
// <composing> state
|
||||
_converse.handleMessageStanza($msg({
|
||||
from: contact_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
}).c('composing', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree());
|
||||
expect(_converse.minimized_chats.toggleview.el.querySelector('.unread-message-count').textContent).toBe((i).toString());
|
||||
await u.waitUntil(() => _converse.chatboxes.length == 4);
|
||||
|
||||
// <paused> state
|
||||
_converse.handleMessageStanza($msg({
|
||||
chatview = _converse.chatboxviews.get(contact_jid);
|
||||
chatview.model.set({'minimized': true});
|
||||
for (i=0; i<3; i++) {
|
||||
msg = $msg({
|
||||
from: contact_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
}).c('paused', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree());
|
||||
expect(_converse.minimized_chats.toggleview.el.querySelector('.unread-message-count').textContent).toBe((i).toString());
|
||||
id: u.getUniqueId()
|
||||
}).c('body').t('This message is sent to a minimized chatbox').up()
|
||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree();
|
||||
_converse.handleMessageStanza(msg);
|
||||
}
|
||||
await u.waitUntil(() => chatview.model.messages.length === 3, 500);
|
||||
|
||||
// <gone> state
|
||||
_converse.handleMessageStanza($msg({
|
||||
from: contact_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
}).c('gone', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree());
|
||||
expect(_converse.minimized_chats.toggleview.el.querySelector('.unread-message-count').textContent).toBe((i).toString());
|
||||
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((3).toString());
|
||||
// Chat state notifications don't increment the unread messages counter
|
||||
// <composing> state
|
||||
_converse.handleMessageStanza($msg({
|
||||
from: contact_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: u.getUniqueId()
|
||||
}).c('composing', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree());
|
||||
expect(_converse.minimized_chats.toggleview.el.querySelector('.unread-message-count').textContent).toBe((i).toString());
|
||||
|
||||
// <inactive> state
|
||||
_converse.handleMessageStanza($msg({
|
||||
from: contact_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
}).c('inactive', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree());
|
||||
expect(_converse.minimized_chats.toggleview.el.querySelector('.unread-message-count').textContent).toBe((i).toString());
|
||||
done();
|
||||
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL))
|
||||
// <paused> state
|
||||
_converse.handleMessageStanza($msg({
|
||||
from: contact_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: u.getUniqueId()
|
||||
}).c('paused', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree());
|
||||
expect(_converse.minimized_chats.toggleview.el.querySelector('.unread-message-count').textContent).toBe((i).toString());
|
||||
|
||||
// <gone> state
|
||||
_converse.handleMessageStanza($msg({
|
||||
from: contact_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: u.getUniqueId()
|
||||
}).c('gone', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree());
|
||||
expect(_converse.minimized_chats.toggleview.el.querySelector('.unread-message-count').textContent).toBe((i).toString());
|
||||
|
||||
// <inactive> state
|
||||
_converse.handleMessageStanza($msg({
|
||||
from: contact_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: u.getUniqueId()
|
||||
}).c('inactive', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree());
|
||||
expect(_converse.minimized_chats.toggleview.el.querySelector('.unread-message-count').textContent).toBe((i).toString());
|
||||
done();
|
||||
}));
|
||||
|
||||
it("shows the number messages received to minimized groupchats",
|
||||
@ -154,7 +154,7 @@
|
||||
const nick = mock.chatroom_names[0];
|
||||
const msg = $msg({
|
||||
from: muc_jid+'/'+nick,
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').t(message).tree();
|
||||
|
36
spec/muc.js
36
spec/muc.js
@ -490,7 +490,7 @@
|
||||
nick = mock.chatroom_names[0],
|
||||
msg = $msg({
|
||||
'from': 'lounge@montague.lit/'+nick,
|
||||
'id': (new Date()).getTime(),
|
||||
'id': u.getUniqueId(),
|
||||
'to': 'romeo@montague.lit',
|
||||
'type': 'groupchat'
|
||||
}).c('body').t(message).tree();
|
||||
@ -521,7 +521,7 @@
|
||||
nick = mock.chatroom_names[0],
|
||||
msg = $msg({
|
||||
'from': 'lounge@montague.lit/'+nick,
|
||||
'id': (new Date()).getTime(),
|
||||
'id': u.getUniqueId(),
|
||||
'to': 'romeo@montague.lit',
|
||||
'type': 'groupchat'
|
||||
}).c('body').t(message).tree();
|
||||
@ -644,7 +644,7 @@
|
||||
|
||||
const msg = $msg({
|
||||
'from': 'coven@chat.shakespeare.lit/some1',
|
||||
'id': (new Date()).getTime(),
|
||||
'id': u.getUniqueId(),
|
||||
'to': 'romeo@montague.lit',
|
||||
'type': 'groupchat'
|
||||
}).c('body').t('hello world').tree();
|
||||
@ -1109,7 +1109,7 @@
|
||||
const view = _converse.chatboxviews.get('conversations@conference.siacs.eu');
|
||||
const msg = $msg({
|
||||
'from': 'conversations@conference.siacs.eu/romeo',
|
||||
'id': (new Date()).getTime(),
|
||||
'id': u.getUniqueId(),
|
||||
'to': 'romeo@montague.lit',
|
||||
'type': 'groupchat'
|
||||
}).c('body').t('Some message').tree();
|
||||
@ -1325,7 +1325,7 @@
|
||||
const nick = mock.chatroom_names[0];
|
||||
let msg = $msg({
|
||||
'from': 'lounge@montague.lit/'+nick,
|
||||
'id': (new Date()).getTime(),
|
||||
'id': u.getUniqueId(),
|
||||
'to': 'romeo@montague.lit',
|
||||
'type': 'groupchat'
|
||||
}).c('body').t(message).tree();
|
||||
@ -1336,7 +1336,7 @@
|
||||
message = '/me is as well';
|
||||
msg = $msg({
|
||||
from: 'lounge@montague.lit/Romeo Montague',
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').t(message).tree();
|
||||
@ -2134,7 +2134,7 @@
|
||||
from: 'lounge@montague.lit/someone',
|
||||
to: 'romeo@montague.lit.com',
|
||||
type: 'groupchat',
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
}).c('body').t('Message: '+i).tree())
|
||||
);
|
||||
}
|
||||
@ -2147,7 +2147,7 @@
|
||||
from: 'lounge@montague.lit/someone',
|
||||
to: 'romeo@montague.lit.com',
|
||||
type: 'groupchat',
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
}).c('body').t(message).tree());
|
||||
// Now check that the message appears inside the chatbox in the DOM
|
||||
const chat_content = view.el.querySelector('.chat-content');
|
||||
@ -4948,7 +4948,7 @@
|
||||
|
||||
await view.model.onMessage($msg({
|
||||
from: muc_jid+'/'+nick,
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').t(message).tree());
|
||||
@ -4959,7 +4959,7 @@
|
||||
|
||||
await view.model.onMessage($msg({
|
||||
'from': muc_jid+'/'+nick,
|
||||
'id': (new Date()).getTime(),
|
||||
'id': u.getUniqueId(),
|
||||
'to': 'romeo@montague.lit',
|
||||
'type': 'groupchat'
|
||||
}).c('body').t(message).tree());
|
||||
@ -5078,7 +5078,7 @@
|
||||
// <composing> state
|
||||
let msg = $msg({
|
||||
from: muc_jid+'/newguy',
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').c('composing', {'xmlns': Strophe.NS.CHATSTATES}).tree();
|
||||
@ -5103,7 +5103,7 @@
|
||||
// Check that it doesn't appear twice
|
||||
msg = $msg({
|
||||
from: muc_jid+'/newguy',
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').c('composing', {'xmlns': Strophe.NS.CHATSTATES}).tree();
|
||||
@ -5123,7 +5123,7 @@
|
||||
// <composing> state for a different occupant
|
||||
msg = $msg({
|
||||
from: muc_jid+'/nomorenicks',
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').c('composing', {'xmlns': Strophe.NS.CHATSTATES}).tree();
|
||||
@ -5143,7 +5143,7 @@
|
||||
// Check that new messages appear under the chat state notifications
|
||||
msg = $msg({
|
||||
from: `${muc_jid}/some1`,
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').t('hello world').tree();
|
||||
@ -5248,7 +5248,7 @@
|
||||
// <composing> state
|
||||
var msg = $msg({
|
||||
from: muc_jid+'/newguy',
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').c('composing', {'xmlns': Strophe.NS.CHATSTATES}).tree();
|
||||
@ -5269,7 +5269,7 @@
|
||||
// Check that it doesn't appear twice
|
||||
msg = $msg({
|
||||
from: muc_jid+'/newguy',
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').c('composing', {'xmlns': Strophe.NS.CHATSTATES}).tree();
|
||||
@ -5288,7 +5288,7 @@
|
||||
// <composing> state for a different occupant
|
||||
msg = $msg({
|
||||
from: muc_jid+'/nomorenicks',
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').c('composing', {'xmlns': Strophe.NS.CHATSTATES}).tree();
|
||||
@ -5311,7 +5311,7 @@
|
||||
// <paused> state from occupant who typed first
|
||||
msg = $msg({
|
||||
from: muc_jid+'/newguy',
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').c('paused', {'xmlns': Strophe.NS.CHATSTATES}).tree();
|
||||
|
@ -116,7 +116,7 @@
|
||||
const nick = mock.chatroom_names[0],
|
||||
msg = $msg({
|
||||
from: 'lounge@montague.lit/'+nick,
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').t(message).tree();
|
||||
@ -322,7 +322,7 @@
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
let msg = $msg({
|
||||
from: 'lounge@montague.lit/romeo',
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').t('I wrote this message!').tree();
|
||||
@ -348,7 +348,7 @@
|
||||
|
||||
msg = $msg({
|
||||
from: 'lounge@montague.lit/romeo',
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').t('Another message!').tree();
|
||||
@ -383,7 +383,7 @@
|
||||
const add_events = view.model.occupants._events.add.length;
|
||||
msg = $msg({
|
||||
from: 'lounge@montague.lit/some1',
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').t('Message from someone not in the MUC right now').tree();
|
||||
@ -447,7 +447,7 @@
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
const msg = $msg({
|
||||
from: 'lounge@montague.lit/romeo',
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').t('I wrote this message!').tree();
|
||||
@ -599,7 +599,7 @@
|
||||
// Check that messages from other users are skipped
|
||||
await view.model.onMessage($msg({
|
||||
'from': muc_jid+'/someone-else',
|
||||
'id': (new Date()).getTime(),
|
||||
'id': u.getUniqueId(),
|
||||
'to': 'romeo@montague.lit',
|
||||
'type': 'groupchat'
|
||||
}).c('body').t('Hello world').tree());
|
||||
@ -835,7 +835,7 @@
|
||||
});
|
||||
const msg = $msg({
|
||||
from: 'lounge@montague.lit/gibson',
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').t('hello z3r0 tom mr.robot, how are you?').up()
|
||||
|
@ -27,7 +27,7 @@
|
||||
from: sender_jid,
|
||||
to: _converse.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
id: u.getUniqueId()
|
||||
}).c('body').t(message).up()
|
||||
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree();
|
||||
await _converse.handleMessageStanza(msg); // This will emit 'message'
|
||||
@ -62,7 +62,7 @@
|
||||
const nick = mock.chatroom_names[0],
|
||||
msg = $msg({
|
||||
from: 'lounge@montague.lit/'+nick,
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').t(message).tree();
|
||||
|
@ -286,7 +286,7 @@
|
||||
await view.model.onMessage(
|
||||
$msg({
|
||||
from: room_jid+'/'+nick,
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').t('foo').tree());
|
||||
@ -300,7 +300,7 @@
|
||||
await view.model.onMessage(
|
||||
$msg({
|
||||
from: room_jid+'/'+nick,
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').t('romeo: Your attention is required').tree()
|
||||
@ -313,7 +313,7 @@
|
||||
await view.model.onMessage(
|
||||
$msg({
|
||||
from: room_jid+'/'+nick,
|
||||
id: (new Date()).getTime(),
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').t('romeo: and another thing...').tree()
|
||||
|
Loading…
Reference in New Issue
Block a user