Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
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 | add_task(function() { |
michael@0 | 8 | info("Check Tab Groups button functionality"); |
michael@0 | 9 | let deferred = Promise.defer(); |
michael@0 | 10 | let timeout = null; |
michael@0 | 11 | |
michael@0 | 12 | // add the Tab View button to the panel |
michael@0 | 13 | CustomizableUI.addWidgetToArea("tabview-button", CustomizableUI.AREA_PANEL); |
michael@0 | 14 | |
michael@0 | 15 | window.addEventListener("tabviewhidden", function tabViewHidden() { |
michael@0 | 16 | clearTimeout(timeout); |
michael@0 | 17 | window.removeEventListener("tabviewhidden", tabViewHidden, false); |
michael@0 | 18 | ok(true, "Tab View is closed"); |
michael@0 | 19 | deferred.resolve(); |
michael@0 | 20 | }, false); |
michael@0 | 21 | |
michael@0 | 22 | window.addEventListener("tabviewshown", function tabViewShown() { |
michael@0 | 23 | window.removeEventListener("tabviewshown", tabViewShown, false); |
michael@0 | 24 | ok(true, "Tab Groups are loaded"); |
michael@0 | 25 | // close tabs view |
michael@0 | 26 | window.TabView.hide(); |
michael@0 | 27 | timeout = setTimeout(() => { |
michael@0 | 28 | window.removeEventListener("tabviewhidden", tabViewHidden, false); |
michael@0 | 29 | deferred.reject("Tabs view wasn't hidden within 20000ms"); |
michael@0 | 30 | }, 20000); |
michael@0 | 31 | }, false); |
michael@0 | 32 | |
michael@0 | 33 | // check the button's functionality |
michael@0 | 34 | yield PanelUI.show(); |
michael@0 | 35 | |
michael@0 | 36 | let tabViewButton = document.getElementById("tabview-button"); |
michael@0 | 37 | ok(tabViewButton, "Tab Groups button was added to the Panel Menu"); |
michael@0 | 38 | tabViewButton.click(); |
michael@0 | 39 | |
michael@0 | 40 | yield deferred.promise; |
michael@0 | 41 | |
michael@0 | 42 | ok(!isPanelUIOpen(), "The panel is closed"); |
michael@0 | 43 | |
michael@0 | 44 | if(isPanelUIOpen()) { |
michael@0 | 45 | let panelHidePromise = promisePanelHidden(window); |
michael@0 | 46 | PanelUI.hide(); |
michael@0 | 47 | yield panelHidePromise; |
michael@0 | 48 | } |
michael@0 | 49 | }); |
michael@0 | 50 | |
michael@0 | 51 | add_task(function asyncCleanup() { |
michael@0 | 52 | // reset the panel to the default state |
michael@0 | 53 | yield resetCustomization(); |
michael@0 | 54 | ok(CustomizableUI.inDefaultState, "UI is in default state again."); |
michael@0 | 55 | }); |