Add tests for additional events
This commit is contained in:
committed by
Vasyl Nakvasiuk
parent
78e22a910e
commit
cfb9a54e21
@@ -337,6 +337,7 @@ describe 'VideoCaptionAlpha', ->
|
||||
describe 'toggle', ->
|
||||
beforeEach ->
|
||||
@player = jasmine.stubVideoPlayerAlpha @
|
||||
spyOn @video, 'log'
|
||||
@caption = @player.caption
|
||||
$('.subtitles li[data-index=1]').addClass 'current'
|
||||
|
||||
@@ -345,6 +346,10 @@ describe 'VideoCaptionAlpha', ->
|
||||
@caption.el.removeClass 'closed'
|
||||
@caption.toggle jQuery.Event('click')
|
||||
|
||||
it 'log the hide_transcript event', ->
|
||||
expect(@video.log).toHaveBeenCalledWith 'hide_transcript',
|
||||
currentTime: @player.currentTime
|
||||
|
||||
it 'hide the caption', ->
|
||||
expect(@caption.el).toHaveClass 'closed'
|
||||
|
||||
@@ -353,6 +358,10 @@ describe 'VideoCaptionAlpha', ->
|
||||
@caption.el.addClass 'closed'
|
||||
@caption.toggle jQuery.Event('click')
|
||||
|
||||
it 'log the show_transcript event', ->
|
||||
expect(@video.log).toHaveBeenCalledWith 'show_transcript',
|
||||
currentTime: @player.currentTime
|
||||
|
||||
it 'show the caption', ->
|
||||
expect(@caption.el).not.toHaveClass 'closed'
|
||||
|
||||
|
||||
@@ -432,9 +432,14 @@ describe 'VideoPlayerAlpha', ->
|
||||
|
||||
describe 'when the video player is not full screen', ->
|
||||
beforeEach ->
|
||||
spyOn @video, 'log'
|
||||
@player.el.removeClass 'fullscreen'
|
||||
@player.toggleFullScreen(jQuery.Event("click"))
|
||||
|
||||
it 'log the fullscreen event', ->
|
||||
expect(@video.log).toHaveBeenCalledWith 'fullscreen',
|
||||
currentTime: @player.currentTime
|
||||
|
||||
it 'replace the full screen button tooltip', ->
|
||||
expect($('.add-fullscreen')).toHaveAttr 'title', 'Exit fill browser'
|
||||
|
||||
@@ -446,9 +451,14 @@ describe 'VideoPlayerAlpha', ->
|
||||
|
||||
describe 'when the video player already full screen', ->
|
||||
beforeEach ->
|
||||
spyOn @video, 'log'
|
||||
@player.el.addClass 'fullscreen'
|
||||
@player.toggleFullScreen(jQuery.Event("click"))
|
||||
|
||||
it 'log the not_fullscreen event', ->
|
||||
expect(@video.log).toHaveBeenCalledWith 'not_fullscreen',
|
||||
currentTime: @player.currentTime
|
||||
|
||||
it 'replace the full screen button tooltip', ->
|
||||
expect($('.add-fullscreen')).toHaveAttr 'title', 'Fill browser'
|
||||
|
||||
|
||||
@@ -135,8 +135,6 @@ class @VideoPlayerAlpha extends SubviewAlpha
|
||||
# NOTE: It is my strong belief that in the future YouTube Flash player will
|
||||
# not get speed changes. This is a dying technology. So we can safely use
|
||||
# this indirect method to determine player mode.
|
||||
|
||||
|
||||
availableSpeeds = @player.getAvailablePlaybackRates()
|
||||
prev_player_type = $.cookie('prev_player_type')
|
||||
if availableSpeeds.length > 1
|
||||
|
||||
Reference in New Issue
Block a user