Bug 1638275 - Allow searchbar one-offs hidden attribute to override display:flex. r=dao

Differential Revision: https://phabricator.services.mozilla.com/D77086
This commit is contained in:
Harry Twyford 2020-06-01 20:23:56 +00:00
parent 9daa2430da
commit b2fb31c57b
2 changed files with 39 additions and 1 deletions

View File

@ -216,6 +216,44 @@ add_task(async function click_opens_popup() {
textbox.value = "";
});
add_task(async function open_empty_hiddenOneOffs() {
// Disable all the engines but the current one and check the oneoffs.
let defaultEngine = await Services.search.getDefault();
let engines = (await Services.search.getVisibleEngines()).filter(
e => e.name != defaultEngine.name
);
await SpecialPowers.pushPrefEnv({
set: [["browser.search.hiddenOneOffs", engines.map(e => e.name).join(",")]],
});
let oneOffButtons = searchPopup.searchOneOffsContainer.querySelector(
".search-panel-one-offs"
);
textbox.value = "foo";
let promise = promiseEvent(searchPopup, "popupshown");
EventUtils.synthesizeMouseAtCenter(textbox, {});
await promise;
Assert.ok(
oneOffButtons.getAttribute("hidden"),
"The one-offs buttons should have the hidden attribute."
);
Assert.equal(
getComputedStyle(oneOffButtons).display,
"none",
"The one-off buttons should be hidden."
);
promise = promiseEvent(searchPopup, "popuphidden");
info("Hiding popup");
await synthesizeNativeMouseClick(searchIcon);
await promise;
await SpecialPowers.popPrefEnv();
textbox.value = "";
});
// Right clicking in a non-empty search box when unfocused should open the edit context menu.
add_no_popup_task(async function right_click_doesnt_open_popup() {
gURLBar.focus();

View File

@ -53,7 +53,7 @@
border-top: none;
}
.search-panel-one-offs,
.search-panel-one-offs:not([hidden]),
.search-panel-one-offs-container {
display: flex;
flex-direction: row;