author | Neil Deakin <neil@mozilla.com> |
Tue, 22 Jul 2014 11:17:26 -0400 | |
changeset 195500 | 5c38e0a84b54ce795b11e9487636aa89db9891c9 |
parent 195499 | f604cdbc6e85c1d7cf68d38592faf2e57495b0f1 |
child 195501 | 93019f345da9ec27e51ceeee5c67783aee6da748 |
push id | 27184 |
push user | kwierso@gmail.com |
push date | Wed, 23 Jul 2014 00:39:18 +0000 |
treeherder | mozilla-central@0ad20ad7b70a [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | MattN |
bugs | 1026310 |
milestone | 34.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
browser/modules/test/browser_UITour_panel_close_annotation.js | file | annotate | diff | comparison | revisions | |
browser/modules/test/head.js | file | annotate | diff | comparison | revisions |
--- a/browser/modules/test/browser_UITour_panel_close_annotation.js +++ b/browser/modules/test/browser_UITour_panel_close_annotation.js @@ -30,34 +30,34 @@ let tests = [ waitForElementToBeVisible(highlight, function checkPanelIsOpen() { isnot(PanelUI.panel.state, "closed", "Panel should have opened"); // Move the highlight outside which should close the app menu. gContentAPI.showHighlight("appMenu"); waitForPopupAtAnchor(highlight.parentElement, document.getElementById("PanelUI-button"), () => { isnot(PanelUI.panel.state, "open", "Panel should have closed after the highlight moved elsewhere."); - is(tooltip.state, "open", "The info panel should have remained open"); + ok(tooltip.state == "showing" || tooltip.state == "open", "The info panel should have remained open"); done(); }, "Highlight should move to the appMenu button and still be visible"); }, "Highlight should be shown after showHighlight() for fixed panel items"); }, function test_highlight_panel_hideMenu(done) { gContentAPI.showHighlight("customize"); gContentAPI.showInfo("search", "test title", "test text"); waitForElementToBeVisible(highlight, function checkPanelIsOpen() { isnot(PanelUI.panel.state, "closed", "Panel should have opened"); // Close the app menu and make sure the highlight also disappeared. gContentAPI.hideMenu("appMenu"); waitForElementToBeHidden(highlight, function checkPanelIsClosed() { isnot(PanelUI.panel.state, "open", "Panel still should have closed"); - is(tooltip.state, "open", "The info panel should have remained open"); + ok(tooltip.state == "showing" || tooltip.state == "open", "The info panel should have remained open"); done(); }, "Highlight should have disappeared when panel closed"); }, "Highlight should be shown after showHighlight() for fixed panel items"); }, function test_highlight_panel_click_find(done) { gContentAPI.showHighlight("help"); gContentAPI.showInfo("searchProvider", "test title", "test text"); @@ -65,17 +65,17 @@ let tests = [ isnot(PanelUI.panel.state, "closed", "Panel should have opened"); // Click the find button which should close the panel. let findButton = document.getElementById("find-button"); EventUtils.synthesizeMouseAtCenter(findButton, {}); waitForElementToBeHidden(highlight, function checkPanelIsClosed() { isnot(PanelUI.panel.state, "open", "Panel should have closed when the find bar opened"); - is(tooltip.state, "open", "The info panel should have remained open"); + ok(tooltip.state == "showing" || tooltip.state == "open", "The info panel should have remained open"); done(); }, "Highlight should have disappeared when panel closed"); }, "Highlight should be shown after showHighlight() for fixed panel items"); }, function test_highlight_info_panel_click_find(done) { gContentAPI.showHighlight("help"); gContentAPI.showInfo("customize", "customize me!", "awesome!"); @@ -103,17 +103,17 @@ let tests = [ isnot(PanelUI.panel.state, "closed", "Panel should have opened"); // Click the help button which should open the subview in the panel menu. let helpButton = document.getElementById("PanelUI-help"); EventUtils.synthesizeMouseAtCenter(helpButton, {}); waitForElementToBeHidden(highlight, function highlightHidden() { is(PanelUI.panel.state, "open", "Panel should have stayed open when the subview opened"); - is(tooltip.state, "open", "The info panel should have remained open"); + ok(tooltip.state == "showing" || tooltip.state == "open", "The info panel should have remained open"); PanelUI.hide(); done(); }, "Highlight should have disappeared when the subview opened"); }, "Highlight should be shown after showHighlight() for fixed panel items"); }, function test_info_panel_open_subview(done) { gContentAPI.showHighlight("urlbar");
--- a/browser/modules/test/head.js +++ b/browser/modules/test/head.js @@ -36,23 +36,39 @@ function is_hidden(element) { // Hiding a parent element will hide all its children if (element.parentNode != element.ownerDocument) return is_hidden(element.parentNode); return false; } +function is_visible(element) { + var style = element.ownerDocument.defaultView.getComputedStyle(element, ""); + if (style.display == "none") + return false; + if (style.visibility != "visible") + return false; + if (style.display == "-moz-popup" && element.state != "open") + return false; + + // Hiding a parent element will hide all its children + if (element.parentNode != element.ownerDocument) + return is_visible(element.parentNode); + + return true; +} + function is_element_visible(element, msg) { isnot(element, null, "Element should not be null, when checking visibility"); - ok(!is_hidden(element), msg); + ok(is_visible(element), msg); } function waitForElementToBeVisible(element, nextTest, msg) { - waitForCondition(() => !is_hidden(element), + waitForCondition(() => is_visible(element), () => { ok(true, msg); nextTest(); }, "Timeout waiting for visibility: " + msg); } function waitForElementToBeHidden(element, nextTest, msg) { @@ -60,17 +76,17 @@ function waitForElementToBeHidden(elemen () => { ok(true, msg); nextTest(); }, "Timeout waiting for invisibility: " + msg); } function waitForPopupAtAnchor(popup, anchorNode, nextTest, msg) { - waitForCondition(() => popup.popupBoxObject.anchorNode == anchorNode, + waitForCondition(() => is_visible(popup) && popup.popupBoxObject.anchorNode == anchorNode, () => { ok(true, msg); is_element_visible(popup, "Popup should be visible"); nextTest(); }, "Timeout waiting for popup at anchor: " + msg); }