Commit 41154614 authored by JC Brand's avatar JC Brand

Make tests independent of URL at which they're run

parent 8de78dfa
...@@ -365,10 +365,10 @@ ...@@ -365,10 +365,10 @@
}).then(function () { }).then(function () {
// Check that the image renders // Check that the image renders
expect(view.el.querySelector('.chat-msg .chat-msg__media').innerHTML.trim()).toEqual( expect(view.el.querySelector('.chat-msg .chat-msg__media').innerHTML.trim()).toEqual(
'<!-- src/templates/image.html -->\n'+ `<!-- src/templates/image.html -->\n`+
'<a href="http://localhost:8000/logo/conversejs-filled.svg" target="_blank" rel="noopener">'+ `<a href="${window.location.origin}/logo/conversejs-filled.svg" target="_blank" rel="noopener">`+
'<img class="chat-image img-thumbnail" src="http://localhost:8000/logo/conversejs-filled.svg">'+ `<img class="chat-image img-thumbnail" src="${window.location.origin}/logo/conversejs-filled.svg">`+
'</a>'); `</a>`);
XMLHttpRequest.prototype.send = send_backup; XMLHttpRequest.prototype.send = send_backup;
done(); done();
}); });
...@@ -473,9 +473,10 @@ ...@@ -473,9 +473,10 @@
}).then(function () { }).then(function () {
// Check that the image renders // Check that the image renders
expect(view.el.querySelector('.chat-msg .chat-msg__media').innerHTML.trim()).toEqual( expect(view.el.querySelector('.chat-msg .chat-msg__media').innerHTML.trim()).toEqual(
'<!-- src/templates/image.html -->\n'+ `<!-- src/templates/image.html -->\n`+
'<a href="http://localhost:8000/logo/conversejs-filled.svg" target="_blank" rel="noopener">'+ `<a href="${window.location.origin}/logo/conversejs-filled.svg" target="_blank" rel="noopener">`+
'<img class="chat-image img-thumbnail" src="http://localhost:8000/logo/conversejs-filled.svg"></a>') `<img class="chat-image img-thumbnail" src="${window.location.origin}/logo/conversejs-filled.svg">`+
`</a>`);
XMLHttpRequest.prototype.send = send_backup; XMLHttpRequest.prototype.send = send_backup;
done(); done();
}); });
......
...@@ -1815,10 +1815,10 @@ ...@@ -1815,10 +1815,10 @@
expect(msg.outerHTML).toEqual('<div class="chat-msg__text">Have you seen this funny image?</div>'); expect(msg.outerHTML).toEqual('<div class="chat-msg__text">Have you seen this funny image?</div>');
const media = view.el.querySelector('.chat-msg .chat-msg__media'); const media = view.el.querySelector('.chat-msg .chat-msg__media');
expect(media.innerHTML.replace(/(\r\n|\n|\r)/gm, "")).toEqual( expect(media.innerHTML.replace(/(\r\n|\n|\r)/gm, "")).toEqual(
'<!-- src/templates/image.html -->'+ `<!-- src/templates/image.html -->`+
'<a href="http://localhost:8000/logo/conversejs-filled.svg" target="_blank" rel="noopener">'+ `<a href="${window.location.origin}/logo/conversejs-filled.svg" target="_blank" rel="noopener">`+
'<img class="chat-image img-thumbnail" src="http://localhost:8000/logo/conversejs-filled.svg">'+ `<img class="chat-image img-thumbnail" src="${window.location.origin}/logo/conversejs-filled.svg">`+
'</a>'); `</a>`);
done(); done();
}).catch(_.partial(console.error, _)); }).catch(_.partial(console.error, _));
})); }));
......
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