Ver Fonte

Fixes #985 Give help messages a "message" class and isodate data attr.

JC Brand há 7 anos atrás
pai
commit
9b3c6d1a3a
3 ficheiros alterados com 11 adições e 1 exclusões
  1. 9 0
      spec/chatbox.js
  2. 1 0
      src/converse-chatview.js
  3. 1 1
      src/templates/help_message.html

+ 9 - 0
spec/chatbox.js

@@ -39,6 +39,15 @@
                 expect(info_messages.pop().textContent).toBe('/help: Show this menu');
                 expect(info_messages.pop().textContent).toBe('/me: Write in the third person');
                 expect(info_messages.pop().textContent).toBe('/clear: Remove messages');
+
+                var msg = $msg({
+                        from: contact_jid,
+                        to: _converse.connection.jid,
+                        type: 'chat',
+                        id: (new Date()).getTime()
+                    }).c('body').t('hello world').tree();
+                _converse.chatboxes.onMessage(msg);
+                expect(view.content.lastElementChild.textContent.trim().indexOf('hello world')).not.toBe(-1);
                 done();
             }));
 

+ 1 - 0
src/converse-chatview.js

@@ -580,6 +580,7 @@
                         this.content.insertAdjacentHTML(
                             'beforeend',
                             tpl_help_message({
+                                'isodate': moment().format(),
                                 'type': type||'info',
                                 'message': xss.filterXSS(msg, {'whiteList': {'strong': []}})
                             })

+ 1 - 1
src/templates/help_message.html

@@ -1 +1 @@
-<div class="chat-{{{o.type}}}">{{o.message}}</div>
+<div class="message chat-{{{o.type}}}" data-isodate="{{{o.isodate}}}">{{o.message}}</div>