browser/components/customizableui/test/browser_948985_non_removable_defaultArea.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 const kWidgetId = "test-destroy-non-removable-defaultArea";
michael@0 6
michael@0 7 add_task(function() {
michael@0 8 let spec = {id: kWidgetId, label: "Test non-removable defaultArea re-adding.",
michael@0 9 removable: false, defaultArea: CustomizableUI.AREA_NAVBAR};
michael@0 10 CustomizableUI.createWidget(spec);
michael@0 11 let placement = CustomizableUI.getPlacementOfWidget(kWidgetId);
michael@0 12 ok(placement, "Should have placed the widget.");
michael@0 13 is(placement && placement.area, CustomizableUI.AREA_NAVBAR, "Widget should be in navbar");
michael@0 14 CustomizableUI.destroyWidget(kWidgetId);
michael@0 15 CustomizableUI.removeWidgetFromArea(kWidgetId);
michael@0 16
michael@0 17 CustomizableUI.createWidget(spec);
michael@0 18 ok(placement, "Should have placed the widget.");
michael@0 19 is(placement && placement.area, CustomizableUI.AREA_NAVBAR, "Widget should be in navbar");
michael@0 20 CustomizableUI.destroyWidget(kWidgetId);
michael@0 21 CustomizableUI.removeWidgetFromArea(kWidgetId);
michael@0 22
michael@0 23 const kPrefCustomizationAutoAdd = "browser.uiCustomization.autoAdd";
michael@0 24 Services.prefs.setBoolPref(kPrefCustomizationAutoAdd, false);
michael@0 25 CustomizableUI.createWidget(spec);
michael@0 26 ok(placement, "Should have placed the widget.");
michael@0 27 is(placement && placement.area, CustomizableUI.AREA_NAVBAR, "Widget should be in navbar");
michael@0 28 CustomizableUI.destroyWidget(kWidgetId);
michael@0 29 CustomizableUI.removeWidgetFromArea(kWidgetId);
michael@0 30 Services.prefs.clearUserPref(kPrefCustomizationAutoAdd);
michael@0 31 });
michael@0 32

mercurial