Commit 6002e0fd authored by Pete Nicholls's avatar Pete Nicholls

Use converse.emit to dispatch call button event

parent db608948
...@@ -1171,7 +1171,7 @@ ...@@ -1171,7 +1171,7 @@
toggleCall: function (ev) { toggleCall: function (ev) {
ev.stopPropagation(); ev.stopPropagation();
$('#conversejs').trigger('converse:callButtonClicked', { converse.emit('onCallButtonClicked', {
connection: converse.connection connection: converse.connection
}); });
}, },
......
...@@ -197,6 +197,8 @@ ...@@ -197,6 +197,8 @@
}, converse)); }, converse));
it("contains a button for starting a call", $.proxy(function () { it("contains a button for starting a call", $.proxy(function () {
spyOn(converse, 'emit');
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);
...@@ -206,20 +208,9 @@ ...@@ -206,20 +208,9 @@
expect(callButton.length).toBe(1); expect(callButton.length).toBe(1);
var callEventTriggered = false;
$(document).on('converse:callButtonClicked', function() {
callEventTriggered = true;
});
runs(function () { runs(function () {
callButton.click(); callButton.click();
}); expect(converse.emit).toHaveBeenCalledWith('onCallButtonClicked', jasmine.any(Object));
waits(50);
runs(function () {
expect(callEventTriggered).toBe(true);
}); });
}, converse)); }, converse));
}, 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