summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/pointerevents/pointerevent_auxclick_is_a_pointerevent.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/pointerevents/pointerevent_auxclick_is_a_pointerevent.html
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/pointerevents/pointerevent_auxclick_is_a_pointerevent.html')
-rw-r--r--testing/web-platform/tests/pointerevents/pointerevent_auxclick_is_a_pointerevent.html74
1 files changed, 74 insertions, 0 deletions
diff --git a/testing/web-platform/tests/pointerevents/pointerevent_auxclick_is_a_pointerevent.html b/testing/web-platform/tests/pointerevents/pointerevent_auxclick_is_a_pointerevent.html
new file mode 100644
index 0000000000..b32bee9e8f
--- /dev/null
+++ b/testing/web-platform/tests/pointerevents/pointerevent_auxclick_is_a_pointerevent.html
@@ -0,0 +1,74 @@
+<!DOCTYPE HTML>
+<title>auxclick is a PointerEvent</title>
+<meta name="variant" content="?mouse">
+<meta name="variant" content="?pen">
+<!-- TODO: Does any platform support auxclick with touch? -->
+<link rel="help" href="https://github.com/w3c/pointerevents/pull/317">
+<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>
+<script src="pointerevent_support.js"></script>
+
+<input id="target" style="margin: 20px">
+
+<script>
+ 'use strict';
+ const target = document.getElementById("target");
+ const pointer_type = location.search.substring(1);
+ const test_pointer = pointer_type + "TestPointer";
+
+ function assertAuxclickProperties(auxclick_event, pointerdown_event) {
+ assert_equals(auxclick_event.constructor, window.PointerEvent,
+ "auxclick should use a PointerEvent constructor");
+ assert_true(auxclick_event instanceof PointerEvent,
+ "auxclick should be a PointerEvent");
+ assert_not_equals(auxclick_event.pointerId, -1,
+ "auxclick.pointerId should not be -1");
+ assert_equals(auxclick_event.pointerType, pointer_type,
+ "auxclick.pointerType should match test action pointerType");
+ assert_equals(auxclick_event.composed, true,
+ "auxclick.composed should be true");
+
+ if (pointerdown_event) {
+ assert_equals(auxclick_event.pointerId, pointerdown_event.pointerId,
+ "auxclick.pointerId should match pointerdown.pointerId");
+ }
+ }
+
+ promise_test(async test => {
+ let actions = new test_driver.Actions();
+ actions = actions
+ .addPointer(test_pointer, pointer_type)
+ .pointerMove(0,0, {origin:target, sourceName:test_pointer})
+ .pointerDown({button:actions.ButtonType.MIDDLE, sourceName:test_pointer})
+ .pointerUp({button:actions.ButtonType.MIDDLE, sourceName:test_pointer});
+ let pointerdown_prevented = preventDefaultPointerdownOnce(target, test);
+ let pointerdown_promise = getEvent("pointerdown", target, test);
+ let auxclick_promise = getEvent("auxclick", target, test);
+
+ await actions.send();
+ await pointerdown_prevented;
+ let pointerdown_event = await pointerdown_promise;
+ let auxclick_event = await auxclick_promise;
+
+ assertAuxclickProperties(auxclick_event, pointerdown_event);
+ }, "auxclick using " + pointer_type + " is a PointerEvent with correct properties");
+
+ promise_test(async test => {
+ let actions = new test_driver.Actions();
+ actions = actions
+ .addPointer(test_pointer, pointer_type)
+ .pointerMove(0,0, {origin:target, sourceName:test_pointer})
+ .pointerDown({button:actions.ButtonType.MIDDLE, sourceName:test_pointer})
+ .pointerUp({button:actions.ButtonType.MIDDLE, sourceName:test_pointer});
+ let auxclick_promise = getEvent("auxclick", target, test);
+
+ await actions.send();
+ let auxclick_event = await auxclick_promise;
+
+ assertAuxclickProperties(auxclick_event);
+ }, "auxclick using " + pointer_type + " is a PointerEvent with correct properties"
+ + " when no other PointerEvent listeners are present");
+</script>