Bug 1191093 - Hide ruleview autocomplete popup on page navigation;r=bgrins

In ruleview #selectElement, if the autocomplete popup is opened, hide it.
Added one mochitest to verify the popup is properly hidden after navigation.
This commit is contained in:
Julian Descottes 2015-08-07 20:31:13 +02:00
parent 4ecd64beb0
commit 7d20649f5d
3 changed files with 43 additions and 0 deletions

View File

@ -1706,6 +1706,10 @@ CssRuleView.prototype = {
return promise.resolve(undefined);
}
if (this.popup.isOpen) {
this.popup.hidePopup();
}
this.clear();
this.clearPseudoClassPanel();

View File

@ -74,6 +74,7 @@ support-files =
[browser_ruleview_completion-existing-property_02.js]
[browser_ruleview_completion-new-property_01.js]
[browser_ruleview_completion-new-property_02.js]
[browser_ruleview_completion-popup-hidden-after-navigation.js]
[browser_ruleview_content_01.js]
[browser_ruleview_content_02.js]
skip-if = e10s # Bug 1039528: "inspect element" contextual-menu doesn't work with e10s

View File

@ -0,0 +1,38 @@
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test that the ruleview autocomplete popup is hidden after page navigation
let TEST_URL = "data:text/html;charset=utf-8,<h1 style='font: 24px serif'></h1>";
add_task(function*() {
yield addTab(TEST_URL);
let {inspector, view} = yield openRuleView();
info("Test autocompletion popup is hidden after page navigation");
info("Selecting the test node");
yield selectNode("h1", inspector);
info("Focusing the css property editable field");
let propertyName = view.styleDocument.querySelectorAll(".ruleview-propertyname")[0];
let editor = yield focusEditableField(view, propertyName);
info("Pressing key VK_DOWN");
let onSuggest = once(editor.input, "keypress");
EventUtils.synthesizeKey("VK_DOWN", {}, view.styleWindow);
info("Waiting for autocomplete popup to be displayed");
yield onSuggest;
yield wait(1);
ok(view.popup && view.popup.isOpen, "Popup should be opened");
info("Reloading the page");
yield reloadPage(inspector);
ok(!(view.popup && view.popup.isOpen), "Popup should be closed");
});