Commit 6b5d8648 by cahrens

Change test to pass on Chrome as well as FireFox.

parent 30dc4418
...@@ -223,6 +223,9 @@ define ["js/views/overview", "js/views/feedback_notification", "sinon", "js/base ...@@ -223,6 +223,9 @@ define ["js/views/overview", "js/views/feedback_notification", "sinon", "js/base
expect($('#subsection-1')).toHaveClass('expand-on-drop') expect($('#subsection-1')).toHaveClass('expand-on-drop')
describe "onDragMove", -> describe "onDragMove", ->
beforeEach ->
@scrollSpy = spyOn(window, 'scrollBy').andCallThrough()
it "adds the correct CSS class to the drop destination", -> it "adds the correct CSS class to the drop destination", ->
$ele = $('#unit-1') $ele = $('#unit-1')
dragY = $ele.offset().top + 10 dragY = $ele.offset().top + 10
...@@ -251,20 +254,16 @@ define ["js/views/overview", "js/views/feedback_notification", "sinon", "js/base ...@@ -251,20 +254,16 @@ define ["js/views/overview", "js/views/feedback_notification", "sinon", "js/base
expect($ele).not.toHaveClass('valid-drop') expect($ele).not.toHaveClass('valid-drop')
it "scrolls up if necessary", -> it "scrolls up if necessary", ->
scrollSpy = spyOn(window, 'scrollBy').andCallThrough()
OverviewDragger.onDragMove( OverviewDragger.onDragMove(
{element: $('#unit-1')}, '', {clientY: 2} {element: $('#unit-1')}, '', {clientY: 2}
) )
expect(scrollSpy).toHaveBeenCalledWith(0, -10) expect(@scrollSpy).toHaveBeenCalledWith(0, -10)
it "scrolls down if necessary", -> it "scrolls down if necessary", ->
height = Math.max(window.innerHeight, 100);
spyOn(window, 'innerHeight').andReturn(height)
scrollSpy = spyOn(window, 'scrollBy').andCallThrough()
OverviewDragger.onDragMove( OverviewDragger.onDragMove(
{element: $('#unit-1')}, '', {clientY: (height - 5)} {element: $('#unit-1')}, '', {clientY: (window.innerHeight - 5)}
) )
expect(scrollSpy).toHaveBeenCalledWith(0, 10) expect(@scrollSpy).toHaveBeenCalledWith(0, 10)
describe "onDragEnd", -> describe "onDragEnd", ->
beforeEach -> beforeEach ->
......
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