summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/pointerevents/deviceproperties/pointer-event-has-device-properties-uniqueid-from-pointer-event-init.tentative.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/pointerevents/deviceproperties/pointer-event-has-device-properties-uniqueid-from-pointer-event-init.tentative.html')
-rw-r--r--testing/web-platform/tests/pointerevents/deviceproperties/pointer-event-has-device-properties-uniqueid-from-pointer-event-init.tentative.html92
1 files changed, 92 insertions, 0 deletions
diff --git a/testing/web-platform/tests/pointerevents/deviceproperties/pointer-event-has-device-properties-uniqueid-from-pointer-event-init.tentative.html b/testing/web-platform/tests/pointerevents/deviceproperties/pointer-event-has-device-properties-uniqueid-from-pointer-event-init.tentative.html
new file mode 100644
index 0000000000..a37df4b421
--- /dev/null
+++ b/testing/web-platform/tests/pointerevents/deviceproperties/pointer-event-has-device-properties-uniqueid-from-pointer-event-init.tentative.html
@@ -0,0 +1,92 @@
+<!DOCTYPE html>
+<!--
+ Tentative; contingent on merge of:
+ https://github.com/w3c/pointerevents/pull/495
+-->
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="console"></div>
+
+<!-- This test verifies that pointerEvent.deviceProperties.uniqueId
+ can be set via PointerEventInit. -->
+<script>
+ const UNIQUE_ID = 1001;
+ const INVALID_UNIQUE_ID = 0;
+
+ function CheckDeviceId(event, uniqueId) {
+ assert_equals(event.deviceProperties.uniqueId, uniqueId, "uniqueId is populated");
+ }
+
+ promise_test(async () => {
+ if (!window.internals)
+ return;
+ var deviceProps = new DeviceProperties({
+ uniqueId: 1001
+ });
+ var downEvent = new PointerEvent("pointerdown",
+ {pointerId: 1,
+ bubbles: true,
+ cancelable: true,
+ pointerType: "pen",
+ width: 100,
+ height: 100,
+ isPrimary: true,
+ deviceProperties: deviceProps
+ });
+ CheckDeviceId(downEvent, UNIQUE_ID);
+ var moveEvent = new PointerEvent("pointermove",
+ {pointerId: 1,
+ bubbles: true,
+ cancelable: true,
+ pointerType: "pen",
+ width: 100,
+ height: 100,
+ isPrimary: true,
+ deviceProperties: deviceProps
+ });
+ CheckDeviceId(moveEvent, UNIQUE_ID);
+ var upEvent = new PointerEvent("pointerup",
+ {pointerId: 1,
+ bubbles: true,
+ cancelable: true,
+ pointerType: "pen",
+ width: 100,
+ height: 100,
+ isPrimary: true,
+ deviceProperties: deviceProps
+ });
+ CheckDeviceId(upEvent, UNIQUE_ID);
+ }, 'PointerEvent.deviceProperties via DevicePropertiesInit');
+
+ promise_test(async () => {
+ if (!window.internals)
+ return;
+ var emptyDeviceProps = new DeviceProperties({});
+ var downEventEmptyProps = new PointerEvent("pointerdown",
+ {pointerId: 1,
+ bubbles: true,
+ cancelable: true,
+ pointerType: "pen",
+ width: 100,
+ height: 100,
+ isPrimary: true,
+ deviceProperties: emptyDeviceProps
+ });
+ CheckDeviceId(downEventEmptyProps, INVALID_UNIQUE_ID);
+ }, 'PointerEvent.deviceProperties via empty DevicePropertiesInit');
+
+ promise_test(async () => {
+ if (!window.internals)
+ return;
+ var downEventEmptyProps = new PointerEvent("pointerdown",
+ {pointerId: 1,
+ bubbles: true,
+ cancelable: true,
+ pointerType: "pen",
+ width: 100,
+ height: 100,
+ isPrimary: true,
+ });
+ CheckDeviceId(downEventEmptyProps, INVALID_UNIQUE_ID);
+ }, 'No deviceProperties in PointerEventInit');
+</script> \ No newline at end of file