Commit 6d835348 by Prem Sichanugrist

Fix bug on flashing speed selector

parent 89194892
...@@ -46,17 +46,17 @@ describe 'VideoSpeedControl', -> ...@@ -46,17 +46,17 @@ describe 'VideoSpeedControl', ->
@speedControl = new VideoSpeedControl @player, @video.speeds @speedControl = new VideoSpeedControl @player, @video.speeds
it 'open the speed toggle on hover', -> it 'open the speed toggle on hover', ->
$('.speeds').mouseover() $('.speeds').mouseenter()
expect($('.speeds')).toHaveClass 'open' expect($('.speeds')).toHaveClass 'open'
$('.speeds').mouseout() $('.speeds').mouseleave()
expect($('.speeds')).not.toHaveClass 'open' expect($('.speeds')).not.toHaveClass 'open'
it 'close the speed toggle on mouse out', -> it 'close the speed toggle on mouse out', ->
$('.speeds').mouseover().mouseout() $('.speeds').mouseenter().mouseleave()
expect($('.speeds')).not.toHaveClass 'open' expect($('.speeds')).not.toHaveClass 'open'
it 'close the speed toggle on click', -> it 'close the speed toggle on click', ->
$('.speeds').mouseover().click() $('.speeds').mouseenter().click()
expect($('.speeds')).not.toHaveClass 'open' expect($('.speeds')).not.toHaveClass 'open'
describe 'changeVideoSpeed', -> describe 'changeVideoSpeed', ->
......
...@@ -12,8 +12,10 @@ class @VideoSpeedControl ...@@ -12,8 +12,10 @@ class @VideoSpeedControl
if onTouchBasedDevice() if onTouchBasedDevice()
@$('.speeds').click -> $(this).toggleClass('open') @$('.speeds').click -> $(this).toggleClass('open')
else else
@$('.speeds').mouseover -> $(this).addClass('open') @$('.speeds').mouseenter ->
@$('.speeds').mouseout -> $(this).removeClass('open') $(this).addClass('open')
@$('.speeds').mouseleave ->
$(this).removeClass('open')
@$('.speeds').click (event) -> @$('.speeds').click (event) ->
event.preventDefault() event.preventDefault()
$(this).removeClass('open') $(this).removeClass('open')
......
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