mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +00:00
Add list view tests
Also, * moved fetch out of the list view * removed unused #last() function * put test setup lines in their own tiny file. * added data-cover to view script tags for code coveage reports.
This commit is contained in:
22
test/views/list_view_test.js
Normal file
22
test/views/list_view_test.js
Normal file
@@ -0,0 +1,22 @@
|
||||
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);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,5 +1,3 @@
|
||||
mocha.setup("bdd");
|
||||
window.assert = chai.assert;
|
||||
describe('MessageView', function() {
|
||||
var message = Whisper.Messages.add({
|
||||
threadId: 'test-thread',
|
||||
|
||||
Reference in New Issue
Block a user