browser/components/customizableui/test/browser_956602_remove_special_widget.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/customizableui/test/browser_956602_remove_special_widget.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,31 @@
     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 +
    1.11 +// Adding a separator and then dragging it out of the navbar shouldn't throw
    1.12 +add_task(function() {
    1.13 +  try {
    1.14 +    let navbar = document.getElementById("nav-bar");
    1.15 +    let separatorSelector = "toolbarseparator[id^=customizableui-special-separator]";
    1.16 +    ok(!navbar.querySelector(separatorSelector), "Shouldn't be a separator in the navbar");
    1.17 +    CustomizableUI.addWidgetToArea('separator', 'nav-bar');
    1.18 +    yield startCustomizing();
    1.19 +    let separator = navbar.querySelector(separatorSelector);
    1.20 +    ok(separator, "There should be a separator in the navbar now.");
    1.21 +    let palette = document.getElementById("customization-palette");
    1.22 +    simulateItemDrag(separator, palette);
    1.23 +    ok(!palette.querySelector(separatorSelector), "No separator in the palette.");
    1.24 +  } catch (ex) {
    1.25 +    Cu.reportError(ex);
    1.26 +    ok(false, "Shouldn't throw an exception moving an item to the navbar.");
    1.27 +  } finally {
    1.28 +    yield endCustomizing();
    1.29 +  }
    1.30 +});
    1.31 +
    1.32 +add_task(function asyncCleanup() {
    1.33 +  resetCustomization();
    1.34 +});

mercurial