javascript - Testing animations angular 1.2+ -
anyone know how test animations in angular? animations built using either $animateprovider or angular.module('', []).animate() ? i'm building animations library, , it's nice, can't find proper way test animations using $animate. never work. have hacked work, i'm pretty recreating animations inside each test. make sure it's not animations, created new 1 on test. got straight out of angular's source code , still not work.
describe('testing async animations', function() { var = false; beforeeach(module('nganimate')); beforeeach(module('nganimatemock')); beforeeach(module(function($animateprovider){ $animateprovider.register('.fade', function(){ return { enter: function(element, done){ console.log('here'); = true; done(); } }; }); })); /* done() method mocha provides. make work in jasmine, follow example using asynchronous test */ it("should asynchronously test animation", function() { inject(function($animate, $compile, $document, $rootscope, $rootelement) { var element = $compile('<div class="fade">hello</div>')($rootscope); $rootelement.append(element); angular.element($document[0].body).append($rootelement); $animate.enabled(true); $animate.enter(element, $rootelement); $rootscope.$digest(); expect(am).to.be(true); }); }); });
i correct in way test animations, @ time angular made change ngmocks in v1.2.16 screwed up.
Comments
Post a Comment