Start fixing message count bugs

This commit is contained in:
JC Brand 2014-06-02 21:51:30 +02:00
parent c6a32b847e
commit 0d3c101cbf
2 changed files with 12 additions and 8 deletions

View File

@ -1463,8 +1463,10 @@
},
scrollDown: function () {
var $content = this.$el.find('.chat-content');
var $content = this.$('.chat-content');
if ($content.is(':visible')) {
$content.scrollTop($content[0].scrollHeight);
}
return this;
}
});

View File

@ -464,13 +464,13 @@
runs(function () {
utils.openChatBoxFor(contact_jid);
});
waits(250);
waits(50);
runs(function () {
var chatview = converse.chatboxviews.get(contact_jid);
expect(chatview.model.get('minimized')).toBeFalsy();
chatview.$el.find('.toggle-chatbox-button').click();
});
waits(250);
waits(50);
runs($.proxy(function () {
var chatview = this.chatboxviews.get(contact_jid);
expect(chatview.model.get('minimized')).toBeTruthy();
@ -486,10 +486,12 @@
this.chatboxes.onMessage(msg);
expect(this.emit).toHaveBeenCalledWith('onMessage', msg);
}, converse));
waits(250);
waits(50);
runs($.proxy(function () {
var chatview = this.chatboxviews.get(contact_jid);
var $count = chatview.$el.find('.chat-head-message-count');
var trimmed_chatboxes = this.chatboxviews.trimmed_chatboxes_view;
var trimmedview = trimmed_chatboxes.get(contact_jid);
var $count = trimmedview.$el.find('.chat-head-message-count');
expect(chatview.model.get('minimized')).toBeTruthy();
expect($count.is(':visible')).toBeTruthy();
expect($count.data('count')).toBe(1);
@ -504,7 +506,7 @@
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree()
);
}, converse));
waits(100);
waits(50);
runs($.proxy(function () {
var chatview = this.chatboxviews.get(contact_jid);
var $count = chatview.$el.find('.chat-head-message-count');
@ -514,7 +516,7 @@
expect($count.html()).toBe('2');
chatview.$el.find('.toggle-chatbox-button').click();
}, converse));
waits(250);
waits(50);
runs($.proxy(function () {
var chatview = this.chatboxviews.get(contact_jid);
var $count = chatview.$el.find('.chat-head-message-count');