Skip to content

Instantly share code, notes, and snippets.

@gregberge
Created September 1, 2014 12:55
Show Gist options
  • Save gregberge/4b582699deab5a4dfb9c to your computer and use it in GitHub Desktop.
Save gregberge/4b582699deab5a4dfb9c to your computer and use it in GitHub Desktop.
Angular directive test using mocha.
describe('My directive', function () {
var scope, $compile;
beforeEach(module('app.directives'));
beforeEach(inject(function ($injector) {
$compile = $injector.get('$compile');
var $rootScope = $injector.get('$rootScope');
scope = $rootScope.$new();
}));
afterEach(function () {
scope.$destroy();
});
it('should do something', function () {
$compile('<my-directive></my-directive>')(scope);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment