Skip to content

Instantly share code, notes, and snippets.

@rolaveric
Created February 4, 2014 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rolaveric/8813721 to your computer and use it in GitHub Desktop.
Save rolaveric/8813721 to your computer and use it in GitHub Desktop.
An ng-hide directive test taken from the AngularJS source to illustrate a simple directive test.
describe('ngHide', function() {
it('should hide an element', inject(function($rootScope, $compile) {
var element = angular.element('<div ng-hide="exp"></div>');
element = $compile(element)($rootScope);
expect(element).toBeShown();
$rootScope.exp = true;
$rootScope.$digest();
expect(element).toBeHidden();
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment