function waitForEvent(aTarget, aEvent) {
return new Promise(aResolve => {
aTarget.addEventListener(aEvent, aResolve, { once: true });
});
}
/** Test for Bug 367028 **/
add_task(async function drag_thumb_in_link() {
let scroller = document.getElementById("scroller");
scroller.ondragstart = function(e) {
e.preventDefault();
ok(false, "dragging on scroller bar should not trigger drag-and-drop operation");
scroller.ondragstart = null;
};
// Click the scroll bar.
let x = scroller.getBoundingClientRect().width - 5;
let y = scroller.getBoundingClientRect().height - 70;
synthesizeMouse(scroller, x, y, { type : "mousedown" }, window);
synthesizeMouse(scroller, x, y, { type : "mousemove" }, window);
let scrollPromise = waitForEvent(scroller, "scroll");
x = scroller.getBoundingClientRect().width + 20;
y = scroller.getBoundingClientRect().height - 30;
synthesizeMouse(scroller, x, y, { type : "mousemove" }, window);
synthesizeMouse(scroller, x, y, { type : "mouseup" }, window);
await scrollPromise;
ok(true, "Dragging scroller bar should scroll");
scroller.ondragstart = null;
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.