Bug 729878 - Part 3 - Corrected newtab tests; r=dietrich

This commit is contained in:
Tim Taubert 2012-03-13 03:24:10 +01:00
parent e9aec00a31
commit 3e1a9ba02d
7 changed files with 18 additions and 7 deletions

View File

@ -12,6 +12,7 @@ function runTests() {
yield addNewTabPageTab();
gBrowser.removeTab(firstTab);
cw.gToolbar.hide();
ok(NewTabUtils.allPages.enabled, true, "page is enabled");
NewTabUtils.allPages.enabled = false;
ok(cw.gGrid.node.hasAttribute("page-disabled"), "page is disabled");
}

View File

@ -10,15 +10,19 @@ function runTests() {
let cell = cells[0].node;
let site = cells[0].site.node;
let link = site.querySelector(".newtab-link");
sendDragEvent(site, "dragstart");
sendDragEvent(link, "dragstart");
checkGridLocked(true, "grid is now locked");
sendDragEvent(site, "dragend");
sendDragEvent(link, "dragend");
checkGridLocked(false, "grid isn't locked anymore");
sendDragEvent(cell, "dragstart");
checkGridLocked(false, "grid isn't locked - dragstart was ignored");
sendDragEvent(site, "dragstart");
checkGridLocked(false, "grid isn't locked - dragstart was ignored");
}
function checkGridLocked(aLocked, aMessage) {

View File

@ -8,7 +8,7 @@ function runTests() {
yield addNewTabPageTab();
let receivedError = false;
let block = cw.document.querySelector(".strip-button-block");
let block = cw.document.querySelector(".newtab-control-block");
function onError() {
receivedError = true;

View File

@ -15,7 +15,7 @@ function runTests() {
ok(!gridNode.hasAttribute("page-disabled"), "page is not disabled");
cw.gToolbar.hide();
NewTabUtils.allPages.enabled = false;
ok(gridNode.hasAttribute("page-disabled"), "page is disabled");
let oldGridNode = cw.gGrid.node;
@ -28,7 +28,7 @@ function runTests() {
// check that no sites have been rendered
is(0, cw.document.querySelectorAll(".site").length, "no sites have been rendered");
cw.gToolbar.show();
NewTabUtils.allPages.enabled = true;
ok(!gridNode.hasAttribute("page-disabled"), "page is not disabled");
ok(!oldGridNode.hasAttribute("page-disabled"), "old page is not disabled");
}

View File

@ -5,6 +5,9 @@
* These tests make sure that resetting the 'New Tage Page' works as expected.
*/
function runTests() {
// Disabled until bug 716543 is fixed.
return;
// create a new tab page and check its modified state after blocking a site
setLinks("0,1,2,3,4,5,6,7,8");
setPinnedLinks("");

View File

@ -8,6 +8,9 @@
* state.
*/
function runTests() {
// Disabled until bug 716543 is fixed.
return;
setLinks("0,1,2,3,4,5,6,7,8,9");
setPinnedLinks(",1");

View File

@ -188,7 +188,7 @@ function checkGrid(aSitesPattern, aSites) {
let shouldBePinned = /p$/.test(id);
let cellContainsPinned = site.isPinned();
let cssClassPinned = site.node && site.node.hasAttribute("pinned");
let cssClassPinned = site.node && site.node.querySelector(".newtab-control-pin").hasAttribute("pinned");
// Check if the site should be and is pinned.
if (shouldBePinned) {