I need to trigger a window scroll event to check for infinite scrolling, I tried to use it triggerEvent, but it seems like I'm missing something, and that doesn't work. I am using Ember 2.0, and the list is displayed inside the component, if that matters. The test does not work with the last 2 statements, the scroll position does not change after the event is triggered
test 'loads more items when scrolling', (assert) ->
visit '/locations/1'
andThen ->
assert.equal(find('.items-list li').length, 30)
find(window).scrollTop(10000)
triggerEvent(window, 'scroll')
andThen ->
assert.ok(find(window).scrollTop() > 0, 'window should scroll')
assert.ok(find('.items-list li').length > 30, 'should load more items after reaching threshold')
Has anyone successfully raised a scroll event in their tests?
source
share