michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: "use strict"; michael@0: michael@0: const BUTTONID = "test-API-created-widget-toolbar-gone"; michael@0: const TOOLBARID = "test-API-created-extra-toolbar"; michael@0: michael@0: add_task(function*() { michael@0: let toolbar = createToolbarWithPlacements(TOOLBARID, []); michael@0: CustomizableUI.addWidgetToArea(BUTTONID, TOOLBARID); michael@0: is(CustomizableUI.getPlacementOfWidget(BUTTONID).area, TOOLBARID, "Should be on toolbar"); michael@0: is(toolbar.children.length, 0, "Toolbar has no kid"); michael@0: michael@0: CustomizableUI.unregisterArea(TOOLBARID); michael@0: CustomizableUI.createWidget({id: BUTTONID, label: "Test widget toolbar gone"}); michael@0: michael@0: let currentWidget = CustomizableUI.getWidget(BUTTONID); michael@0: michael@0: yield startCustomizing(); michael@0: let buttonNode = document.getElementById(BUTTONID); michael@0: ok(buttonNode, "Should find button in window"); michael@0: if (buttonNode) { michael@0: is(buttonNode.parentNode.localName, "toolbarpaletteitem", "Node should be wrapped"); michael@0: is(buttonNode.parentNode.getAttribute("place"), "palette", "Node should be in palette"); michael@0: is(buttonNode, gNavToolbox.palette.querySelector("#" + BUTTONID), "Node should really be in palette."); michael@0: } michael@0: is(currentWidget.forWindow(window).node, buttonNode, "Should have the same node for customize mode"); michael@0: yield endCustomizing(); michael@0: michael@0: CustomizableUI.destroyWidget(BUTTONID); michael@0: CustomizableUI.unregisterArea(TOOLBARID, true); michael@0: toolbar.remove(); michael@0: gAddedToolbars.clear(); michael@0: });