browser/components/customizableui/test/browser_973932_addonbar_currentset.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/customizableui/test/browser_973932_addonbar_currentset.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,30 @@
     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 +let addonbarID = CustomizableUI.AREA_ADDONBAR;
    1.11 +let addonbar = document.getElementById(addonbarID);
    1.12 +
    1.13 +// Check that currentset is correctly updated after a reset:
    1.14 +add_task(function() {
    1.15 +  let placements = CustomizableUI.getWidgetIdsInArea(addonbarID);
    1.16 +  is(placements.join(','), addonbar.getAttribute("currentset"), "Addon-bar currentset should match default placements");
    1.17 +  ok(CustomizableUI.inDefaultState, "Should be in default state");
    1.18 +  info("Adding a spring to add-on bar shim");
    1.19 +  CustomizableUI.addWidgetToArea("spring", addonbarID, 1);
    1.20 +  ok(addonbar.getElementsByTagName("toolbarspring").length, "There should be a spring in the toolbar");
    1.21 +  ok(!CustomizableUI.inDefaultState, "Should no longer be in default state");
    1.22 +  placements = CustomizableUI.getWidgetIdsInArea(addonbarID);
    1.23 +  is(placements.join(','), addonbar.getAttribute("currentset"), "Addon-bar currentset should match placements after spring addition");
    1.24 +
    1.25 +  yield startCustomizing();
    1.26 +  yield gCustomizeMode.reset();
    1.27 +  ok(CustomizableUI.inDefaultState, "Should be in default state after reset");
    1.28 +  placements = CustomizableUI.getWidgetIdsInArea(addonbarID);
    1.29 +  is(placements.join(','), addonbar.getAttribute("currentset"), "Addon-bar currentset should match default placements after reset");
    1.30 +  ok(!addonbar.getElementsByTagName("toolbarspring").length, "There should be no spring in the toolbar");
    1.31 +  yield endCustomizing();
    1.32 +});
    1.33 +

mercurial