You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
I have some unit tests for a directive that worked fine until I migrated to the latest release candidate. The tests pass without incident even under the RC, but fail if the main module includes 'ngAnimate', even where, as here, the application has no animations defined or used. Somehow a routine synchronous test goes funky.
The application works fine when run in production.
app.directive('directive',function(){return{template: '<dir ng-class="blues()">'+'This text is {{blues()}}, but the test failed.'+'</dir>',restrict: 'E',replace: true,link: function(scope,element,attrs){scope.blues=function(){return'blue';};}};});
The test
...
beforeEach(inject(function($rootScope,$compile){scope=$rootScope.$new();element=$compile('<directive></directive>')(scope);$rootScope.$digest();}));
...
it('should have the text be blue',function(){expect(element.hasClass('blue')).toBeTruthy();});
...
(just remove ngAnimate in the app.js definition of the main module to see tests pass).
The problem seems to have something to do with the recent changes to ng-class and animation. No amount of research seems to work. What's going on?
Pure aside: I note that the angular.mock.animate decorator doesn't seem to get installed merely by adding angular-mock.js to my build in ordinary course. ($animate does not have flushNext coded.) Do I need to do anything special, or load in any particular order to make the config work right?