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 TEST_PAGE = "http://mochi.test:8888/browser/browser/components/customizableui/test/support/feeds_test_page.html"; |
michael@0 | 8 | const TEST_FEED = "http://mochi.test:8888/browser/browser/components/customizableui/test/support/test-feed.xml" |
michael@0 | 9 | |
michael@0 | 10 | let newTab = null; |
michael@0 | 11 | let initialLocation = gBrowser.currentURI.spec; |
michael@0 | 12 | |
michael@0 | 13 | add_task(function() { |
michael@0 | 14 | info("Check Subscribe button functionality"); |
michael@0 | 15 | |
michael@0 | 16 | // add the Subscribe button to the panel |
michael@0 | 17 | CustomizableUI.addWidgetToArea("feed-button", |
michael@0 | 18 | CustomizableUI.AREA_PANEL); |
michael@0 | 19 | |
michael@0 | 20 | // check the button's functionality |
michael@0 | 21 | yield PanelUI.show(); |
michael@0 | 22 | |
michael@0 | 23 | let feedButton = document.getElementById("feed-button"); |
michael@0 | 24 | ok(feedButton, "The Subscribe button was added to the Panel Menu"); |
michael@0 | 25 | is(feedButton.getAttribute("disabled"), "true", "The Subscribe button is initially disabled"); |
michael@0 | 26 | |
michael@0 | 27 | let panelHidePromise = promisePanelHidden(window); |
michael@0 | 28 | PanelUI.hide(); |
michael@0 | 29 | yield panelHidePromise; |
michael@0 | 30 | |
michael@0 | 31 | newTab = gBrowser.selectedTab; |
michael@0 | 32 | yield promiseTabLoadEvent(newTab, TEST_PAGE); |
michael@0 | 33 | |
michael@0 | 34 | yield PanelUI.show(); |
michael@0 | 35 | |
michael@0 | 36 | yield waitForCondition(function() !feedButton.hasAttribute("disabled")); |
michael@0 | 37 | ok(!feedButton.hasAttribute("disabled"), "The Subscribe button gets enabled"); |
michael@0 | 38 | |
michael@0 | 39 | feedButton.click(); |
michael@0 | 40 | yield promiseTabLoadEvent(newTab, TEST_FEED); |
michael@0 | 41 | |
michael@0 | 42 | is(gBrowser.currentURI.spec, TEST_FEED, "Subscribe page opened"); |
michael@0 | 43 | ok(!isPanelUIOpen(), "Panel is closed"); |
michael@0 | 44 | |
michael@0 | 45 | if(isPanelUIOpen()) { |
michael@0 | 46 | panelHidePromise = promisePanelHidden(window); |
michael@0 | 47 | PanelUI.hide(); |
michael@0 | 48 | yield panelHidePromise; |
michael@0 | 49 | } |
michael@0 | 50 | }); |
michael@0 | 51 | |
michael@0 | 52 | add_task(function asyncCleanup() { |
michael@0 | 53 | // reset the panel UI to the default state |
michael@0 | 54 | yield resetCustomization(); |
michael@0 | 55 | ok(CustomizableUI.inDefaultState, "The UI is in default state again."); |
michael@0 | 56 | |
michael@0 | 57 | // restore the initial location |
michael@0 | 58 | gBrowser.addTab(initialLocation); |
michael@0 | 59 | gBrowser.removeTab(newTab); |
michael@0 | 60 | }); |