browser/components/customizableui/test/browser_948985_non_removable_defaultArea.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/customizableui/test/browser_948985_non_removable_defaultArea.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,32 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +const kWidgetId = "test-destroy-non-removable-defaultArea";
     1.9 +
    1.10 +add_task(function() {
    1.11 +  let spec = {id: kWidgetId, label: "Test non-removable defaultArea re-adding.",
    1.12 +              removable: false, defaultArea: CustomizableUI.AREA_NAVBAR};
    1.13 +  CustomizableUI.createWidget(spec);
    1.14 +  let placement = CustomizableUI.getPlacementOfWidget(kWidgetId);
    1.15 +  ok(placement, "Should have placed the widget.");
    1.16 +  is(placement && placement.area, CustomizableUI.AREA_NAVBAR, "Widget should be in navbar");
    1.17 +  CustomizableUI.destroyWidget(kWidgetId);
    1.18 +  CustomizableUI.removeWidgetFromArea(kWidgetId);
    1.19 +
    1.20 +  CustomizableUI.createWidget(spec);
    1.21 +  ok(placement, "Should have placed the widget.");
    1.22 +  is(placement && placement.area, CustomizableUI.AREA_NAVBAR, "Widget should be in navbar");
    1.23 +  CustomizableUI.destroyWidget(kWidgetId);
    1.24 +  CustomizableUI.removeWidgetFromArea(kWidgetId);
    1.25 +
    1.26 +  const kPrefCustomizationAutoAdd = "browser.uiCustomization.autoAdd";
    1.27 +  Services.prefs.setBoolPref(kPrefCustomizationAutoAdd, false);
    1.28 +  CustomizableUI.createWidget(spec);
    1.29 +  ok(placement, "Should have placed the widget.");
    1.30 +  is(placement && placement.area, CustomizableUI.AREA_NAVBAR, "Widget should be in navbar");
    1.31 +  CustomizableUI.destroyWidget(kWidgetId);
    1.32 +  CustomizableUI.removeWidgetFromArea(kWidgetId);
    1.33 +  Services.prefs.clearUserPref(kPrefCustomizationAutoAdd);
    1.34 +});
    1.35 +

mercurial