Add a test to check that moderators are highlighted

This commit is contained in:
JC Brand 2013-05-11 14:34:36 +02:00
parent 6d9fe68a25
commit cc28f7e827

View File

@ -29,7 +29,8 @@
var chatroomview = this.chatboxesview.views['lounge@muc.localhost']; var chatroomview = this.chatboxesview.views['lounge@muc.localhost'];
var $participant_list = chatroomview.$el.find('.participant-list'); var $participant_list = chatroomview.$el.find('.participant-list');
var roster = {}, room = {}, i; var roster = {}, room = {}, i;
for (i=0; i<chatroom_names.length; i++) {
for (i=0; i<chatroom_names.length-1; i++) {
roster[chatroom_names[i]] = {}; roster[chatroom_names[i]] = {};
chatroomview.onChatRoomRoster(roster, room); chatroomview.onChatRoomRoster(roster, room);
expect($participant_list.find('li').length).toBe(1+i); expect($participant_list.find('li').length).toBe(1+i);
@ -39,6 +40,20 @@
chatroomview.onChatRoomRoster(roster, room); chatroomview.onChatRoomRoster(roster, room);
}, converse)); }, converse));
it("indicates moderators by means of a special css class and tooltip", $.proxy(function () {
var chatroomview = this.chatboxesview.views['lounge@muc.localhost'];
var $participant_list = chatroomview.$el.find('.participant-list');
var roster = {}, idx = chatroom_names.length-1;
roster[chatroom_names[idx]] = {};
roster[chatroom_names[idx]].role = 'moderator';
chatroomview.onChatRoomRoster(roster, {});
occupant = $participant_list.find('li');
expect(occupant.length).toBe(1);
expect($(occupant).text()).toBe(chatroom_names[idx]);
expect($(occupant).attr('class')).toBe('moderator');
expect($(occupant).attr('title')).toBe('This user is a moderator');
}, 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.