Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | "use strict"; |
michael@0 | 6 | |
michael@0 | 7 | const BUTTONID = "test-API-created-widget-toolbar-gone"; |
michael@0 | 8 | const TOOLBARID = "test-API-created-extra-toolbar"; |
michael@0 | 9 | |
michael@0 | 10 | add_task(function*() { |
michael@0 | 11 | let toolbar = createToolbarWithPlacements(TOOLBARID, []); |
michael@0 | 12 | CustomizableUI.addWidgetToArea(BUTTONID, TOOLBARID); |
michael@0 | 13 | is(CustomizableUI.getPlacementOfWidget(BUTTONID).area, TOOLBARID, "Should be on toolbar"); |
michael@0 | 14 | is(toolbar.children.length, 0, "Toolbar has no kid"); |
michael@0 | 15 | |
michael@0 | 16 | CustomizableUI.unregisterArea(TOOLBARID); |
michael@0 | 17 | CustomizableUI.createWidget({id: BUTTONID, label: "Test widget toolbar gone"}); |
michael@0 | 18 | |
michael@0 | 19 | let currentWidget = CustomizableUI.getWidget(BUTTONID); |
michael@0 | 20 | |
michael@0 | 21 | yield startCustomizing(); |
michael@0 | 22 | let buttonNode = document.getElementById(BUTTONID); |
michael@0 | 23 | ok(buttonNode, "Should find button in window"); |
michael@0 | 24 | if (buttonNode) { |
michael@0 | 25 | is(buttonNode.parentNode.localName, "toolbarpaletteitem", "Node should be wrapped"); |
michael@0 | 26 | is(buttonNode.parentNode.getAttribute("place"), "palette", "Node should be in palette"); |
michael@0 | 27 | is(buttonNode, gNavToolbox.palette.querySelector("#" + BUTTONID), "Node should really be in palette."); |
michael@0 | 28 | } |
michael@0 | 29 | is(currentWidget.forWindow(window).node, buttonNode, "Should have the same node for customize mode"); |
michael@0 | 30 | yield endCustomizing(); |
michael@0 | 31 | |
michael@0 | 32 | CustomizableUI.destroyWidget(BUTTONID); |
michael@0 | 33 | CustomizableUI.unregisterArea(TOOLBARID, true); |
michael@0 | 34 | toolbar.remove(); |
michael@0 | 35 | gAddedToolbars.clear(); |
michael@0 | 36 | }); |