Title: [210516] trunk/LayoutTests
Revision
210516
Author
bda...@apple.com
Date
2017-01-09 11:09:23 -0800 (Mon, 09 Jan 2017)

Log Message

Add a test to ensure that preventDefault on touchmove prevents scrolling
https://bugs.webkit.org/show_bug.cgi?id=166790

Reviewed by Simon Fraser.

* fast/events/touch/ios/iphone7/prevent-default-touchmove-prevents-scrolling-expected.txt: Added.
* fast/events/touch/ios/iphone7/prevent-default-touchmove-prevents-scrolling.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (210515 => 210516)


--- trunk/LayoutTests/ChangeLog	2017-01-09 18:55:09 UTC (rev 210515)
+++ trunk/LayoutTests/ChangeLog	2017-01-09 19:09:23 UTC (rev 210516)
@@ -1,3 +1,13 @@
+2017-01-09  Beth Dakin  <bda...@apple.com>
+
+        Add a test to ensure that preventDefault on touchmove prevents scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=166790
+
+        Reviewed by Simon Fraser.
+
+        * fast/events/touch/ios/iphone7/prevent-default-touchmove-prevents-scrolling-expected.txt: Added.
+        * fast/events/touch/ios/iphone7/prevent-default-touchmove-prevents-scrolling.html: Added.
+
 2017-01-09  Ryan Haddad  <ryanhad...@apple.com>
 
         Rebaseline W3C test for ios-simulator after r210468.

Added: trunk/LayoutTests/fast/events/touch/ios/iphone7/prevent-default-touchmove-prevents-scrolling-expected.txt (0 => 210516)


--- trunk/LayoutTests/fast/events/touch/ios/iphone7/prevent-default-touchmove-prevents-scrolling-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/iphone7/prevent-default-touchmove-prevents-scrolling-expected.txt	2017-01-09 19:09:23 UTC (rev 210516)
@@ -0,0 +1,10 @@
+Test that preventing default on touchmove will prevent scrolling in overflow:scroll.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementById('scroller').scrollTop is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/events/touch/ios/iphone7/prevent-default-touchmove-prevents-scrolling.html (0 => 210516)


--- trunk/LayoutTests/fast/events/touch/ios/iphone7/prevent-default-touchmove-prevents-scrolling.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/iphone7/prevent-default-touchmove-prevents-scrolling.html	2017-01-09 19:09:23 UTC (rev 210516)
@@ -0,0 +1,99 @@
+<html >
+<head>
+<script src=""
+<style>
+#scroller {
+    border: 2px solid black;
+    height: 400px;
+    overflow: scroll;
+    position: absolute;
+}
+        
+#big {
+    width: 50px;
+    height: 2000px;
+    background-color: purple;
+    border: 15px solid green;
+}
+</style>
+</head>
+
+<body>
+<div id="scroller">
+    <div id="big"></div>
+</div>
+
+<script>
+description("Test that preventing default on touchmove will prevent scrolling in overflow:scroll.");
+window.jsTestIsAsync = true;
+
+function getUIScript(startX, startY, endX, endY)
+{
+    return `
+    (function() {
+     var eventStream = {
+     events : [
+        {
+        interpolate : "linear",
+        timestep: 0.025,
+        startEvent : {
+        inputType : "hand",
+        timeOffset : 0,
+        touches : [
+            {
+            inputType : "finger",
+            phase : "began",
+            id : 1,
+            x : ${startX},
+            y : ${startY},
+            pressure : 0
+            }
+        ]
+        },
+        endEvent : {
+        inputType : "hand",
+        timeOffset : 3.0,
+        touches : [
+            {
+            inputType : "finger",
+            phase : "stationary",
+            id : 1,
+            x : ${endX},
+            y : ${endY},
+            pressure : 500
+            }
+        ]
+        }
+    }
+    ]
+    };
+     
+    uiController.sendEventStream(JSON.stringify(eventStream), function() {
+        uiController.uiScriptComplete();
+    });
+    })();`
+}
+
+function runTest()
+{
+    function touchmoveEventHandler(event) {
+        event.preventDefault();
+    }
+
+    let eventTarget = document.getElementById("scroller");
+    eventTarget.addEventListener("touchmove", touchmoveEventHandler);
+    let clientRect = eventTarget.getBoundingClientRect();
+    
+    if (window.testRunner) {
+        testRunner.runUIScript(getUIScript(clientRect.left + 10, clientRect.top + 200, clientRect.left + 10, clientRect.top + 10), function(result) {
+                            shouldBe("document.getElementById('scroller').scrollTop", "0");
+                            finishJSTest();
+                               });
+    }
+}
+
+window.addEventListener('load', runTest, false);
+</script>
+<script src=""
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to