browser/components/customizableui/test/browser_993322_widget_notoolbar.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

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 "use strict";
     7 const BUTTONID = "test-API-created-widget-toolbar-gone";
     8 const TOOLBARID = "test-API-created-extra-toolbar";
    10 add_task(function*() {
    11   let toolbar = createToolbarWithPlacements(TOOLBARID, []);
    12   CustomizableUI.addWidgetToArea(BUTTONID, TOOLBARID);
    13   is(CustomizableUI.getPlacementOfWidget(BUTTONID).area, TOOLBARID, "Should be on toolbar");
    14   is(toolbar.children.length, 0, "Toolbar has no kid");
    16   CustomizableUI.unregisterArea(TOOLBARID);
    17   CustomizableUI.createWidget({id: BUTTONID, label: "Test widget toolbar gone"});
    19   let currentWidget = CustomizableUI.getWidget(BUTTONID);
    21   yield startCustomizing();
    22   let buttonNode = document.getElementById(BUTTONID);
    23   ok(buttonNode, "Should find button in window");
    24   if (buttonNode) {
    25     is(buttonNode.parentNode.localName, "toolbarpaletteitem", "Node should be wrapped");
    26     is(buttonNode.parentNode.getAttribute("place"), "palette", "Node should be in palette");
    27     is(buttonNode, gNavToolbox.palette.querySelector("#" + BUTTONID), "Node should really be in palette.");
    28   }
    29   is(currentWidget.forWindow(window).node, buttonNode, "Should have the same node for customize mode");
    30   yield endCustomizing();
    32   CustomizableUI.destroyWidget(BUTTONID);
    33   CustomizableUI.unregisterArea(TOOLBARID, true);
    34   toolbar.remove();
    35   gAddedToolbars.clear();
    36 });

mercurial