Browse Source

Fix failing tests due to time tag

JC Brand 7 years ago
parent
commit
4361d0d66a
2 changed files with 7 additions and 7 deletions
  1. 4 4
      spec/chatroom.js
  2. 3 3
      spec/messages.js

+ 4 - 4
spec/chatroom.js

@@ -714,8 +714,8 @@
                         });
                     _converse.connection._dataRecv(test_utils.createRequest(presence));
 
-                    var $time = $chat_content.find('time');
-                    expect($time.length).toEqual(4);
+                    let time = chat_content.querySelectorAll('time.separator-text');
+                    expect(time.length).toEqual(4);
 
                     var $indicator = $chat_content.find('.date-separator:eq(3)');
                     expect($indicator.attr('class')).toEqual('message date-separator');
@@ -753,8 +753,8 @@
                             });
                     _converse.connection._dataRecv(test_utils.createRequest(presence));
 
-                    $time = $chat_content.find('time');
-                    expect($time.length).toEqual(6);
+                    time = chat_content.querySelectorAll('time.separator-text');
+                    expect(time.length).toEqual(6);
 
                     $indicator = $chat_content.find('.date-separator:eq(5)');
                     expect($indicator.attr('class')).toEqual('message date-separator');

+ 3 - 3
spec/messages.js

@@ -577,7 +577,7 @@
                 expect($el.hasClass('chat-msg-followup')).toBe(false);
                 expect($el.text()).toEqual('Older message');
 
-                $time = $chat_content.find('time:eq(1)');
+                $time = $chat_content.find('time.separator-text:eq(1)');
                 expect($time.text()).toEqual("Monday Jan 1st 2018");
 
                 $day = $chat_content.find('.date-separator:eq(1)');
@@ -591,7 +591,7 @@
                 expect($el.find('.chat-msg-text').text()).toEqual('another inbetween message');
                 expect($el.hasClass('chat-msg-followup')).toBe(true);
 
-                $time = $chat_content.find('time:nth(2)');
+                $time = $chat_content.find('time.separator-text:nth(2)');
                 expect($time.text()).toEqual("Tuesday Jan 2nd 2018");
 
                 $day = $chat_content.find('.date-separator:nth(2)');
@@ -928,7 +928,7 @@
                     expect(_converse.emit).toHaveBeenCalledWith('message', jasmine.any(Object));
                     // Check that there is a <time> element, with the required
                     // props.
-                    expect($chat_content[0].querySelectorAll('time').length).toEqual(2); // There are now two time elements
+                    expect($chat_content[0].querySelectorAll('time.separator-text').length).toEqual(2); // There are now two time elements
 
                     var message_date = new Date();
                     $day = $chat_content.find('.date-separator:last');