summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/newtab/browser_newtab_disable.js
diff options
context:
space:
mode:
Diffstat (limited to 'browser/base/content/test/newtab/browser_newtab_disable.js')
-rw-r--r--browser/base/content/test/newtab/browser_newtab_disable.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/browser/base/content/test/newtab/browser_newtab_disable.js b/browser/base/content/test/newtab/browser_newtab_disable.js
new file mode 100644
index 000000000..58b9a18af
--- /dev/null
+++ b/browser/base/content/test/newtab/browser_newtab_disable.js
@@ -0,0 +1,49 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/*
+ * These tests make sure that the 'New Tab Page' feature can be disabled if the
+ * decides not to use it.
+ */
+add_task(function* () {
+ // create a new tab page and hide it.
+ yield setLinks("0,1,2,3,4,5,6,7,8");
+ setPinnedLinks("");
+
+ let firstTab = yield* addNewTabPageTab();
+
+ function isGridDisabled(browser = gBrowser.selectedBrowser)
+ {
+ return ContentTask.spawn(browser, {}, function*() {
+ return content.gGrid.node.hasAttribute("page-disabled");
+ });
+ }
+
+ let isDisabled = yield isGridDisabled();
+ ok(!isDisabled, "page is not disabled");
+
+ NewTabUtils.allPages.enabled = false;
+
+ isDisabled = yield isGridDisabled();
+ ok(isDisabled, "page is disabled");
+
+ // create a second new tab page and make sure it's disabled. enable it
+ // again and check if the former page gets enabled as well.
+ yield* addNewTabPageTab();
+ isDisabled = yield isGridDisabled(firstTab.linkedBrowser);
+ ok(isDisabled, "page is disabled");
+
+ // check that no sites have been rendered
+ yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function*() {
+ Assert.equal(content.document.querySelectorAll(".site").length, 0,
+ "no sites have been rendered");
+ });
+
+ NewTabUtils.allPages.enabled = true;
+
+ isDisabled = yield isGridDisabled();
+ ok(!isDisabled, "page is not disabled");
+
+ isDisabled = yield isGridDisabled(firstTab.linkedBrowser);
+ ok(!isDisabled, "old page is not disabled");
+});