Skip to content

Commit

Permalink
Add failing test for #6782
Browse files Browse the repository at this point in the history
  • Loading branch information
Anand Thakker committed Jul 6, 2018
1 parent 01f0857 commit 1cc797a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/node_modules/mapbox-gl-js-test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 19 additions & 1 deletion test/unit/ui/handler/scroll_zoom.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,25 @@ test('ScrollZoomHandler', (t) => {
t.end();
});

test('does not zoom if preventDefault is called on the wheel event', (t) => {
t.test('Gracefully handle wheel events that cancel each other out before the first scroll frame', (t) => {
// See also https://github.com/mapbox/mapbox-gl-js/issues/6782
const map = createMap(t);
map._renderTaskQueue.run();

simulate.wheel(map.getCanvas(), {type: 'wheel', deltaY: -1});
simulate.wheel(map.getCanvas(), {type: 'wheel', deltaY: -1});
now += 1;
simulate.wheel(map.getCanvas(), {type: 'wheel', deltaY: 2});

map._renderTaskQueue.run();

now += 400;
map._renderTaskQueue.run();

t.end();
});

t.test('does not zoom if preventDefault is called on the wheel event', (t) => {
const map = createMap(t);

map.on('wheel', e => e.preventDefault());
Expand Down

0 comments on commit 1cc797a

Please sign in to comment.