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