diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/events/test/pointerevents/pointerevent_capture_suppressing_mouse-manual.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/events/test/pointerevents/pointerevent_capture_suppressing_mouse-manual.html')
-rw-r--r-- | dom/events/test/pointerevents/pointerevent_capture_suppressing_mouse-manual.html | 186 |
1 files changed, 186 insertions, 0 deletions
diff --git a/dom/events/test/pointerevents/pointerevent_capture_suppressing_mouse-manual.html b/dom/events/test/pointerevents/pointerevent_capture_suppressing_mouse-manual.html new file mode 100644 index 000000000..6b891b846 --- /dev/null +++ b/dom/events/test/pointerevents/pointerevent_capture_suppressing_mouse-manual.html @@ -0,0 +1,186 @@ +<!doctype html> +<html> + <head> + <title>Set/Release capture</title> + <meta name="viewport" content="width=device-width"> + <link rel="stylesheet" type="text/css" href="pointerevent_styles.css"> + <script src="/resources/testharness.js"></script> + <!--script src="/resources/testharnessreport.js"></script--> + <!-- Additional helper script for common checks across event types --> + <script type="text/javascript" src="pointerevent_support.js"></script> + <script type="text/javascript" src="mochitest_support_internal.js"></script> + </head> + <body> + <!-- + <h1>Pointer Events capture test</h1> + <h4> + Test Description: This test checks if setCapture/releaseCapture functions works properly. Complete the following actions: + <ol> + <li> Put your mouse over the black rectangle. pointerover and pointerenter should be logged inside of it.</li> + <li> Move your mouse out of the black rectangle. pointerout and pointerleave should be logged inside of it</li> + <li> Put your mouse over the purple rectangle. pointerover and pointerenter should be logged inside of it.</li> + <li> Move your mouse out of the purple rectangle. pointerout and pointerleave should be logged inside of it</li> + <li> Press and hold left mouse button over "Set Capture" button. "gotpointercapture" should be logged in the black rectangle</li> + <li> Put your mouse over the purple rectangle and then move it out. Nothing should happen</li> + <li> Put your mouse over the black rectangle. pointerover and pointerenter should be logged inside of it.</li> + <li> Move your mouse out of the black rectangle. pointerout and pointerleave should be logged inside of it</li> + <li> Release left mouse button. "lostpointercapture" should be logged in the black rectangle</li> + </ol> + </h4> + Test passes if the proper behaviour of the events is observed. + --> + <div id="target0"></div> + <br> + <div id="target1"></div> + <br> + <input type="button" id="btnCapture" value="Set Capture"> + <script type='text/javascript'> + var isPointerCapture = false; + var isRelatedTargetValueTested = false; + var isTargetAuthenticityTested = false; + var count = 0; + + var detected_pointertypes = {}; + add_completion_callback(showPointerTypes); + + var target0 = document.getElementById('target0'); + var target1 = document.getElementById('target1'); + var captureButton = document.getElementById('btnCapture'); + + var test_gotpointercapture = async_test("gotpointercapture event received"); + var test_lostpointercapture = async_test("lostpointercapture event received"); + + var test_pointerover_no_capture = async_test("pointerover event without capture received"); + var test_pointerover_capture = async_test("pointerover event with capture received"); + + var test_pointerout_no_capture = async_test("pointerout event without capture received"); + var test_pointerout_capture = async_test("pointerout event with capture received"); + + var test_pointerenter_no_capture = async_test("pointerenter event without capture received"); + var test_pointerenter_capture = async_test("pointerenter event with capture received"); + + var test_pointerleave_no_capture = async_test("pointerleave event without capture received"); + var test_pointerleave_capture = async_test("pointerleave event with capture received"); + + window.onload = function() { + on_event(captureButton, 'pointerdown', function(e) { + if(isPointerCapture == false) { + sPointerCapture(e); + isPointerCapture = true; + } + }); + + on_event(target0, 'gotpointercapture', function(e) { + test_gotpointercapture.done(); + log("gotpointercapture", target0); + }); + + on_event(target0, 'lostpointercapture', function(e) { + isPointerCapture = false; + test_lostpointercapture.done(); + log("lostpointercapture", target0); + }); + + run(); + } + + function run() { + on_event(target0, "pointerover", function (event) { + detected_pointertypes[ event.pointerType ] = true; + log("pointerover", target0); + if(isPointerCapture) { + test_pointerover_capture.done(); + if (!isRelatedTargetValueTested) { + test(function() { + assert_true(event.relatedTarget==null, "relatedTarget is null when the capture is set") + }, "relatedTarget is null when the capture is set. relatedTarget is " + event.relatedTarget); + isRelatedTargetValueTested = true; + } + var hitTest = document.elementFromPoint(event.clientX, event.clientY); + if(event.target !== hitTest && !isTargetAuthenticityTested) { + test(function () { + assert_unreached("pointerover for this target shouldn't trigger events on capture target"); + }, "pointerover should only trigger over the black rectangle"); + isTargetAuthenticityTested = true; + } + } + else { + test_pointerover_no_capture.done(); + } + }); + + on_event(target0, "pointerout", function (event) { + log("pointerout", target0); + if(isPointerCapture) { + test_pointerout_capture.done(); + } + else { + test_pointerout_no_capture.done(); + } + }); + + on_event(target0, "pointerenter", function (event) { + log("pointerenter", target0); + if(isPointerCapture) { + test_pointerenter_capture.done(); + } + else { + test_pointerenter_no_capture.done(); + } + }); + + on_event(target0, "pointerleave", function (event) { + log("pointerleave", target0); + if(isPointerCapture) { + test_pointerleave_capture.done(); + } + else { + test_pointerleave_no_capture.done(); + } + }); + + // fail if capture is set but event is received for the non-captured target + on_event(target1, "pointerover", function (event) { + log("pointerover", target1); + if(isPointerCapture == true) { + test(function() { + assert_unreached("pointerover shouldn't trigger for this target when capture is enabled"); + }, "pointerover shouldn't trigger for the purple rectangle while the black rectangle has capture"); + } + }); + + on_event(target1, "pointerout", function (event) { + log("pointerout", target1); + if(isPointerCapture == true) { + test(function() { + assert_unreached("pointerout shouldn't trigger for this target when capture is enabled"); + }, "pointerout shouldn't trigger for the purple rectangle while the black rectangle has capture"); + } + }); + + on_event(target1, "pointerenter", function (event) { + log("pointerenter", target1); + if(isPointerCapture == true) { + test(function() { + assert_unreached("pointerenter shouldn't trigger for this target when capture is enabled"); + }, "pointerenter shouldn't trigger for the purple rectangle while the black rectangle has capture"); + } + }); + + on_event(target1, "pointerleave", function (event) { + log("pointerleave", target1); + if(isPointerCapture == true) { + test(function() { + assert_unreached("pointerleave shouldn't trigger for this target when capture is enabled"); + }, "pointerleave shouldn't trigger for the purple rectangle while the black rectangle has capture"); + } + }); + } + </script> + <h1>Pointer Events Capture Test</h1> + <div id="complete-notice"> + <p>The following pointer types were detected: <span id="pointertype-log"></span>.</p> + </div> + <div id="log"></div> + </body> +</html>
\ No newline at end of file |