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

Use converse.emit to dispatch call button event

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