зеркало из https://github.com/mozilla/gecko-dev.git
Bug 703210 part.2 Add test r=smaug
This commit is contained in:
Родитель
ca6afa8566
Коммит
095d71efb1
|
@ -63,3 +63,12 @@ libs:: $(_TEST_FILES)
|
|||
|
||||
libs:: $(_CHROME_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
|
||||
|
||||
ifneq (mobile,$(MOZ_BUILD_APP))
|
||||
_BROWSER_FILES = \
|
||||
browser_bug703210.js \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_BROWSER_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
|
||||
endif
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
function test() {
|
||||
waitForExplicitFinish();
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
|
||||
let doStopPropagation = function (aEvent)
|
||||
{
|
||||
aEvent.stopPropagation();
|
||||
}
|
||||
|
||||
let onPopupShowing = function (aEvent)
|
||||
{
|
||||
is(aEvent.originalTarget.localName, "tooltip", "tooltip is showing");
|
||||
|
||||
let doc = gBrowser.contentDocument;
|
||||
let win = gBrowser.contentWindow;
|
||||
let p2 = doc.getElementById("p2");
|
||||
setTimeout(function () {
|
||||
EventUtils.synthesizeMouseAtCenter(p2, { type: "mousemove" }, win); }, 0);
|
||||
}
|
||||
|
||||
let onPopupHiding = function (aEvent)
|
||||
{
|
||||
is(aEvent.originalTarget.localName, "tooltip", "tooltip is hiding");
|
||||
|
||||
let doc = gBrowser.contentDocument;
|
||||
|
||||
doc.removeEventListener("mousemove", doStopPropagation, true);
|
||||
doc.removeEventListener("mouseenter", doStopPropagation, true);
|
||||
doc.removeEventListener("mouseleave", doStopPropagation, true);
|
||||
doc.removeEventListener("mouseover", doStopPropagation, true);
|
||||
doc.removeEventListener("mouseout", doStopPropagation, true);
|
||||
document.removeEventListener("popupshowing", onPopupShowing, true);
|
||||
document.removeEventListener("popuphiding", onPopupHiding, true);
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
|
||||
let onLoad = function (aEvent)
|
||||
{
|
||||
let doc = gBrowser.contentDocument;
|
||||
let win = gBrowser.contentWindow;
|
||||
let p1 = doc.getElementById("p1");
|
||||
let p2 = doc.getElementById("p2");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(p2, { type: "mousemove" }, win);
|
||||
|
||||
doc.addEventListener("mousemove", doStopPropagation, true);
|
||||
doc.addEventListener("mouseenter", doStopPropagation, true);
|
||||
doc.addEventListener("mouseleave", doStopPropagation, true);
|
||||
doc.addEventListener("mouseover", doStopPropagation, true);
|
||||
doc.addEventListener("mouseout", doStopPropagation, true);
|
||||
document.addEventListener("popupshown", onPopupShowing, true);
|
||||
document.addEventListener("popuphiding", onPopupHiding, true);
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(p1, { type: "mousemove" }, win);
|
||||
}
|
||||
|
||||
gBrowser.selectedBrowser.addEventListener("load",
|
||||
function () { setTimeout(onLoad, 0); }, true);
|
||||
|
||||
content.location = "data:text/html," +
|
||||
"<p id=\"p1\" title=\"tooltip is here\">This paragraph has a tooltip.</p>" +
|
||||
"<p id=\"p2\">This paragraph doesn't have tooltip.</p>";
|
||||
}
|
Загрузка…
Ссылка в новой задаче