|
@@ -1215,16 +1215,14 @@
|
|
}));
|
|
}));
|
|
|
|
|
|
it("will render images from their URLs", mock.initConverse(function (_converse) {
|
|
it("will render images from their URLs", mock.initConverse(function (_converse) {
|
|
- test_utils.createContacts(_converse, 'current');
|
|
|
|
- test_utils.openControlBox();
|
|
|
|
- test_utils.openContactsPanel(_converse);
|
|
|
|
-
|
|
|
|
if (/PhantomJS/.test(window.navigator.userAgent)) {
|
|
if (/PhantomJS/.test(window.navigator.userAgent)) {
|
|
// Doesn't work when running tests in PhantomJS, since
|
|
// Doesn't work when running tests in PhantomJS, since
|
|
// the page is loaded via file:///
|
|
// the page is loaded via file:///
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- var message = document.URL.split(window.location.pathname)[0] + "/logo/conversejs.svg";
|
|
|
|
|
|
+ test_utils.createContacts(_converse, 'current');
|
|
|
|
+ var base_url = document.URL.split(window.location.pathname)[0];
|
|
|
|
+ var message = base_url+"/logo/conversejs.svg";
|
|
var contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
|
|
var contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
|
|
test_utils.openChatBoxFor(_converse, contact_jid);
|
|
test_utils.openChatBoxFor(_converse, contact_jid);
|
|
var view = _converse.chatboxviews.get(contact_jid);
|
|
var view = _converse.chatboxviews.get(contact_jid);
|
|
@@ -1237,33 +1235,15 @@
|
|
expect(view.sendMessage).toHaveBeenCalled();
|
|
expect(view.sendMessage).toHaveBeenCalled();
|
|
var msg = view.$el.find('.chat-content').find('.chat-message').last().find('.chat-msg-content');
|
|
var msg = view.$el.find('.chat-content').find('.chat-message').last().find('.chat-msg-content');
|
|
expect(msg.html()).toEqual('<img src="'+message+'" class="chat-image">');
|
|
expect(msg.html()).toEqual('<img src="'+message+'" class="chat-image">');
|
|
- });
|
|
|
|
- }));
|
|
|
|
-
|
|
|
|
- it("will render images from their URLs with query strings containing HTML-escaping characters", mock.initConverse(function (_converse) {
|
|
|
|
- test_utils.createContacts(_converse, 'current');
|
|
|
|
- test_utils.openControlBox();
|
|
|
|
- test_utils.openContactsPanel(_converse);
|
|
|
|
|
|
|
|
- if (/PhantomJS/.test(window.navigator.userAgent)) {
|
|
|
|
- // Doesn't work when running tests in PhantomJS, since
|
|
|
|
- // the page is loaded via file:///
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- var message = document.URL.split(window.location.pathname)[0] + "/logo/conversejs.svg?param1=val1¶m2=val2",
|
|
|
|
- htmlEscapedMessage = message.replace(/&/g, '&');
|
|
|
|
- var contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
|
|
|
|
- test_utils.openChatBoxFor(_converse, contact_jid);
|
|
|
|
- var view = _converse.chatboxviews.get(contact_jid);
|
|
|
|
- spyOn(view, 'sendMessage').andCallThrough();
|
|
|
|
- runs(function () {
|
|
|
|
|
|
+ message += "?param1=val1¶m2=val2";
|
|
test_utils.sendMessage(view, message);
|
|
test_utils.sendMessage(view, message);
|
|
});
|
|
});
|
|
waits(500);
|
|
waits(500);
|
|
runs(function () {
|
|
runs(function () {
|
|
expect(view.sendMessage).toHaveBeenCalled();
|
|
expect(view.sendMessage).toHaveBeenCalled();
|
|
var msg = view.$el.find('.chat-content').find('.chat-message').last().find('.chat-msg-content');
|
|
var msg = view.$el.find('.chat-content').find('.chat-message').last().find('.chat-msg-content');
|
|
- expect(msg.html()).toEqual('<img src="'+htmlEscapedMessage+'" class="chat-image">');
|
|
|
|
|
|
+ expect(msg.html()).toEqual('<img src="'+message.replace(/&/g, '&')+'" class="chat-image">');
|
|
});
|
|
});
|
|
}));
|
|
}));
|
|
|
|
|