Skip to content

Instantly share code, notes, and snippets.

@ivan-demchenko
Created April 15, 2015 12:05
Show Gist options
  • Save ivan-demchenko/4689251cf8756d588813 to your computer and use it in GitHub Desktop.
Save ivan-demchenko/4689251cf8756d588813 to your computer and use it in GitHub Desktop.
Test directive's controller
// http://stackoverflow.com/a/24761145/993216
describe("myDirective", function() ->
var el, scope, controller;
beforeEach inject(function($compile, $rootScope) {
el = angular.element("<my-directive></my-directive>")
$compile(el)($rootScope.$new())
$rootScope.$digest()
controller = el.controller()
scope = el.isolateScope() || el.scope()
})
it("should do something to the scope", function() {
expect(scope.isInitialized).toBeDefined()
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment