Ich habe von this tutorial gearbeitet und habe Google nicht geortet, aber ich kann nicht scheinen, was zu einem trivialen ngAnimate
Unit-Test läuft.ngAnimate 1.4.7 Komponententest nicht aufrufen Animationsfunktionen
Ich habe ngAnimate
funktioniert gut in der App. Alle Angular Core-Bibliotheken sind Version 1.4.7.
Modul
angular.module 'MyAnimation', [ 'ngAnimate' ]
.animation '.added-class', ->
addClass: (element, className, done) ->
console.log 'add class triggered'
element.css 'opacity', '0.5'
done()
-Test
describe 'MyAnimation', ->
beforeEach -> module 'ngAnimate'
beforeEach -> module 'ngAnimateMock'
beforeEach -> module 'MyAnimation'
it 'animates', -> inject ($animate, $rootScope, $rootElement) ->
$animate.enabled(true)
divElement = angular.element '<div>my div</div>'
# Kick off initial digest loop in which no animations are run.
$rootScope.$digest()
# Trigger animation.
$animate.addClass divElement, 'added-class'
$rootScope.$digest()
# Tried this, doesn't seem to do anything.
# $animate.flush()
# Results in AssertionError: expected '' to equal '0.5'
expect(divElement.css('opacity')).to.eq '0.5'
Ich bin sicher, dass das Modul in den Test einbezogen wird, aber $animate.enter
Auslösung auch Sie mich nicht meine log
Ausgang .
Ich habe dies mit anderen $animate
Funktionen auch versucht und komme nirgendwohin. Hilfe?