You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			44 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
		
		
			
		
	
	
			44 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
| 
											8 years ago
										 | 'use strict'; | ||
|  | 
 | ||
|  | describe('ConversationController', function() { | ||
|  |   it('sorts conversations based on timestamp then by intl-friendly title', function() { | ||
|  |     var collection = window.getInboxCollection(); | ||
|  |     collection.reset([]); | ||
|  | 
 | ||
|  |     collection.add(new Whisper.Conversation({ | ||
|  |       name: 'No timestamp', | ||
|  |     })); | ||
|  |     collection.add(new Whisper.Conversation({ | ||
|  |       name: 'B', | ||
|  |       timestamp: 20, | ||
|  |     })); | ||
|  |     collection.add(new Whisper.Conversation({ | ||
|  |       name: 'C', | ||
|  |       timestamp: 20, | ||
|  |     })); | ||
|  |     collection.add(new Whisper.Conversation({ | ||
|  |       name: 'Á', | ||
|  |       timestamp: 20, | ||
|  |     })); | ||
|  |     collection.add(new Whisper.Conversation({ | ||
|  |       name: 'First!', | ||
|  |       timestamp: 30, | ||
|  |     })); | ||
|  | 
 | ||
|  |     console.log('WTF!'); | ||
|  |     console.log(collection.at('0').attributes); | ||
|  |     console.log(collection.at('1').attributes); | ||
|  |     console.log(collection.at('2').attributes); | ||
|  |     console.log(collection.at('3').attributes); | ||
|  |     console.log(collection.at('4').attributes); | ||
|  | 
 | ||
|  |     assert.strictEqual(collection.at('0').get('name'), 'First!'); | ||
|  |     assert.strictEqual(collection.at('1').get('name'), 'Á'); | ||
|  |     assert.strictEqual(collection.at('2').get('name'), 'B'); | ||
|  |     assert.strictEqual(collection.at('3').get('name'), 'C'); | ||
|  |     assert.strictEqual(collection.at('4').get('name'), 'No timestamp'); | ||
|  | 
 | ||
|  |     collection.reset([]); | ||
|  |   }); | ||
|  | }); |