Created
September 25, 2013 08:28
-
-
Save tonini/6696690 to your computer and use it in GitHub Desktop.
This file contains 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
context = describe | |
before = beforeEach | |
describe "LockIconToggleCtrl", -> | |
beforeEach(angular.mock.module("test")) | |
scope = {} | |
ctrl = {} | |
beforeEach inject ($controller, $rootScope) -> | |
scope = $rootScope.$new() | |
ctrl = $controller("LockIconToggleCtrl", {$scope: scope}) | |
describe '#toggle', -> | |
it 'Return icon-lock', -> | |
scope.currentIcon = 'icon-unlock' | |
expect(scope.toggle()).toEqual('icon-lock') | |
it 'Return icon-unlock', -> | |
scope.currentIcon = 'icon-lock' | |
expect(scope.toggle()).toEqual('icon-unlock') | |
describe '#isLocked', -> | |
context 'icon-lock is active', -> | |
before -> | |
scope.currentIcon = 'icon-lock' | |
it 'Return true', -> | |
expect(scope.isLocked()).toBe(true) | |
context 'icon-lock is inactive', -> | |
before -> | |
scope.currentIcon = 'icon-unlock' | |
it 'Return false', -> | |
expect(scope.isLocked()).toBe(false) | |
describe '#isUnlocked', -> | |
context 'icon-unlock is active', -> | |
before -> | |
scope.currentIcon = 'icon-unlock' | |
it 'Return true', -> | |
expect(scope.isUnlocked()).toBe(true) | |
context 'icon-unlock is inactive', -> | |
before -> | |
scope.currentIcon = 'icon-lock' | |
it 'Return true', -> | |
expect(scope.isUnlocked()).toBe(false) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment