Created
November 7, 2013 01:33
-
-
Save twelverobots/7347428 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
describe('Controller: TodoListController handles Todo Lists', function () { | |
// load the controller's module | |
beforeEach(module('todosApp')); | |
var todoListCtrl, | |
scope; | |
// Initialize the controller and a mock scope | |
beforeEach(inject(function ($controller, $rootScope) { | |
scope = $rootScope.$new(); | |
todoListCtrl = $controller('TodoListController', { | |
$scope: scope | |
}); | |
})); | |
it('and adds default text to the scope ', function () { | |
expect(scope.newListName).toBeDefined(); | |
}); | |
it('and will tell us how many characters are left in the field', function () { | |
scope.newListName = "Test Text"; | |
todoListCtrl.setMaxLength(200); | |
expect(scope.charsLeft()).toBe(191); | |
expect(todoListCtrl.getMaxLength()).toBe(200); | |
}); | |
it('and will create a new list', function () { | |
scope.newListName = 'Test List'; | |
scope.addList(); | |
expect(scope.lists[0].name).toBe('Test List'); | |
expect(Array.isArray(scope.lists)).toBe(true); | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment