Bug 1401128 - Part 2: Modify test to change the way to send mouse event. r?pbro
MozReview-Commit-ID: GOGJjRowa0W
--- a/devtools/client/animationinspector/test/head.js
+++ b/devtools/client/animationinspector/test/head.js
@@ -435,18 +435,26 @@ function* clickOnAnimation(panel, index,
// Expect a selection event.
let onSelectionChanged = timeline.once(shouldAlreadySelected
? "animation-already-selected"
: "animation-selected");
info("Click on animation " + index + " in the timeline");
let timeBlock = timeline.rootWrapperEl.querySelectorAll(".time-block")[index];
- EventUtils.sendMouseEvent({type: "click"}, timeBlock,
- timeBlock.ownerDocument.defaultView);
+ // Scroll to show the timeBlock since the element may be out of displayed area.
+ timeBlock.scrollIntoView(false);
+ let timeBlockBounds = timeBlock.getBoundingClientRect();
+ let x = timeBlockBounds.width / 2;
+ let y = timeBlockBounds.height / 2;
+ if (timeBlock != timeBlock.ownerDocument.elementFromPoint(x, y)) {
+ // Move the mouse pointer a little since scrubber element may be at the point.
+ x += timeBlockBounds.width / 4;
+ }
+ EventUtils.synthesizeMouse(timeBlock, x, y, {}, timeBlock.ownerDocument.defaultView);
return yield onSelectionChanged;
}
/**
* Get an instance of the Keyframes component from the timeline.
* @param {AnimationsPanel} panel The panel instance.
* @param {String} propertyName The name of the animated property.