mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
6a261b9e77
# ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D35927 --HG-- extra : source : b9cc96337c05dbb9a9f811c63dcc5fd63588d652
57 lines
1.5 KiB
JavaScript
57 lines
1.5 KiB
JavaScript
add_task(async function() {
|
|
const url =
|
|
"data:text/html," +
|
|
"<html onmousemove='event.stopPropagation()'" +
|
|
" onmouseenter='event.stopPropagation()' onmouseleave='event.stopPropagation()'" +
|
|
" onmouseover='event.stopPropagation()' onmouseout='event.stopPropagation()'>" +
|
|
'<p id="p1" title="tooltip is here">This paragraph has a tooltip.</p>' +
|
|
'<p id="p2">This paragraph doesn\'t have tooltip.</p></html>';
|
|
|
|
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
|
|
let browser = gBrowser.selectedBrowser;
|
|
|
|
await new Promise(resolve => {
|
|
SpecialPowers.pushPrefEnv({ set: [["ui.tooltipDelay", 0]] }, resolve);
|
|
});
|
|
|
|
let popupShownPromise = BrowserTestUtils.waitForEvent(
|
|
document,
|
|
"popupshown",
|
|
false,
|
|
event => {
|
|
is(event.originalTarget.localName, "tooltip", "tooltip is showing");
|
|
return true;
|
|
}
|
|
);
|
|
let popupHiddenPromise = BrowserTestUtils.waitForEvent(
|
|
document,
|
|
"popuphidden",
|
|
false,
|
|
event => {
|
|
is(event.originalTarget.localName, "tooltip", "tooltip is hidden");
|
|
return true;
|
|
}
|
|
);
|
|
|
|
// Send a mousemove at a known position to start the test.
|
|
await BrowserTestUtils.synthesizeMouseAtCenter(
|
|
"#p2",
|
|
{ type: "mousemove" },
|
|
browser
|
|
);
|
|
await BrowserTestUtils.synthesizeMouseAtCenter(
|
|
"#p1",
|
|
{ type: "mousemove" },
|
|
browser
|
|
);
|
|
await popupShownPromise;
|
|
await BrowserTestUtils.synthesizeMouseAtCenter(
|
|
"#p2",
|
|
{ type: "mousemove" },
|
|
browser
|
|
);
|
|
await popupHiddenPromise;
|
|
|
|
gBrowser.removeCurrentTab();
|
|
});
|