Test chatroom message

This commit is contained in:
JC Brand 2013-05-14 23:20:59 +02:00
parent 2a7031b504
commit b35d71e22f
2 changed files with 21 additions and 1 deletions

View File

@ -11,6 +11,10 @@
var chatroom_names = [
'Dyon van de Wege', 'Thomas Kalb', 'Dirk Theissen', 'Felix Hofmann', 'Ka Lek', 'Anne Ebersbacher'
];
closeChatRoom = function (name) {
converse.chatboxesview.views['lounge@muc.localhost'].closeChat();
};
describe("A Chat Room", $.proxy(function () {
beforeEach($.proxy(function () {
if (!$("div#controlbox").is(':visible')) {
@ -54,6 +58,23 @@
expect($(occupant).attr('title')).toBe('This user is a moderator');
}, converse));
it("shows received and sent groupchat messages", $.proxy(function () {
var view = this.chatboxesview.views['lounge@muc.localhost'];
if (!view.$el.find('.chat-area').length) { view.renderChatArea(); }
var nick = chatroom_names[0];
var text = 'This is a received message';
var message = $msg({
from: 'lounge@muc.localhost/'+nick,
id: '1',
to: 'dummy@localhost',
type: 'groupchat'
}).c('body').t(text);
view.onChatRoomMessage(message.nodeTree);
var $chat_content = view.$el.find('.chat-content');
expect($chat_content.find('.chat-message').length).toBe(1);
expect($chat_content.find('.chat-message-content').text()).toBe(text);
}, converse));
it("can be saved to, and retrieved from, localStorage", $.proxy(function () {
// We instantiate a new ChatBoxes collection, which by default
// will be empty.

View File

@ -32,7 +32,6 @@
};
openControlBox = function () {
// Make sure the controlbox is open
if (!$("div#controlbox").is(':visible')) {
$('.toggle-online-users').click();
}