jasmine と jasmine-jquery を使用して JavaScript を少しテストしようとしています
だから私はこのJavascriptのビットを関数に持っています
trackTransition = ()->
$("#test").on "transitionend MSTransitionEnd webkitTransitionEnd oTransitionEnd", ()->
console.log "trans End"
cssトランジションを追加するspec.cssにいくつかのスタイルを適用し、いくつかのhtmlをフィクスチャに追加してから、ジャスミン仕様に次のように追加しました。
describe "Checks when animation finished", ->
beforeEach ->
@trans = spyOnEvent('#test', 'transitionend MSTransitionEnd webkitTransitionEnd oTransitionEnd')
jasmine.Clock.useMock()
trackTransition()
it "Should check when transition ended", ->
expect(@trans).not.toHaveBeenTriggered()
jasmine.Clock.tick(1001)
expect(@trans).toHaveBeenTriggered()
これをページでテストして問題なく起動しましたが、ランナーでは失敗し、console.log も実行されません。遷移をテストできますか?