Skip to content

Instantly share code, notes, and snippets.

@trodrigues
Last active December 26, 2015 07:38
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 trodrigues/7116176 to your computer and use it in GitHub Desktop.
Save trodrigues/7116176 to your computer and use it in GitHub Desktop.
describe('Testing something', function () {
var container, scope;
beforeEach(function () {
inject(function ($rootScope, $compile) {
scope = $rootScope.$new();
scope.can = function () {
return false;
};
container = angular.element('<div><div class="container" ng-show="can()">{{can()}}</div></div>');
$compile(container)(scope);
scope.$digest();
});
});
it('should be hidden if can returns false', function () {
// passes
expect(container.find('.container').hasClass('container')).toBe(true);
// passes
expect(container.find('.container').text()).toBe('false');
// doesn't pass, ng-show never does it's thing
expect(container.find('.container').hasClass('ng-hide')).toBe(true);
});
});
@trodrigues
Copy link
Author

This is due to ng-animate inside ng-hide and it's fixed by updating to the latest 1.2.0-rc3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment