mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
Bug 1819708 [wpt PR 38778] - [CodeHealth] Misc cleaups in WPTs in pointerevents/ folder., a=testonly
Automatic update from web-platform-tests [CodeHealth] Misc cleaups in WPTs in pointerevents/ folder. (#38778) This is a no-op change, fixes: - redundant arrays in pointerevent_mouse-pointer-preventdefault.html - inconsistent indentation in pointerevent_support.js Bug: 1085647 Change-Id: Icd78e45c4f6c013d34d56b0866ed7676524660e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4300670 Reviewed-by: Kevin Ellis <kevers@chromium.org> Commit-Queue: Mustaq Ahmed <mustaq@chromium.org> Cr-Commit-Position: refs/heads/main@{#1111926} Co-authored-by: Mustaq Ahmed <mustaq@google.com> -- wpt-commits: 3a1026219a6b6d8d710abb0741bc1cb48ab33a67 wpt-pr: 38778
This commit is contained in:
parent
03df0793b2
commit
9719b318ac
@ -17,119 +17,58 @@ div.box {
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var receivedEvents = [];
|
||||
var receivedMouseEvents = [];
|
||||
var receivedPointerEvents = [];
|
||||
var mouseEventList = ["mousedown", "mouseup", "mouseenter", "mouseleave", "mouseover", "mouseout", "mousemove"];
|
||||
var pointerEventList = ["pointerdown", "pointerup", "pointerenter", "pointerleave", "pointerover", "pointerout", "pointermove"];
|
||||
var receivedEvents = [];
|
||||
var receivedMouseEvents = [];
|
||||
var receivedPointerEvents = [];
|
||||
var mouseEventList = ["mousedown", "mouseup", "mouseenter", "mouseleave", "mouseover", "mouseout", "mousemove"];
|
||||
var pointerEventList = ["pointerdown", "pointerup", "pointerenter", "pointerleave", "pointerover", "pointerout", "pointermove"];
|
||||
|
||||
var preventDefaultList = ["none"].concat(pointerEventList);
|
||||
var eventToPreventDefault = "";
|
||||
var preventDefaultList = ["none"].concat(pointerEventList);
|
||||
var eventToPreventDefault = "";
|
||||
|
||||
function init() {
|
||||
var targetDiv = document.getElementById("target");
|
||||
function init() {
|
||||
var targetDiv = document.getElementById("target");
|
||||
|
||||
mouseEventList.forEach(function(eventName) {
|
||||
targetDiv.addEventListener(eventName, function(event) {
|
||||
receivedEvents.push(eventName);
|
||||
receivedMouseEvents.push(eventName);
|
||||
mouseEventList.forEach(function (eventName) {
|
||||
targetDiv.addEventListener(eventName, function (event) {
|
||||
receivedEvents.push(eventName);
|
||||
receivedMouseEvents.push(eventName);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
pointerEventList.forEach(function(eventName) {
|
||||
targetDiv.addEventListener(eventName, function(event) {
|
||||
if (event.type == eventToPreventDefault) {
|
||||
event.preventDefault();
|
||||
}
|
||||
receivedEvents.push(eventName);
|
||||
receivedPointerEvents.push(eventName);
|
||||
pointerEventList.forEach(function (eventName) {
|
||||
targetDiv.addEventListener(eventName, function (event) {
|
||||
if (event.type == eventToPreventDefault) {
|
||||
event.preventDefault();
|
||||
}
|
||||
receivedEvents.push(eventName);
|
||||
receivedPointerEvents.push(eventName);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var expectedPointerEvents = new Map([
|
||||
["none", ["pointerover", "pointerenter", "pointermove", "pointerdown", "pointerup",
|
||||
"pointerdown", "pointermove", "pointerout", "pointerleave",
|
||||
"pointerover", "pointerenter", "pointermove", "pointerup", "pointerout",
|
||||
"pointerleave"
|
||||
]],
|
||||
["pointerdown", ["pointerover", "pointerenter", "pointermove", "pointerdown",
|
||||
"pointerup", "pointerdown", "pointermove", "pointerout", "pointerleave",
|
||||
"pointerover", "pointerenter", "pointermove", "pointerup", "pointerout",
|
||||
"pointerleave"
|
||||
]],
|
||||
["pointerup", ["pointerover", "pointerenter", "pointermove", "pointerdown",
|
||||
"pointerup", "pointerdown", "pointermove", "pointerout", "pointerleave",
|
||||
"pointerover", "pointerenter", "pointermove", "pointerup",
|
||||
"pointerout", "pointerleave"
|
||||
]],
|
||||
["pointerenter", ["pointerover", "pointerenter", "pointermove",
|
||||
"pointerdown", "pointerup", "pointerdown", "pointermove",
|
||||
"pointerout", "pointerleave", "pointerover", "pointerenter",
|
||||
"pointermove", "pointerup", "pointerout", "pointerleave"
|
||||
]],
|
||||
["pointerleave", ["pointerover", "pointerenter", "pointermove",
|
||||
"pointerdown", "pointerup", "pointerdown", "pointermove",
|
||||
"pointerout", "pointerleave", "pointerover", "pointerenter",
|
||||
"pointermove", "pointerup", "pointerout", "pointerleave"
|
||||
]],
|
||||
["pointerover", ["pointerover", "pointerenter", "pointermove",
|
||||
"pointerdown", "pointerup", "pointerdown", "pointermove",
|
||||
"pointerout", "pointerleave", "pointerover", "pointerenter",
|
||||
"pointermove", "pointerup", "pointerout",
|
||||
"pointerleave"
|
||||
]],
|
||||
["pointerout", ["pointerover", "pointerenter", "pointermove",
|
||||
"pointerdown", "pointerup", "pointerdown", "pointermove",
|
||||
"pointerout", "pointerleave", "pointerover", "pointerenter",
|
||||
"pointermove", "pointerup", "pointerout",
|
||||
"pointerleave"
|
||||
]],
|
||||
["pointermove", ["pointerover", "pointerenter", "pointermove",
|
||||
"pointerdown", "pointerup", "pointerdown", "pointermove",
|
||||
"pointerout", "pointerleave", "pointerover", "pointerenter",
|
||||
"pointermove", "pointerup", "pointerout", "pointerleave"
|
||||
]]
|
||||
]);
|
||||
var expectedMouseEvents = new Map([
|
||||
["none", ["mouseover", "mouseenter", "mousemove", "mousedown", "mouseup",
|
||||
"mousedown", "mousemove", "mouseout", "mouseleave",
|
||||
"mouseover", "mouseenter", "mousemove", "mouseup", "mouseout", "mouseleave"
|
||||
]],
|
||||
["pointerdown", ["mouseover", "mouseenter", "mousemove",
|
||||
"mouseout", "mouseleave", "mouseover", "mouseenter",
|
||||
"mouseout", "mouseleave"
|
||||
]],
|
||||
["pointerup", ["mouseover", "mouseenter", "mousemove",
|
||||
"mousedown", "mouseup", "mousedown", "mousemove",
|
||||
"mouseout", "mouseleave", "mouseover",
|
||||
"mouseenter", "mousemove", "mouseup", "mouseout", "mouseleave"
|
||||
]],
|
||||
["pointerenter", ["mouseover", "mouseenter", "mousemove", "mousedown",
|
||||
"mouseup", "mousedown", "mousemove", "mouseout", "mouseleave",
|
||||
"mouseover", "mouseenter", "mousemove", "mouseup", "mouseout", "mouseleave"
|
||||
]],
|
||||
["pointerleave", ["mouseover", "mouseenter", "mousemove", "mousedown",
|
||||
"mouseup", "mousedown", "mousemove", "mouseout", "mouseleave",
|
||||
"mouseover", "mouseenter", "mousemove", "mouseup",
|
||||
"mouseout", "mouseleave"
|
||||
]],
|
||||
["pointerover", ["mouseover", "mouseenter", "mousemove",
|
||||
"mousedown", "mouseup", "mousedown", "mousemove", "mouseout",
|
||||
"mouseleave", "mouseover", "mouseenter", "mousemove", "mouseup",
|
||||
"mouseout", "mouseleave"
|
||||
]],
|
||||
["pointerout", ["mouseover", "mouseenter", "mousemove",
|
||||
"mousedown", "mouseup", "mousedown", "mousemove",
|
||||
"mouseout", "mouseleave", "mouseover", "mouseenter",
|
||||
"mousemove", "mouseup", "mouseout", "mouseleave"
|
||||
]],
|
||||
["pointermove", ["mouseover", "mouseenter", "mousemove",
|
||||
"mousedown", "mouseup", "mousedown", "mousemove",
|
||||
"mouseout", "mouseleave", "mouseover", "mouseenter",
|
||||
"mousemove", "mouseup", "mouseout", "mouseleave"
|
||||
]]
|
||||
]);
|
||||
function expectedPointerEvents() {
|
||||
return [
|
||||
"pointerover", "pointerenter", "pointermove", "pointerdown", "pointerup",
|
||||
"pointerdown", "pointermove", "pointerout", "pointerleave", "pointerover",
|
||||
"pointerenter", "pointermove", "pointerup", "pointerout", "pointerleave"
|
||||
];
|
||||
}
|
||||
|
||||
// When "pointerdown" is not prevented, all compat mouse events are fired.
|
||||
// Otherwise, the "mousedown/move/up" events between "pointerdown" and
|
||||
// "pointerup" are suppressed.
|
||||
function expectedMouseEvents(prevented_event) {
|
||||
return prevented_event === "pointerdown"
|
||||
? ["mouseover", "mouseenter", "mousemove",
|
||||
"mouseout", "mouseleave", "mouseover", "mouseenter",
|
||||
"mouseout", "mouseleave"]
|
||||
: ["mouseover", "mouseenter", "mousemove",
|
||||
"mousedown", "mouseup", "mousedown", "mousemove",
|
||||
"mouseout", "mouseleave", "mouseover", "mouseenter",
|
||||
"mousemove", "mouseup",
|
||||
"mouseout", "mouseleave"];
|
||||
}
|
||||
|
||||
async function runTestForDefaultEvent(preventDefaultEvent) {
|
||||
promise_test((test)=>
|
||||
@ -153,8 +92,8 @@ async function runTestForDefaultEvent(preventDefaultEvent) {
|
||||
if(eventToPreventDefault === 'none'){
|
||||
assert_true(arePointerEventsBeforeCompatMouseEvents(receivedEvents), "There are no compatible mouse events for all pointer events:" + receivedEvents);
|
||||
}
|
||||
assert_array_equals(receivedPointerEvents, expectedPointerEvents.get(preventDefaultEvent));
|
||||
assert_array_equals(receivedMouseEvents, expectedMouseEvents.get(preventDefaultEvent));
|
||||
assert_array_equals(receivedPointerEvents, expectedPointerEvents());
|
||||
assert_array_equals(receivedMouseEvents, expectedMouseEvents(preventDefaultEvent));
|
||||
});
|
||||
resolve();
|
||||
}), `Verifies the effect of pointer event prevent-default on ${preventDefaultEvent}`);
|
||||
|
@ -1,14 +1,15 @@
|
||||
const All_Pointer_Events = [
|
||||
"pointerdown",
|
||||
"pointerup",
|
||||
"pointercancel",
|
||||
"pointermove",
|
||||
"pointerover",
|
||||
"pointerout",
|
||||
"pointerenter",
|
||||
"pointerleave",
|
||||
"gotpointercapture",
|
||||
"lostpointercapture"];
|
||||
"pointerdown",
|
||||
"pointerup",
|
||||
"pointercancel",
|
||||
"pointermove",
|
||||
"pointerover",
|
||||
"pointerout",
|
||||
"pointerenter",
|
||||
"pointerleave",
|
||||
"gotpointercapture",
|
||||
"lostpointercapture"
|
||||
];
|
||||
|
||||
// https://w3c.github.io/pointerevents/#the-button-property
|
||||
// Values for the button property, which indicates the device button whose state
|
||||
@ -44,194 +45,194 @@ const ButtonsBitfield = {
|
||||
// Check for conformance to PointerEvent interface
|
||||
// https://w3c.github.io/pointerevents/#pointerevent-interface
|
||||
function check_PointerEvent(event, testNamePrefix) {
|
||||
if (testNamePrefix === undefined)
|
||||
testNamePrefix = "";
|
||||
if (testNamePrefix === undefined)
|
||||
testNamePrefix = "";
|
||||
|
||||
// Use expectedPointerType if set otherwise just use the incoming event pointerType in the test name.
|
||||
var pointerTestName = (testNamePrefix ? testNamePrefix + ' ' : '')
|
||||
+ (expectedPointerType == null ? event.pointerType : expectedPointerType) + ' ' + event.type;
|
||||
// Use expectedPointerType if set otherwise just use the incoming event pointerType in the test name.
|
||||
var pointerTestName = (testNamePrefix ? testNamePrefix + ' ' : '')
|
||||
+ (expectedPointerType == null ? event.pointerType : expectedPointerType) + ' ' + event.type;
|
||||
|
||||
if (expectedPointerType != null) {
|
||||
test(function () {
|
||||
assert_equals(event.pointerType, expectedPointerType);
|
||||
}, pointerTestName + ".pointerType is correct.");
|
||||
if (expectedPointerType != null) {
|
||||
test(function () {
|
||||
assert_equals(event.pointerType, expectedPointerType);
|
||||
}, pointerTestName + ".pointerType is correct.");
|
||||
}
|
||||
|
||||
test(function () {
|
||||
assert_true(event instanceof event.target.ownerDocument.defaultView.PointerEvent);
|
||||
}, pointerTestName + " event is a PointerEvent event");
|
||||
|
||||
|
||||
// Check attributes for conformance to WebIDL (existence, type, being readable).
|
||||
var idl_type_check = {
|
||||
"long": function (v) { return typeof v === "number" && Math.round(v) === v; },
|
||||
"float": function (v) { return typeof v === "number"; },
|
||||
"string": function (v) { return typeof v === "string"; },
|
||||
"boolean": function (v) { return typeof v === "boolean" },
|
||||
"object": function (v) { return typeof v === "object" }
|
||||
};
|
||||
[
|
||||
["long", "pointerId"],
|
||||
["float", "width"],
|
||||
["float", "height"],
|
||||
["float", "pressure"],
|
||||
["long", "tiltX"],
|
||||
["long", "tiltY"],
|
||||
["string", "pointerType"],
|
||||
["boolean", "isPrimary"],
|
||||
["long", "detail", 0],
|
||||
["object", "fromElement"],
|
||||
["object", "toElement"],
|
||||
["boolean", "isTrusted"],
|
||||
["boolean", "composed"],
|
||||
["boolean", "bubbles"]
|
||||
].forEach(function (attr) {
|
||||
var type = attr[0];
|
||||
var name = attr[1];
|
||||
|
||||
test(function () {
|
||||
// Existence check.
|
||||
assert_true(name in event, "attribute exists");
|
||||
|
||||
// Readonly check.
|
||||
assert_readonly(event.type, name, "attribute is readonly");
|
||||
|
||||
// Type check.
|
||||
assert_true(idl_type_check[type](event[name]),
|
||||
"attribute type " + type + " (JS type was " + typeof event[name] + ")");
|
||||
}, pointerTestName + "." + name + " conforms to WebIDL");
|
||||
});
|
||||
|
||||
// Check values for inherited attributes.
|
||||
// https://w3c.github.io/pointerevents/#attributes-and-default-actions
|
||||
test(function () {
|
||||
assert_equals(event.fromElement, null);
|
||||
}, pointerTestName + ".fromElement value is null");
|
||||
test(function () {
|
||||
assert_equals(event.toElement, null);
|
||||
}, pointerTestName + ".toElement value is null");
|
||||
test(function () {
|
||||
assert_equals(event.isTrusted, true);
|
||||
}, pointerTestName + ".isTrusted value is true");
|
||||
test(function () {
|
||||
let expected = (event.type != 'pointerenter' && event.type != 'pointerleave');
|
||||
assert_equals(event.composed, expected);
|
||||
}, pointerTestName + ".composed value is valid");
|
||||
test(function () {
|
||||
let expected = (event.type != 'pointerenter' && event.type != 'pointerleave');
|
||||
assert_equals(event.bubbles, expected);
|
||||
}, pointerTestName + ".bubbles value is valid");
|
||||
|
||||
// Check the pressure value.
|
||||
// https://w3c.github.io/pointerevents/#dom-pointerevent-pressure
|
||||
test(function () {
|
||||
assert_greater_than_equal(event.pressure, 0, "pressure is greater than or equal to 0");
|
||||
assert_less_than_equal(event.pressure, 1, "pressure is less than or equal to 1");
|
||||
|
||||
if (event.buttons === 0) {
|
||||
assert_equals(event.pressure, 0, "pressure is 0 with no buttons pressed");
|
||||
} else {
|
||||
assert_greater_than(event.pressure, 0, "pressure is greater than 0 with a button pressed");
|
||||
if (event.pointerType === "mouse") {
|
||||
assert_equals(event.pressure, 0.5, "pressure is 0.5 for mouse with a button pressed");
|
||||
}
|
||||
}
|
||||
}, pointerTestName + ".pressure value is valid");
|
||||
|
||||
// Check mouse-specific properties.
|
||||
if (event.pointerType === "mouse") {
|
||||
test(function () {
|
||||
assert_true(event instanceof event.target.ownerDocument.defaultView.PointerEvent);
|
||||
}, pointerTestName + " event is a PointerEvent event");
|
||||
assert_equals(event.width, 1, "width of mouse should be 1");
|
||||
assert_equals(event.height, 1, "height of mouse should be 1");
|
||||
assert_equals(event.tiltX, 0, event.type + ".tiltX is 0 for mouse");
|
||||
assert_equals(event.tiltY, 0, event.type + ".tiltY is 0 for mouse");
|
||||
assert_true(event.isPrimary, event.type + ".isPrimary is true for mouse");
|
||||
}, pointerTestName + " properties for pointerType = mouse");
|
||||
}
|
||||
|
||||
|
||||
// Check attributes for conformance to WebIDL (existence, type, being readable).
|
||||
var idl_type_check = {
|
||||
"long": function (v) { return typeof v === "number" && Math.round(v) === v; },
|
||||
"float": function (v) { return typeof v === "number"; },
|
||||
"string": function (v) { return typeof v === "string"; },
|
||||
"boolean": function (v) { return typeof v === "boolean" },
|
||||
"object": function (v) { return typeof v === "object" }
|
||||
};
|
||||
[
|
||||
["long", "pointerId"],
|
||||
["float", "width"],
|
||||
["float", "height"],
|
||||
["float", "pressure"],
|
||||
["long", "tiltX"],
|
||||
["long", "tiltY"],
|
||||
["string", "pointerType"],
|
||||
["boolean", "isPrimary"],
|
||||
["long", "detail", 0],
|
||||
["object", "fromElement"],
|
||||
["object", "toElement"],
|
||||
["boolean", "isTrusted"],
|
||||
["boolean", "composed"],
|
||||
["boolean", "bubbles"]
|
||||
].forEach(function (attr) {
|
||||
var type = attr[0];
|
||||
var name = attr[1];
|
||||
|
||||
test(function () {
|
||||
// Existence check.
|
||||
assert_true(name in event, "attribute exists");
|
||||
|
||||
// Readonly check.
|
||||
assert_readonly(event.type, name, "attribute is readonly");
|
||||
|
||||
// Type check.
|
||||
assert_true(idl_type_check[type](event[name]),
|
||||
"attribute type " + type + " (JS type was " + typeof event[name] + ")");
|
||||
}, pointerTestName + "." + name + " conforms to WebIDL");
|
||||
});
|
||||
|
||||
// Check values for inherited attributes.
|
||||
// https://w3c.github.io/pointerevents/#attributes-and-default-actions
|
||||
// Check "pointerup" specific properties.
|
||||
if (event.type == "pointerup") {
|
||||
test(function () {
|
||||
assert_equals(event.fromElement, null);
|
||||
}, pointerTestName + ".fromElement value is null");
|
||||
test(function () {
|
||||
assert_equals(event.toElement, null);
|
||||
}, pointerTestName + ".toElement value is null");
|
||||
test(function () {
|
||||
assert_equals(event.isTrusted, true);
|
||||
}, pointerTestName + ".isTrusted value is true");
|
||||
test(function () {
|
||||
let expected = (event.type != 'pointerenter' && event.type != 'pointerleave');
|
||||
assert_equals(event.composed, expected);
|
||||
}, pointerTestName + ".composed value is valid");
|
||||
test(function () {
|
||||
let expected = (event.type != 'pointerenter' && event.type != 'pointerleave');
|
||||
assert_equals(event.bubbles, expected);
|
||||
}, pointerTestName + ".bubbles value is valid");
|
||||
|
||||
// Check the pressure value.
|
||||
// https://w3c.github.io/pointerevents/#dom-pointerevent-pressure
|
||||
test(function () {
|
||||
assert_greater_than_equal(event.pressure, 0, "pressure is greater than or equal to 0");
|
||||
assert_less_than_equal(event.pressure, 1, "pressure is less than or equal to 1");
|
||||
|
||||
if (event.buttons === 0) {
|
||||
assert_equals(event.pressure, 0, "pressure is 0 with no buttons pressed");
|
||||
} else {
|
||||
assert_greater_than(event.pressure, 0, "pressure is greater than 0 with a button pressed");
|
||||
if (event.pointerType === "mouse") {
|
||||
assert_equals(event.pressure, 0.5, "pressure is 0.5 for mouse with a button pressed");
|
||||
}
|
||||
}
|
||||
}, pointerTestName + ".pressure value is valid");
|
||||
|
||||
// Check mouse-specific properties.
|
||||
if (event.pointerType === "mouse") {
|
||||
test(function () {
|
||||
assert_equals(event.width, 1, "width of mouse should be 1");
|
||||
assert_equals(event.height, 1, "height of mouse should be 1");
|
||||
assert_equals(event.tiltX, 0, event.type + ".tiltX is 0 for mouse");
|
||||
assert_equals(event.tiltY, 0, event.type + ".tiltY is 0 for mouse");
|
||||
assert_true(event.isPrimary, event.type + ".isPrimary is true for mouse");
|
||||
}, pointerTestName + " properties for pointerType = mouse");
|
||||
}
|
||||
|
||||
// Check "pointerup" specific properties.
|
||||
if (event.type == "pointerup") {
|
||||
test(function () {
|
||||
assert_equals(event.width, 1, "width of pointerup should be 1");
|
||||
assert_equals(event.height, 1, "height of pointerup should be 1");
|
||||
}, pointerTestName + " properties for pointerup");
|
||||
}
|
||||
assert_equals(event.width, 1, "width of pointerup should be 1");
|
||||
assert_equals(event.height, 1, "height of pointerup should be 1");
|
||||
}, pointerTestName + " properties for pointerup");
|
||||
}
|
||||
}
|
||||
|
||||
function showPointerTypes() {
|
||||
var complete_notice = document.getElementById("complete-notice");
|
||||
var pointertype_log = document.getElementById("pointertype-log");
|
||||
var pointertypes = Object.keys(detected_pointertypes);
|
||||
pointertype_log.innerHTML = pointertypes.length ?
|
||||
pointertypes.join(",") : "(none)";
|
||||
complete_notice.style.display = "block";
|
||||
var complete_notice = document.getElementById("complete-notice");
|
||||
var pointertype_log = document.getElementById("pointertype-log");
|
||||
var pointertypes = Object.keys(detected_pointertypes);
|
||||
pointertype_log.innerHTML = pointertypes.length ?
|
||||
pointertypes.join(",") : "(none)";
|
||||
complete_notice.style.display = "block";
|
||||
}
|
||||
|
||||
function showLoggedEvents() {
|
||||
var event_log_elem = document.getElementById("event-log");
|
||||
event_log_elem.innerHTML = event_log.length ? event_log.join(", ") : "(none)";
|
||||
var event_log_elem = document.getElementById("event-log");
|
||||
event_log_elem.innerHTML = event_log.length ? event_log.join(", ") : "(none)";
|
||||
|
||||
var complete_notice = document.getElementById("complete-notice");
|
||||
complete_notice.style.display = "block";
|
||||
var complete_notice = document.getElementById("complete-notice");
|
||||
complete_notice.style.display = "block";
|
||||
}
|
||||
|
||||
function failOnScroll() {
|
||||
assert_true(false,
|
||||
"scroll received while shouldn't");
|
||||
assert_true(false,
|
||||
"scroll received while shouldn't");
|
||||
}
|
||||
|
||||
function updateDescriptionNextStep() {
|
||||
document.getElementById('desc').innerHTML = "Test Description: Try to scroll text RIGHT.";
|
||||
document.getElementById('desc').innerHTML = "Test Description: Try to scroll text RIGHT.";
|
||||
}
|
||||
|
||||
function updateDescriptionComplete() {
|
||||
document.getElementById('desc').innerHTML = "Test Description: Test complete";
|
||||
document.getElementById('desc').innerHTML = "Test Description: Test complete";
|
||||
}
|
||||
|
||||
function updateDescriptionSecondStepTouchActionElement(target, scrollReturnInterval) {
|
||||
window.step_timeout(function() {
|
||||
objectScroller(target, 'up', 0);}
|
||||
, scrollReturnInterval);
|
||||
document.getElementById('desc').innerHTML = "Test Description: Try to scroll element RIGHT moving your outside of the red border";
|
||||
window.step_timeout(function() {
|
||||
objectScroller(target, 'up', 0);}
|
||||
, scrollReturnInterval);
|
||||
document.getElementById('desc').innerHTML = "Test Description: Try to scroll element RIGHT moving your outside of the red border";
|
||||
}
|
||||
|
||||
function updateDescriptionThirdStepTouchActionElement(target, scrollReturnInterval, callback = null) {
|
||||
window.step_timeout(function() {
|
||||
objectScroller(target, 'left', 0);
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
}, scrollReturnInterval);
|
||||
document.getElementById('desc').innerHTML = "Test Description: Try to scroll element DOWN then RIGHT starting your touch inside of the element. Then tap complete button";
|
||||
window.step_timeout(function() {
|
||||
objectScroller(target, 'left', 0);
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
}, scrollReturnInterval);
|
||||
document.getElementById('desc').innerHTML = "Test Description: Try to scroll element DOWN then RIGHT starting your touch inside of the element. Then tap complete button";
|
||||
}
|
||||
|
||||
function updateDescriptionFourthStepTouchActionElement(target, scrollReturnInterval) {
|
||||
document.getElementById('desc').innerHTML = "Test Description: Try to scroll element RIGHT starting your touch inside of the element";
|
||||
document.getElementById('desc').innerHTML = "Test Description: Try to scroll element RIGHT starting your touch inside of the element";
|
||||
}
|
||||
|
||||
function objectScroller(target, direction, value) {
|
||||
if (direction == 'up') {
|
||||
target.scrollTop = 0;
|
||||
} else if (direction == 'left') {
|
||||
target.scrollLeft = 0;
|
||||
}
|
||||
if (direction == 'up') {
|
||||
target.scrollTop = 0;
|
||||
} else if (direction == 'left') {
|
||||
target.scrollLeft = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function sPointerCapture(e) {
|
||||
try {
|
||||
target0.setPointerCapture(e.pointerId);
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
try {
|
||||
target0.setPointerCapture(e.pointerId);
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
}
|
||||
|
||||
function rPointerCapture(e) {
|
||||
try {
|
||||
captureButton.value = 'Set Capture';
|
||||
target0.releasePointerCapture(e.pointerId);
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
try {
|
||||
captureButton.value = 'Set Capture';
|
||||
target0.releasePointerCapture(e.pointerId);
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
}
|
||||
|
||||
var globalPointerEventTest = null;
|
||||
@ -239,192 +240,192 @@ var expectedPointerType = null;
|
||||
const ALL_POINTERS = ['mouse', 'touch', 'pen'];
|
||||
|
||||
function MultiPointerTypeTest(testName, types) {
|
||||
this.testName = testName;
|
||||
this.types = types;
|
||||
this.currentTypeIndex = 0;
|
||||
this.currentTest = null;
|
||||
this.createNextTest();
|
||||
this.testName = testName;
|
||||
this.types = types;
|
||||
this.currentTypeIndex = 0;
|
||||
this.currentTest = null;
|
||||
this.createNextTest();
|
||||
}
|
||||
|
||||
MultiPointerTypeTest.prototype.step = function(op) {
|
||||
this.currentTest.step(op);
|
||||
this.currentTest.step(op);
|
||||
}
|
||||
|
||||
MultiPointerTypeTest.prototype.skip = function() {
|
||||
var prevTest = this.currentTest;
|
||||
this.createNextTest();
|
||||
prevTest.timeout();
|
||||
var prevTest = this.currentTest;
|
||||
this.createNextTest();
|
||||
prevTest.timeout();
|
||||
}
|
||||
|
||||
MultiPointerTypeTest.prototype.done = function() {
|
||||
if (this.currentTest.status != 1) {
|
||||
var prevTest = this.currentTest;
|
||||
this.createNextTest();
|
||||
if (prevTest != null)
|
||||
prevTest.done();
|
||||
}
|
||||
if (this.currentTest.status != 1) {
|
||||
var prevTest = this.currentTest;
|
||||
this.createNextTest();
|
||||
if (prevTest != null)
|
||||
prevTest.done();
|
||||
}
|
||||
}
|
||||
|
||||
MultiPointerTypeTest.prototype.step = function(stepFunction) {
|
||||
this.currentTest.step(stepFunction);
|
||||
this.currentTest.step(stepFunction);
|
||||
}
|
||||
|
||||
MultiPointerTypeTest.prototype.createNextTest = function() {
|
||||
if (this.currentTypeIndex < this.types.length) {
|
||||
var pointerTypeDescription = document.getElementById('pointerTypeDescription');
|
||||
document.getElementById('pointerTypeDescription').innerHTML = "Follow the test instructions with <span style='color: red'>" + this.types[this.currentTypeIndex] + "</span>. If you don't have the device <a href='javascript:;' onclick='globalPointerEventTest.skip()'>skip it</a>.";
|
||||
this.currentTest = async_test(this.types[this.currentTypeIndex] + ' ' + this.testName);
|
||||
expectedPointerType = this.types[this.currentTypeIndex];
|
||||
this.currentTypeIndex++;
|
||||
} else {
|
||||
document.getElementById('pointerTypeDescription').innerHTML = "";
|
||||
}
|
||||
resetTestState();
|
||||
if (this.currentTypeIndex < this.types.length) {
|
||||
var pointerTypeDescription = document.getElementById('pointerTypeDescription');
|
||||
document.getElementById('pointerTypeDescription').innerHTML = "Follow the test instructions with <span style='color: red'>" + this.types[this.currentTypeIndex] + "</span>. If you don't have the device <a href='javascript:;' onclick='globalPointerEventTest.skip()'>skip it</a>.";
|
||||
this.currentTest = async_test(this.types[this.currentTypeIndex] + ' ' + this.testName);
|
||||
expectedPointerType = this.types[this.currentTypeIndex];
|
||||
this.currentTypeIndex++;
|
||||
} else {
|
||||
document.getElementById('pointerTypeDescription').innerHTML = "";
|
||||
}
|
||||
resetTestState();
|
||||
}
|
||||
|
||||
function setup_pointerevent_test(testName, supportedPointerTypes) {
|
||||
return globalPointerEventTest = new MultiPointerTypeTest(testName, supportedPointerTypes);
|
||||
return globalPointerEventTest = new MultiPointerTypeTest(testName, supportedPointerTypes);
|
||||
}
|
||||
|
||||
function checkPointerEventType(event) {
|
||||
assert_equals(event.pointerType, expectedPointerType, "pointerType should be the same as the requested device.");
|
||||
assert_equals(event.pointerType, expectedPointerType, "pointerType should be the same as the requested device.");
|
||||
}
|
||||
|
||||
function touchScrollInTarget(target, direction) {
|
||||
var x_delta = 0;
|
||||
var y_delta = 0;
|
||||
if (direction == "down") {
|
||||
x_delta = 0;
|
||||
y_delta = -10;
|
||||
} else if (direction == "up") {
|
||||
x_delta = 0;
|
||||
y_delta = 10;
|
||||
} else if (direction == "right") {
|
||||
x_delta = -10;
|
||||
y_delta = 0;
|
||||
} else if (direction == "left") {
|
||||
x_delta = 10;
|
||||
y_delta = 0;
|
||||
} else {
|
||||
throw("scroll direction '" + direction + "' is not expected, direction should be 'down', 'up', 'left' or 'right'");
|
||||
}
|
||||
return new test_driver.Actions()
|
||||
.addPointer("touchPointer1", "touch")
|
||||
.pointerMove(0, 0, {origin: target})
|
||||
.pointerDown()
|
||||
.pointerMove(x_delta, y_delta, {origin: target})
|
||||
.pointerMove(2 * x_delta, 2 * y_delta, {origin: target})
|
||||
.pointerMove(3 * x_delta, 3 * y_delta, {origin: target})
|
||||
.pointerMove(4 * x_delta, 4 * y_delta, {origin: target})
|
||||
.pointerMove(5 * x_delta, 5 * y_delta, {origin: target})
|
||||
.pointerMove(6 * x_delta, 6 * y_delta, {origin: target})
|
||||
.pause(100)
|
||||
.pointerUp()
|
||||
.send();
|
||||
var x_delta = 0;
|
||||
var y_delta = 0;
|
||||
if (direction == "down") {
|
||||
x_delta = 0;
|
||||
y_delta = -10;
|
||||
} else if (direction == "up") {
|
||||
x_delta = 0;
|
||||
y_delta = 10;
|
||||
} else if (direction == "right") {
|
||||
x_delta = -10;
|
||||
y_delta = 0;
|
||||
} else if (direction == "left") {
|
||||
x_delta = 10;
|
||||
y_delta = 0;
|
||||
} else {
|
||||
throw("scroll direction '" + direction + "' is not expected, direction should be 'down', 'up', 'left' or 'right'");
|
||||
}
|
||||
return new test_driver.Actions()
|
||||
.addPointer("touchPointer1", "touch")
|
||||
.pointerMove(0, 0, {origin: target})
|
||||
.pointerDown()
|
||||
.pointerMove(x_delta, y_delta, {origin: target})
|
||||
.pointerMove(2 * x_delta, 2 * y_delta, {origin: target})
|
||||
.pointerMove(3 * x_delta, 3 * y_delta, {origin: target})
|
||||
.pointerMove(4 * x_delta, 4 * y_delta, {origin: target})
|
||||
.pointerMove(5 * x_delta, 5 * y_delta, {origin: target})
|
||||
.pointerMove(6 * x_delta, 6 * y_delta, {origin: target})
|
||||
.pause(100)
|
||||
.pointerUp()
|
||||
.send();
|
||||
}
|
||||
|
||||
function clickInTarget(pointerType, target) {
|
||||
var pointerId = pointerType + "Pointer1";
|
||||
return new test_driver.Actions()
|
||||
.addPointer(pointerId, pointerType)
|
||||
.pointerMove(0, 0, {origin: target})
|
||||
.pointerDown()
|
||||
.pointerUp()
|
||||
.send();
|
||||
var pointerId = pointerType + "Pointer1";
|
||||
return new test_driver.Actions()
|
||||
.addPointer(pointerId, pointerType)
|
||||
.pointerMove(0, 0, {origin: target})
|
||||
.pointerDown()
|
||||
.pointerUp()
|
||||
.send();
|
||||
}
|
||||
|
||||
function rightClickInTarget(pointerType, target) {
|
||||
let pointerId = pointerType + "Pointer1";
|
||||
let actions = new test_driver.Actions();
|
||||
return actions.addPointer(pointerId, pointerType)
|
||||
.pointerMove(0, 0, {origin: target})
|
||||
.pointerDown({button:actions.ButtonType.RIGHT})
|
||||
.pointerUp({button:actions.ButtonType.RIGHT})
|
||||
.send();
|
||||
let pointerId = pointerType + "Pointer1";
|
||||
let actions = new test_driver.Actions();
|
||||
return actions.addPointer(pointerId, pointerType)
|
||||
.pointerMove(0, 0, {origin: target})
|
||||
.pointerDown({button:actions.ButtonType.RIGHT})
|
||||
.pointerUp({button:actions.ButtonType.RIGHT})
|
||||
.send();
|
||||
}
|
||||
|
||||
function twoFingerDrag(target) {
|
||||
return new test_driver.Actions()
|
||||
.addPointer("touchPointer1", "touch")
|
||||
.addPointer("touchPointer2", "touch")
|
||||
.pointerMove(0, 0, {origin: target, sourceName: "touchPointer1"})
|
||||
.pointerMove(10, 0, {origin: target, sourceName: "touchPointer2"})
|
||||
.pointerDown({sourceName: "touchPointer1"})
|
||||
.pointerDown({sourceName: "touchPointer2"})
|
||||
.pointerMove(0, 10, {origin: target, sourceName: "touchPointer1"})
|
||||
.pointerMove(10, 10, {origin: target, sourceName: "touchPointer2"})
|
||||
.pointerMove(0, 20, {origin: target, sourceName: "touchPointer1"})
|
||||
.pointerMove(10, 20, {origin: target, sourceName: "touchPointer2"})
|
||||
.pause(100)
|
||||
.pointerUp({sourceName: "touchPointer1"})
|
||||
.pointerUp({sourceName: "touchPointer2"})
|
||||
.send();
|
||||
.addPointer("touchPointer1", "touch")
|
||||
.addPointer("touchPointer2", "touch")
|
||||
.pointerMove(0, 0, { origin: target, sourceName: "touchPointer1" })
|
||||
.pointerMove(10, 0, { origin: target, sourceName: "touchPointer2" })
|
||||
.pointerDown({ sourceName: "touchPointer1" })
|
||||
.pointerDown({ sourceName: "touchPointer2" })
|
||||
.pointerMove(0, 10, { origin: target, sourceName: "touchPointer1" })
|
||||
.pointerMove(10, 10, { origin: target, sourceName: "touchPointer2" })
|
||||
.pointerMove(0, 20, { origin: target, sourceName: "touchPointer1" })
|
||||
.pointerMove(10, 20, { origin: target, sourceName: "touchPointer2" })
|
||||
.pause(100)
|
||||
.pointerUp({ sourceName: "touchPointer1" })
|
||||
.pointerUp({ sourceName: "touchPointer2" })
|
||||
.send();
|
||||
}
|
||||
|
||||
function pointerDragInTarget(pointerType, target, direction) {
|
||||
var x_delta = 0;
|
||||
var y_delta = 0;
|
||||
if (direction == "down") {
|
||||
x_delta = 0;
|
||||
y_delta = 10;
|
||||
} else if (direction == "up") {
|
||||
x_delta = 0;
|
||||
y_delta = -10;
|
||||
} else if (direction == "right") {
|
||||
x_delta = 10;
|
||||
y_delta = 0;
|
||||
} else if (direction == "left") {
|
||||
x_delta = -10;
|
||||
y_delta = 0;
|
||||
} else {
|
||||
throw("drag direction '" + direction + "' is not expected, direction should be 'down', 'up', 'left' or 'right'");
|
||||
}
|
||||
var pointerId = pointerType + "Pointer1";
|
||||
return new test_driver.Actions()
|
||||
.addPointer(pointerId, pointerType)
|
||||
.pointerMove(0, 0, {origin: target})
|
||||
.pointerDown()
|
||||
.pointerMove(x_delta, y_delta, {origin: target})
|
||||
.pointerMove(2 * x_delta, 2 * y_delta, {origin: target})
|
||||
.pointerMove(3 * x_delta, 3 * y_delta, {origin: target})
|
||||
.pointerUp()
|
||||
.send();
|
||||
var x_delta = 0;
|
||||
var y_delta = 0;
|
||||
if (direction == "down") {
|
||||
x_delta = 0;
|
||||
y_delta = 10;
|
||||
} else if (direction == "up") {
|
||||
x_delta = 0;
|
||||
y_delta = -10;
|
||||
} else if (direction == "right") {
|
||||
x_delta = 10;
|
||||
y_delta = 0;
|
||||
} else if (direction == "left") {
|
||||
x_delta = -10;
|
||||
y_delta = 0;
|
||||
} else {
|
||||
throw("drag direction '" + direction + "' is not expected, direction should be 'down', 'up', 'left' or 'right'");
|
||||
}
|
||||
var pointerId = pointerType + "Pointer1";
|
||||
return new test_driver.Actions()
|
||||
.addPointer(pointerId, pointerType)
|
||||
.pointerMove(0, 0, {origin: target})
|
||||
.pointerDown()
|
||||
.pointerMove(x_delta, y_delta, {origin: target})
|
||||
.pointerMove(2 * x_delta, 2 * y_delta, {origin: target})
|
||||
.pointerMove(3 * x_delta, 3 * y_delta, {origin: target})
|
||||
.pointerUp()
|
||||
.send();
|
||||
}
|
||||
|
||||
function pointerHoverInTarget(pointerType, target, direction) {
|
||||
var x_delta = 0;
|
||||
var y_delta = 0;
|
||||
if (direction == "down") {
|
||||
x_delta = 0;
|
||||
y_delta = 10;
|
||||
} else if (direction == "up") {
|
||||
x_delta = 0;
|
||||
y_delta = -10;
|
||||
} else if (direction == "right") {
|
||||
x_delta = 10;
|
||||
y_delta = 0;
|
||||
} else if (direction == "left") {
|
||||
x_delta = -10;
|
||||
y_delta = 0;
|
||||
} else {
|
||||
throw("drag direction '" + direction + "' is not expected, direction should be 'down', 'up', 'left' or 'right'");
|
||||
}
|
||||
var pointerId = pointerType + "Pointer1";
|
||||
return new test_driver.Actions()
|
||||
.addPointer(pointerId, pointerType)
|
||||
.pointerMove(0, 0, {origin: target})
|
||||
.pointerMove(x_delta, y_delta, {origin: target})
|
||||
.pointerMove(2 * x_delta, 2 * y_delta, {origin: target})
|
||||
.pointerMove(3 * x_delta, 3 * y_delta, {origin: target})
|
||||
.send();
|
||||
var x_delta = 0;
|
||||
var y_delta = 0;
|
||||
if (direction == "down") {
|
||||
x_delta = 0;
|
||||
y_delta = 10;
|
||||
} else if (direction == "up") {
|
||||
x_delta = 0;
|
||||
y_delta = -10;
|
||||
} else if (direction == "right") {
|
||||
x_delta = 10;
|
||||
y_delta = 0;
|
||||
} else if (direction == "left") {
|
||||
x_delta = -10;
|
||||
y_delta = 0;
|
||||
} else {
|
||||
throw("drag direction '" + direction + "' is not expected, direction should be 'down', 'up', 'left' or 'right'");
|
||||
}
|
||||
var pointerId = pointerType + "Pointer1";
|
||||
return new test_driver.Actions()
|
||||
.addPointer(pointerId, pointerType)
|
||||
.pointerMove(0, 0, {origin: target})
|
||||
.pointerMove(x_delta, y_delta, {origin: target})
|
||||
.pointerMove(2 * x_delta, 2 * y_delta, {origin: target})
|
||||
.pointerMove(3 * x_delta, 3 * y_delta, {origin: target})
|
||||
.send();
|
||||
}
|
||||
|
||||
function moveToDocument(pointerType) {
|
||||
var pointerId = pointerType + "Pointer1";
|
||||
return new test_driver.Actions()
|
||||
.addPointer(pointerId, pointerType)
|
||||
.pointerMove(0, 0)
|
||||
.send();
|
||||
var pointerId = pointerType + "Pointer1";
|
||||
return new test_driver.Actions()
|
||||
.addPointer(pointerId, pointerType)
|
||||
.pointerMove(0, 0)
|
||||
.send();
|
||||
}
|
||||
|
||||
// Returns a promise that only gets resolved when the condition is met.
|
||||
@ -441,61 +442,61 @@ function resolveWhen(condition) {
|
||||
}
|
||||
|
||||
// Returns a promise that only gets resolved after n animation frames
|
||||
function waitForAnimationFrames(n){
|
||||
function waitForAnimationFrames(n) {
|
||||
let p = 0;
|
||||
function next(){
|
||||
function next() {
|
||||
p++;
|
||||
return p === n;
|
||||
}
|
||||
return resolveWhen(next);
|
||||
}
|
||||
|
||||
function isPointerEvent(eventName){
|
||||
function isPointerEvent(eventName) {
|
||||
return All_Pointer_Events.includes(eventName);
|
||||
}
|
||||
|
||||
function isMouseEvent(eventName){
|
||||
function isMouseEvent(eventName) {
|
||||
return ["mousedown", "mouseup", "mousemove", "mouseover",
|
||||
"mouseenter", "mouseout", "mouseleave",
|
||||
"click", "contextmenu", "dblclick"
|
||||
].includes(eventName);
|
||||
"mouseenter", "mouseout", "mouseleave",
|
||||
"click", "contextmenu", "dblclick"
|
||||
].includes(eventName);
|
||||
}
|
||||
|
||||
function arePointerAndMouseEventCompatible(pointerEventName, mouseEventName){
|
||||
// e.g. compatible pointer-mouse events: pointerup - mouseup etc
|
||||
return pointerEventName.startsWith("pointer") &&
|
||||
mouseEventName.startsWith("mouse") &&
|
||||
pointerEventName.substring(7) === mouseEventName.substring(5);
|
||||
}
|
||||
// Events is a list of events fired at a target.
|
||||
//
|
||||
// Checks to see if each pointer event has a corresponding mouse event in the
|
||||
// event array and the two events are in the proper order (pointer event is
|
||||
// first).
|
||||
//
|
||||
// See https://w3c.github.io/pointerevents/#mapping-for-devices-that-support-hover
|
||||
function arePointerEventsBeforeCompatMouseEvents(events) {
|
||||
function arePointerAndMouseEventCompatible(pointerEventName, mouseEventName) {
|
||||
return pointerEventName.startsWith("pointer")
|
||||
&& mouseEventName.startsWith("mouse")
|
||||
&& pointerEventName.substring(7) === mouseEventName.substring(5);
|
||||
}
|
||||
|
||||
// events is a list of events fired at a target
|
||||
// checks to see if each pointer event has a corresponding mouse event in the event array
|
||||
// and the two events are in the proper order (pointer event is first)
|
||||
// see https://www.w3.org/TR/pointerevents3/#mapping-for-devices-that-support-hover
|
||||
function arePointerEventsBeforeCompatMouseEvents(events){
|
||||
// checks to see if the pointer event is compatible with the mouse event
|
||||
// and the pointer event happens before the mouse event
|
||||
function arePointerAndMouseEventInProperOrder(pointerEventIndex, mouseEventIndex, events){
|
||||
function arePointerAndMouseEventInProperOrder(pointerEventIndex, mouseEventIndex, events) {
|
||||
return (pointerEventIndex < mouseEventIndex && isPointerEvent(events[pointerEventIndex]) && isMouseEvent(events[mouseEventIndex])
|
||||
&& arePointerAndMouseEventCompatible(events[pointerEventIndex], events[mouseEventIndex]));
|
||||
}
|
||||
|
||||
let currentPointerEventIndex = events.findIndex((event)=>isPointerEvent(event));
|
||||
let currentMouseEventIndex = events.findIndex((event)=>isMouseEvent(event));
|
||||
let currentPointerEventIndex = events.findIndex((event) => isPointerEvent(event));
|
||||
let currentMouseEventIndex = events.findIndex((event) => isMouseEvent(event));
|
||||
|
||||
while(1){
|
||||
if(currentMouseEventIndex < 0 && currentPointerEventIndex < 0)
|
||||
while (1) {
|
||||
if (currentMouseEventIndex < 0 && currentPointerEventIndex < 0)
|
||||
return true;
|
||||
if(currentMouseEventIndex < 0 || currentPointerEventIndex < 0)
|
||||
if (currentMouseEventIndex < 0 || currentPointerEventIndex < 0)
|
||||
return false;
|
||||
if(!arePointerAndMouseEventInProperOrder(currentPointerEventIndex, currentMouseEventIndex, events))
|
||||
if (!arePointerAndMouseEventInProperOrder(currentPointerEventIndex, currentMouseEventIndex, events))
|
||||
return false;
|
||||
|
||||
let pointerIdx = events.slice(currentPointerEventIndex+1).findIndex(isPointerEvent);
|
||||
let mouseIdx = events.slice(currentMouseEventIndex+1).findIndex(isMouseEvent);
|
||||
let pointerIdx = events.slice(currentPointerEventIndex + 1).findIndex(isPointerEvent);
|
||||
let mouseIdx = events.slice(currentMouseEventIndex + 1).findIndex(isMouseEvent);
|
||||
|
||||
currentPointerEventIndex = (pointerIdx < 0)?pointerIdx:(currentPointerEventIndex+1+pointerIdx);
|
||||
currentMouseEventIndex = (mouseIdx < 0)?mouseIdx:(currentMouseEventIndex+1+mouseIdx);
|
||||
currentPointerEventIndex = (pointerIdx < 0) ? pointerIdx : (currentPointerEventIndex + 1 + pointerIdx);
|
||||
currentMouseEventIndex = (mouseIdx < 0) ? mouseIdx : (currentMouseEventIndex + 1 + mouseIdx);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -505,7 +506,7 @@ function arePointerEventsBeforeCompatMouseEvents(events){
|
||||
// receives an event of type |event_type|.
|
||||
function getEvent(event_type, target) {
|
||||
return new Promise(resolve => {
|
||||
target.addEventListener(event_type, e => resolve(e), {once: true});
|
||||
target.addEventListener(event_type, e => resolve(e), { once: true });
|
||||
});
|
||||
}
|
||||
|
||||
@ -528,8 +529,8 @@ function preventDefaultPointerdownOnce(target) {
|
||||
return new Promise(
|
||||
(resolve) => {
|
||||
target.addEventListener("pointerdown", (event) => {
|
||||
event.preventDefault();
|
||||
resolve();
|
||||
}, {once: true});
|
||||
event.preventDefault();
|
||||
resolve();
|
||||
}, { once: true });
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user