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.

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

mercurial