Commit 044907e4 authored by JC Brand's avatar JC Brand

Looks like `focus` parameter was never used.

parent 401513e6
......@@ -224,16 +224,19 @@
// visible, but no other chat boxes have been created.
expect(_converse.chatboxes.length).toEqual(1);
spyOn(_converse.ChatBoxView.prototype, 'focus');
chatbox = test_utils.openChatBoxFor(_converse, contact_jid);
$el = $(_converse.rosterview.el).find('a.open-chat:contains("'+chatbox.get('fullname')+'")');
jid = $el.text().replace(/ /g,'.').toLowerCase() + '@localhost';
spyOn(_converse, 'emit');
$el[0].click();
expect(_converse.chatboxes.length).toEqual(2);
var chatboxview = _converse.chatboxviews.get(contact_jid);
expect(chatboxview.focus).toHaveBeenCalled();
done();
test_utils.waitUntil(function () {
return _converse.emit.calls.count();
}, 300).then(function () {
expect(_converse.chatboxes.length).toEqual(2);
expect(_converse.emit).toHaveBeenCalledWith('chatBoxFocused', jasmine.any(Object));
done();
});
}));
......@@ -280,9 +283,8 @@
test_utils.createContacts(_converse, 'current');
test_utils.openControlBox();
test_utils.waitUntil(function () {
return $(_converse.rosterview.el).find('.roster-group').length;
}, 300)
.then(function () {
return $(_converse.rosterview.el).find('.roster-group').length;
}, 300).then(function () {
var chatbox = test_utils.openChatBoxes(_converse, 1)[0],
controlview = _converse.chatboxviews.get('controlbox'), // The controlbox is currently open
chatview = _converse.chatboxviews.get(chatbox.get('jid'));
......
......@@ -1083,7 +1083,7 @@
return this;
},
afterShown (focus) {
afterShown () {
if (u.isPersistableModel(this.model)) {
this.model.clearUnreadMsgCounter();
this.model.save();
......@@ -1091,21 +1091,18 @@
this.setChatState(_converse.ACTIVE);
this.renderEmojiPicker();
this.scrollDown();
if (focus) {
this.focus();
}
},
_show (focus) {
_show (f) {
/* Inner show method that gets debounced */
if (u.isVisible(this.el)) {
if (focus) { this.focus(); }
this.focus();
return;
}
u.fadeIn(this.el, _.bind(this.afterShown, this, focus));
u.fadeIn(this.el, _.bind(this.afterShown, this));
},
show (focus) {
show () {
if (_.isUndefined(this.debouncedShow)) {
/* We wrap the method in a debouncer and set it on the
* instance, so that we have it debounced per instance.
......
......@@ -517,7 +517,7 @@
}));
},
afterShown (focus) {
afterShown () {
/* Override from converse-chatview, specifically to avoid
* the 'active' chat state from being sent out prematurely.
*
......@@ -530,18 +530,17 @@
this.occupantsview.setOccupantsHeight();
this.scrollDown();
this.renderEmojiPicker();
if (focus) { this.focus(); }
},
show (focus) {
show () {
if (u.isVisible(this.el)) {
if (focus) { this.focus(); }
this.focus();
return;
}
// Override from converse-chatview in order to not use
// "fadeIn", which causes flashing.
u.showElement(this.el);
this.afterShown(focus);
this.afterShown();
},
afterConnected () {
......
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