diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/infrastructure/testdriver/actions/elementTiming.html | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/infrastructure/testdriver/actions/elementTiming.html')
-rw-r--r-- | testing/web-platform/tests/infrastructure/testdriver/actions/elementTiming.html | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/testing/web-platform/tests/infrastructure/testdriver/actions/elementTiming.html b/testing/web-platform/tests/infrastructure/testdriver/actions/elementTiming.html new file mode 100644 index 0000000000..33731e9299 --- /dev/null +++ b/testing/web-platform/tests/infrastructure/testdriver/actions/elementTiming.html @@ -0,0 +1,69 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>TestDriver actions: element timing</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="/resources/testdriver-vendor.js"></script> + +<style> +div#test1, div#test2 { + position: fixed; + top: 0; + left: 0; + width: 100px; + height: 100px; + background-color: blue; +} + +div#test2 { + display: none; + left: -100px; + background-color: green; +} +</style> + +<div id="test1"> +</div> + +<div id="test2"> +</div> + +<script> +let events = []; + +promise_test(async t => { + let test1 = document.getElementById("test1"); + let test2 = document.getElementById("test2"); + test1.addEventListener("click", + () => { + test2.style.display = "block"; + test2.style.top = "100px"; + test2.style.left = "0" + }); + test2.addEventListener("click", + e => { + events.push(e.clientX); + events.push(e.clientY); + }); + + const waitCondition = new Promise((resolve, reject)=>{setTimeout(resolve, 5000);}); + const test1ClickWatcher = new EventWatcher(t, test1, ["click"], ()=>waitCondition); + const test2ClickWatcher = new EventWatcher(t, test2, ["click"], ()=>waitCondition); + let waitForClicks = Promise.all([test1ClickWatcher.wait_for(["click"]), test2ClickWatcher.wait_for(["click"])]); + + await new test_driver.Actions() + .pointerMove(0, 0, {origin: test1}) + .pointerDown() + .pointerUp() + .send(); + await new test_driver.Actions() + .pointerMove(0, 0, {origin: test2}) + .pointerDown() + .pointerUp() + .send(); + await waitForClicks; + assert_array_equals(events, [50, 150]) +}); +</script> |