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

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

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