@@ -60,21 +60,21 @@ test('it delays rendering head until loaded', function(assert) {
6060 assert . equal ( page . conversationParts ( ) . count , 0 , 'No part is rendered.' ) ;
6161} ) ;
6262
63- test ( 'it renders each conversation part' , function ( assert ) {
63+ test ( 'it renders each conversation part, sorted by insertedAt ' , function ( assert ) {
6464 assert . expect ( 4 ) ;
6565
6666 let conversationParts = [
67- { isLoaded : true , body : 'foo 1' } ,
68- { isLoaded : true , body : 'foo 2' } ,
69- { isLoaded : true , body : 'foo 3' }
67+ { isLoaded : true , body : 'foo 1' , insertedAt : new Date ( '2017-11-01' ) } ,
68+ { isLoaded : true , body : 'foo 2' , insertedAt : new Date ( '2017-12-01' ) } ,
69+ { isLoaded : true , body : 'foo 3' , insertedAt : new Date ( '2017-10-01' ) }
7070 ] ;
7171 set ( this , 'conversation' , { conversationParts } ) ;
7272 renderPage ( ) ;
7373
7474 assert . equal ( page . conversationParts ( ) . count , 3 , 'Each part is rendered.' ) ;
75- assert . equal ( page . conversationParts ( 0 ) . body . text , 'foo 1' , 'Part 1 is rendered correctly .' ) ;
76- assert . equal ( page . conversationParts ( 1 ) . body . text , 'foo 2' , 'Part 2 is rendered correctly .' ) ;
77- assert . equal ( page . conversationParts ( 2 ) . body . text , 'foo 3' , 'Part 3 is rendered correctly .' ) ;
75+ assert . equal ( page . conversationParts ( 1 ) . body . text , 'foo 1' , 'Part 1 is rendered second to last .' ) ;
76+ assert . equal ( page . conversationParts ( 2 ) . body . text , 'foo 2' , 'Part 2 is rendered last (newest) .' ) ;
77+ assert . equal ( page . conversationParts ( 0 ) . body . text , 'foo 3' , 'Part 3 is rendered first (earliest date) .' ) ;
7878} ) ;
7979
8080test ( 'it delays rendering conversation parts not yet loaded' , function ( assert ) {
0 commit comments