92 lines
No EOL
2.8 KiB
HTML
92 lines
No EOL
2.8 KiB
HTML
<!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,
|
|
});
|
|
assert_equals(downEventEmptyProps.deviceProperties, null);
|
|
}, 'No deviceProperties in PointerEventInit');
|
|
</script> |