Rename ChatBoxesView to ChatBoxViews
This commit is contained in:
parent
1567b212c3
commit
b14538b441
20
converse.js
20
converse.js
@ -348,7 +348,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.showLoginButton = function () {
|
this.showLoginButton = function () {
|
||||||
var view = converse.chatboxesview.get('controlbox');
|
var view = converse.chatboxviews.get('controlbox');
|
||||||
if (typeof view.loginpanel !== 'undefined') {
|
if (typeof view.loginpanel !== 'undefined') {
|
||||||
view.loginpanel.showLoginButton();
|
view.loginpanel.showLoginButton();
|
||||||
}
|
}
|
||||||
@ -893,7 +893,7 @@
|
|||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.updateVCard();
|
this.updateVCard();
|
||||||
this.$el.appendTo(converse.chatboxesview.$el);
|
this.$el.appendTo(converse.chatboxviews.$el);
|
||||||
this.render().show().focus().model.messages.fetch({add: true});
|
this.render().show().focus().model.messages.fetch({add: true});
|
||||||
if (this.model.get('status')) {
|
if (this.model.get('status')) {
|
||||||
this.showStatusMessage(this.model.get('status'));
|
this.showStatusMessage(this.model.get('status'));
|
||||||
@ -1750,7 +1750,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!nick) { return; }
|
if (!nick) { return; }
|
||||||
chatroom = converse.chatboxesview.showChatBox({
|
chatroom = converse.chatboxviews.showChatBox({
|
||||||
'id': jid,
|
'id': jid,
|
||||||
'jid': jid,
|
'jid': jid,
|
||||||
'name': Strophe.unescapeNode(Strophe.getNodeFromJid(jid)),
|
'name': Strophe.unescapeNode(Strophe.getNodeFromJid(jid)),
|
||||||
@ -1759,7 +1759,7 @@
|
|||||||
'box_id' : hex_sha1(jid)
|
'box_id' : hex_sha1(jid)
|
||||||
});
|
});
|
||||||
if (!chatroom.get('connected')) {
|
if (!chatroom.get('connected')) {
|
||||||
converse.chatboxesview.get(jid).connect(null);
|
converse.chatboxviews.get(jid).connect(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1775,7 +1775,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
this.$el.appendTo(converse.chatboxesview.$el);
|
this.$el.appendTo(converse.chatboxviews.$el);
|
||||||
this.model.on('change', $.proxy(function (item, changed) {
|
this.model.on('change', $.proxy(function (item, changed) {
|
||||||
var i;
|
var i;
|
||||||
if (_.has(item.changed, 'connected')) {
|
if (_.has(item.changed, 'connected')) {
|
||||||
@ -1898,7 +1898,7 @@
|
|||||||
undefined);
|
undefined);
|
||||||
},
|
},
|
||||||
this);
|
this);
|
||||||
this.$el.appendTo(converse.chatboxesview.$el);
|
this.$el.appendTo(converse.chatboxviews.$el);
|
||||||
this.render().show().model.messages.fetch({add: true});
|
this.render().show().model.messages.fetch({add: true});
|
||||||
this.initDragResize();
|
this.initDragResize();
|
||||||
},
|
},
|
||||||
@ -2351,7 +2351,7 @@
|
|||||||
|
|
||||||
onChatRoomRoster: function (roster, room) {
|
onChatRoomRoster: function (roster, room) {
|
||||||
this.renderChatArea();
|
this.renderChatArea();
|
||||||
var controlboxview = converse.chatboxesview.get('controlbox'),
|
var controlboxview = converse.chatboxviews.get('controlbox'),
|
||||||
roster_size = _.size(roster),
|
roster_size = _.size(roster),
|
||||||
$participant_list = this.$el.find('.participant-list'),
|
$participant_list = this.$el.find('.participant-list'),
|
||||||
participants = [], keys = _.keys(roster), i;
|
participants = [], keys = _.keys(roster), i;
|
||||||
@ -2462,7 +2462,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.ChatBoxesView = Backbone.View.extend({
|
this.ChatBoxViews = Backbone.View.extend({
|
||||||
el: '#conversejs',
|
el: '#conversejs',
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
@ -2539,7 +2539,7 @@
|
|||||||
|
|
||||||
openChat: function (ev) {
|
openChat: function (ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
return converse.chatboxesview.showChatBox({
|
return converse.chatboxviews.showChatBox({
|
||||||
'id': this.model.get('jid'),
|
'id': this.model.get('jid'),
|
||||||
'jid': this.model.get('jid'),
|
'jid': this.model.get('jid'),
|
||||||
'fullname': this.model.get('fullname'),
|
'fullname': this.model.get('fullname'),
|
||||||
@ -3467,7 +3467,7 @@
|
|||||||
// --------------
|
// --------------
|
||||||
// This is the end of the initialize method.
|
// This is the end of the initialize method.
|
||||||
this.chatboxes = new this.ChatBoxes();
|
this.chatboxes = new this.ChatBoxes();
|
||||||
this.chatboxesview = new this.ChatBoxesView({model: this.chatboxes});
|
this.chatboxviews = new this.ChatBoxViews({model: this.chatboxes});
|
||||||
this.controlboxtoggle = new this.ControlBoxToggle();
|
this.controlboxtoggle = new this.ControlBoxToggle();
|
||||||
this.otr = new this.OTR();
|
this.otr = new this.OTR();
|
||||||
|
|
||||||
|
@ -79,8 +79,8 @@
|
|||||||
|
|
||||||
it("can be closed by clicking a DOM element with class 'close-chatbox-button'", $.proxy(function () {
|
it("can be closed by clicking a DOM element with class 'close-chatbox-button'", $.proxy(function () {
|
||||||
var chatbox = utils.openChatBoxes(1)[0],
|
var chatbox = utils.openChatBoxes(1)[0],
|
||||||
controlview = this.chatboxesview.get('controlbox'), // The controlbox is currently open
|
controlview = this.chatboxviews.get('controlbox'), // The controlbox is currently open
|
||||||
chatview = this.chatboxesview.get(chatbox.get('jid'));
|
chatview = this.chatboxviews.get(chatbox.get('jid'));
|
||||||
spyOn(chatview, 'closeChat').andCallThrough();
|
spyOn(chatview, 'closeChat').andCallThrough();
|
||||||
spyOn(controlview, 'closeChat').andCallThrough();
|
spyOn(controlview, 'closeChat').andCallThrough();
|
||||||
spyOn(converse, 'emit');
|
spyOn(converse, 'emit');
|
||||||
@ -141,7 +141,7 @@
|
|||||||
var contact_jid = mock.cur_names[2].replace(' ','.').toLowerCase() + '@localhost';
|
var contact_jid = mock.cur_names[2].replace(' ','.').toLowerCase() + '@localhost';
|
||||||
utils.openChatBoxFor(contact_jid);
|
utils.openChatBoxFor(contact_jid);
|
||||||
var chatbox = this.chatboxes.get(contact_jid);
|
var chatbox = this.chatboxes.get(contact_jid);
|
||||||
var view = this.chatboxesview.get(contact_jid);
|
var view = this.chatboxviews.get(contact_jid);
|
||||||
expect(chatbox).toBeDefined();
|
expect(chatbox).toBeDefined();
|
||||||
expect(view).toBeDefined();
|
expect(view).toBeDefined();
|
||||||
var $toolbar = view.$el.find('ul.chat-toolbar');
|
var $toolbar = view.$el.find('ul.chat-toolbar');
|
||||||
@ -153,7 +153,7 @@
|
|||||||
var contact_jid = mock.cur_names[2].replace(' ','.').toLowerCase() + '@localhost';
|
var contact_jid = mock.cur_names[2].replace(' ','.').toLowerCase() + '@localhost';
|
||||||
utils.openChatBoxFor(contact_jid);
|
utils.openChatBoxFor(contact_jid);
|
||||||
var chatbox = this.chatboxes.get(contact_jid);
|
var chatbox = this.chatboxes.get(contact_jid);
|
||||||
var view = this.chatboxesview.get(contact_jid);
|
var view = this.chatboxviews.get(contact_jid);
|
||||||
var $toolbar = view.$el.find('ul.chat-toolbar');
|
var $toolbar = view.$el.find('ul.chat-toolbar');
|
||||||
var $textarea = view.$el.find('textarea.chat-textarea');
|
var $textarea = view.$el.find('textarea.chat-textarea');
|
||||||
expect($toolbar.children('li.toggle-smiley').length).toBe(1);
|
expect($toolbar.children('li.toggle-smiley').length).toBe(1);
|
||||||
@ -213,7 +213,7 @@
|
|||||||
var contact_jid = mock.cur_names[2].replace(' ','.').toLowerCase() + '@localhost';
|
var contact_jid = mock.cur_names[2].replace(' ','.').toLowerCase() + '@localhost';
|
||||||
utils.openChatBoxFor(contact_jid);
|
utils.openChatBoxFor(contact_jid);
|
||||||
var chatbox = this.chatboxes.get(contact_jid);
|
var chatbox = this.chatboxes.get(contact_jid);
|
||||||
var view = this.chatboxesview.get(contact_jid);
|
var view = this.chatboxviews.get(contact_jid);
|
||||||
var $toolbar = view.$el.find('ul.chat-toolbar');
|
var $toolbar = view.$el.find('ul.chat-toolbar');
|
||||||
expect($toolbar.children('li.toggle-otr').length).toBe(1);
|
expect($toolbar.children('li.toggle-otr').length).toBe(1);
|
||||||
// Register spies
|
// Register spies
|
||||||
@ -239,7 +239,7 @@
|
|||||||
var contact_jid = mock.cur_names[2].replace(' ','.').toLowerCase() + '@localhost';
|
var contact_jid = mock.cur_names[2].replace(' ','.').toLowerCase() + '@localhost';
|
||||||
utils.openChatBoxFor(contact_jid);
|
utils.openChatBoxFor(contact_jid);
|
||||||
var chatbox = this.chatboxes.get(contact_jid);
|
var chatbox = this.chatboxes.get(contact_jid);
|
||||||
var view = this.chatboxesview.get(contact_jid);
|
var view = this.chatboxviews.get(contact_jid);
|
||||||
var $toolbar = view.$el.find('ul.chat-toolbar');
|
var $toolbar = view.$el.find('ul.chat-toolbar');
|
||||||
var callButton = $toolbar.find('.toggle-call');
|
var callButton = $toolbar.find('.toggle-call');
|
||||||
|
|
||||||
@ -278,7 +278,7 @@
|
|||||||
runs($.proxy(function () {
|
runs($.proxy(function () {
|
||||||
// Check that the chatbox and its view now exist
|
// Check that the chatbox and its view now exist
|
||||||
var chatbox = this.chatboxes.get(sender_jid);
|
var chatbox = this.chatboxes.get(sender_jid);
|
||||||
var chatboxview = this.chatboxesview.get(sender_jid);
|
var chatboxview = this.chatboxviews.get(sender_jid);
|
||||||
expect(chatbox).toBeDefined();
|
expect(chatbox).toBeDefined();
|
||||||
expect(chatboxview).toBeDefined();
|
expect(chatboxview).toBeDefined();
|
||||||
// Check that the message was received and check the
|
// Check that the message was received and check the
|
||||||
@ -311,7 +311,7 @@
|
|||||||
var one_day_ago = new Date(new Date().setDate(new Date().getDate()-1));
|
var one_day_ago = new Date(new Date().setDate(new Date().getDate()-1));
|
||||||
var message = 'This is a day old message';
|
var message = 'This is a day old message';
|
||||||
var chatbox = this.chatboxes.get(contact_jid);
|
var chatbox = this.chatboxes.get(contact_jid);
|
||||||
var chatboxview = this.chatboxesview.get(contact_jid);
|
var chatboxview = this.chatboxviews.get(contact_jid);
|
||||||
var $chat_content = chatboxview.$el.find('.chat-content');
|
var $chat_content = chatboxview.$el.find('.chat-content');
|
||||||
var msg_obj;
|
var msg_obj;
|
||||||
var msg_txt;
|
var msg_txt;
|
||||||
@ -380,7 +380,7 @@
|
|||||||
waits(250);
|
waits(250);
|
||||||
runs(function () {
|
runs(function () {
|
||||||
expect(converse.emit).toHaveBeenCalledWith('onChatBoxFocused', jasmine.any(Object));
|
expect(converse.emit).toHaveBeenCalledWith('onChatBoxFocused', jasmine.any(Object));
|
||||||
var view = this.chatboxesview.get(contact_jid);
|
var view = this.chatboxviews.get(contact_jid);
|
||||||
var message = 'This message is sent from this chatbox';
|
var message = 'This message is sent from this chatbox';
|
||||||
spyOn(view, 'sendMessage').andCallThrough();
|
spyOn(view, 'sendMessage').andCallThrough();
|
||||||
view.$el.find('.chat-textarea').text(message);
|
view.$el.find('.chat-textarea').text(message);
|
||||||
@ -396,7 +396,7 @@
|
|||||||
it("are sanitized to prevent Javascript injection attacks", $.proxy(function () {
|
it("are 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(' ','.').toLowerCase() + '@localhost';
|
||||||
utils.openChatBoxFor(contact_jid);
|
utils.openChatBoxFor(contact_jid);
|
||||||
var view = this.chatboxesview.get(contact_jid);
|
var view = this.chatboxviews.get(contact_jid);
|
||||||
var message = 'This message contains <b>markup</b>';
|
var message = 'This message contains <b>markup</b>';
|
||||||
spyOn(view, 'sendMessage').andCallThrough();
|
spyOn(view, 'sendMessage').andCallThrough();
|
||||||
view.$el.find('.chat-textarea').text(message);
|
view.$el.find('.chat-textarea').text(message);
|
||||||
@ -413,7 +413,7 @@
|
|||||||
it("'/clear' can be used to clear messages in a conversation", $.proxy(function () {
|
it("'/clear' can be used to clear messages in a conversation", $.proxy(function () {
|
||||||
spyOn(converse, 'emit');
|
spyOn(converse, 'emit');
|
||||||
var contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
|
var contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
|
||||||
var view = this.chatboxesview.get(contact_jid);
|
var view = this.chatboxviews.get(contact_jid);
|
||||||
var message = 'This message is another sent from this chatbox';
|
var message = 'This message is another sent from this chatbox';
|
||||||
// Lets make sure there is at least one message already
|
// Lets make sure there is at least one message already
|
||||||
// (e.g for when this test is run on its own).
|
// (e.g for when this test is run on its own).
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
waits(300);
|
waits(300);
|
||||||
runs(function () {
|
runs(function () {
|
||||||
// Open a new chatroom
|
// Open a new chatroom
|
||||||
var roomspanel = converse.chatboxesview.get('controlbox').roomspanel;
|
var roomspanel = converse.chatboxviews.get('controlbox').roomspanel;
|
||||||
var $input = roomspanel.$el.find('input.new-chatroom-name');
|
var $input = roomspanel.$el.find('input.new-chatroom-name');
|
||||||
var $nick = roomspanel.$el.find('input.new-chatroom-nick');
|
var $nick = roomspanel.$el.find('input.new-chatroom-nick');
|
||||||
var $server = roomspanel.$el.find('input.new-chatroom-server');
|
var $server = roomspanel.$el.find('input.new-chatroom-server');
|
||||||
@ -42,7 +42,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("shows users currently present in the room", $.proxy(function () {
|
it("shows users currently present in the room", $.proxy(function () {
|
||||||
var chatroomview = this.chatboxesview.get('lounge@muc.localhost'),
|
var chatroomview = this.chatboxviews.get('lounge@muc.localhost'),
|
||||||
$participant_list;
|
$participant_list;
|
||||||
var roster = {}, room = {}, i;
|
var roster = {}, room = {}, i;
|
||||||
for (i=0; i<mock.chatroom_names.length-1; i++) {
|
for (i=0; i<mock.chatroom_names.length-1; i++) {
|
||||||
@ -57,7 +57,7 @@
|
|||||||
}, converse));
|
}, converse));
|
||||||
|
|
||||||
it("indicates moderators by means of a special css class and tooltip", $.proxy(function () {
|
it("indicates moderators by means of a special css class and tooltip", $.proxy(function () {
|
||||||
var chatroomview = this.chatboxesview.get('lounge@muc.localhost');
|
var chatroomview = this.chatboxviews.get('lounge@muc.localhost');
|
||||||
var roster = {}, idx = mock.chatroom_names.length-1;
|
var roster = {}, idx = mock.chatroom_names.length-1;
|
||||||
roster[mock.chatroom_names[idx]] = {};
|
roster[mock.chatroom_names[idx]] = {};
|
||||||
roster[mock.chatroom_names[idx]].role = 'moderator';
|
roster[mock.chatroom_names[idx]].role = 'moderator';
|
||||||
@ -71,7 +71,7 @@
|
|||||||
|
|
||||||
it("shows received groupchat messages", $.proxy(function () {
|
it("shows received groupchat messages", $.proxy(function () {
|
||||||
spyOn(converse, 'emit');
|
spyOn(converse, 'emit');
|
||||||
var view = this.chatboxesview.get('lounge@muc.localhost');
|
var view = this.chatboxviews.get('lounge@muc.localhost');
|
||||||
if (!view.$el.find('.chat-area').length) { view.renderChatArea(); }
|
if (!view.$el.find('.chat-area').length) { view.renderChatArea(); }
|
||||||
var nick = mock.chatroom_names[0];
|
var nick = mock.chatroom_names[0];
|
||||||
var text = 'This is a received message';
|
var text = 'This is a received message';
|
||||||
@ -90,7 +90,7 @@
|
|||||||
|
|
||||||
it("shows sent groupchat messages", $.proxy(function () {
|
it("shows sent groupchat messages", $.proxy(function () {
|
||||||
spyOn(converse, 'emit');
|
spyOn(converse, 'emit');
|
||||||
var view = this.chatboxesview.get('lounge@muc.localhost');
|
var view = this.chatboxviews.get('lounge@muc.localhost');
|
||||||
if (!view.$el.find('.chat-area').length) { view.renderChatArea(); }
|
if (!view.$el.find('.chat-area').length) { view.renderChatArea(); }
|
||||||
var nick = mock.chatroom_names[0];
|
var nick = mock.chatroom_names[0];
|
||||||
var text = 'This is a sent message';
|
var text = 'This is a sent message';
|
||||||
@ -133,7 +133,7 @@
|
|||||||
}, converse));
|
}, converse));
|
||||||
|
|
||||||
it("can be closed again by clicking a DOM element with class 'close-chatbox-button'", $.proxy(function () {
|
it("can be closed again by clicking a DOM element with class 'close-chatbox-button'", $.proxy(function () {
|
||||||
var view = this.chatboxesview.get('lounge@muc.localhost'), chatroom = view.model, $el;
|
var view = this.chatboxviews.get('lounge@muc.localhost'), chatroom = view.model, $el;
|
||||||
spyOn(view, 'closeChat').andCallThrough();
|
spyOn(view, 'closeChat').andCallThrough();
|
||||||
spyOn(converse, 'emit');
|
spyOn(converse, 'emit');
|
||||||
spyOn(converse.connection.muc, 'leave');
|
spyOn(converse.connection.muc, 'leave');
|
||||||
@ -152,7 +152,7 @@
|
|||||||
|
|
||||||
describe("When attempting to enter a chatroom", $.proxy(function () {
|
describe("When attempting to enter a chatroom", $.proxy(function () {
|
||||||
beforeEach($.proxy(function () {
|
beforeEach($.proxy(function () {
|
||||||
var roomspanel = this.chatboxesview.get('controlbox').roomspanel;
|
var roomspanel = this.chatboxviews.get('controlbox').roomspanel;
|
||||||
var $input = roomspanel.$el.find('input.new-chatroom-name');
|
var $input = roomspanel.$el.find('input.new-chatroom-name');
|
||||||
var $nick = roomspanel.$el.find('input.new-chatroom-nick');
|
var $nick = roomspanel.$el.find('input.new-chatroom-nick');
|
||||||
var $server = roomspanel.$el.find('input.new-chatroom-server');
|
var $server = roomspanel.$el.find('input.new-chatroom-server');
|
||||||
@ -163,7 +163,7 @@
|
|||||||
}, converse));
|
}, converse));
|
||||||
|
|
||||||
afterEach($.proxy(function () {
|
afterEach($.proxy(function () {
|
||||||
var view = this.chatboxesview.get('problematic@muc.localhost');
|
var view = this.chatboxviews.get('problematic@muc.localhost');
|
||||||
view.closeChat();
|
view.closeChat();
|
||||||
}, converse));
|
}, converse));
|
||||||
|
|
||||||
@ -177,7 +177,7 @@
|
|||||||
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'auth'})
|
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'auth'})
|
||||||
.c('not-authorized').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
|
.c('not-authorized').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
|
||||||
|
|
||||||
var view = this.chatboxesview.get('problematic@muc.localhost');
|
var view = this.chatboxviews.get('problematic@muc.localhost');
|
||||||
spyOn(view, 'renderPasswordForm').andCallThrough();
|
spyOn(view, 'renderPasswordForm').andCallThrough();
|
||||||
runs(function () {
|
runs(function () {
|
||||||
view.onChatRoomPresence(presence, {'nick': 'dummy'});
|
view.onChatRoomPresence(presence, {'nick': 'dummy'});
|
||||||
@ -200,7 +200,7 @@
|
|||||||
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
|
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
|
||||||
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'auth'})
|
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'auth'})
|
||||||
.c('registration-required').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
|
.c('registration-required').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
|
||||||
var view = this.chatboxesview.get('problematic@muc.localhost');
|
var view = this.chatboxviews.get('problematic@muc.localhost');
|
||||||
spyOn(view, 'showErrorMessage').andCallThrough();
|
spyOn(view, 'showErrorMessage').andCallThrough();
|
||||||
view.onChatRoomPresence(presence, {'nick': 'dummy'});
|
view.onChatRoomPresence(presence, {'nick': 'dummy'});
|
||||||
expect(view.$el.find('.chat-body p').text()).toBe('You are not on the member list of this room');
|
expect(view.$el.find('.chat-body p').text()).toBe('You are not on the member list of this room');
|
||||||
@ -215,7 +215,7 @@
|
|||||||
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
|
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
|
||||||
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'auth'})
|
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'auth'})
|
||||||
.c('forbidden').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
|
.c('forbidden').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
|
||||||
var view = this.chatboxesview.get('problematic@muc.localhost');
|
var view = this.chatboxviews.get('problematic@muc.localhost');
|
||||||
spyOn(view, 'showErrorMessage').andCallThrough();
|
spyOn(view, 'showErrorMessage').andCallThrough();
|
||||||
view.onChatRoomPresence(presence, {'nick': 'dummy'});
|
view.onChatRoomPresence(presence, {'nick': 'dummy'});
|
||||||
expect(view.$el.find('.chat-body p').text()).toBe('You have been banned from this room');
|
expect(view.$el.find('.chat-body p').text()).toBe('You have been banned from this room');
|
||||||
@ -230,7 +230,7 @@
|
|||||||
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
|
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
|
||||||
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'modify'})
|
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'modify'})
|
||||||
.c('jid-malformed').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
|
.c('jid-malformed').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
|
||||||
var view = this.chatboxesview.get('problematic@muc.localhost');
|
var view = this.chatboxviews.get('problematic@muc.localhost');
|
||||||
spyOn(view, 'showErrorMessage').andCallThrough();
|
spyOn(view, 'showErrorMessage').andCallThrough();
|
||||||
view.onChatRoomPresence(presence, {'nick': 'dummy'});
|
view.onChatRoomPresence(presence, {'nick': 'dummy'});
|
||||||
expect(view.$el.find('.chat-body p').text()).toBe('No nickname was specified');
|
expect(view.$el.find('.chat-body p').text()).toBe('No nickname was specified');
|
||||||
@ -245,7 +245,7 @@
|
|||||||
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
|
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
|
||||||
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'cancel'})
|
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'cancel'})
|
||||||
.c('not-allowed').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
|
.c('not-allowed').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
|
||||||
var view = this.chatboxesview.get('problematic@muc.localhost');
|
var view = this.chatboxviews.get('problematic@muc.localhost');
|
||||||
spyOn(view, 'showErrorMessage').andCallThrough();
|
spyOn(view, 'showErrorMessage').andCallThrough();
|
||||||
view.onChatRoomPresence(presence, {'nick': 'dummy'});
|
view.onChatRoomPresence(presence, {'nick': 'dummy'});
|
||||||
expect(view.$el.find('.chat-body p').text()).toBe('You are not allowed to create new rooms');
|
expect(view.$el.find('.chat-body p').text()).toBe('You are not allowed to create new rooms');
|
||||||
@ -260,7 +260,7 @@
|
|||||||
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
|
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
|
||||||
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'cancel'})
|
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'cancel'})
|
||||||
.c('not-acceptable').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
|
.c('not-acceptable').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
|
||||||
var view = this.chatboxesview.get('problematic@muc.localhost');
|
var view = this.chatboxviews.get('problematic@muc.localhost');
|
||||||
spyOn(view, 'showErrorMessage').andCallThrough();
|
spyOn(view, 'showErrorMessage').andCallThrough();
|
||||||
view.onChatRoomPresence(presence, {'nick': 'dummy'});
|
view.onChatRoomPresence(presence, {'nick': 'dummy'});
|
||||||
expect(view.$el.find('.chat-body p').text()).toBe("Your nickname doesn't conform to this room's policies");
|
expect(view.$el.find('.chat-body p').text()).toBe("Your nickname doesn't conform to this room's policies");
|
||||||
@ -275,7 +275,7 @@
|
|||||||
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
|
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
|
||||||
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'cancel'})
|
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'cancel'})
|
||||||
.c('conflict').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
|
.c('conflict').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
|
||||||
var view = this.chatboxesview.get('problematic@muc.localhost');
|
var view = this.chatboxviews.get('problematic@muc.localhost');
|
||||||
spyOn(view, 'showErrorMessage').andCallThrough();
|
spyOn(view, 'showErrorMessage').andCallThrough();
|
||||||
view.onChatRoomPresence(presence, {'nick': 'dummy'});
|
view.onChatRoomPresence(presence, {'nick': 'dummy'});
|
||||||
expect(view.$el.find('.chat-body p').text()).toBe("Your nickname is already taken");
|
expect(view.$el.find('.chat-body p').text()).toBe("Your nickname is already taken");
|
||||||
@ -290,7 +290,7 @@
|
|||||||
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
|
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
|
||||||
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'cancel'})
|
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'cancel'})
|
||||||
.c('item-not-found').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
|
.c('item-not-found').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
|
||||||
var view = this.chatboxesview.get('problematic@muc.localhost');
|
var view = this.chatboxviews.get('problematic@muc.localhost');
|
||||||
spyOn(view, 'showErrorMessage').andCallThrough();
|
spyOn(view, 'showErrorMessage').andCallThrough();
|
||||||
view.onChatRoomPresence(presence, {'nick': 'dummy'});
|
view.onChatRoomPresence(presence, {'nick': 'dummy'});
|
||||||
expect(view.$el.find('.chat-body p').text()).toBe("This room does not (yet) exist");
|
expect(view.$el.find('.chat-body p').text()).toBe("This room does not (yet) exist");
|
||||||
@ -305,7 +305,7 @@
|
|||||||
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
|
.c('x').attrs({xmlns:'http://jabber.org/protocol/muc'}).up()
|
||||||
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'cancel'})
|
.c('error').attrs({by:'coven@chat.shakespeare.lit', type:'cancel'})
|
||||||
.c('service-unavailable').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
|
.c('service-unavailable').attrs({xmlns:'urn:ietf:params:xml:ns:xmpp-stanzas'}).nodeTree;
|
||||||
var view = this.chatboxesview.get('problematic@muc.localhost');
|
var view = this.chatboxviews.get('problematic@muc.localhost');
|
||||||
spyOn(view, 'showErrorMessage').andCallThrough();
|
spyOn(view, 'showErrorMessage').andCallThrough();
|
||||||
view.onChatRoomPresence(presence, {'nick': 'dummy'});
|
view.onChatRoomPresence(presence, {'nick': 'dummy'});
|
||||||
expect(view.$el.find('.chat-body p').text()).toBe("This room has reached it's maximum number of occupants");
|
expect(view.$el.find('.chat-body p').text()).toBe("This room has reached it's maximum number of occupants");
|
||||||
|
@ -481,7 +481,7 @@
|
|||||||
|
|
||||||
describe("The 'Add Contact' widget", $.proxy(function (mock, utils) {
|
describe("The 'Add Contact' widget", $.proxy(function (mock, utils) {
|
||||||
it("opens up an add form when you click on it", $.proxy(function () {
|
it("opens up an add form when you click on it", $.proxy(function () {
|
||||||
var panel = this.chatboxesview.get('controlbox').contactspanel;
|
var panel = this.chatboxviews.get('controlbox').contactspanel;
|
||||||
spyOn(panel, 'toggleContactForm').andCallThrough();
|
spyOn(panel, 'toggleContactForm').andCallThrough();
|
||||||
panel.delegateEvents(); // We need to rebind all events otherwise our spy won't be called
|
panel.delegateEvents(); // We need to rebind all events otherwise our spy won't be called
|
||||||
panel.$el.find('a.toggle-xmpp-contact-form').click();
|
panel.$el.find('a.toggle-xmpp-contact-form').click();
|
||||||
@ -506,7 +506,7 @@
|
|||||||
}, converse));
|
}, converse));
|
||||||
|
|
||||||
it("contains two tabs, 'Contacts' and 'ChatRooms'", $.proxy(function () {
|
it("contains two tabs, 'Contacts' and 'ChatRooms'", $.proxy(function () {
|
||||||
var cbview = this.chatboxesview.get('controlbox');
|
var cbview = this.chatboxviews.get('controlbox');
|
||||||
var $panels = cbview.$el.find('.controlbox-panes');
|
var $panels = cbview.$el.find('.controlbox-panes');
|
||||||
expect($panels.children().length).toBe(2);
|
expect($panels.children().length).toBe(2);
|
||||||
expect($panels.children().first().attr('id')).toBe('users');
|
expect($panels.children().first().attr('id')).toBe('users');
|
||||||
@ -529,7 +529,7 @@
|
|||||||
}, converse));
|
}, converse));
|
||||||
|
|
||||||
it("is opened by clicking the 'Chatrooms' tab", $.proxy(function () {
|
it("is opened by clicking the 'Chatrooms' tab", $.proxy(function () {
|
||||||
var cbview = this.chatboxesview.get('controlbox');
|
var cbview = this.chatboxviews.get('controlbox');
|
||||||
var $tabs = cbview.$el.find('#controlbox-tabs');
|
var $tabs = cbview.$el.find('#controlbox-tabs');
|
||||||
var $panels = cbview.$el.find('.controlbox-panes');
|
var $panels = cbview.$el.find('.controlbox-panes');
|
||||||
var $contacts = $panels.children().first();
|
var $contacts = $panels.children().first();
|
||||||
@ -548,7 +548,7 @@
|
|||||||
}, converse));
|
}, converse));
|
||||||
|
|
||||||
it("contains a form through which a new chatroom can be created", $.proxy(function () {
|
it("contains a form through which a new chatroom can be created", $.proxy(function () {
|
||||||
var roomspanel = this.chatboxesview.get('controlbox').roomspanel;
|
var roomspanel = this.chatboxviews.get('controlbox').roomspanel;
|
||||||
var $input = roomspanel.$el.find('input.new-chatroom-name');
|
var $input = roomspanel.$el.find('input.new-chatroom-name');
|
||||||
var $nick = roomspanel.$el.find('input.new-chatroom-nick');
|
var $nick = roomspanel.$el.find('input.new-chatroom-nick');
|
||||||
var $server = roomspanel.$el.find('input.new-chatroom-server');
|
var $server = roomspanel.$el.find('input.new-chatroom-server');
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
var i, chatbox;
|
var i, chatbox;
|
||||||
for (i=converse.chatboxes.models.length-1; i>-1; i--) {
|
for (i=converse.chatboxes.models.length-1; i>-1; i--) {
|
||||||
chatbox = converse.chatboxes.models[i];
|
chatbox = converse.chatboxes.models[i];
|
||||||
converse.chatboxesview.get(chatbox.get('id')).closeChat();
|
converse.chatboxviews.get(chatbox.get('id')).closeChat();
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
@ -22,17 +22,17 @@
|
|||||||
var i, chatbox, num_chatboxes = converse.chatboxes.models.length;
|
var i, chatbox, num_chatboxes = converse.chatboxes.models.length;
|
||||||
for (i=num_chatboxes-1; i>-1; i--) {
|
for (i=num_chatboxes-1; i>-1; i--) {
|
||||||
chatbox = converse.chatboxes.models[i];
|
chatbox = converse.chatboxes.models[i];
|
||||||
converse.chatboxesview.get(chatbox.get('id')).closeChat();
|
converse.chatboxviews.get(chatbox.get('id')).closeChat();
|
||||||
converse.chatboxesview.get(chatbox.get('id')).$el.remove();
|
converse.chatboxviews.get(chatbox.get('id')).$el.remove();
|
||||||
}
|
}
|
||||||
converse.chatboxesview.get('controlbox').closeChat();
|
converse.chatboxviews.get('controlbox').closeChat();
|
||||||
converse.chatboxesview.get('controlbox').$el.remove();
|
converse.chatboxviews.get('controlbox').$el.remove();
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
utils.initConverse = function () {
|
utils.initConverse = function () {
|
||||||
converse.chatboxes = new converse.ChatBoxes();
|
converse.chatboxes = new converse.ChatBoxes();
|
||||||
converse.chatboxesview = new converse.ChatBoxesView({model: converse.chatboxes});
|
converse.chatboxviews = new converse.ChatBoxViews({model: converse.chatboxes});
|
||||||
converse.onConnected();
|
converse.onConnected();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -66,13 +66,13 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
utils.openContactsPanel = function () {
|
utils.openContactsPanel = function () {
|
||||||
var cbview = converse.chatboxesview.get('controlbox');
|
var cbview = converse.chatboxviews.get('controlbox');
|
||||||
var $tabs = cbview.$el.find('#controlbox-tabs');
|
var $tabs = cbview.$el.find('#controlbox-tabs');
|
||||||
$tabs.find('li').first().find('a').click();
|
$tabs.find('li').first().find('a').click();
|
||||||
};
|
};
|
||||||
|
|
||||||
utils.openRoomsPanel = function () {
|
utils.openRoomsPanel = function () {
|
||||||
var cbview = converse.chatboxesview.get('controlbox');
|
var cbview = converse.chatboxviews.get('controlbox');
|
||||||
var $tabs = cbview.$el.find('#controlbox-tabs');
|
var $tabs = cbview.$el.find('#controlbox-tabs');
|
||||||
$tabs.find('li').last().find('a').click();
|
$tabs.find('li').last().find('a').click();
|
||||||
};
|
};
|
||||||
@ -91,7 +91,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
utils.clearChatBoxMessages = function (jid) {
|
utils.clearChatBoxMessages = function (jid) {
|
||||||
var view = converse.chatboxesview.get(jid);
|
var view = converse.chatboxviews.get(jid);
|
||||||
view.$el.find('.chat-content').empty();
|
view.$el.find('.chat-content').empty();
|
||||||
view.model.messages.reset().localStorage._clear();
|
view.model.messages.reset().localStorage._clear();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user