Testing - Jenliszka/todoapp GitHub Wiki
Running Jasmine Tests After downloading project run npm install to install dependent Jasmine materials Tests are located in ControllerSpec.js. Tests can be run using SpecRunner.html.
https://github.com/Jenliszka/todoapp/blob/master/jasminetestsscreenshot.png
describe('element complete toggle', function () {
it('should update the model', function () {
var todo = {id: 21, title: 'my todo', completed: false};
setUpModel([todo]);
subject.setView('');
view.trigger('itemToggle', {id: 21, completed: true});
expect(model.update).toHaveBeenCalledWith(21, {completed: true}, jasmine.any(Function));
});
it('should update the view', function () {
var todo = {id: 42, title: 'my todo', completed: true};
setUpModel([todo]);
subject.setView('');
view.trigger('itemToggle', {id: 42, completed: false});
expect(view.render).toHaveBeenCalledWith('elementComplete', {id: 42, completed: false});
});
});