Commit 180d175e authored by JC Brand's avatar JC Brand

Fix tests. Make sure the min chats toggle gets updated

parent e3afc2ec
......@@ -2650,8 +2650,7 @@
},
updateUnreadMessagesCounter: function () {
var count = this.model.get('num_unread') + 1;
this.model.set({'num_unread': count});
this.model.set({'num_unread': this.model.get('num_unread') + 1});
this.render();
},
......@@ -2765,6 +2764,7 @@
initialize: function () {
this.model.on('change:num_minimized', this.render, this);
this.model.on('change:num_unread', this.render, this);
this.$flyout = this.$el.siblings('.minimized-chats-flyout');
},
......
......@@ -483,7 +483,6 @@
var $count = trimmedview.$el.find('.chat-head-message-count');
expect(trimmedview.model.get('minimized')).toBeTruthy();
expect($count.is(':visible')).toBeTruthy();
expect($count.data('count')).toBe(1);
expect($count.html()).toBe('1');
this.chatboxes.onMessage(
$msg({
......@@ -502,7 +501,6 @@
var $count = trimmedview.$el.find('.chat-head-message-count');
expect(trimmedview.model.get('minimized')).toBeTruthy();
expect($count.is(':visible')).toBeTruthy();
expect($count.data('count')).toBe(2);
expect($count.html()).toBe('2');
trimmedview.$el.find('.restore-chat').click();
}, converse));
......
......@@ -18,7 +18,7 @@
runs(function () {
utils.closeControlBox();
});
waits(250);
waits(50);
runs(function () {
// This spec will only pass if the controlbox is not currently
// open yet.
......@@ -30,7 +30,7 @@
this.controlboxtoggle.delegateEvents();
$('.toggle-controlbox').click();
}.bind(converse));
waits(250);
waits(50);
runs(function () {
expect(this.controlboxtoggle.onClick).toHaveBeenCalled();
expect(this.controlboxtoggle.showControlBox).toHaveBeenCalled();
......
......@@ -82,7 +82,7 @@
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree();
this.chatboxes.onMessage(msg);
expect(this.minimized_chats.toggleview.$('.unread-message-count').is(':visible')).toBeTruthy();
expect(this.minimized_chats.toggleview.$('.unread-message-count').text()).toBe(i.toString());
expect(this.minimized_chats.toggleview.$('.unread-message-count').text()).toBe((i+1).toString());
}
}, converse));
......
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