Commit 47409654 by cahrens

Skip tests instead of commenting them out (for merge that is coming).

parent 05428f5b
...@@ -70,12 +70,12 @@ describe 'Problem', -> ...@@ -70,12 +70,12 @@ describe 'Problem', ->
it 'bind the math input', -> it 'bind the math input', ->
expect($('input.math')).toHandleWith 'keyup', @problem.refreshMath expect($('input.math')).toHandleWith 'keyup', @problem.refreshMath
# TODO figure out why this is failing # TODO: figure out why failing
# it 'replace math content on the page', -> xit 'replace math content on the page', ->
# expect(MathJax.Hub.Queue.mostRecentCall.args).toEqual [ expect(MathJax.Hub.Queue.mostRecentCall.args).toEqual [
# ['Text', @stubbedJax, ''], ['Text', @stubbedJax, ''],
# [@problem.updateMathML, @stubbedJax, $('#input_example_1').get(0)] [@problem.updateMathML, @stubbedJax, $('#input_example_1').get(0)]
# ] ]
describe 'render', -> describe 'render', ->
beforeEach -> beforeEach ->
...@@ -138,14 +138,14 @@ describe 'Problem', -> ...@@ -138,14 +138,14 @@ describe 'Problem', ->
@problem.check() @problem.check()
expect(@problem.el.html()).toEqual 'Incorrect!' expect(@problem.el.html()).toEqual 'Incorrect!'
# TODO figure out why this is failing # TODO: figure out why failing
# describe 'when the response is undetermined', -> xdescribe 'when the response is undetermined', ->
# it 'alert the response', -> it 'alert the response', ->
# spyOn window, 'alert' spyOn window, 'alert'
# spyOn($, 'postWithPrefix').andCallFake (url, answers, callback) -> spyOn($, 'postWithPrefix').andCallFake (url, answers, callback) ->
# callback(success: 'Number Only!') callback(success: 'Number Only!')
# @problem.check() @problem.check()
# expect(window.alert).toHaveBeenCalledWith 'Number Only!' expect(window.alert).toHaveBeenCalledWith 'Number Only!'
describe 'reset', -> describe 'reset', ->
beforeEach -> beforeEach ->
...@@ -264,12 +264,12 @@ describe 'Problem', -> ...@@ -264,12 +264,12 @@ describe 'Problem', ->
expect($.postWithPrefix).toHaveBeenCalledWith '/problem/Problem1/problem_save', expect($.postWithPrefix).toHaveBeenCalledWith '/problem/Problem1/problem_save',
'foo=1&bar=2', jasmine.any(Function) 'foo=1&bar=2', jasmine.any(Function)
# TODO figure out why this is failing # TODO: figure out why failing
# it 'alert to the user', -> xit 'alert to the user', ->
# spyOn window, 'alert' spyOn window, 'alert'
# spyOn($, 'postWithPrefix').andCallFake (url, answers, callback) -> callback(success: 'OK') spyOn($, 'postWithPrefix').andCallFake (url, answers, callback) -> callback(success: 'OK')
# @problem.save() @problem.save()
# expect(window.alert).toHaveBeenCalledWith 'Saved' expect(window.alert).toHaveBeenCalledWith 'Saved'
describe 'refreshMath', -> describe 'refreshMath', ->
beforeEach -> beforeEach ->
...@@ -323,10 +323,10 @@ describe 'Problem', -> ...@@ -323,10 +323,10 @@ describe 'Problem', ->
@problem.refreshAnswers() @problem.refreshAnswers()
expect(@stubCodeMirror.save).toHaveBeenCalled() expect(@stubCodeMirror.save).toHaveBeenCalled()
# TODO figure out why this is failing # TODO: figure out why failing
# it 'serialize all answers', -> xit 'serialize all answers', ->
# @problem.refreshAnswers() @problem.refreshAnswers()
# expect(@problem.answers).toEqual "input_1_1=one&input_1_2=two" expect(@problem.answers).toEqual "input_1_1=one&input_1_2=two"
#describe 'VideoControl', -> # TODO: figure out why failing
# beforeEach -> xdescribe 'VideoControl', ->
# jasmine.stubVideoPlayer @ beforeEach ->
# $('.video-controls').html '' jasmine.stubVideoPlayer @
# $('.video-controls').html ''
# describe 'constructor', ->
# it 'render the video controls', -> describe 'constructor', ->
# new VideoControl(el: $('.video-controls')) it 'render the video controls', ->
# expect($('.video-controls').html()).toContain ''' new VideoControl(el: $('.video-controls'))
# <div class="slider"></div> expect($('.video-controls').html()).toContain '''
# <div> <div class="slider"></div>
# <ul class="vcr"> <div>
# <li><a class="video_control play" href="#">Play</a></li> <ul class="vcr">
# <li> <li><a class="video_control play" href="#">Play</a></li>
# <div class="vidtime">0:00 / 0:00</div> <li>
# </li> <div class="vidtime">0:00 / 0:00</div>
# </ul> </li>
# <div class="secondary-controls"> </ul>
# <a href="#" class="add-fullscreen" title="Fill browser">Fill Browser</a> <div class="secondary-controls">
# </div> <a href="#" class="add-fullscreen" title="Fill browser">Fill Browser</a>
# </div> </div>
# ''' </div>
# '''
# it 'bind the playback button', ->
# control = new VideoControl(el: $('.video-controls')) it 'bind the playback button', ->
# expect($('.video_control')).toHandleWith 'click', control.togglePlayback control = new VideoControl(el: $('.video-controls'))
# expect($('.video_control')).toHandleWith 'click', control.togglePlayback
# describe 'when on a touch based device', ->
# beforeEach -> describe 'when on a touch based device', ->
# spyOn(window, 'onTouchBasedDevice').andReturn true beforeEach ->
# spyOn(window, 'onTouchBasedDevice').andReturn true
# it 'does not add the play class to video control', ->
# new VideoControl(el: $('.video-controls')) it 'does not add the play class to video control', ->
# expect($('.video_control')).not.toHaveClass 'play' new VideoControl(el: $('.video-controls'))
# expect($('.video_control')).not.toHaveHtml 'Play' expect($('.video_control')).not.toHaveClass 'play'
# expect($('.video_control')).not.toHaveHtml 'Play'
#
# describe 'when on a non-touch based device', ->
# beforeEach -> describe 'when on a non-touch based device', ->
# spyOn(window, 'onTouchBasedDevice').andReturn false beforeEach ->
# spyOn(window, 'onTouchBasedDevice').andReturn false
# it 'add the play class to video control', ->
# new VideoControl(el: $('.video-controls')) it 'add the play class to video control', ->
# expect($('.video_control')).toHaveClass 'play' new VideoControl(el: $('.video-controls'))
# expect($('.video_control')).toHaveHtml 'Play' expect($('.video_control')).toHaveClass 'play'
# expect($('.video_control')).toHaveHtml 'Play'
# describe 'play', ->
# beforeEach -> describe 'play', ->
# @control = new VideoControl(el: $('.video-controls')) beforeEach ->
# @control.play() @control = new VideoControl(el: $('.video-controls'))
# @control.play()
# it 'switch playback button to play state', ->
# expect($('.video_control')).not.toHaveClass 'play' it 'switch playback button to play state', ->
# expect($('.video_control')).toHaveClass 'pause' expect($('.video_control')).not.toHaveClass 'play'
# expect($('.video_control')).toHaveHtml 'Pause' expect($('.video_control')).toHaveClass 'pause'
# expect($('.video_control')).toHaveHtml 'Pause'
# describe 'pause', ->
# beforeEach -> describe 'pause', ->
# @control = new VideoControl(el: $('.video-controls')) beforeEach ->
# @control.pause() @control = new VideoControl(el: $('.video-controls'))
# @control.pause()
# it 'switch playback button to pause state', ->
# expect($('.video_control')).not.toHaveClass 'pause' it 'switch playback button to pause state', ->
# expect($('.video_control')).toHaveClass 'play' expect($('.video_control')).not.toHaveClass 'pause'
# expect($('.video_control')).toHaveHtml 'Play' expect($('.video_control')).toHaveClass 'play'
# expect($('.video_control')).toHaveHtml 'Play'
# describe 'togglePlayback', ->
# beforeEach -> describe 'togglePlayback', ->
# @control = new VideoControl(el: $('.video-controls')) beforeEach ->
# @control = new VideoControl(el: $('.video-controls'))
# describe 'when the control does not have play or pause class', ->
# beforeEach -> describe 'when the control does not have play or pause class', ->
# $('.video_control').removeClass('play').removeClass('pause') beforeEach ->
# $('.video_control').removeClass('play').removeClass('pause')
# describe 'when the video is playing', ->
# beforeEach -> describe 'when the video is playing', ->
# $('.video_control').addClass('play') beforeEach ->
# spyOnEvent @control, 'pause' $('.video_control').addClass('play')
# @control.togglePlayback jQuery.Event('click') spyOnEvent @control, 'pause'
# @control.togglePlayback jQuery.Event('click')
# it 'does not trigger the pause event', ->
# expect('pause').not.toHaveBeenTriggeredOn @control it 'does not trigger the pause event', ->
# expect('pause').not.toHaveBeenTriggeredOn @control
# describe 'when the video is paused', ->
# beforeEach -> describe 'when the video is paused', ->
# $('.video_control').addClass('pause') beforeEach ->
# spyOnEvent @control, 'play' $('.video_control').addClass('pause')
# @control.togglePlayback jQuery.Event('click') spyOnEvent @control, 'play'
# @control.togglePlayback jQuery.Event('click')
# it 'does not trigger the play event', ->
# expect('play').not.toHaveBeenTriggeredOn @control it 'does not trigger the play event', ->
# expect('play').not.toHaveBeenTriggeredOn @control
# describe 'when the video is playing', ->
# beforeEach -> describe 'when the video is playing', ->
# spyOnEvent @control, 'pause' beforeEach ->
# $('.video_control').addClass 'pause' spyOnEvent @control, 'pause'
# @control.togglePlayback jQuery.Event('click') $('.video_control').addClass 'pause'
# @control.togglePlayback jQuery.Event('click')
# it 'trigger the pause event', ->
# expect('pause').toHaveBeenTriggeredOn @control it 'trigger the pause event', ->
# expect('pause').toHaveBeenTriggeredOn @control
# describe 'when the video is paused', ->
# beforeEach -> describe 'when the video is paused', ->
# spyOnEvent @control, 'play' beforeEach ->
# $('.video_control').addClass 'play' spyOnEvent @control, 'play'
# @control.togglePlayback jQuery.Event('click') $('.video_control').addClass 'play'
# @control.togglePlayback jQuery.Event('click')
# it 'trigger the play event', ->
# expect('play').toHaveBeenTriggeredOn @control it 'trigger the play event', ->
expect('play').toHaveBeenTriggeredOn @control
#describe 'VideoSpeedControl', -> # TODO: figure out why failing
# beforeEach -> xdescribe 'VideoSpeedControl', ->
# jasmine.stubVideoPlayer @ beforeEach ->
# $('.speeds').remove() jasmine.stubVideoPlayer @
# $('.speeds').remove()
# describe 'constructor', ->
# describe 'always', -> describe 'constructor', ->
# beforeEach -> describe 'always', ->
# @speedControl = new VideoSpeedControl el: $('.secondary-controls'), speeds: @video.speeds, currentSpeed: '1.0' beforeEach ->
# @speedControl = new VideoSpeedControl el: $('.secondary-controls'), speeds: @video.speeds, currentSpeed: '1.0'
# it 'add the video speed control to player', ->
# expect($('.secondary-controls').html()).toContain ''' it 'add the video speed control to player', ->
# <div class="speeds"> expect($('.secondary-controls').html()).toContain '''
# <a href="#"> <div class="speeds">
# <h3>Speed</h3> <a href="#">
# <p class="active">1.0x</p> <h3>Speed</h3>
# </a> <p class="active">1.0x</p>
# <ol class="video_speeds"><li data-speed="1.0" class="active"><a href="#">1.0x</a></li><li data-speed="0.75"><a href="#">0.75x</a></li></ol> </a>
# </div> <ol class="video_speeds"><li data-speed="1.0" class="active"><a href="#">1.0x</a></li><li data-speed="0.75"><a href="#">0.75x</a></li></ol>
# ''' </div>
# '''
# it 'bind to change video speed link', ->
# expect($('.video_speeds a')).toHandleWith 'click', @speedControl.changeVideoSpeed it 'bind to change video speed link', ->
# expect($('.video_speeds a')).toHandleWith 'click', @speedControl.changeVideoSpeed
# describe 'when running on touch based device', ->
# beforeEach -> describe 'when running on touch based device', ->
# spyOn(window, 'onTouchBasedDevice').andReturn true beforeEach ->
# $('.speeds').removeClass 'open' spyOn(window, 'onTouchBasedDevice').andReturn true
# @speedControl = new VideoSpeedControl el: $('.secondary-controls'), speeds: @video.speeds, currentSpeed: '1.0' $('.speeds').removeClass 'open'
# @speedControl = new VideoSpeedControl el: $('.secondary-controls'), speeds: @video.speeds, currentSpeed: '1.0'
# it 'open the speed toggle on click', ->
# $('.speeds').click() it 'open the speed toggle on click', ->
# expect($('.speeds')).toHaveClass 'open' $('.speeds').click()
# $('.speeds').click() expect($('.speeds')).toHaveClass 'open'
# expect($('.speeds')).not.toHaveClass 'open' $('.speeds').click()
# expect($('.speeds')).not.toHaveClass 'open'
# describe 'when running on non-touch based device', ->
# beforeEach -> describe 'when running on non-touch based device', ->
# spyOn(window, 'onTouchBasedDevice').andReturn false beforeEach ->
# $('.speeds').removeClass 'open' spyOn(window, 'onTouchBasedDevice').andReturn false
# @speedControl = new VideoSpeedControl el: $('.secondary-controls'), speeds: @video.speeds, currentSpeed: '1.0' $('.speeds').removeClass 'open'
# @speedControl = new VideoSpeedControl el: $('.secondary-controls'), speeds: @video.speeds, currentSpeed: '1.0'
# it 'open the speed toggle on hover', ->
# $('.speeds').mouseenter() it 'open the speed toggle on hover', ->
# expect($('.speeds')).toHaveClass 'open' $('.speeds').mouseenter()
# $('.speeds').mouseleave() expect($('.speeds')).toHaveClass 'open'
# expect($('.speeds')).not.toHaveClass 'open' $('.speeds').mouseleave()
# expect($('.speeds')).not.toHaveClass 'open'
# it 'close the speed toggle on mouse out', ->
# $('.speeds').mouseenter().mouseleave() it 'close the speed toggle on mouse out', ->
# expect($('.speeds')).not.toHaveClass 'open' $('.speeds').mouseenter().mouseleave()
# expect($('.speeds')).not.toHaveClass 'open'
# it 'close the speed toggle on click', ->
# $('.speeds').mouseenter().click() it 'close the speed toggle on click', ->
# expect($('.speeds')).not.toHaveClass 'open' $('.speeds').mouseenter().click()
# expect($('.speeds')).not.toHaveClass 'open'
# describe 'changeVideoSpeed', ->
# beforeEach -> describe 'changeVideoSpeed', ->
# @speedControl = new VideoSpeedControl el: $('.secondary-controls'), speeds: @video.speeds, currentSpeed: '1.0' beforeEach ->
# @video.setSpeed '1.0' @speedControl = new VideoSpeedControl el: $('.secondary-controls'), speeds: @video.speeds, currentSpeed: '1.0'
# @video.setSpeed '1.0'
# describe 'when new speed is the same', ->
# beforeEach -> describe 'when new speed is the same', ->
# spyOnEvent @speedControl, 'speedChange' beforeEach ->
# $('li[data-speed="1.0"] a').click() spyOnEvent @speedControl, 'speedChange'
# $('li[data-speed="1.0"] a').click()
# it 'does not trigger speedChange event', ->
# expect('speedChange').not.toHaveBeenTriggeredOn @speedControl it 'does not trigger speedChange event', ->
# expect('speedChange').not.toHaveBeenTriggeredOn @speedControl
# describe 'when new speed is not the same', ->
# beforeEach -> describe 'when new speed is not the same', ->
# @newSpeed = null beforeEach ->
# $(@speedControl).bind 'speedChange', (event, newSpeed) => @newSpeed = newSpeed @newSpeed = null
# spyOnEvent @speedControl, 'speedChange' $(@speedControl).bind 'speedChange', (event, newSpeed) => @newSpeed = newSpeed
# $('li[data-speed="0.75"] a').click() spyOnEvent @speedControl, 'speedChange'
# $('li[data-speed="0.75"] a').click()
# it 'trigger speedChange event', ->
# expect('speedChange').toHaveBeenTriggeredOn @speedControl it 'trigger speedChange event', ->
# expect(@newSpeed).toEqual 0.75 expect('speedChange').toHaveBeenTriggeredOn @speedControl
# expect(@newSpeed).toEqual 0.75
# describe 'onSpeedChange', ->
# beforeEach -> describe 'onSpeedChange', ->
# @speedControl = new VideoSpeedControl el: $('.secondary-controls'), speeds: @video.speeds, currentSpeed: '1.0' beforeEach ->
# $('li[data-speed="1.0"] a').addClass 'active' @speedControl = new VideoSpeedControl el: $('.secondary-controls'), speeds: @video.speeds, currentSpeed: '1.0'
# @speedControl.setSpeed '0.75' $('li[data-speed="1.0"] a').addClass 'active'
# @speedControl.setSpeed '0.75'
# it 'set the new speed as active', ->
# expect($('.video_speeds li[data-speed="1.0"]')).not.toHaveClass 'active' it 'set the new speed as active', ->
# expect($('.video_speeds li[data-speed="0.75"]')).toHaveClass 'active' expect($('.video_speeds li[data-speed="1.0"]')).not.toHaveClass 'active'
# expect($('.speeds p.active')).toHaveHtml '0.75x' expect($('.video_speeds li[data-speed="0.75"]')).toHaveClass 'active'
expect($('.speeds p.active')).toHaveHtml '0.75x'
#describe 'VideoVolumeControl', -> # TODO: figure out why failing
# beforeEach -> xdescribe 'VideoVolumeControl', ->
# jasmine.stubVideoPlayer @ beforeEach ->
# $('.volume').remove() jasmine.stubVideoPlayer @
# $('.volume').remove()
# describe 'constructor', ->
# beforeEach -> describe 'constructor', ->
# spyOn($.fn, 'slider') beforeEach ->
# @volumeControl = new VideoVolumeControl el: $('.secondary-controls') spyOn($.fn, 'slider')
# @volumeControl = new VideoVolumeControl el: $('.secondary-controls')
# it 'initialize currentVolume to 100', ->
# expect(@volumeControl.currentVolume).toEqual 100 it 'initialize currentVolume to 100', ->
# expect(@volumeControl.currentVolume).toEqual 100
# it 'render the volume control', ->
# expect($('.secondary-controls').html()).toContain """ it 'render the volume control', ->
# <div class="volume"> expect($('.secondary-controls').html()).toContain """
# <a href="#"></a> <div class="volume">
# <div class="volume-slider-container"> <a href="#"></a>
# <div class="volume-slider"></div> <div class="volume-slider-container">
# </div> <div class="volume-slider"></div>
# </div> </div>
# """ </div>
# """
# it 'create the slider', ->
# expect($.fn.slider).toHaveBeenCalledWith it 'create the slider', ->
# orientation: "vertical" expect($.fn.slider).toHaveBeenCalledWith
# range: "min" orientation: "vertical"
# min: 0 range: "min"
# max: 100 min: 0
# value: 100 max: 100
# change: @volumeControl.onChange value: 100
# slide: @volumeControl.onChange change: @volumeControl.onChange
# slide: @volumeControl.onChange
# it 'bind the volume control', ->
# expect($('.volume>a')).toHandleWith 'click', @volumeControl.toggleMute it 'bind the volume control', ->
# expect($('.volume>a')).toHandleWith 'click', @volumeControl.toggleMute
# expect($('.volume')).not.toHaveClass 'open'
# $('.volume').mouseenter() expect($('.volume')).not.toHaveClass 'open'
# expect($('.volume')).toHaveClass 'open' $('.volume').mouseenter()
# $('.volume').mouseleave() expect($('.volume')).toHaveClass 'open'
# expect($('.volume')).not.toHaveClass 'open' $('.volume').mouseleave()
# expect($('.volume')).not.toHaveClass 'open'
# describe 'onChange', ->
# beforeEach -> describe 'onChange', ->
# spyOnEvent @volumeControl, 'volumeChange' beforeEach ->
# @newVolume = undefined spyOnEvent @volumeControl, 'volumeChange'
# @volumeControl = new VideoVolumeControl el: $('.secondary-controls') @newVolume = undefined
# $(@volumeControl).bind 'volumeChange', (event, volume) => @newVolume = volume @volumeControl = new VideoVolumeControl el: $('.secondary-controls')
# $(@volumeControl).bind 'volumeChange', (event, volume) => @newVolume = volume
# describe 'when the new volume is more than 0', ->
# beforeEach -> describe 'when the new volume is more than 0', ->
# @volumeControl.onChange undefined, value: 60 beforeEach ->
# @volumeControl.onChange undefined, value: 60
# it 'set the player volume', ->
# expect(@newVolume).toEqual 60 it 'set the player volume', ->
# expect(@newVolume).toEqual 60
# it 'remote muted class', ->
# expect($('.volume')).not.toHaveClass 'muted' it 'remote muted class', ->
# expect($('.volume')).not.toHaveClass 'muted'
# describe 'when the new volume is 0', ->
# beforeEach -> describe 'when the new volume is 0', ->
# @volumeControl.onChange undefined, value: 0 beforeEach ->
# @volumeControl.onChange undefined, value: 0
# it 'set the player volume', ->
# expect(@newVolume).toEqual 0 it 'set the player volume', ->
# expect(@newVolume).toEqual 0
# it 'add muted class', ->
# expect($('.volume')).toHaveClass 'muted' it 'add muted class', ->
# expect($('.volume')).toHaveClass 'muted'
# describe 'toggleMute', ->
# beforeEach -> describe 'toggleMute', ->
# @newVolume = undefined beforeEach ->
# @volumeControl = new VideoVolumeControl el: $('.secondary-controls') @newVolume = undefined
# $(@volumeControl).bind 'volumeChange', (event, volume) => @newVolume = volume @volumeControl = new VideoVolumeControl el: $('.secondary-controls')
# $(@volumeControl).bind 'volumeChange', (event, volume) => @newVolume = volume
# describe 'when the current volume is more than 0', ->
# beforeEach -> describe 'when the current volume is more than 0', ->
# @volumeControl.currentVolume = 60 beforeEach ->
# @volumeControl.toggleMute() @volumeControl.currentVolume = 60
# @volumeControl.toggleMute()
# it 'save the previous volume', ->
# expect(@volumeControl.previousVolume).toEqual 60 it 'save the previous volume', ->
# expect(@volumeControl.previousVolume).toEqual 60
# it 'set the player volume', ->
# expect(@newVolume).toEqual 0 it 'set the player volume', ->
# expect(@newVolume).toEqual 0
# describe 'when the current volume is 0', ->
# beforeEach -> describe 'when the current volume is 0', ->
# @volumeControl.currentVolume = 0 beforeEach ->
# @volumeControl.previousVolume = 60 @volumeControl.currentVolume = 0
# @volumeControl.toggleMute() @volumeControl.previousVolume = 60
# @volumeControl.toggleMute()
# it 'set the player volume to previous volume', ->
# expect(@newVolume).toEqual 60 it 'set the player volume to previous volume', ->
expect(@newVolume).toEqual 60
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment