浏览代码

Test for mentions with spaces in them.

Also remove Converse from fullscreen background
JC Brand 6 年之前
父节点
当前提交
41a42fe2f7
共有 2 个文件被更改,包括 9 次插入7 次删除
  1. 0 5
      fullscreen.html
  2. 9 2
      spec/messages.js

+ 0 - 5
fullscreen.html

@@ -12,11 +12,6 @@
     <script src="dist/converse.js"></script>
 </head>
 <body class="reset">
-    <div class="content">
-        <div class="inner-content">
-            <h1 class="brand-heading"><i class="icon-conversejs"></i> Converse</h1>
-        </div>
-    </div>
 <script>
     /*
     @licstart

+ 9 - 2
spec/messages.js

@@ -2145,7 +2145,7 @@
                 test_utils.openAndEnterChatRoom(_converse, 'lounge', 'localhost', 'tom')
                 .then(() => {
                     const view = _converse.chatboxviews.get('lounge@localhost');
-                    ['z3r0', 'mr.robot', 'gibson', 'sw0rdf1sh'].forEach((nick) => {
+                    ['z3r0', 'mr.robot', 'gibson', 'sw0rdf1sh', 'Link Mauve'].forEach((nick) => {
                         _converse.connection._dataRecv(test_utils.createRequest(
                             $pres({
                                 'to': 'tom@localhost/resource',
@@ -2154,7 +2154,7 @@
                             .c('x', {xmlns: Strophe.NS.MUC_USER})
                             .c('item', {
                                 'affiliation': 'none',
-                                'jid': `${nick}@localhost/resource`,
+                                'jid': `${nick.replace(/\s/g, '-')}@localhost/resource`,
                                 'role': 'participant'
                             })));
                     });
@@ -2190,6 +2190,13 @@
                     expect(references.length).toBe(1);
                     expect(JSON.stringify(references))
                         .toBe('[{"begin":0,"end":6,"value":"gibson","type":"mention","uri":"xmpp:gibson@localhost"}]');
+
+                    [text, references] = view.model.parseTextForReferences('hi @Link Mauve how are you?')
+                    expect(text).toBe('hi Link Mauve how are you?');
+                    expect(references.length).toBe(1);
+                    expect(JSON.stringify(references))
+                        .toBe('[{"begin":3,"end":13,"value":"Link Mauve","type":"mention","uri":"xmpp:Link-Mauve@localhost"}]');
+
                     done();
                     return;
                 });