| <!DOCTYPE html> |
| <html> |
| <head> |
| <style> |
| body { |
| height: 5000px; |
| } |
| |
| #target { |
| width: 200px; |
| height: 200px; |
| background-color: silver; |
| margin: 20px; |
| } |
| </style> |
| <script src="../../../resources/js-test-pre.js"></script> |
| <script src="../../../resources/ui-helper.js"></script> |
| <script> |
| var jsTestIsAsync = true; |
| |
| let isFirst = true; |
| let windowScrollEventCount = 0; |
| let wasCancelable; |
| let wasCanceled; |
| |
| async function testScroll() |
| { |
| await UIHelper.mouseWheelScrollAt(100, 100); |
| shouldBeTrue('windowScrollEventCount > 0'); |
| |
| shouldBeFalse('wasCancelable'); |
| shouldBeFalse('wasCanceled'); |
| |
| finishJSTest(); |
| } |
| |
| window.addEventListener('load', () => { |
| debug('Tests that wheel events in the passive region are non-cancelable') |
| let target = document.getElementById('target'); |
| |
| target.addEventListener('wheel', (event) => { |
| if (isFirst) { |
| wasCancelable = event.cancelable; |
| event.preventDefault(); |
| wasCanceled = event.defaultPrevented; |
| isFirst = false; |
| } |
| |
| }, { passive: true }); |
| |
| window.addEventListener('scroll', () => { |
| ++windowScrollEventCount; |
| }, false); |
| |
| setTimeout(testScroll, 0); |
| }, false); |
| </script> |
| </head> |
| <body> |
| <div id="target"></div> |
| <div id="console"></div> |
| <script src="../../../resources/js-test-post.js"></script> |
| </body> |
| </html> |