Bug 1939917 - Update Sidebar visibility settings and settings order r=sidebar-reviewers,fluent-reviewers,desktop-theme-reviewers,bolsson,sclements,hjones
- change order of settings as per spec - only show visibilty settings if vertical tabs enabled Depends on D234592 Differential Revision: https://phabricator.services.mozilla.com/D235178
This commit is contained in:
@@ -239,7 +239,7 @@ export class SidebarState {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// we need this set to verticalTabsEnabled to ensure it has the correct state when toggling the sidebar button
|
// we need this set to verticalTabsEnabled to ensure it has the correct state when toggling the sidebar button
|
||||||
this.launcherExpanded = lazy.verticalTabsEnabled;
|
this.launcherExpanded = lazy.verticalTabsEnabled && visible;
|
||||||
|
|
||||||
if (!visible && this.panelOpen) {
|
if (!visible && this.panelOpen) {
|
||||||
// Hiding the launcher should also close out any open panels and resets panelOpen
|
// Hiding the launcher should also close out any open panels and resets panelOpen
|
||||||
|
|||||||
@@ -1827,7 +1827,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||||||
"always-show",
|
"always-show",
|
||||||
(_aPreference, _previousValue, newValue) => {
|
(_aPreference, _previousValue, newValue) => {
|
||||||
if (!SidebarController.uninitializing) {
|
if (!SidebarController.uninitializing) {
|
||||||
SidebarController.updateToolbarButton();
|
|
||||||
SidebarController.recordVisibilitySetting(newValue);
|
SidebarController.recordVisibilitySetting(newValue);
|
||||||
SidebarController._state.revampVisibility = newValue;
|
SidebarController._state.revampVisibility = newValue;
|
||||||
SidebarController._state.updateVisibility(
|
SidebarController._state.updateVisibility(
|
||||||
@@ -1835,6 +1834,7 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||||||
SidebarController.sidebarVerticalTabsEnabled) ||
|
SidebarController.sidebarVerticalTabsEnabled) ||
|
||||||
!SidebarController.sidebarVerticalTabsEnabled
|
!SidebarController.sidebarVerticalTabsEnabled
|
||||||
);
|
);
|
||||||
|
SidebarController.updateToolbarButton();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -1845,11 +1845,11 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||||||
false,
|
false,
|
||||||
(_aPreference, _previousValue, newValue) => {
|
(_aPreference, _previousValue, newValue) => {
|
||||||
if (!SidebarController.uninitializing) {
|
if (!SidebarController.uninitializing) {
|
||||||
|
SidebarController.recordTabsLayoutSetting(newValue);
|
||||||
Services.prefs.setStringPref(
|
Services.prefs.setStringPref(
|
||||||
SidebarController.VISIBILITY_PREF,
|
SidebarController.VISIBILITY_PREF,
|
||||||
newValue ? "always-show" : "hide-sidebar"
|
newValue ? "always-show" : "hide-sidebar"
|
||||||
);
|
);
|
||||||
SidebarController.recordTabsLayoutSetting(newValue);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -14,6 +14,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.medium-top-margin {
|
||||||
|
margin-block-start: var(--space-medium);
|
||||||
|
}
|
||||||
|
|
||||||
.customize-header {
|
.customize-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -61,7 +65,6 @@
|
|||||||
font-weight: var(--font-weight-bold);
|
font-weight: var(--font-weight-bold);
|
||||||
}
|
}
|
||||||
|
|
||||||
moz-radio-group,
|
|
||||||
moz-fieldset {
|
moz-fieldset {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
||||||
@@ -75,7 +78,6 @@ moz-fieldset {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
moz-radio,
|
|
||||||
moz-checkbox {
|
moz-checkbox {
|
||||||
padding-block: var(--space-medium);
|
padding-block: var(--space-medium);
|
||||||
|
|
||||||
@@ -83,6 +85,13 @@ moz-checkbox {
|
|||||||
border-bottom: 0.5px solid var(--panel-separator-color);
|
border-bottom: 0.5px solid var(--panel-separator-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
> moz-checkbox:last-of-type {
|
||||||
|
padding-block: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-label::part(label) {
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#manage-settings {
|
#manage-settings {
|
||||||
@@ -92,6 +101,6 @@ moz-checkbox {
|
|||||||
padding-inline-start: var(--space-medium);
|
padding-inline-start: var(--space-medium);
|
||||||
}
|
}
|
||||||
|
|
||||||
.customize-group {
|
.customize-group:not(.no-end-margin) {
|
||||||
margin-block-end: var(--space-xlarge);
|
margin-block-end: var(--space-xlarge);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ import { html, when } from "chrome://global/content/vendor/lit.all.mjs";
|
|||||||
|
|
||||||
import { SidebarPage } from "./sidebar-page.mjs";
|
import { SidebarPage } from "./sidebar-page.mjs";
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-unassigned-import
|
|
||||||
import "chrome://global/content/elements/moz-radio-group.mjs";
|
|
||||||
|
|
||||||
const lazy = {};
|
const lazy = {};
|
||||||
|
|
||||||
ChromeUtils.defineESModuleGetters(lazy, {
|
ChromeUtils.defineESModuleGetters(lazy, {
|
||||||
@@ -44,11 +41,11 @@ export class SidebarCustomize extends SidebarPage {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static queries = {
|
static queries = {
|
||||||
toolInputs: { all: ".customize-group moz-checkbox" },
|
toolInputs: { all: ".tool" },
|
||||||
extensionLinks: { all: ".extension-link" },
|
extensionLinks: { all: ".extension-link" },
|
||||||
positionInputs: { all: ".position-setting" },
|
positionInput: "#position",
|
||||||
visibilityInputs: { all: ".visibility-setting" },
|
visibilityInput: "#hide-sidebar",
|
||||||
verticalTabsInputs: { all: ".vertical-tabs-setting" },
|
verticalTabsInput: "#vertical-tabs",
|
||||||
};
|
};
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
@@ -94,6 +91,13 @@ export class SidebarCustomize extends SidebarPage {
|
|||||||
return this.getWindow().document.querySelector("sidebar-launcher");
|
return this.getWindow().document.querySelector("sidebar-launcher");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get fluentStrings() {
|
||||||
|
if (!this._fluentStrings) {
|
||||||
|
this._fluentStrings = new Localization(["browser/sidebar.ftl"], true);
|
||||||
|
}
|
||||||
|
return this._fluentStrings;
|
||||||
|
}
|
||||||
|
|
||||||
getWindow() {
|
getWindow() {
|
||||||
return window.browsingContext.embedderWindowGlobal.browsingContext.window;
|
return window.browsingContext.embedderWindowGlobal.browsingContext.window;
|
||||||
}
|
}
|
||||||
@@ -158,6 +162,7 @@ export class SidebarCustomize extends SidebarPage {
|
|||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<moz-checkbox
|
<moz-checkbox
|
||||||
|
class="tool"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
id=${tool.view}
|
id=${tool.view}
|
||||||
name=${tool.view}
|
name=${tool.view}
|
||||||
@@ -242,6 +247,42 @@ export class SidebarCustomize extends SidebarPage {
|
|||||||
<div class="sidebar-panel">
|
<div class="sidebar-panel">
|
||||||
<sidebar-panel-header data-l10n-id="sidebar-menu-customize-header" data-l10n-attrs="heading" view="viewCustomizeSidebar">
|
<sidebar-panel-header data-l10n-id="sidebar-menu-customize-header" data-l10n-attrs="heading" view="viewCustomizeSidebar">
|
||||||
</sidebar-panel-header>
|
</sidebar-panel-header>
|
||||||
|
<moz-fieldset class="customize-group no-end-margin" data-l10n-id="sidebar-settings">
|
||||||
|
<moz-checkbox
|
||||||
|
type="checkbox"
|
||||||
|
id="vertical-tabs"
|
||||||
|
name="verticalTabs"
|
||||||
|
iconsrc="chrome://browser/skin/sidebar-collapsed.svg"
|
||||||
|
data-l10n-id="sidebar-vertical-tabs"
|
||||||
|
@change=${this.#handleTabDirectionChange}
|
||||||
|
?checked=${this.verticalTabsEnabled}
|
||||||
|
>
|
||||||
|
${when(
|
||||||
|
this.verticalTabsEnabled,
|
||||||
|
() => html`
|
||||||
|
<moz-checkbox
|
||||||
|
slot="nested"
|
||||||
|
type="checkbox"
|
||||||
|
id="hide-sidebar"
|
||||||
|
name="hideSidebar"
|
||||||
|
data-l10n-id="sidebar-hide-tabs-and-sidebar"
|
||||||
|
@change=${this.#handleVisibilityChange}
|
||||||
|
?checked=${this.visibility == "hide-sidebar"}
|
||||||
|
></moz-checkbox>
|
||||||
|
`
|
||||||
|
)}
|
||||||
|
</moz-checkbox>
|
||||||
|
</moz-fieldset>
|
||||||
|
<moz-fieldset class="customize-group medium-top-margin no-label">
|
||||||
|
<moz-checkbox
|
||||||
|
type="checkbox"
|
||||||
|
id="position"
|
||||||
|
name="position"
|
||||||
|
data-l10n-id=${document.dir == "rtl" ? "sidebar-show-on-the-left" : "sidebar-show-on-the-right"}
|
||||||
|
@change=${this.reversePosition}
|
||||||
|
?checked=${!this.getWindow().SidebarController._positionStart}
|
||||||
|
></moz-checkbox>
|
||||||
|
</moz-fieldset>
|
||||||
<moz-fieldset class="customize-group" data-l10n-id="sidebar-customize-firefox-tools-header">
|
<moz-fieldset class="customize-group" data-l10n-id="sidebar-customize-firefox-tools-header">
|
||||||
${this.getWindow()
|
${this.getWindow()
|
||||||
.SidebarController.getTools()
|
.SidebarController.getTools()
|
||||||
@@ -262,91 +303,6 @@ export class SidebarCustomize extends SidebarPage {
|
|||||||
</div>
|
</div>
|
||||||
</div>`
|
</div>`
|
||||||
)}
|
)}
|
||||||
${when(
|
|
||||||
this.verticalTabsEnabled,
|
|
||||||
() =>
|
|
||||||
html`<div class="customize-group">
|
|
||||||
<moz-radio-group
|
|
||||||
@change=${this.#handleVisibilityChange}
|
|
||||||
name="visibility"
|
|
||||||
data-l10n-id="sidebar-customize-button-header"
|
|
||||||
>
|
|
||||||
<moz-radio
|
|
||||||
class="visibility-setting"
|
|
||||||
value="always-show"
|
|
||||||
?checked=${this.visibility === "always-show"}
|
|
||||||
iconsrc="chrome://browser/skin/sidebar-expanded.svg"
|
|
||||||
data-l10n-id="sidebar-visibility-setting-always-show"
|
|
||||||
></moz-radio>
|
|
||||||
<moz-radio
|
|
||||||
class="visibility-setting"
|
|
||||||
value="hide-sidebar"
|
|
||||||
?checked=${this.visibility === "hide-sidebar"}
|
|
||||||
iconsrc="chrome://browser/skin/sidebar-hidden.svg"
|
|
||||||
data-l10n-id="sidebar-visibility-setting-hide-sidebar"
|
|
||||||
></moz-radio>
|
|
||||||
</moz-radio-group>
|
|
||||||
</div>`
|
|
||||||
)}
|
|
||||||
<div class="customize-group">
|
|
||||||
<moz-radio-group
|
|
||||||
@change=${this.reversePosition}
|
|
||||||
name="position"
|
|
||||||
data-l10n-id="sidebar-customize-position-header">
|
|
||||||
<moz-radio
|
|
||||||
class="position-setting"
|
|
||||||
id="position-left"
|
|
||||||
value=${!this.getWindow().RTL_UI}
|
|
||||||
?checked=${
|
|
||||||
this.getWindow().RTL_UI
|
|
||||||
? !this.getWindow().SidebarController._positionStart
|
|
||||||
: this.getWindow().SidebarController._positionStart
|
|
||||||
}
|
|
||||||
iconsrc="chrome://browser/skin/sidebar-expanded.svg"
|
|
||||||
data-l10n-id="sidebar-position-left"
|
|
||||||
></moz-radio>
|
|
||||||
<moz-radio
|
|
||||||
class="position-setting"
|
|
||||||
id="position-right"
|
|
||||||
value=${this.getWindow().RTL_UI}
|
|
||||||
?checked=${
|
|
||||||
this.getWindow().RTL_UI
|
|
||||||
? this.getWindow().SidebarController._positionStart
|
|
||||||
: !this.getWindow().SidebarController._positionStart
|
|
||||||
}
|
|
||||||
iconsrc="chrome://browser/skin/sidebar-expanded-right.svg"
|
|
||||||
data-l10n-id="sidebar-position-right"
|
|
||||||
></moz-radio>
|
|
||||||
</moz-radio-group>
|
|
||||||
</div>
|
|
||||||
<div class="customize-group">
|
|
||||||
<moz-radio-group
|
|
||||||
@change=${this.#handleTabDirectionChange}
|
|
||||||
name="tabDirection"
|
|
||||||
data-l10n-id="sidebar-customize-tabs-header">
|
|
||||||
<moz-radio
|
|
||||||
class="vertical-tabs-setting"
|
|
||||||
id="vertical-tabs"
|
|
||||||
value=${true}
|
|
||||||
?checked=${
|
|
||||||
this.getWindow().SidebarController.sidebarVerticalTabsEnabled
|
|
||||||
}
|
|
||||||
iconsrc="chrome://browser/skin/sidebar-collapsed.svg"
|
|
||||||
data-l10n-id="sidebar-vertical-tabs"
|
|
||||||
></moz-radio>
|
|
||||||
<moz-radio
|
|
||||||
class="vertical-tabs-setting"
|
|
||||||
id="horizontal-tabs"
|
|
||||||
value=${false}
|
|
||||||
?checked=${
|
|
||||||
this.getWindow().SidebarController
|
|
||||||
.sidebarVerticalTabsEnabled === false
|
|
||||||
}
|
|
||||||
iconsrc="chrome://browser/skin/sidebar-horizontal-tabs.svg"
|
|
||||||
data-l10n-id="sidebar-horizontal-tabs"
|
|
||||||
></moz-radio>
|
|
||||||
</moz-radio-group>
|
|
||||||
</div>
|
|
||||||
<div id="manage-settings">
|
<div id="manage-settings">
|
||||||
<img src="chrome://browser/skin/preferences/category-general.svg" class="icon" role="presentation" />
|
<img src="chrome://browser/skin/preferences/category-general.svg" class="icon" role="presentation" />
|
||||||
<a
|
<a
|
||||||
@@ -361,16 +317,20 @@ export class SidebarCustomize extends SidebarPage {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
#handleVisibilityChange({ target: { value } }) {
|
#handleVisibilityChange(e) {
|
||||||
this.visibility = value;
|
e.stopPropagation();
|
||||||
Services.prefs.setStringPref(VISIBILITY_SETTING_PREF, value);
|
this.visibility = e.target.checked ? "hide-sidebar" : "always-show";
|
||||||
|
Services.prefs.setStringPref(
|
||||||
|
VISIBILITY_SETTING_PREF,
|
||||||
|
e.target.checked ? "hide-sidebar" : "always-show"
|
||||||
|
);
|
||||||
Glean.sidebarCustomize.sidebarDisplay.record({
|
Glean.sidebarCustomize.sidebarDisplay.record({
|
||||||
preference: value === "always-show" ? "always" : "hide",
|
preference: e.target.checked ? "hide" : "always",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#handleTabDirectionChange({ target: { value } }) {
|
#handleTabDirectionChange({ target: { checked } }) {
|
||||||
const verticalTabsEnabled = value === "true";
|
const verticalTabsEnabled = checked;
|
||||||
Services.prefs.setBoolPref(TAB_DIRECTION_SETTING_PREF, verticalTabsEnabled);
|
Services.prefs.setBoolPref(TAB_DIRECTION_SETTING_PREF, verticalTabsEnabled);
|
||||||
Glean.sidebarCustomize.tabsLayout.record({
|
Glean.sidebarCustomize.tabsLayout.record({
|
||||||
orientation: verticalTabsEnabled ? "vertical" : "horizontal",
|
orientation: verticalTabsEnabled ? "vertical" : "horizontal",
|
||||||
|
|||||||
@@ -13,7 +13,11 @@ async function showCustomizePanel(win) {
|
|||||||
const document = win.SidebarController.browser.contentDocument;
|
const document = win.SidebarController.browser.contentDocument;
|
||||||
return TestUtils.waitForCondition(async () => {
|
return TestUtils.waitForCondition(async () => {
|
||||||
const component = document.querySelector("sidebar-customize");
|
const component = document.querySelector("sidebar-customize");
|
||||||
if (!component?.positionInputs || !component?.visibilityInputs) {
|
if (
|
||||||
|
!component?.positionInput ||
|
||||||
|
(win.SidebarController.sidebarVerticalTabsEnabled &&
|
||||||
|
!component?.visibilityInput)
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return component;
|
return component;
|
||||||
@@ -170,19 +174,22 @@ add_task(async function test_customize_position_setting() {
|
|||||||
() => BrowserTestUtils.isVisible(sidebarBox),
|
() => BrowserTestUtils.isVisible(sidebarBox),
|
||||||
"Sidebar panel is visible"
|
"Sidebar panel is visible"
|
||||||
);
|
);
|
||||||
const [positionLeft, positionRight] = panel.positionInputs;
|
|
||||||
ok(positionLeft.checked, "The sidebar positioned on the left by default.");
|
ok(
|
||||||
|
!panel.positionInput.checked,
|
||||||
|
"The sidebar positioned on the left by default."
|
||||||
|
);
|
||||||
is(
|
is(
|
||||||
sidebarBox.style.order,
|
sidebarBox.style.order,
|
||||||
"3",
|
"3",
|
||||||
"Sidebar box should have an order of 3 when on the left"
|
"Sidebar box should have an order of 3 when on the left"
|
||||||
);
|
);
|
||||||
EventUtils.synthesizeMouseAtCenter(
|
EventUtils.synthesizeMouseAtCenter(
|
||||||
positionRight,
|
panel.positionInput,
|
||||||
{},
|
{},
|
||||||
win.SidebarController.browser.contentWindow
|
win.SidebarController.browser.contentWindow
|
||||||
);
|
);
|
||||||
ok(positionRight.checked, "Sidebar is positioned on the right");
|
ok(panel.positionInput.checked, "Sidebar is positioned on the right");
|
||||||
|
|
||||||
const newWin = await BrowserTestUtils.openNewBrowserWindow();
|
const newWin = await BrowserTestUtils.openNewBrowserWindow();
|
||||||
const newPanel = await showCustomizePanel(newWin);
|
const newPanel = await showCustomizePanel(newWin);
|
||||||
@@ -191,8 +198,8 @@ add_task(async function test_customize_position_setting() {
|
|||||||
() => BrowserTestUtils.isVisible(newSidebarBox),
|
() => BrowserTestUtils.isVisible(newSidebarBox),
|
||||||
"Sidebar panel is visible"
|
"Sidebar panel is visible"
|
||||||
);
|
);
|
||||||
const [, newPositionRight] = newPanel.positionInputs;
|
|
||||||
ok(newPositionRight.checked, "Position setting persists.");
|
ok(newPanel.positionInput.checked, "Position setting persists.");
|
||||||
is(
|
is(
|
||||||
newSidebarBox.style.order,
|
newSidebarBox.style.order,
|
||||||
"5",
|
"5",
|
||||||
@@ -217,22 +224,20 @@ add_task(async function test_customize_visibility_setting() {
|
|||||||
|
|
||||||
const win = await BrowserTestUtils.openNewBrowserWindow();
|
const win = await BrowserTestUtils.openNewBrowserWindow();
|
||||||
const panel = await showCustomizePanel(win);
|
const panel = await showCustomizePanel(win);
|
||||||
const [showInput, hideInput] = panel.visibilityInputs;
|
ok(!panel.visibilityInput.checked, "Always show is enabled by default.");
|
||||||
ok(showInput.checked, "Always show is enabled by default.");
|
|
||||||
EventUtils.synthesizeMouseAtCenter(
|
EventUtils.synthesizeMouseAtCenter(
|
||||||
hideInput,
|
panel.visibilityInput,
|
||||||
{},
|
{},
|
||||||
win.SidebarController.browser.contentWindow
|
win.SidebarController.browser.contentWindow
|
||||||
);
|
);
|
||||||
ok(hideInput.checked, "Hide sidebar is enabled.");
|
ok(panel.visibilityInput.checked, "Hide sidebar is enabled.");
|
||||||
await deferredPrefChange.promise;
|
await deferredPrefChange.promise;
|
||||||
const newPrefValue = Services.prefs.getStringPref(SIDEBAR_VISIBILITY_PREF);
|
const newPrefValue = Services.prefs.getStringPref(SIDEBAR_VISIBILITY_PREF);
|
||||||
is(newPrefValue, "hide-sidebar", "Visibility preference updated.");
|
is(newPrefValue, "hide-sidebar", "Visibility preference updated.");
|
||||||
|
|
||||||
const newWin = await BrowserTestUtils.openNewBrowserWindow();
|
const newWin = await BrowserTestUtils.openNewBrowserWindow();
|
||||||
const newPanel = await showCustomizePanel(newWin);
|
const newPanel = await showCustomizePanel(newWin);
|
||||||
const [, newHideInput] = newPanel.visibilityInputs;
|
ok(newPanel.visibilityInput.checked, "Visibility setting persists.");
|
||||||
ok(newHideInput.checked, "Visibility setting persists.");
|
|
||||||
|
|
||||||
await BrowserTestUtils.closeWindow(win);
|
await BrowserTestUtils.closeWindow(win);
|
||||||
await BrowserTestUtils.closeWindow(newWin);
|
await BrowserTestUtils.closeWindow(newWin);
|
||||||
@@ -251,22 +256,23 @@ add_task(async function test_vertical_tabs_setting() {
|
|||||||
|
|
||||||
const win = await BrowserTestUtils.openNewBrowserWindow();
|
const win = await BrowserTestUtils.openNewBrowserWindow();
|
||||||
const panel = await showCustomizePanel(win);
|
const panel = await showCustomizePanel(win);
|
||||||
const [verticalTabs, horizontalTabs] = panel.verticalTabsInputs;
|
ok(
|
||||||
ok(horizontalTabs.checked, "Horizontal tabs is enabled by default.");
|
!panel.verticalTabsInput.checked,
|
||||||
|
"Horizontal tabs is enabled by default."
|
||||||
|
);
|
||||||
EventUtils.synthesizeMouseAtCenter(
|
EventUtils.synthesizeMouseAtCenter(
|
||||||
verticalTabs,
|
panel.verticalTabsInput,
|
||||||
{},
|
{},
|
||||||
win.SidebarController.browser.contentWindow
|
win.SidebarController.browser.contentWindow
|
||||||
);
|
);
|
||||||
ok(verticalTabs.checked, "Vertical tabs is enabled.");
|
ok(panel.verticalTabsInput.checked, "Vertical tabs is enabled.");
|
||||||
await deferredPrefChange.promise;
|
await deferredPrefChange.promise;
|
||||||
const newPrefValue = Services.prefs.getBoolPref(TAB_DIRECTION_PREF);
|
const newPrefValue = Services.prefs.getBoolPref(TAB_DIRECTION_PREF);
|
||||||
is(newPrefValue, true, "Vertical tabs pref updated.");
|
is(newPrefValue, true, "Vertical tabs pref updated.");
|
||||||
|
|
||||||
const newWin = await BrowserTestUtils.openNewBrowserWindow();
|
const newWin = await BrowserTestUtils.openNewBrowserWindow();
|
||||||
const newPanel = await showCustomizePanel(newWin);
|
const newPanel = await showCustomizePanel(newWin);
|
||||||
const [newVerticalTabs] = newPanel.verticalTabsInputs;
|
ok(newPanel.verticalTabsInput.checked, "Vertical tabs setting persists.");
|
||||||
ok(newVerticalTabs.checked, "Vertical tabs setting persists.");
|
|
||||||
|
|
||||||
await BrowserTestUtils.closeWindow(win);
|
await BrowserTestUtils.closeWindow(win);
|
||||||
await BrowserTestUtils.closeWindow(newWin);
|
await BrowserTestUtils.closeWindow(newWin);
|
||||||
|
|||||||
@@ -366,21 +366,18 @@ add_task(async function test_customize_extensions_clicked() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function testCustomizeSetting(
|
async function testCustomizeSetting(
|
||||||
inputs,
|
input,
|
||||||
gleanEventOrMetric,
|
gleanEventOrMetric,
|
||||||
firstExpected,
|
firstExpected,
|
||||||
secondExpected,
|
secondExpected
|
||||||
reverseInputsOrder
|
|
||||||
) {
|
) {
|
||||||
await SidebarController.show("viewCustomizeSidebar");
|
await SidebarController.show("viewCustomizeSidebar");
|
||||||
const { contentDocument, contentWindow } = SidebarController.browser;
|
const { contentDocument } = SidebarController.browser;
|
||||||
const component = contentDocument.querySelector("sidebar-customize");
|
const component = contentDocument.querySelector("sidebar-customize");
|
||||||
const [firstInput, secondInput] = reverseInputsOrder
|
|
||||||
? [...component[inputs]].reverse()
|
|
||||||
: component[inputs];
|
|
||||||
|
|
||||||
info(`Toggle the setting for ${inputs}.`);
|
info(`Toggle the setting for ${input}.`);
|
||||||
EventUtils.synthesizeMouseAtCenter(firstInput, {}, contentWindow);
|
// Use click as the rect in synthesizeMouseAtCenter can change for the vertical tabs toggle
|
||||||
|
component[input].click();
|
||||||
await TestUtils.waitForTick();
|
await TestUtils.waitForTick();
|
||||||
let value = gleanEventOrMetric.testGetValue();
|
let value = gleanEventOrMetric.testGetValue();
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
@@ -390,7 +387,8 @@ async function testCustomizeSetting(
|
|||||||
Assert.equal(value, firstExpected);
|
Assert.equal(value, firstExpected);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventUtils.synthesizeMouseAtCenter(secondInput, {}, contentWindow);
|
info(`Toggle the setting for ${input}.`);
|
||||||
|
component[input].click();
|
||||||
await TestUtils.waitForTick();
|
await TestUtils.waitForTick();
|
||||||
value = gleanEventOrMetric.testGetValue();
|
value = gleanEventOrMetric.testGetValue();
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
@@ -408,32 +406,29 @@ add_task(async function test_customize_sidebar_display() {
|
|||||||
set: [[TAB_DIRECTION_PREF, true]],
|
set: [[TAB_DIRECTION_PREF, true]],
|
||||||
});
|
});
|
||||||
await testCustomizeSetting(
|
await testCustomizeSetting(
|
||||||
"visibilityInputs",
|
"visibilityInput",
|
||||||
Glean.sidebarCustomize.sidebarDisplay,
|
Glean.sidebarCustomize.sidebarDisplay,
|
||||||
{ preference: "hide" },
|
{ preference: "hide" },
|
||||||
{ preference: "always" },
|
{ preference: "always" }
|
||||||
true
|
|
||||||
);
|
);
|
||||||
await SpecialPowers.popPrefEnv();
|
await SpecialPowers.popPrefEnv();
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_customize_sidebar_position() {
|
add_task(async function test_customize_sidebar_position() {
|
||||||
await testCustomizeSetting(
|
await testCustomizeSetting(
|
||||||
"positionInputs",
|
"positionInput",
|
||||||
Glean.sidebarCustomize.sidebarPosition,
|
Glean.sidebarCustomize.sidebarPosition,
|
||||||
{ position: "right" },
|
{ position: "right" },
|
||||||
{ position: "left" },
|
{ position: "left" }
|
||||||
true
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_customize_tabs_layout() {
|
add_task(async function test_customize_tabs_layout() {
|
||||||
await testCustomizeSetting(
|
await testCustomizeSetting(
|
||||||
"verticalTabsInputs",
|
"verticalTabsInput",
|
||||||
Glean.sidebarCustomize.tabsLayout,
|
Glean.sidebarCustomize.tabsLayout,
|
||||||
{ orientation: "vertical" },
|
{ orientation: "vertical" },
|
||||||
{ orientation: "horizontal" },
|
{ orientation: "horizontal" }
|
||||||
false
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -484,32 +479,29 @@ add_task(async function test_sidebar_display_settings() {
|
|||||||
set: [[TAB_DIRECTION_PREF, true]],
|
set: [[TAB_DIRECTION_PREF, true]],
|
||||||
});
|
});
|
||||||
await testCustomizeSetting(
|
await testCustomizeSetting(
|
||||||
"visibilityInputs",
|
"visibilityInput",
|
||||||
Glean.sidebar.displaySettings,
|
Glean.sidebar.displaySettings,
|
||||||
"hide",
|
"hide",
|
||||||
"always",
|
"always"
|
||||||
true
|
|
||||||
);
|
);
|
||||||
await SpecialPowers.popPrefEnv();
|
await SpecialPowers.popPrefEnv();
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_sidebar_position_settings() {
|
add_task(async function test_sidebar_position_settings() {
|
||||||
await testCustomizeSetting(
|
await testCustomizeSetting(
|
||||||
"positionInputs",
|
"positionInput",
|
||||||
Glean.sidebar.positionSettings,
|
Glean.sidebar.positionSettings,
|
||||||
"right",
|
"right",
|
||||||
"left",
|
"left"
|
||||||
true
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function test_sidebar_tabs_layout() {
|
add_task(async function test_sidebar_tabs_layout() {
|
||||||
await testCustomizeSetting(
|
await testCustomizeSetting(
|
||||||
"verticalTabsInputs",
|
"verticalTabsInput",
|
||||||
Glean.sidebar.tabsLayout,
|
Glean.sidebar.tabsLayout,
|
||||||
"vertical",
|
"vertical",
|
||||||
"horizontal",
|
"horizontal"
|
||||||
false
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -522,13 +514,13 @@ add_task(async function test_sidebar_position_rtl_ui() {
|
|||||||
// When RTL is enabled, sidebar is shown on the right by default.
|
// When RTL is enabled, sidebar is shown on the right by default.
|
||||||
// Toggle position setting to move it to the left, then back to the right.
|
// Toggle position setting to move it to the left, then back to the right.
|
||||||
await testCustomizeSetting(
|
await testCustomizeSetting(
|
||||||
"positionInputs",
|
"positionInput",
|
||||||
Glean.sidebarCustomize.sidebarPosition,
|
Glean.sidebarCustomize.sidebarPosition,
|
||||||
{ position: "left" },
|
{ position: "left" },
|
||||||
{ position: "right" }
|
{ position: "right" }
|
||||||
);
|
);
|
||||||
await testCustomizeSetting(
|
await testCustomizeSetting(
|
||||||
"positionInputs",
|
"positionInput",
|
||||||
Glean.sidebar.positionSettings,
|
Glean.sidebar.positionSettings,
|
||||||
"left",
|
"left",
|
||||||
"right"
|
"right"
|
||||||
|
|||||||
@@ -48,24 +48,8 @@ sidebar-customize-extensions-header = Sidebar extensions
|
|||||||
sidebar-customize-firefox-tools-header =
|
sidebar-customize-firefox-tools-header =
|
||||||
.label = { -brand-product-name } tools
|
.label = { -brand-product-name } tools
|
||||||
sidebar-customize-firefox-settings = Manage { -brand-short-name } settings
|
sidebar-customize-firefox-settings = Manage { -brand-short-name } settings
|
||||||
sidebar-position-left =
|
|
||||||
.label = Show on the left
|
|
||||||
sidebar-position-right =
|
|
||||||
.label = Show on the right
|
|
||||||
sidebar-vertical-tabs =
|
sidebar-vertical-tabs =
|
||||||
.label = Vertical tabs
|
.label = Vertical tabs
|
||||||
sidebar-horizontal-tabs =
|
|
||||||
.label = Horizontal tabs
|
|
||||||
sidebar-customize-tabs-header =
|
|
||||||
.label = Tab settings
|
|
||||||
sidebar-customize-button-header =
|
|
||||||
.label = Sidebar button
|
|
||||||
sidebar-customize-position-header =
|
|
||||||
.label = Sidebar position
|
|
||||||
sidebar-visibility-setting-always-show =
|
|
||||||
.label = Expand and collapse sidebar
|
|
||||||
sidebar-visibility-setting-hide-sidebar =
|
|
||||||
.label = Show and hide sidebar
|
|
||||||
sidebar-settings =
|
sidebar-settings =
|
||||||
.label = Sidebar settings
|
.label = Sidebar settings
|
||||||
sidebar-hide-tabs-and-sidebar =
|
sidebar-hide-tabs-and-sidebar =
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
|
||||||
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="context-fill" fill-opacity="context-fill-opacity">
|
|
||||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 3.5C1.72421 3.5 1.5 3.72421 1.5 4V12C1.5 12.2758 1.72421 12.5 2 12.5H14C14.2758 12.5 14.5 12.2758 14.5 12V4C14.5 3.72421 14.2758 3.5 14 3.5H2ZM0 4C0 2.89579 0.895786 2 2 2H14C15.1042 2 16 2.89579 16 4V12C16 13.1042 15.1042 14 14 14H2C0.895786 14 0 13.1042 0 12V4Z"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 678 B |
@@ -1,6 +0,0 @@
|
|||||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
|
||||||
<svg width="16" height="16" fill="context-fill" fill-opacity="context-fill-opacity" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 2a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H2zm-.5 2a.5.5 0 0 1 .5-.5h3.5v2A.5.5 0 0 0 6 6h8.5v6a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5V4z"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 550 B |
@@ -201,8 +201,6 @@
|
|||||||
skin/classic/browser/sidebar-collapsed-right.svg (../shared/icons/sidebar-collapsed-right.svg)
|
skin/classic/browser/sidebar-collapsed-right.svg (../shared/icons/sidebar-collapsed-right.svg)
|
||||||
skin/classic/browser/sidebar-expanded.svg (../shared/icons/sidebar-expanded.svg)
|
skin/classic/browser/sidebar-expanded.svg (../shared/icons/sidebar-expanded.svg)
|
||||||
skin/classic/browser/sidebar-expanded-right.svg (../shared/icons/sidebar-expanded-right.svg)
|
skin/classic/browser/sidebar-expanded-right.svg (../shared/icons/sidebar-expanded-right.svg)
|
||||||
skin/classic/browser/sidebar-hidden.svg (../shared/icons/sidebar-hidden.svg)
|
|
||||||
skin/classic/browser/sidebar-horizontal-tabs.svg (../shared/icons/sidebar-horizontal-tabs.svg)
|
|
||||||
skin/classic/browser/sidebars.svg (../shared/icons/sidebars.svg)
|
skin/classic/browser/sidebars.svg (../shared/icons/sidebars.svg)
|
||||||
skin/classic/browser/sidebars-right.svg (../shared/icons/sidebars-right.svg)
|
skin/classic/browser/sidebars-right.svg (../shared/icons/sidebars-right.svg)
|
||||||
#ifndef MOZ_WIDGET_GTK
|
#ifndef MOZ_WIDGET_GTK
|
||||||
|
|||||||
Reference in New Issue
Block a user