Make sure to enter chatroom in test
This commit is contained in:
parent
097d992d13
commit
62cdd03562
@ -1440,24 +1440,33 @@
|
|||||||
null, ['rosterGroupsFetched'], {},
|
null, ['rosterGroupsFetched'], {},
|
||||||
function (done, _converse) {
|
function (done, _converse) {
|
||||||
|
|
||||||
test_utils.openChatRoom(_converse, 'lounge', 'localhost', 'dummy');
|
test_utils.openAndEnterChatRoom(_converse, 'lounge', 'localhost', 'dummy').then(function () {
|
||||||
spyOn(_converse, 'emit');
|
spyOn(_converse, 'emit');
|
||||||
var view = _converse.chatboxviews.get('lounge@localhost');
|
var view = _converse.chatboxviews.get('lounge@localhost');
|
||||||
if (!$(view.el).find('.chat-area').length) { view.renderChatArea(); }
|
|
||||||
var nick = mock.chatroom_names[0];
|
|
||||||
var text = 'This is a received message';
|
if (!$(view.el).find('.chat-area').length) { view.renderChatArea(); }
|
||||||
var message = $msg({
|
var nick = mock.chatroom_names[0];
|
||||||
from: 'lounge@localhost/'+nick,
|
|
||||||
id: '1',
|
view.model.occupants.create({
|
||||||
to: 'dummy@localhost',
|
'nick': nick,
|
||||||
type: 'groupchat'
|
'muc_jid': `${view.model.get('jid')}/${nick}`
|
||||||
}).c('body').t(text);
|
});
|
||||||
view.model.onMessage(message.nodeTree);
|
|
||||||
var $chat_content = $(view.el).find('.chat-content');
|
var text = 'This is a received message';
|
||||||
expect($chat_content.find('.chat-msg').length).toBe(1);
|
var message = $msg({
|
||||||
expect($chat_content.find('.chat-msg-text').text()).toBe(text);
|
from: 'lounge@localhost/'+nick,
|
||||||
expect(_converse.emit).toHaveBeenCalledWith('message', jasmine.any(Object));
|
id: '1',
|
||||||
done();
|
to: 'dummy@localhost',
|
||||||
|
type: 'groupchat'
|
||||||
|
}).c('body').t(text);
|
||||||
|
view.model.onMessage(message.nodeTree);
|
||||||
|
var $chat_content = $(view.el).find('.chat-content');
|
||||||
|
expect($chat_content.find('.chat-msg').length).toBe(1);
|
||||||
|
expect($chat_content.find('.chat-msg-text').text()).toBe(text);
|
||||||
|
expect(_converse.emit).toHaveBeenCalledWith('message', jasmine.any(Object));
|
||||||
|
done();
|
||||||
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("shows sent groupchat messages",
|
it("shows sent groupchat messages",
|
||||||
|
Loading…
Reference in New Issue
Block a user