зеркало из https://github.com/mozilla/gecko-dev.git
Bug 934113 - correctly mark items as removable when in customize mode, r=jaws
This commit is contained in:
Родитель
bc9bd43447
Коммит
b8101e8ad2
|
@ -859,13 +859,14 @@ let CustomizableUIInternal = {
|
|||
parent = parent.parentNode;
|
||||
}
|
||||
|
||||
if ((parent && parent.customizationTarget == node.parentNode &&
|
||||
gBuildWindows.get(aWindow).has(parent.toolbox)) ||
|
||||
(parent && parent.localName == "toolbarpaletteitem")) {
|
||||
if (parent && ((parent.customizationTarget == node.parentNode &&
|
||||
gBuildWindows.get(aWindow).has(parent.toolbox)) ||
|
||||
parent.localName == "toolbarpaletteitem")) {
|
||||
// Normalize the removable attribute. For backwards compat, if
|
||||
// the widget is not defined in a toolbox palette then absence
|
||||
// of the "removable" attribute means it is not removable.
|
||||
if (!node.hasAttribute("removable")) {
|
||||
parent = parent.localName == "toolbarpaletteitem" ? parent.parentNode : parent;
|
||||
// If we first see this in customization mode, it may be in the
|
||||
// customization palette instead of the toolbox palette.
|
||||
node.setAttribute("removable", !parent.customizationTarget);
|
||||
|
|
|
@ -30,3 +30,7 @@ run-if = os == "mac"
|
|||
[browser_923857_customize_mode_event_wrapping_during_reset.js]
|
||||
[browser_927717_customize_drag_empty_toolbar.js]
|
||||
|
||||
[browser_934113_menubar_removable.js]
|
||||
# Because this test is about the menubar, it can't be run on mac
|
||||
skip-if = os == "mac"
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/* 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/. */
|
||||
|
||||
let gTests = [
|
||||
{
|
||||
desc: "Attempting to drag the menubar to the navbar shouldn't work.",
|
||||
setup: startCustomizing,
|
||||
run: function() {
|
||||
let menuItems = document.getElementById("menubar-items");
|
||||
let navbar = document.getElementById("nav-bar");
|
||||
let menubar = document.getElementById("toolbar-menubar");
|
||||
simulateItemDrag(menuItems, navbar.customizationTarget);
|
||||
is(getAreaWidgetIds("nav-bar").indexOf("menubar-items"), -1, "Menu bar shouldn't be in the navbar.");
|
||||
ok(!navbar.querySelector("#menubar-items"), "Shouldn't find menubar items in the navbar.");
|
||||
ok(menubar.querySelector("#menubar-items"), "Should find menubar items in the menubar.");
|
||||
isnot(getAreaWidgetIds("toolbar-menubar").indexOf("menubar-items"), -1, "Menubar items shouldn't be missing from the navbar.");
|
||||
},
|
||||
teardown: endCustomizing
|
||||
},
|
||||
];
|
||||
function asyncCleanup() {
|
||||
yield endCustomizing();
|
||||
Services.prefs.clearUserPref("browser.uiCustomization.skipSourceNodeCheck");
|
||||
yield resetCustomization();
|
||||
}
|
||||
|
||||
function test() {
|
||||
Services.prefs.setBoolPref("browser.uiCustomization.skipSourceNodeCheck", true);
|
||||
waitForExplicitFinish();
|
||||
runTests(gTests, asyncCleanup);
|
||||
}
|
Загрузка…
Ссылка в новой задаче