browser/components/customizableui/test/browser_987177_destroyWidget_xul.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.

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-XUL-wrapper-destroyWidget";
michael@0 8
michael@0 9
michael@0 10 add_task(function() {
michael@0 11 let btn = createDummyXULButton(BUTTONID, "XUL btn");
michael@0 12 gNavToolbox.palette.appendChild(btn);
michael@0 13 let firstWrapper = CustomizableUI.getWidget(BUTTONID).forWindow(window);
michael@0 14 ok(firstWrapper, "Should get a wrapper");
michael@0 15 ok(firstWrapper.node, "Node should be there on first wrapper.");
michael@0 16
michael@0 17 btn.remove();
michael@0 18 CustomizableUI.destroyWidget(BUTTONID);
michael@0 19 let secondWrapper = CustomizableUI.getWidget(BUTTONID).forWindow(window);
michael@0 20 isnot(firstWrapper, secondWrapper, "Wrappers should be different after destroyWidget call.");
michael@0 21 ok(!firstWrapper.node, "No node should be there on old wrapper.");
michael@0 22 ok(!secondWrapper.node, "No node should be there on new wrapper.");
michael@0 23
michael@0 24 btn = createDummyXULButton(BUTTONID, "XUL btn");
michael@0 25 gNavToolbox.palette.appendChild(btn);
michael@0 26 let thirdWrapper = CustomizableUI.getWidget(BUTTONID).forWindow(window);
michael@0 27 ok(thirdWrapper, "Should get a wrapper");
michael@0 28 is(secondWrapper, thirdWrapper, "Should get the second wrapper again.");
michael@0 29 ok(firstWrapper.node, "Node should be there on old wrapper.");
michael@0 30 ok(secondWrapper.node, "Node should be there on second wrapper.");
michael@0 31 ok(thirdWrapper.node, "Node should be there on third wrapper.");
michael@0 32 });
michael@0 33

mercurial