|
@@ -262,6 +262,23 @@ describe("A Chat Message", function () {
|
|
expect(_converse.api.chatboxes.get).not.toHaveBeenCalled();
|
|
expect(_converse.api.chatboxes.get).not.toHaveBeenCalled();
|
|
}));
|
|
}));
|
|
|
|
|
|
|
|
+ it("will render Openstreetmap-URL from geo-URI",
|
|
|
|
+ mock.initConverse(['chatBoxesFetched'], {}, async function (_converse) {
|
|
|
|
+
|
|
|
|
+ await mock.waitForRoster(_converse, 'current', 1);
|
|
|
|
+ const message = "geo:37.786971,-122.399677";
|
|
|
|
+ const contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@montague.lit';
|
|
|
|
+ await mock.openChatBoxFor(_converse, contact_jid);
|
|
|
|
+ const view = _converse.chatboxviews.get(contact_jid);
|
|
|
|
+ spyOn(view.model, 'sendMessage').and.callThrough();
|
|
|
|
+ await mock.sendMessage(view, message);
|
|
|
|
+ await u.waitUntil(() => view.querySelectorAll('.chat-content .chat-msg').length, 1000);
|
|
|
|
+ expect(view.model.sendMessage).toHaveBeenCalled();
|
|
|
|
+ const msg = sizzle('.chat-content .chat-msg:last .chat-msg__text', view).pop();
|
|
|
|
+ await u.waitUntil(() => msg.innerHTML.replace(/\<!-.*?-\>/g, '') ===
|
|
|
|
+ '<a target="_blank" rel="noopener" href="https://www.openstreetmap.org/?mlat=37.786971&'+
|
|
|
|
+ 'mlon=-122.399677#map=18/37.786971/-122.399677">https://www.openstreetmap.org/?mlat=37.786971&mlon=-122.399677#map=18/37.786971/-122.399677</a>');
|
|
|
|
+ }));
|
|
|
|
|
|
it("can be a carbon message, as defined in XEP-0280",
|
|
it("can be a carbon message, as defined in XEP-0280",
|
|
mock.initConverse([], {}, async function (_converse) {
|
|
mock.initConverse([], {}, async function (_converse) {
|
|
@@ -799,6 +816,7 @@ describe("A Chat Message", function () {
|
|
"Another message within 10 minutes, but from a different person");
|
|
"Another message within 10 minutes, but from a different person");
|
|
|
|
|
|
jasmine.clock().uninstall();
|
|
jasmine.clock().uninstall();
|
|
|
|
+
|
|
}));
|
|
}));
|
|
|
|
|
|
|
|
|