@@ -60,21 +60,21 @@ test('it delays rendering head until loaded', function(assert) {
60
60
assert . equal ( page . conversationParts ( ) . count , 0 , 'No part is rendered.' ) ;
61
61
} ) ;
62
62
63
- test ( 'it renders each conversation part' , function ( assert ) {
63
+ test ( 'it renders each conversation part, sorted by insertedAt ' , function ( assert ) {
64
64
assert . expect ( 4 ) ;
65
65
66
66
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" ) }
70
70
] ;
71
71
set ( this , 'conversation' , { conversationParts } ) ;
72
72
renderPage ( ) ;
73
73
74
74
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) .' ) ;
78
78
} ) ;
79
79
80
80
test ( 'it delays rendering conversation parts not yet loaded' , function ( assert ) {
0 commit comments