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-XUL-wrapper-destroyWidget"; michael@0: michael@0: michael@0: add_task(function() { michael@0: let btn = createDummyXULButton(BUTTONID, "XUL btn"); michael@0: gNavToolbox.palette.appendChild(btn); michael@0: let firstWrapper = CustomizableUI.getWidget(BUTTONID).forWindow(window); michael@0: ok(firstWrapper, "Should get a wrapper"); michael@0: ok(firstWrapper.node, "Node should be there on first wrapper."); michael@0: michael@0: btn.remove(); michael@0: CustomizableUI.destroyWidget(BUTTONID); michael@0: let secondWrapper = CustomizableUI.getWidget(BUTTONID).forWindow(window); michael@0: isnot(firstWrapper, secondWrapper, "Wrappers should be different after destroyWidget call."); michael@0: ok(!firstWrapper.node, "No node should be there on old wrapper."); michael@0: ok(!secondWrapper.node, "No node should be there on new wrapper."); michael@0: michael@0: btn = createDummyXULButton(BUTTONID, "XUL btn"); michael@0: gNavToolbox.palette.appendChild(btn); michael@0: let thirdWrapper = CustomizableUI.getWidget(BUTTONID).forWindow(window); michael@0: ok(thirdWrapper, "Should get a wrapper"); michael@0: is(secondWrapper, thirdWrapper, "Should get the second wrapper again."); michael@0: ok(firstWrapper.node, "Node should be there on old wrapper."); michael@0: ok(secondWrapper.node, "Node should be there on second wrapper."); michael@0: ok(thirdWrapper.node, "Node should be there on third wrapper."); michael@0: }); michael@0: