Commit b35d71e2 authored by JC Brand's avatar JC Brand

Test chatroom message

parent 2a7031b5
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
var chatroom_names = [ var chatroom_names = [
'Dyon van de Wege', 'Thomas Kalb', 'Dirk Theissen', 'Felix Hofmann', 'Ka Lek', 'Anne Ebersbacher' '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 () { describe("A Chat Room", $.proxy(function () {
beforeEach($.proxy(function () { beforeEach($.proxy(function () {
if (!$("div#controlbox").is(':visible')) { if (!$("div#controlbox").is(':visible')) {
...@@ -54,6 +58,23 @@ ...@@ -54,6 +58,23 @@
expect($(occupant).attr('title')).toBe('This user is a moderator'); expect($(occupant).attr('title')).toBe('This user is a moderator');
}, converse)); }, 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 () { it("can be saved to, and retrieved from, localStorage", $.proxy(function () {
// We instantiate a new ChatBoxes collection, which by default // We instantiate a new ChatBoxes collection, which by default
// will be empty. // will be empty.
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
}; };
openControlBox = function () { openControlBox = function () {
// Make sure the controlbox is open
if (!$("div#controlbox").is(':visible')) { if (!$("div#controlbox").is(':visible')) {
$('.toggle-online-users').click(); $('.toggle-online-users').click();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment