browser_bug703210.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. add_task(function* () {
  2. const url = "data:text/html," +
  3. "<html onmousemove='event.stopPropagation()'" +
  4. " onmouseenter='event.stopPropagation()' onmouseleave='event.stopPropagation()'" +
  5. " onmouseover='event.stopPropagation()' onmouseout='event.stopPropagation()'>" +
  6. "<p id=\"p1\" title=\"tooltip is here\">This paragraph has a tooltip.</p>" +
  7. "<p id=\"p2\">This paragraph doesn't have tooltip.</p></html>";
  8. let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, url);
  9. let browser = gBrowser.selectedBrowser;
  10. yield new Promise(resolve => {
  11. SpecialPowers.pushPrefEnv({"set": [["ui.tooltipDelay", 0]]}, resolve);
  12. });
  13. // Send a mousemove at a known position to start the test.
  14. yield BrowserTestUtils.synthesizeMouseAtCenter("#p2", { type: "mousemove" }, browser);
  15. let popupShownPromise = BrowserTestUtils.waitForEvent(document, "popupshown", false, event => {
  16. is(event.originalTarget.localName, "tooltip", "tooltip is showing");
  17. return true;
  18. });
  19. yield BrowserTestUtils.synthesizeMouseAtCenter("#p1", { type: "mousemove" }, browser);
  20. yield popupShownPromise;
  21. let popupHiddenPromise = BrowserTestUtils.waitForEvent(document, "popuphidden", false, event => {
  22. is(event.originalTarget.localName, "tooltip", "tooltip is hidden");
  23. return true;
  24. });
  25. yield BrowserTestUtils.synthesizeMouseAtCenter("#p2", { type: "mousemove" }, browser);
  26. yield popupHiddenPromise;
  27. gBrowser.removeCurrentTab();
  28. });