1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/preferences/in-content/tests/browser_bug731866.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,109 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + * http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +Components.utils.import("resource://gre/modules/PlacesUtils.jsm"); 1.8 +Components.utils.import("resource://gre/modules/NetUtil.jsm"); 1.9 + 1.10 +function test() { 1.11 + waitForExplicitFinish(); 1.12 + open_preferences(runTest); 1.13 +} 1.14 + 1.15 +function runTest(win) { 1.16 + is(gBrowser.currentURI.spec, "about:preferences", "about:preferences loaded"); 1.17 + 1.18 + let tab = win.document; 1.19 + let elements = tab.getElementById("mainPrefPane").children; 1.20 + 1.21 + //Test if general pane is opened correctly 1.22 + win.gotoPref("paneGeneral"); 1.23 + for (let element of elements) { 1.24 + let attributeValue = element.getAttribute("data-category"); 1.25 + if (attributeValue == "paneGeneral") { 1.26 + is_element_visible(element, "General elements should be visible"); 1.27 + } else { 1.28 + is_element_hidden(element, "Non-General elements should be hidden"); 1.29 + } 1.30 + } 1.31 + 1.32 + //Test if tabs pane is opened correctly 1.33 + win.gotoPref("paneTabs"); 1.34 + for (let element of elements) { 1.35 + let attributeValue = element.getAttribute("data-category"); 1.36 + if (attributeValue == "paneTabs") { 1.37 + is_element_visible(element, "Tab elements should be visible"); 1.38 + } else { 1.39 + is_element_hidden(element, "Non-Tab elements should be hidden"); 1.40 + } 1.41 + } 1.42 + 1.43 + //Test if content pane is opened correctly 1.44 + win.gotoPref("paneContent"); 1.45 + for (let element of elements) { 1.46 + let attributeValue = element.getAttribute("data-category"); 1.47 + if (attributeValue == "paneContent") { 1.48 + is_element_visible(element, "Content elements should be visible"); 1.49 + } else { 1.50 + is_element_hidden(element, "Non-Content elements should be hidden"); 1.51 + } 1.52 + } 1.53 + 1.54 + //Test if applications pane is opened correctly 1.55 + win.gotoPref("paneApplications"); 1.56 + for (let element of elements) { 1.57 + let attributeValue = element.getAttribute("data-category"); 1.58 + if (attributeValue == "paneApplications") { 1.59 + is_element_visible(element, "Application elements should be visible"); 1.60 + } else { 1.61 + is_element_hidden(element, "Non-Application elements should be hidden"); 1.62 + } 1.63 + } 1.64 + 1.65 + //Test if privacy pane is opened correctly 1.66 + win.gotoPref("panePrivacy"); 1.67 + for (let element of elements) { 1.68 + let attributeValue = element.getAttribute("data-category"); 1.69 + if (attributeValue == "panePrivacy") { 1.70 + is_element_visible(element, "Privacy elements should be visible"); 1.71 + } else { 1.72 + is_element_hidden(element, "Non-Privacy elements should be hidden"); 1.73 + } 1.74 + } 1.75 + 1.76 + //Test if security pane is opened correctly 1.77 + win.gotoPref("paneSecurity"); 1.78 + for (let element of elements) { 1.79 + let attributeValue = element.getAttribute("data-category"); 1.80 + if (attributeValue == "paneSecurity") { 1.81 + is_element_visible(element, "Security elements should be visible"); 1.82 + } else { 1.83 + is_element_hidden(element, "Non-Security elements should be hidden"); 1.84 + } 1.85 + } 1.86 + 1.87 + //Test if sync pane is opened correctly 1.88 + win.gotoPref("paneSync"); 1.89 + for (let element of elements) { 1.90 + let attributeValue = element.getAttribute("data-category"); 1.91 + if (attributeValue == "paneSync") { 1.92 + is_element_visible(element, "Sync elements should be visible"); 1.93 + } else { 1.94 + is_element_hidden(element, "Non-Sync elements should be hidden"); 1.95 + } 1.96 + } 1.97 + 1.98 + //Test if advanced pane is opened correctly 1.99 + win.gotoPref("paneAdvanced"); 1.100 + for (let element of elements) { 1.101 + let attributeValue = element.getAttribute("data-category"); 1.102 + if (attributeValue == "paneAdvanced") { 1.103 + is_element_visible(element, "Advanced elements should be visible"); 1.104 + } else { 1.105 + is_element_hidden(element, "Non-Advanced elements should be hidden"); 1.106 + } 1.107 + } 1.108 + 1.109 + gBrowser.removeCurrentTab(); 1.110 + win.close(); 1.111 + finish(); 1.112 +}