मैं this tutorial से काम कर रहा हूं और गुगल विज्ञापन नोडम है, लेकिन मुझे ऐसा लगता है कि यह एक छोटा ngAnimate
यूनिट परीक्षण चल रहा है।एनजी 1.47 यूनिट टेस्ट एनीमेशन फ़ंक्शंस को कॉल न करें
मेरे पास ngAnimate
ऐप में अच्छी तरह से काम कर रहा है। सभी कोणीय कोर पुस्तकालय संस्करण 1.4.7 हैं।
मॉड्यूल
angular.module 'MyAnimation', [ 'ngAnimate' ]
.animation '.added-class', ->
addClass: (element, className, done) ->
console.log 'add class triggered'
element.css 'opacity', '0.5'
done()
टेस्ट
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'
मुझे यकीन है कि मॉड्यूल परीक्षण में शामिल किया जा रहा है हूँ, लेकिन ट्रिगर $animate.enter
भी मुझे मेरे log
उत्पादन नहीं मिलता है ।
मैंने इसे अन्य $animate
फ़ंक्शंस के साथ भी कोशिश की है और कहीं भी नहीं मिल रहा है। मदद?