browser/base/content/test/newtab/browser_newtab_disable.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /*
michael@0 5 * These tests make sure that the 'New Tab Page' feature can be disabled if the
michael@0 6 * decides not to use it.
michael@0 7 */
michael@0 8 function runTests() {
michael@0 9 // create a new tab page and hide it.
michael@0 10 yield setLinks("0,1,2,3,4,5,6,7,8");
michael@0 11 setPinnedLinks("");
michael@0 12
michael@0 13 yield addNewTabPageTab();
michael@0 14 let gridNode = getGrid().node;
michael@0 15
michael@0 16 ok(!gridNode.hasAttribute("page-disabled"), "page is not disabled");
michael@0 17
michael@0 18 NewTabUtils.allPages.enabled = false;
michael@0 19 ok(gridNode.hasAttribute("page-disabled"), "page is disabled");
michael@0 20
michael@0 21 let oldGridNode = gridNode;
michael@0 22
michael@0 23 // create a second new tage page and make sure it's disabled. enable it
michael@0 24 // again and check if the former page gets enabled as well.
michael@0 25 yield addNewTabPageTab();
michael@0 26 ok(gridNode.hasAttribute("page-disabled"), "page is disabled");
michael@0 27
michael@0 28 // check that no sites have been rendered
michael@0 29 is(0, getContentDocument().querySelectorAll(".site").length, "no sites have been rendered");
michael@0 30
michael@0 31 NewTabUtils.allPages.enabled = true;
michael@0 32 ok(!gridNode.hasAttribute("page-disabled"), "page is not disabled");
michael@0 33 ok(!oldGridNode.hasAttribute("page-disabled"), "old page is not disabled");
michael@0 34 }

mercurial