diff --git a/static/coffee/spec/modules/video/video_control_spec.coffee b/static/coffee/spec/modules/video/video_control_spec.coffee index a912abb2d0..0c8615b8f7 100644 --- a/static/coffee/spec/modules/video/video_control_spec.coffee +++ b/static/coffee/spec/modules/video/video_control_spec.coffee @@ -1,17 +1,16 @@ describe 'VideoControl', -> beforeEach -> @player = jasmine.stubVideoPlayer @ + $('.video-controls').html '' describe 'constructor', -> - beforeEach -> - @control = new VideoControl @player - it 'render the video controls', -> + new VideoControl @player expect($('.video-controls').html()).toContain '''
- """ + """ + + unless onTouchBasedDevice() + @$('.video_control').addClass('play').html('Play') onPlay: => @$('.video_control').removeClass('play').addClass('pause').html('Pause') @@ -36,7 +39,8 @@ class @VideoControl togglePlayback: (event) => event.preventDefault() - if @player.isPlaying() - $(@player).trigger('pause') - else - $(@player).trigger('play') + if $('.video_control').hasClass('play') || $('.video_control').hasClass('pause') + if @player.isPlaying() + $(@player).trigger('pause') + else + $(@player).trigger('play')