From 3e1a9ba02d27e5fc3b2438f9e7898a79780d8b62 Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Tue, 13 Mar 2012 03:24:10 +0100 Subject: [PATCH] Bug 729878 - Part 3 - Corrected newtab tests; r=dietrich --- .../base/content/test/newtab/browser_newtab_bug723102.js | 3 ++- .../base/content/test/newtab/browser_newtab_bug723121.js | 8 ++++++-- .../base/content/test/newtab/browser_newtab_bug734043.js | 2 +- .../base/content/test/newtab/browser_newtab_disable.js | 4 ++-- browser/base/content/test/newtab/browser_newtab_reset.js | 3 +++ .../base/content/test/newtab/browser_newtab_tabsync.js | 3 +++ browser/base/content/test/newtab/head.js | 2 +- 7 files changed, 18 insertions(+), 7 deletions(-) diff --git a/browser/base/content/test/newtab/browser_newtab_bug723102.js b/browser/base/content/test/newtab/browser_newtab_bug723102.js index 2981fd51179..b6ac4d2b36c 100644 --- a/browser/base/content/test/newtab/browser_newtab_bug723102.js +++ b/browser/base/content/test/newtab/browser_newtab_bug723102.js @@ -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"); } diff --git a/browser/base/content/test/newtab/browser_newtab_bug723121.js b/browser/base/content/test/newtab/browser_newtab_bug723121.js index d71a7396616..e82f0ec5e0b 100644 --- a/browser/base/content/test/newtab/browser_newtab_bug723121.js +++ b/browser/base/content/test/newtab/browser_newtab_bug723121.js @@ -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) { diff --git a/browser/base/content/test/newtab/browser_newtab_bug734043.js b/browser/base/content/test/newtab/browser_newtab_bug734043.js index 8c84b495f6a..26e2c742f6d 100644 --- a/browser/base/content/test/newtab/browser_newtab_bug734043.js +++ b/browser/base/content/test/newtab/browser_newtab_bug734043.js @@ -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; diff --git a/browser/base/content/test/newtab/browser_newtab_disable.js b/browser/base/content/test/newtab/browser_newtab_disable.js index dde79e92f0b..90c3ea805d0 100644 --- a/browser/base/content/test/newtab/browser_newtab_disable.js +++ b/browser/base/content/test/newtab/browser_newtab_disable.js @@ -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"); } diff --git a/browser/base/content/test/newtab/browser_newtab_reset.js b/browser/base/content/test/newtab/browser_newtab_reset.js index 0cee8fb0003..884207ac9a9 100644 --- a/browser/base/content/test/newtab/browser_newtab_reset.js +++ b/browser/base/content/test/newtab/browser_newtab_reset.js @@ -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(""); diff --git a/browser/base/content/test/newtab/browser_newtab_tabsync.js b/browser/base/content/test/newtab/browser_newtab_tabsync.js index aa2835b5ed5..8682ebb977f 100644 --- a/browser/base/content/test/newtab/browser_newtab_tabsync.js +++ b/browser/base/content/test/newtab/browser_newtab_tabsync.js @@ -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"); diff --git a/browser/base/content/test/newtab/head.js b/browser/base/content/test/newtab/head.js index ed83fd93a36..507c7f0d213 100644 --- a/browser/base/content/test/newtab/head.js +++ b/browser/base/content/test/newtab/head.js @@ -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) {