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