1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/customizableui/test/browser_967000_button_feeds.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,60 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +"use strict"; 1.9 + 1.10 +const TEST_PAGE = "http://mochi.test:8888/browser/browser/components/customizableui/test/support/feeds_test_page.html"; 1.11 +const TEST_FEED = "http://mochi.test:8888/browser/browser/components/customizableui/test/support/test-feed.xml" 1.12 + 1.13 +let newTab = null; 1.14 +let initialLocation = gBrowser.currentURI.spec; 1.15 + 1.16 +add_task(function() { 1.17 + info("Check Subscribe button functionality"); 1.18 + 1.19 + // add the Subscribe button to the panel 1.20 + CustomizableUI.addWidgetToArea("feed-button", 1.21 + CustomizableUI.AREA_PANEL); 1.22 + 1.23 + // check the button's functionality 1.24 + yield PanelUI.show(); 1.25 + 1.26 + let feedButton = document.getElementById("feed-button"); 1.27 + ok(feedButton, "The Subscribe button was added to the Panel Menu"); 1.28 + is(feedButton.getAttribute("disabled"), "true", "The Subscribe button is initially disabled"); 1.29 + 1.30 + let panelHidePromise = promisePanelHidden(window); 1.31 + PanelUI.hide(); 1.32 + yield panelHidePromise; 1.33 + 1.34 + newTab = gBrowser.selectedTab; 1.35 + yield promiseTabLoadEvent(newTab, TEST_PAGE); 1.36 + 1.37 + yield PanelUI.show(); 1.38 + 1.39 + yield waitForCondition(function() !feedButton.hasAttribute("disabled")); 1.40 + ok(!feedButton.hasAttribute("disabled"), "The Subscribe button gets enabled"); 1.41 + 1.42 + feedButton.click(); 1.43 + yield promiseTabLoadEvent(newTab, TEST_FEED); 1.44 + 1.45 + is(gBrowser.currentURI.spec, TEST_FEED, "Subscribe page opened"); 1.46 + ok(!isPanelUIOpen(), "Panel is closed"); 1.47 + 1.48 + if(isPanelUIOpen()) { 1.49 + panelHidePromise = promisePanelHidden(window); 1.50 + PanelUI.hide(); 1.51 + yield panelHidePromise; 1.52 + } 1.53 +}); 1.54 + 1.55 +add_task(function asyncCleanup() { 1.56 + // reset the panel UI to the default state 1.57 + yield resetCustomization(); 1.58 + ok(CustomizableUI.inDefaultState, "The UI is in default state again."); 1.59 + 1.60 + // restore the initial location 1.61 + gBrowser.addTab(initialLocation); 1.62 + gBrowser.removeTab(newTab); 1.63 +});