Created
September 11, 2013 09:13
-
-
Save felixzapata/6521203 to your computer and use it in GitHub Desktop.
Common skeleton unit test for a directive
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
describe('myDir directive', function () { | |
var element, scope; | |
beforeEach(module('myDirModule')); | |
beforeEach(inject(function ($compile, $rootScope) { | |
var linkingFn = $compile('<my-dir></my-dir>'); | |
scope = $rootScope; | |
element = linkingFn(scope); | |
})); | |
it('has some properties', function() { | |
expect(element.someMethod()).toBe(XXX); | |
}); | |
it('does something to the scope', function() { | |
expect(scope.someField).toBe(XXX); | |
}); | |
.... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment