Work on getting proper separation between tests.
This commit is contained in:
parent
718f75a464
commit
5034ae33f2
@ -3223,6 +3223,7 @@
|
||||
|
||||
this.model.on("remove", function (item) { this.removeRosterItemView(item); }, this);
|
||||
this.model.on("destroy", function (item) { this.removeRosterItemView(item); }, this);
|
||||
this.model.on("reset", function () { this.removeAllRosterItemViewss(); }, this);
|
||||
|
||||
var roster_markup = converse.templates.contacts({
|
||||
'label_contacts': __('My contacts')
|
||||
@ -3263,6 +3264,12 @@
|
||||
return this;
|
||||
},
|
||||
|
||||
removeAllRosterItemViewss: function () {
|
||||
var views = this.removeAll();
|
||||
this.render();
|
||||
return this;
|
||||
},
|
||||
|
||||
removeRosterItemView: function (item) {
|
||||
if (this.get(item.id)) {
|
||||
this.get(item.id).remove();
|
||||
|
@ -32,7 +32,7 @@
|
||||
var online_contacts = this.rosterview.$el.find('dt#xmpp-contacts').siblings('dd.current-xmpp-contact').find('a.open-chat');
|
||||
for (i=0; i<online_contacts.length; i++) {
|
||||
$el = $(online_contacts[i]);
|
||||
jid = $el.text().replace(' ','.').toLowerCase() + '@localhost';
|
||||
jid = $el.text().replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
view = this.rosterview.get(jid);
|
||||
spyOn(view, 'openChat').andCallThrough();
|
||||
view.delegateEvents(); // We need to rebind all events otherwise our spy won't be called
|
||||
@ -63,7 +63,7 @@
|
||||
var online_contacts = this.rosterview.$el.find('dt#xmpp-contacts').siblings('dd.current-xmpp-contact').find('a.open-chat');
|
||||
for (i=0; i<online_contacts.length; i++) {
|
||||
$el = $(online_contacts[i]);
|
||||
jid = $el.text().replace(' ','.').toLowerCase() + '@localhost';
|
||||
jid = $el.text().replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
view = this.rosterview.get(jid);
|
||||
$el.click();
|
||||
expect(this.chatboxviews.trimChats).toHaveBeenCalled();
|
||||
@ -96,7 +96,7 @@
|
||||
}, converse));
|
||||
|
||||
it("is focused if its already open and you click on its corresponding roster item", $.proxy(function () {
|
||||
var contact_jid = mock.cur_names[2].replace(' ','.').toLowerCase() + '@localhost';
|
||||
var contact_jid = mock.cur_names[2].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
var i, $el, click, jid, view, chatboxview, chatbox;
|
||||
// openControlBox was called earlier, so the controlbox is
|
||||
// visible, but no other chat boxes have been created.
|
||||
@ -105,7 +105,7 @@
|
||||
chatboxview = this.chatboxviews.get(contact_jid);
|
||||
spyOn(chatboxview, 'focus');
|
||||
$el = this.rosterview.$el.find('a.open-chat:contains("'+chatbox.get('fullname')+'")');
|
||||
jid = $el.text().replace(' ','.').toLowerCase() + '@localhost';
|
||||
jid = $el.text().replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
view = this.rosterview.get(jid);
|
||||
spyOn(view, 'openChat').andCallThrough();
|
||||
view.delegateEvents(); // We need to rebind all events otherwise our spy won't be called
|
||||
@ -246,7 +246,7 @@
|
||||
|
||||
describe("A chat toolbar", $.proxy(function () {
|
||||
it("can be found on each chat box", $.proxy(function () {
|
||||
var contact_jid = mock.cur_names[2].replace(' ','.').toLowerCase() + '@localhost';
|
||||
var contact_jid = mock.cur_names[2].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
utils.openChatBoxFor(contact_jid);
|
||||
var chatbox = this.chatboxes.get(contact_jid);
|
||||
var view = this.chatboxviews.get(contact_jid);
|
||||
@ -258,7 +258,7 @@
|
||||
}, converse));
|
||||
|
||||
it("contains a button for inserting emoticons", $.proxy(function () {
|
||||
var contact_jid = mock.cur_names[2].replace(' ','.').toLowerCase() + '@localhost';
|
||||
var contact_jid = mock.cur_names[2].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
utils.openChatBoxFor(contact_jid);
|
||||
var view = this.chatboxviews.get(contact_jid);
|
||||
var $toolbar = view.$el.find('ul.chat-toolbar');
|
||||
@ -317,7 +317,7 @@
|
||||
|
||||
it("contains a button for starting an encrypted chat session", $.proxy(function () {
|
||||
// TODO: More tests can be added here...
|
||||
var contact_jid = mock.cur_names[2].replace(' ','.').toLowerCase() + '@localhost';
|
||||
var contact_jid = mock.cur_names[2].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
utils.openChatBoxFor(contact_jid);
|
||||
var view = this.chatboxviews.get(contact_jid);
|
||||
var $toolbar = view.$el.find('ul.chat-toolbar');
|
||||
@ -341,7 +341,7 @@
|
||||
|
||||
it("can contain a button for starting a call", $.proxy(function () {
|
||||
var view, callButton, $toolbar;
|
||||
var contact_jid = mock.cur_names[2].replace(' ','.').toLowerCase() + '@localhost';
|
||||
var contact_jid = mock.cur_names[2].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
spyOn(converse, 'emit');
|
||||
// First check that the button doesn't show if it's not enabled
|
||||
// via "visible_toolbar_buttons"
|
||||
@ -366,7 +366,7 @@
|
||||
|
||||
it("can contain a button for clearing messages", $.proxy(function () {
|
||||
var view, clearButton, $toolbar;
|
||||
var contact_jid = mock.cur_names[2].replace(' ','.').toLowerCase() + '@localhost';
|
||||
var contact_jid = mock.cur_names[2].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
// First check that the button doesn't show if it's not enabled
|
||||
// via "visible_toolbar_buttons"
|
||||
converse.visible_toolbar_buttons.clear = false;
|
||||
@ -406,7 +406,7 @@
|
||||
it("can be received which will open a chatbox and be displayed inside it", $.proxy(function () {
|
||||
spyOn(converse, 'emit');
|
||||
var message = 'This is a received message';
|
||||
var sender_jid = mock.cur_names[0].replace(' ','.').toLowerCase() + '@localhost';
|
||||
var sender_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
msg = $msg({
|
||||
from: sender_jid,
|
||||
to: this.connection.jid,
|
||||
@ -452,7 +452,7 @@
|
||||
|
||||
it("received for a minimized chat box will increment a counter on its header", $.proxy(function () {
|
||||
var contact_name = mock.cur_names[0];
|
||||
var contact_jid = contact_name.replace(' ','.').toLowerCase() + '@localhost';
|
||||
var contact_jid = contact_name.replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
spyOn(this, 'emit');
|
||||
runs(function () {
|
||||
utils.openChatBoxFor(contact_jid);
|
||||
@ -465,7 +465,7 @@
|
||||
var chatview = this.chatboxviews.get(contact_jid);
|
||||
expect(chatview.model.get('minimized')).toBeTruthy();
|
||||
var message = 'This message is sent to a minimized chatbox';
|
||||
var sender_jid = mock.cur_names[0].replace(' ','.').toLowerCase() + '@localhost';
|
||||
var sender_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
msg = $msg({
|
||||
from: sender_jid,
|
||||
to: this.connection.jid,
|
||||
@ -486,7 +486,7 @@
|
||||
expect($count.html()).toBe('1');
|
||||
this.chatboxes.onMessage(
|
||||
$msg({
|
||||
from: mock.cur_names[0].replace(' ','.').toLowerCase() + '@localhost',
|
||||
from: mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost',
|
||||
to: this.connection.jid,
|
||||
type: 'chat',
|
||||
id: (new Date()).getTime()
|
||||
@ -514,7 +514,7 @@
|
||||
it("will indicate when it has a time difference of more than a day between it and its predecessor", $.proxy(function () {
|
||||
spyOn(converse, 'emit');
|
||||
var contact_name = mock.cur_names[1];
|
||||
var contact_jid = contact_name.replace(' ','.').toLowerCase() + '@localhost';
|
||||
var contact_jid = contact_name.replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
utils.openChatBoxFor(contact_jid);
|
||||
utils.clearChatBoxMessages(contact_jid);
|
||||
var one_day_ago = moment();
|
||||
@ -582,7 +582,7 @@
|
||||
|
||||
it("can be sent from a chatbox, and will appear inside it", $.proxy(function () {
|
||||
spyOn(converse, 'emit');
|
||||
var contact_jid = mock.cur_names[0].replace(' ','.').toLowerCase() + '@localhost';
|
||||
var contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
runs(function () {
|
||||
utils.openChatBoxFor(contact_jid);
|
||||
});
|
||||
@ -601,7 +601,7 @@
|
||||
}, converse));
|
||||
|
||||
it("is sanitized to prevent Javascript injection attacks", $.proxy(function () {
|
||||
var contact_jid = mock.cur_names[0].replace(' ','.').toLowerCase() + '@localhost';
|
||||
var contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
utils.openChatBoxFor(contact_jid);
|
||||
var view = this.chatboxviews.get(contact_jid);
|
||||
var message = '<p>This message contains <em>some</em> <b>markup</b></p>';
|
||||
@ -614,7 +614,7 @@
|
||||
}, converse));
|
||||
|
||||
it("can contain hyperlinks, which will be clickable", $.proxy(function () {
|
||||
var contact_jid = mock.cur_names[0].replace(' ','.').toLowerCase() + '@localhost';
|
||||
var contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
utils.openChatBoxFor(contact_jid);
|
||||
var view = this.chatboxviews.get(contact_jid);
|
||||
var message = 'This message contains a hyperlink: www.opkode.com';
|
||||
@ -627,7 +627,7 @@
|
||||
}, converse));
|
||||
|
||||
it("should display emoticons correctly", $.proxy(function () {
|
||||
var contact_jid = mock.cur_names[0].replace(' ','.').toLowerCase() + '@localhost';
|
||||
var contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
utils.openChatBoxFor(contact_jid);
|
||||
var view = this.chatboxviews.get(contact_jid);
|
||||
var messages = [':)', ';)', ':D', ':P', '8)', '>:)', ':S', ':\\', '>:(', ':(', ':O', '(^.^)b', '<3'];
|
||||
@ -651,7 +651,7 @@
|
||||
}, converse));
|
||||
|
||||
it("will have properly escaped URLs", $.proxy(function () {
|
||||
var contact_jid = mock.cur_names[0].replace(' ','.').toLowerCase() + '@localhost';
|
||||
var contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
utils.openChatBoxFor(contact_jid);
|
||||
var view = this.chatboxviews.get(contact_jid);
|
||||
spyOn(view, 'sendMessage').andCallThrough();
|
||||
@ -741,7 +741,7 @@
|
||||
spyOn(converse, 'incrementMsgCounter').andCallThrough();
|
||||
$(window).trigger('blur');
|
||||
var message = 'This message will increment the message counter';
|
||||
var sender_jid = mock.cur_names[0].replace(' ','.').toLowerCase() + '@localhost';
|
||||
var sender_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
msg = $msg({
|
||||
from: sender_jid,
|
||||
to: this.connection.jid,
|
||||
@ -772,7 +772,7 @@
|
||||
spyOn(converse, 'incrementMsgCounter').andCallThrough();
|
||||
$(window).trigger('focus');
|
||||
var message = 'This message will not increment the message counter';
|
||||
var sender_jid = mock.cur_names[0].replace(' ','.').toLowerCase() + '@localhost';
|
||||
var sender_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
msg = $msg({
|
||||
from: sender_jid,
|
||||
to: this.connection.jid,
|
||||
|
@ -205,7 +205,7 @@
|
||||
beforeEach($.proxy(function () {
|
||||
runs(function () {
|
||||
converse.rosterview.model.reset();
|
||||
converse.rosterview.render();
|
||||
utils.createCurrentContacts();
|
||||
});
|
||||
waits(50);
|
||||
runs(function () {
|
||||
@ -218,16 +218,18 @@
|
||||
}, converse));
|
||||
|
||||
it("do not have a heading if there aren't any", $.proxy(function () {
|
||||
converse.rosterview.model.reset();
|
||||
expect(this.rosterview.$el.find('dt#xmpp-contacts').css('display')).toEqual('none');
|
||||
}, converse));
|
||||
|
||||
it("can be added to the roster and they will be sorted alphabetically", $.proxy(function () {
|
||||
var i, t;
|
||||
converse.rosterview.model.reset();
|
||||
spyOn(converse, 'emit');
|
||||
spyOn(this.rosterview, 'render').andCallThrough();
|
||||
for (i=0; i<mock.cur_names.length; i++) {
|
||||
this.roster.create({
|
||||
jid: mock.cur_names[i].replace(' ','.').toLowerCase() + '@localhost',
|
||||
jid: mock.cur_names[i].replace(/ /g,'.').toLowerCase() + '@localhost',
|
||||
subscription: 'both',
|
||||
ask: null,
|
||||
fullname: mock.cur_names[i],
|
||||
@ -249,8 +251,8 @@
|
||||
var item, view, jid, t;
|
||||
spyOn(converse, 'emit');
|
||||
spyOn(this.rosterview, 'render').andCallThrough();
|
||||
for (i=0; i<3; i++) {
|
||||
jid = mock.cur_names[i].replace(' ','.').toLowerCase() + '@localhost';
|
||||
for (i=0; i<mock.cur_names.length; i++) {
|
||||
jid = mock.cur_names[i].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
view = this.rosterview.get(jid);
|
||||
spyOn(view, 'render').andCallThrough();
|
||||
item = view.model;
|
||||
@ -268,8 +270,8 @@
|
||||
var item, view, jid, t;
|
||||
spyOn(converse, 'emit');
|
||||
spyOn(this.rosterview, 'render').andCallThrough();
|
||||
for (i=3; i<6; i++) {
|
||||
jid = mock.cur_names[i].replace(' ','.').toLowerCase() + '@localhost';
|
||||
for (i=0; i<mock.cur_names.length; i++) {
|
||||
jid = mock.cur_names[i].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
view = this.rosterview.get(jid);
|
||||
spyOn(view, 'render').andCallThrough();
|
||||
item = view.model;
|
||||
@ -279,7 +281,7 @@
|
||||
expect(converse.emit).toHaveBeenCalledWith('onRosterViewUpdated');
|
||||
// Check that they are sorted alphabetically
|
||||
t = this.rosterview.$el.find('dt#xmpp-contacts').siblings('dd.current-xmpp-contact.dnd').find('a.open-chat').text();
|
||||
expect(t).toEqual(mock.cur_names.slice(3,i+1).sort().join(''));
|
||||
expect(t).toEqual(mock.cur_names.slice(0,i+1).sort().join(''));
|
||||
}
|
||||
}, converse));
|
||||
|
||||
@ -287,8 +289,8 @@
|
||||
var item, view, jid, t;
|
||||
spyOn(converse, 'emit');
|
||||
spyOn(this.rosterview, 'render').andCallThrough();
|
||||
for (i=6; i<9; i++) {
|
||||
jid = mock.cur_names[i].replace(' ','.').toLowerCase() + '@localhost';
|
||||
for (i=0; i<mock.cur_names.length; i++) {
|
||||
jid = mock.cur_names[i].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
view = this.rosterview.get(jid);
|
||||
spyOn(view, 'render').andCallThrough();
|
||||
item = view.model;
|
||||
@ -298,7 +300,7 @@
|
||||
expect(converse.emit).toHaveBeenCalledWith('onRosterViewUpdated');
|
||||
// Check that they are sorted alphabetically
|
||||
t = this.rosterview.$el.find('dt#xmpp-contacts').siblings('dd.current-xmpp-contact.away').find('a.open-chat').text();
|
||||
expect(t).toEqual(mock.cur_names.slice(6,i+1).sort().join(''));
|
||||
expect(t).toEqual(mock.cur_names.slice(0,i+1).sort().join(''));
|
||||
}
|
||||
}, converse));
|
||||
|
||||
@ -306,7 +308,7 @@
|
||||
var item, view, jid, t;
|
||||
spyOn(converse, 'emit');
|
||||
spyOn(this.rosterview, 'render').andCallThrough();
|
||||
for (i=9; i<12; i++) {
|
||||
for (i=0; i<mock.cur_names.length; i++) {
|
||||
jid = mock.cur_names[i].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
view = this.rosterview.get(jid);
|
||||
spyOn(view, 'render').andCallThrough();
|
||||
@ -317,7 +319,7 @@
|
||||
expect(converse.emit).toHaveBeenCalledWith('onRosterViewUpdated');
|
||||
// Check that they are sorted alphabetically
|
||||
t = this.rosterview.$el.find('dt#xmpp-contacts').siblings('dd.current-xmpp-contact.xa').find('a.open-chat').text();
|
||||
expect(t).toEqual(mock.cur_names.slice(9,i+1).sort().join(''));
|
||||
expect(t).toEqual(mock.cur_names.slice(0,i+1).sort().join(''));
|
||||
}
|
||||
}, converse));
|
||||
|
||||
@ -325,7 +327,7 @@
|
||||
var item, view, jid, t;
|
||||
spyOn(converse, 'emit');
|
||||
spyOn(this.rosterview, 'render').andCallThrough();
|
||||
for (i=12; i<15; i++) {
|
||||
for (i=0; i<mock.cur_names.length; i++) {
|
||||
jid = mock.cur_names[i].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
view = this.rosterview.get(jid);
|
||||
spyOn(view, 'render').andCallThrough();
|
||||
@ -336,13 +338,39 @@
|
||||
expect(converse.emit).toHaveBeenCalledWith('onRosterViewUpdated');
|
||||
// Check that they are sorted alphabetically
|
||||
t = this.rosterview.$el.find('dt#xmpp-contacts').siblings('dd.current-xmpp-contact.unavailable').find('a.open-chat').text();
|
||||
expect(t).toEqual(mock.cur_names.slice(12, i+1).sort().join(''));
|
||||
expect(t).toEqual(mock.cur_names.slice(0, i+1).sort().join(''));
|
||||
}
|
||||
}, converse));
|
||||
|
||||
it("are ordered according to status: online, busy, away, xa, unavailable, offline", $.proxy(function () {
|
||||
var contacts = this.rosterview.$el.find('dd.current-xmpp-contact');
|
||||
var i;
|
||||
for (i=0; i<3; i++) {
|
||||
jid = mock.cur_names[i].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
view = this.rosterview.get(jid);
|
||||
view.model.set('chat_status', 'online');
|
||||
}
|
||||
for (i=3; i<6; i++) {
|
||||
jid = mock.cur_names[i].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
view = this.rosterview.get(jid);
|
||||
view.model.set('chat_status', 'dnd');
|
||||
}
|
||||
for (i=6; i<9; i++) {
|
||||
jid = mock.cur_names[i].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
view = this.rosterview.get(jid);
|
||||
view.model.set('chat_status', 'away');
|
||||
}
|
||||
for (i=9; i<12; i++) {
|
||||
jid = mock.cur_names[i].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
view = this.rosterview.get(jid);
|
||||
view.model.set('chat_status', 'xa');
|
||||
}
|
||||
for (i=12; i<15; i++) {
|
||||
jid = mock.cur_names[i].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
view = this.rosterview.get(jid);
|
||||
view.model.set('chat_status', 'unavailable');
|
||||
}
|
||||
|
||||
var contacts = this.rosterview.$el.find('dd.current-xmpp-contact');
|
||||
for (i=0; i<3; i++) {
|
||||
expect($(contacts[i]).attr('class').split(' ',1)[0]).toEqual('online');
|
||||
}
|
||||
@ -404,7 +432,7 @@
|
||||
// TODO: Testing can be more thorough here, the user is
|
||||
// actually not accepted/authorized because of
|
||||
// mock_connection.
|
||||
var jid = mock.req_names.sort()[0].replace(' ','.').toLowerCase() + '@localhost';
|
||||
var jid = mock.req_names.sort()[0].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
var view = this.rosterview.get(jid);
|
||||
spyOn(this.connection.roster, 'authorize');
|
||||
spyOn(view, 'acceptRequest').andCallThrough();
|
||||
@ -467,7 +495,7 @@
|
||||
// In the next test suite, we need some online contacts, so
|
||||
// we make some online now
|
||||
for (i=0; i<5; i++) {
|
||||
jid = mock.cur_names[i].replace(' ','.').toLowerCase() + '@localhost';
|
||||
jid = mock.cur_names[i].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
view = this.rosterview.get(jid);
|
||||
view.model.set('chat_status', 'online');
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
it("shows chats that have been minimized", $.proxy(function () {
|
||||
var contact_jid, chatview;
|
||||
contact_jid = mock.cur_names[0].replace(' ','.').toLowerCase() + '@localhost';
|
||||
contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
utils.openChatBoxFor(contact_jid);
|
||||
chatview = converse.chatboxviews.get(contact_jid);
|
||||
expect(chatview.model.get('minimized')).toBeFalsy();
|
||||
@ -36,7 +36,7 @@
|
||||
expect(this.minimized_chats.keys().length).toBe(1);
|
||||
expect(this.minimized_chats.keys()[0]).toBe(contact_jid);
|
||||
|
||||
contact_jid = mock.cur_names[1].replace(' ','.').toLowerCase() + '@localhost';
|
||||
contact_jid = mock.cur_names[1].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
utils.openChatBoxFor(contact_jid);
|
||||
chatview = converse.chatboxviews.get(contact_jid);
|
||||
expect(chatview.model.get('minimized')).toBeFalsy();
|
||||
@ -48,7 +48,7 @@
|
||||
}, converse));
|
||||
|
||||
it("can be toggled to hide or show minimized chats", $.proxy(function () {
|
||||
var contact_jid = mock.cur_names[0].replace(' ','.').toLowerCase() + '@localhost';
|
||||
var contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
utils.openChatBoxFor(contact_jid);
|
||||
var chatview = converse.chatboxviews.get(contact_jid);
|
||||
expect(this.minimized_chats.$el.is(':visible')).toBeFalsy();
|
||||
@ -65,11 +65,11 @@
|
||||
|
||||
it("shows the number messages received to minimized chats", $.proxy(function () {
|
||||
var i, contact_jid, chatview, msg;
|
||||
var sender_jid = mock.cur_names[4].replace(' ','.').toLowerCase() + '@localhost';
|
||||
var sender_jid = mock.cur_names[4].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
this.minimized_chats.toggleview.model.set({'collapsed': true});
|
||||
expect(this.minimized_chats.toggleview.$('.unread-message-count').is(':visible')).toBeFalsy();
|
||||
for (i=0; i<3; i++) {
|
||||
contact_jid = mock.cur_names[i].replace(' ','.').toLowerCase() + '@localhost';
|
||||
contact_jid = mock.cur_names[i].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
utils.openChatBoxFor(contact_jid);
|
||||
chatview = converse.chatboxviews.get(contact_jid);
|
||||
chatview.model.set({'minimized': true});
|
||||
|
@ -79,7 +79,7 @@
|
||||
utils.openChatBoxes = function (amount) {
|
||||
var i = 0, jid, views = [];
|
||||
for (i; i<amount; i++) {
|
||||
jid = mock.cur_names[i].replace(' ','.').toLowerCase() + '@localhost';
|
||||
jid = mock.cur_names[i].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||
views[i] = converse.rosterview.get(jid).openChat(mock.event);
|
||||
}
|
||||
return views;
|
||||
@ -106,7 +106,7 @@
|
||||
// for the user's roster.
|
||||
for (i=0; i<mock.cur_names.length; i++) {
|
||||
converse.roster.create({
|
||||
jid: mock.cur_names[i].replace(' ','.').toLowerCase() + '@localhost',
|
||||
jid: mock.cur_names[i].replace(/ /g,'.').toLowerCase() + '@localhost',
|
||||
subscription: 'both',
|
||||
ask: null,
|
||||
fullname: mock.cur_names[i],
|
||||
|
Loading…
Reference in New Issue
Block a user