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.
		
		
		
		
		
			
		
			
	
	
		
			23 lines
		
	
	
		
			697 B
		
	
	
	
		
			JavaScript
		
	
		
		
			
		
	
	
			23 lines
		
	
	
		
			697 B
		
	
	
	
		
			JavaScript
		
	
| 
											11 years ago
										 | describe('ListView', function() { | ||
|  |   var collection; | ||
|  | 
 | ||
|  |   beforeEach(function(){ | ||
|  |     collection = new Backbone.Collection(); | ||
|  |   }); | ||
|  | 
 | ||
|  |   it('should add children to the list element as they are added to the collection', function() { | ||
|  |     var view = new Whisper.ListView({collection: collection}); | ||
|  |     collection.add('hello'); | ||
|  |     assert.equal(view.$el.children().length, 1); | ||
|  |     collection.add('world'); | ||
|  |     assert.equal(view.$el.children().length, 2); | ||
|  |   }); | ||
|  | 
 | ||
|  |   it('should add all the children to the list element on reset', function() { | ||
|  |     var view = new Whisper.ListView({collection: collection}); | ||
|  |     collection.reset(['goodbye', 'world']); | ||
|  |     assert.equal(view.$el.children().length, 2); | ||
|  |   }); | ||
|  | 
 | ||
|  | }); |