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