Bug 1623476 - Fix event targeting in a click_events_on_input.html. r=jgraham

Presumably, the intention of the test is to hit the middle of the target. To
this end, the test specifies an offset of half the target's dimensions
relative to the origin of the target.

However, when pointerMove() is given an element as origin, it already uses
the element's center as the origin point, so we end up actually targeting
the bottom right pixel which is prone to rounding issues.

Differential Revision: https://phabricator.services.mozilla.com/D67518

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Botond Ballo 2020-03-23 22:21:46 +00:00
Родитель c8a0ab983b
Коммит bdd33701db
1 изменённых файлов: 1 добавлений и 4 удалений

Просмотреть файл

@ -37,10 +37,7 @@
// Inject mouse click events. // Inject mouse click events.
var actions = new test_driver.Actions(); var actions = new test_driver.Actions();
document.getElementById("other").focus(); document.getElementById("other").focus();
var bounds = target.getBoundingClientRect(); actions.pointerMove(0, 0, {origin: target})
actions.pointerMove(Math.floor(bounds.width / 5),
Math.floor(bounds.height / 2),
{origin: target})
.pointerDown({button: mouseButton}) .pointerDown({button: mouseButton})
.pointerUp({button: mouseButton}) .pointerUp({button: mouseButton})
.send() .send()