瀏覽代碼

Move MUC styling test to plugin folder

JC Brand 4 年之前
父節點
當前提交
a129638fd1
共有 3 個文件被更改,包括 33 次插入30 次删除
  1. 1 0
      karma.conf.js
  2. 0 30
      spec/styling.js
  3. 32 0
      src/plugins/muc-views/tests/styling.js

+ 1 - 0
karma.conf.js

@@ -68,6 +68,7 @@ module.exports = function(config) {
       { pattern: "src/plugins/muc-views/tests/muc.js", type: 'module' },
       { 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/muclist.js", type: 'module' },
       { pattern: "src/plugins/muc-views/tests/rai.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/muc-views/tests/xss.js", type: 'module' },
       { pattern: "src/plugins/notifications/tests/notification.js", type: 'module' },
       { pattern: "src/plugins/notifications/tests/notification.js", type: 'module' },
       { pattern: "src/plugins/omemo/tests/omemo.js", type: 'module' },
       { pattern: "src/plugins/omemo/tests/omemo.js", type: 'module' },

+ 0 - 30
spec/styling.js

@@ -387,33 +387,3 @@ describe("An incoming chat Message", function () {
         done();
         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 - 0
src/plugins/muc-views/tests/styling.js

@@ -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();
+    }));
+});