Bug 1028872 - use collapsed property to check for toolbar state in test, r=dao
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Fri, 27 Jun 2014 15:55:23 +0100
changeset 191187 f2e8982acbf03ff2bba72bdd804913911f91b3fb
parent 191186 a033a0b332eb8437357277973490e79796c24e7f
child 191188 f127b565e53febcbc7b7100b63280a62f9d2720b
child 191272 920154597e3be43099ced1443db32189c58f21a6
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersdao
bugs1028872
milestone33.0a1
Bug 1028872 - use collapsed property to check for toolbar state in test, r=dao
browser/components/customizableui/test/browser_938980_navbar_collapsed.js
--- a/browser/components/customizableui/test/browser_938980_navbar_collapsed.js
+++ b/browser/components/customizableui/test/browser_938980_navbar_collapsed.js
@@ -19,34 +19,34 @@ add_task(function() {
   is(navbar.collapsed, false, "Customization reset should restore visibility to the navbar");
 });
 
 // Customization reset should restore collapsed-state to default-collapsed toolbars.
 add_task(function() {
   ok(CustomizableUI.inDefaultState, "Everything should be in its default state");
 
   is(bookmarksToolbar.collapsed, true, "Test should start with bookmarks toolbar collapsed");
-  is(bookmarksToolbar.getBoundingClientRect().height, 0, "bookmarksToolbar should have height=0");
-  isnot(tabsToolbar.getBoundingClientRect().height, 0, "TabsToolbar should have non-zero height");
+  ok(bookmarksToolbar.collapsed, "bookmarksToolbar should be collapsed");
+  ok(!tabsToolbar.collapsed, "TabsToolbar should not be collapsed");
   is(navbar.collapsed, false, "The nav-bar should be shown by default");
 
   setToolbarVisibility(bookmarksToolbar, true);
   setToolbarVisibility(navbar, false);
-  isnot(bookmarksToolbar.getBoundingClientRect().height, 0, "bookmarksToolbar should be visible now");
-  ok(navbar.getBoundingClientRect().height <= 1, "navbar should have height=0 or 1 (due to border)");
+  ok(!bookmarksToolbar.collapsed, "bookmarksToolbar should be visible now");
+  ok(navbar.collapsed, "navbar should be collapsed");
   is(CustomizableUI.inDefaultState, false, "Should no longer be in default state");
 
   yield startCustomizing();
   gCustomizeMode.reset();
   yield waitForCondition(function() !gCustomizeMode.resetting);
   yield endCustomizing();
 
   is(bookmarksToolbar.collapsed, true, "Customization reset should restore collapsed-state to the bookmarks toolbar");
-  isnot(tabsToolbar.getBoundingClientRect().height, 0, "TabsToolbar should have non-zero height");
-  is(bookmarksToolbar.getBoundingClientRect().height, 0, "The bookmarksToolbar should have height=0 after reset");
+  ok(!tabsToolbar.collapsed, "TabsToolbar should not be collapsed");
+  ok(bookmarksToolbar.collapsed, "The bookmarksToolbar should be collapsed after reset");
   ok(CustomizableUI.inDefaultState, "Everything should be back to default state");
 });
 
 // Check that the menubar will be collapsed by resetting, if the platform supports it.
 add_task(function() {
   let menubar = document.getElementById("toolbar-menubar");
   const canMenubarCollapse = CustomizableUI.isToolbarDefaultCollapsed(menubar.id);
   if (!canMenubarCollapse) {
@@ -69,35 +69,35 @@ add_task(function() {
 
   is(menubar.getAttribute("autohide"), "true", "The menubar should have autohide=true after reset");
   is(menubar.getBoundingClientRect().height, 0, "The menubar should have height=0 after reset");
 });
 
 // Customization reset should restore collapsed-state to default-collapsed toolbars.
 add_task(function() {
   ok(CustomizableUI.inDefaultState, "Everything should be in its default state");
-  is(bookmarksToolbar.getBoundingClientRect().height, 0, "bookmarksToolbar should have height=0");
-  isnot(tabsToolbar.getBoundingClientRect().height, 0, "TabsToolbar should have non-zero height");
+  ok(bookmarksToolbar.collapsed, "bookmarksToolbar should be collapsed");
+  ok(!tabsToolbar.collapsed, "TabsToolbar should not be collapsed");
 
   setToolbarVisibility(bookmarksToolbar, true);
-  isnot(bookmarksToolbar.getBoundingClientRect().height, 0, "bookmarksToolbar should be visible now");
+  ok(!bookmarksToolbar.collapsed, "bookmarksToolbar should be visible now");
   is(CustomizableUI.inDefaultState, false, "Should no longer be in default state");
 
   yield startCustomizing();
 
-  isnot(bookmarksToolbar.getBoundingClientRect().height, 0, "The bookmarksToolbar should be visible before reset");
-  isnot(navbar.getBoundingClientRect().height, 0, "The navbar should be visible before reset");
-  isnot(tabsToolbar.getBoundingClientRect().height, 0, "TabsToolbar should have non-zero height");
+  ok(!bookmarksToolbar.collapsed, "The bookmarksToolbar should be visible before reset");
+  ok(!navbar.collapsed, "The navbar should be visible before reset");
+  ok(!tabsToolbar.collapsed, "TabsToolbar should not be collapsed");
 
   gCustomizeMode.reset();
   yield waitForCondition(function() !gCustomizeMode.resetting);
 
-  is(bookmarksToolbar.getBoundingClientRect().height, 0, "The bookmarksToolbar should have height=0 after reset");
-  isnot(tabsToolbar.getBoundingClientRect().height, 0, "TabsToolbar should have non-zero height");
-  isnot(navbar.getBoundingClientRect().height, 0, "The navbar should still be visible after reset");
+  ok(bookmarksToolbar.collapsed, "The bookmarksToolbar should be collapsed after reset");
+  ok(!tabsToolbar.collapsed, "TabsToolbar should not be collapsed");
+  ok(!navbar.collapsed, "The navbar should still be visible after reset");
   ok(CustomizableUI.inDefaultState, "Everything should be back to default state");
   yield endCustomizing();
 });
 
 // Check that the menubar will be collapsed by resetting, if the platform supports it.
 add_task(function() {
   let menubar = document.getElementById("toolbar-menubar");
   const canMenubarCollapse = CustomizableUI.isToolbarDefaultCollapsed(menubar.id);