roomslist: also test that indicators are removed upon maximization

This commit is contained in:
JC Brand 2017-05-24 09:06:17 +02:00
parent c83026e5a8
commit ebc8d243fa
2 changed files with 19 additions and 2 deletions

View File

@ -8,7 +8,7 @@
[jcbrand]
- New non-core plugin `converse-roomslist`, which shows a list of open rooms
in the `Rooms` tab of the control box. [jcbrand]
- Show unread messages for minimized chat rooms. [jcbrand]
- Show unread messages for minimized chats. [jcbrand]
- New configuration setting for `converse-bookmarks`:
[hide_open_bookmarks](https://conversejs.org/docs/html/configurations.html#hide-open-bookmarks)
It is meant to be set to `true` when using `converse-roomslist` so that open

View File

@ -89,7 +89,6 @@
var view = _converse.chatboxviews.get(room_jid);
view.model.set({'minimized': true});
var contact_jid = mock.cur_names[5].replace(/ /g,'.').toLowerCase() + '@localhost';
var nick = mock.chatroom_names[0];
view.handleMUCMessage(
@ -115,6 +114,24 @@
);
var indicator_el = _converse.rooms_list_view.el.querySelector(".msgs-indicactor");
expect(indicator_el.textContent).toBe('1');
view.handleMUCMessage(
$msg({
from: room_jid+'/'+nick,
id: (new Date()).getTime(),
to: 'dummy@localhost',
type: 'groupchat'
}).c('body').t('romeo: and another thing...').tree()
);
indicator_el = _converse.rooms_list_view.el.querySelector(".msgs-indicactor");
expect(indicator_el.textContent).toBe('2');
// When the chat gets maximized again, the unread indicators are removed
view.model.set({'minimized': false});
indicator_el = _converse.rooms_list_view.el.querySelector(".msgs-indicactor");
expect(_.isNull(indicator_el));
room_el = _converse.rooms_list_view.el.querySelector(".available-chatroom");
expect(_.includes(room_el.classList, 'unread-msgs')).toBeFalsy();
}));
});
}));