Move MUC styling test to plugin folder
This commit is contained in:
parent
649e813ee8
commit
a129638fd1
@ -68,6 +68,7 @@ module.exports = function(config) {
|
||||
{ pattern: "src/plugins/muc-views/tests/muc.js", type: 'module' },
|
||||
{ pattern: "src/plugins/muc-views/tests/muclist.js", type: 'module' },
|
||||
{ pattern: "src/plugins/muc-views/tests/rai.js", type: 'module' },
|
||||
{ pattern: "src/plugins/muc-views/tests/styling.js", type: 'module' },
|
||||
{ pattern: "src/plugins/muc-views/tests/xss.js", type: 'module' },
|
||||
{ pattern: "src/plugins/notifications/tests/notification.js", type: 'module' },
|
||||
{ pattern: "src/plugins/omemo/tests/omemo.js", type: 'module' },
|
||||
|
@ -387,33 +387,3 @@ describe("An incoming chat Message", function () {
|
||||
done();
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
describe("A outgoing groupchat Message", function () {
|
||||
|
||||
it("can be styled with span XEP-0393 message styling hints that contain mentions",
|
||||
mock.initConverse(['chatBoxesFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await mock.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
const msg_text = "This *message mentions romeo*";
|
||||
const msg = $msg({
|
||||
from: 'lounge@montague.lit/gibson',
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').t(msg_text).up()
|
||||
.c('reference', {'xmlns':'urn:xmpp:reference:0', 'begin':'23', 'end':'29', 'type':'mention', 'uri':'xmpp:romeo@montague.lit'}).nodeTree;
|
||||
await view.model.handleMessageStanza(msg);
|
||||
const message = await u.waitUntil(() => view.querySelector('.chat-msg__text'));
|
||||
expect(message.classList.length).toEqual(1);
|
||||
|
||||
const msg_el = Array.from(view.querySelectorAll('converse-chat-message-body')).pop();
|
||||
expect(msg_el.innerText).toBe(msg_text);
|
||||
await u.waitUntil(() => msg_el.innerHTML.replace(/<!---->/g, '') ===
|
||||
'This <span class="styling-directive">*</span><b>message mentions <span class="mention mention--self badge badge-info">romeo</span></b><span class="styling-directive">*</span>');
|
||||
done();
|
||||
}));
|
||||
});
|
||||
|
32
src/plugins/muc-views/tests/styling.js
Normal file
32
src/plugins/muc-views/tests/styling.js
Normal file
@ -0,0 +1,32 @@
|
||||
/*global mock, converse */
|
||||
|
||||
const { u, $msg } = converse.env;
|
||||
|
||||
describe("A outgoing groupchat Message", function () {
|
||||
|
||||
it("can be styled with span XEP-0393 message styling hints that contain mentions",
|
||||
mock.initConverse(['chatBoxesFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
const muc_jid = 'lounge@montague.lit';
|
||||
await mock.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
||||
const view = _converse.api.chatviews.get(muc_jid);
|
||||
const msg_text = "This *message mentions romeo*";
|
||||
const msg = $msg({
|
||||
from: 'lounge@montague.lit/gibson',
|
||||
id: u.getUniqueId(),
|
||||
to: 'romeo@montague.lit',
|
||||
type: 'groupchat'
|
||||
}).c('body').t(msg_text).up()
|
||||
.c('reference', {'xmlns':'urn:xmpp:reference:0', 'begin':'23', 'end':'29', 'type':'mention', 'uri':'xmpp:romeo@montague.lit'}).nodeTree;
|
||||
await view.model.handleMessageStanza(msg);
|
||||
const message = await u.waitUntil(() => view.querySelector('.chat-msg__text'));
|
||||
expect(message.classList.length).toEqual(1);
|
||||
|
||||
const msg_el = Array.from(view.querySelectorAll('converse-chat-message-body')).pop();
|
||||
expect(msg_el.innerText).toBe(msg_text);
|
||||
await u.waitUntil(() => msg_el.innerHTML.replace(/<!---->/g, '') ===
|
||||
'This <span class="styling-directive">*</span><b>message mentions <span class="mention mention--self badge badge-info">romeo</span></b><span class="styling-directive">*</span>');
|
||||
done();
|
||||
}));
|
||||
});
|
Loading…
Reference in New Issue
Block a user