browser/components/customizableui/test/browser_938995_indefaultstate_nonremovable.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/customizableui/test/browser_938995_indefaultstate_nonremovable.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,26 @@
     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 +"use strict";
     1.9 +
    1.10 +const kWidgetId = "test-non-removable-widget";
    1.11 +
    1.12 +// Adding non-removable items to a toolbar or the panel shouldn't change inDefaultState
    1.13 +add_task(function() {
    1.14 +  let navbar = document.getElementById("nav-bar");
    1.15 +  ok(CustomizableUI.inDefaultState, "Should start in default state");
    1.16 +
    1.17 +  let button = createDummyXULButton(kWidgetId, "Test non-removable inDefaultState handling");
    1.18 +  CustomizableUI.addWidgetToArea(kWidgetId, CustomizableUI.AREA_NAVBAR);
    1.19 +  button.setAttribute("removable", "false");
    1.20 +  ok(CustomizableUI.inDefaultState, "Should still be in default state after navbar addition");
    1.21 +  button.remove();
    1.22 +
    1.23 +  button = createDummyXULButton(kWidgetId, "Test non-removable inDefaultState handling");
    1.24 +  CustomizableUI.addWidgetToArea(kWidgetId, CustomizableUI.AREA_PANEL);
    1.25 +  button.setAttribute("removable", "false");
    1.26 +  ok(CustomizableUI.inDefaultState, "Should still be in default state after panel addition");
    1.27 +  button.remove();
    1.28 +  ok(CustomizableUI.inDefaultState, "Should be in default state after destroying both widgets");
    1.29 +});

mercurial