Merge pull request #10332 from ahocevar/no-touch-action-css
Conditional default prevention instead of touch-action: none
This commit is contained in:
@@ -174,4 +174,21 @@ describe('ol/MapBrowserEventHandler', function() {
|
||||
expect(moveToleranceHandler.isMoving_(pointermoveAt2)).to.be(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('handleTouchMove_', function() {
|
||||
let handler;
|
||||
beforeEach(function() {
|
||||
handler = new MapBrowserEventHandler(new Map({}));
|
||||
});
|
||||
it('prevents default on touchmove event', function() {
|
||||
handler.originalPointerMoveEvent_ = {
|
||||
defaultPrevented: true
|
||||
};
|
||||
const event = {
|
||||
preventDefault: sinon.spy()
|
||||
};
|
||||
handler.handleTouchMove_(event);
|
||||
expect(event.preventDefault.callCount).to.be(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -666,21 +666,6 @@ describe('ol.Map', function() {
|
||||
expect(map.handleResize_).to.be.ok();
|
||||
});
|
||||
|
||||
it('handles touch-action on focus and blur', function() {
|
||||
expect(map.focusHandlerKeys_).to.be(null);
|
||||
expect(map.getViewport().getAttribute('touch-action')).to.be('none');
|
||||
const target = document.createElement('div');
|
||||
target.setAttribute('tabindex', 1);
|
||||
map.setTarget(target);
|
||||
expect(Array.isArray(map.focusHandlerKeys_)).to.be(true);
|
||||
expect(map.getViewport().getAttribute('touch-action')).to.be('auto');
|
||||
target.dispatchEvent(new Event('focus'));
|
||||
expect(map.getViewport().getAttribute('touch-action')).to.be('none');
|
||||
map.setTarget(null);
|
||||
expect(map.focusHandlerKeys_).to.be(null);
|
||||
expect(map.getViewport().getAttribute('touch-action')).to.be('none');
|
||||
});
|
||||
|
||||
describe('call setTarget with null', function() {
|
||||
it('unregisters the viewport resize listener', function() {
|
||||
map.setTarget(null);
|
||||
|
||||
Reference in New Issue
Block a user