[Pkg-mozext-commits] [compactheader] 331/441: Version 2.0.2beta2: Add tooltiptext for more button. Fix problem in wide layout. Avoid simultanious running setCurrentToolboxPosition. Add mozmill tests for changes.

David Prévot taffit at moszumanska.debian.org
Wed Mar 18 12:29:15 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository compactheader.

commit f37cf3f5a971873af942a7aa15007e63f3dd1852
Author: Joachim.Herb at gmx.de <Joachim.Herb at gmx.de>
Date:   Fri Feb 10 23:49:52 2012 +0100

    Version 2.0.2beta2: Add tooltiptext for more button. Fix problem in wide layout. Avoid simultanious running setCurrentToolboxPosition. Add mozmill tests for changes.
---
 .../CompactHeader/content/compactHeaderOverlay.js  |  61 +-
 chrome/CompactHeader/content/toolbar.js            |  18 +-
 install.rdf                                        |   2 +-
 test/compactheader/test-compactheader-collapse.js  |  56 +-
 test/compactheader/test-compactheader-toolbar.js   |   8 +-
 test/compactheader/test-message-header.js          | 837 ---------------------
 test/compactheader/test-more-button.js             | 158 ++++
 test/executeTests.pl                               |   3 +
 test/shared-modules/test-compactheader-helpers.js  |  32 +
 9 files changed, 309 insertions(+), 866 deletions(-)

diff --git a/chrome/CompactHeader/content/compactHeaderOverlay.js b/chrome/CompactHeader/content/compactHeaderOverlay.js
index 1b2e351..89455a3 100644
--- a/chrome/CompactHeader/content/compactHeaderOverlay.js
+++ b/chrome/CompactHeader/content/compactHeaderOverlay.js
@@ -132,6 +132,10 @@ org.mozdev.compactHeader.pane = function() {
     var names = {};
     var numAddresses =  0;
 
+    let moreButton = document.getAnonymousElementByAttribute(document.getElementById("CompactHeader_collapsed2LtoCcBccBox"),
+        "anonid", "more");
+    let moreTooltip = moreButton.getAttribute("tooltiptext");
+
     var msgHeaderParser = Components.classes["@mozilla.org/messenger/headerparser;1"]
                                     .getService(Components.interfaces.nsIMsgHeaderParser);
     numAddresses = msgHeaderParser.parseHeadersWithArray(emailAddresses, addresses, names, fullNames);
@@ -151,6 +155,19 @@ org.mozdev.compactHeader.pane = function() {
       } else {
         address.displayName = names.value[index];
       }
+      org.mozdev.compactHeader.debug.log("0: " + address.fullAddress);
+      org.mozdev.compactHeader.debug.log("0: " + addressType);
+      if (address.fullAddress != "" &&
+           (addressType == "to" || addressType == "cc" || addressType == "bcc")) {
+        if (moreTooltip == "") {
+          moreTooltip = address.fullAddress;
+          org.mozdev.compactHeader.debug.log("1: " + address.fullAddress);
+        } else {
+          moreTooltip = moreTooltip + ", " + address.fullAddress;
+          org.mozdev.compactHeader.debug.log("2: " + address.fullAddress);
+        }
+      }
+//      window.alert(address);
       if (headerEntry.useToggle && (typeof headerEntry.enclosingBox.addAddressView == 'function')) {
         headerEntry.enclosingBox.addAddressView(address);
       } else {
@@ -158,6 +175,7 @@ org.mozdev.compactHeader.pane = function() {
       }
       index++;
     }
+    moreButton.setAttribute("tooltiptext", moreTooltip);
 
     if (headerEntry.useToggle && (typeof headerEntry.enclosingBox.buildViews == 'function'))
       headerEntry.enclosingBox.buildViews();
@@ -180,6 +198,33 @@ org.mozdev.compactHeader.pane = function() {
         gCoheCollapsedHeaderView[gCoheCollapsedHeader2LListLongAddresses[index].name] =
           new createHeaderEntry('CompactHeader_collapsed2L', gCoheCollapsedHeader2LListLongAddresses[index]);
       }
+      let moreButton = document.getAnonymousElementByAttribute(document.getElementById("CompactHeader_collapsed2LtoCcBccBox"),
+        "anonid", "more");
+      let moreButtonTo = document.getAnonymousElementByAttribute(document.getElementById("expandedtoBox"),
+          "anonid", "more");
+      let moreButtonCC = document.getAnonymousElementByAttribute(document.getElementById("expandedccBox"),
+          "anonid", "more");
+      let moreButtonBCC = document.getAnonymousElementByAttribute(document.getElementById("expandedbccBox"),
+          "anonid", "more");
+
+      if (moreButton) {
+        let oldToggleWrap = moreButton.parentNode.toggleWrap;
+        moreButton.parentNode.toggleWrap = function() {
+          pub.coheToggleHeaderView();
+          if (!moreButtonTo.hasAttribute("collapsed")) {
+            moreButtonTo.click();
+            org.mozdev.compactHeader.debug.log("toggle To");
+          }
+          if (!moreButtonCC.hasAttribute("collapsed")) {
+            moreButtonCC.click();
+            org.mozdev.compactHeader.debug.log("toggle cc");
+          }
+          if (!moreButtonBCC.hasAttribute("collapsed")) {
+            moreButtonBCC.click();
+            org.mozdev.compactHeader.debug.log("toggle bcc");
+          }
+        };
+      }
     } else {
       for (index = 0; index < gCoheCollapsedHeader1LListLongAddresses.length; index++) {
         gCoheCollapsedHeaderView[gCoheCollapsedHeader1LListLongAddresses[index].name] =
@@ -255,13 +300,14 @@ org.mozdev.compactHeader.pane = function() {
 
     org.mozdev.compactHeader.debug.log("coheOnLoadMsgHeaderPane 3");
 
-    coheToggleHeaderContent();
-
-    org.mozdev.compactHeader.debug.log("coheOnLoadMsgHeaderPane 4");
-
     org.mozdev.compactHeader.toolbar.setButtonStyle();
     org.mozdev.customizeHeaderToolbar.messenger.saveToolboxData();
     org.mozdev.compactHeader.toolbar.dispMUACheck();
+
+    org.mozdev.compactHeader.debug.log("coheOnLoadMsgHeaderPane 4");
+
+    coheToggleHeaderContent();
+
     org.mozdev.compactHeader.debug.log("coheOnLoadMsgHeaderPane stop");
   }
 
@@ -383,6 +429,7 @@ org.mozdev.compactHeader.pane = function() {
   }
 
   function coheToggleHeaderContent() {
+    org.mozdev.compactHeader.debug.log("coheToggleHeaderContent start");
     var strHideLabel = document.getElementById("CompactHeader_CoheHideDetailsLabel").value;
     var strShowLabel = document.getElementById("CompactHeader_CoheShowDetailsLabel").value;
     var strLabel;
@@ -433,7 +480,6 @@ org.mozdev.compactHeader.pane = function() {
     } else {
       strLabel = strHideLabel;
     }
-
     if (document.getElementById("CompactHeader_hideDetailsMenu")) {
       document.getElementById("CompactHeader_hideDetailsMenu").setAttribute("label", strLabel);
     }
@@ -443,6 +489,7 @@ org.mozdev.compactHeader.pane = function() {
     if (document.getElementById("CompactHeader_hideDetailsMenu")) {
       document.getElementById("CompactHeader_hideDetailsMenu").setAttribute("label", strLabel);
     }
+    org.mozdev.compactHeader.debug.log("coheToggleHeaderContent stop");
   }
 
   // default method for updating a header value into a header entry
@@ -477,6 +524,10 @@ org.mozdev.compactHeader.pane = function() {
     // affect the header box:
     document.getElementById('msgHeaderView').removeAttribute('height');
 
+    let moreButton = document.getAnonymousElementByAttribute(document.getElementById("CompactHeader_collapsed2LtoCcBccBox"),
+        "anonid", "more");
+    moreButton.setAttribute("tooltiptext", "");
+
     // iterate over each header we received and see if we have a matching entry
     // in each header view table...
     for (var headerName in currentHeaderData)
diff --git a/chrome/CompactHeader/content/toolbar.js b/chrome/CompactHeader/content/toolbar.js
index f4ff5b2..0dc47c5 100644
--- a/chrome/CompactHeader/content/toolbar.js
+++ b/chrome/CompactHeader/content/toolbar.js
@@ -356,7 +356,7 @@ org.mozdev.compactHeader.toolbar = function() {
     org.mozdev.compactHeader.debug.log("onChangeDispMUAicon stop");
   };
 
-  hideDispMUABox = function(dispMUABox) {
+  function hideDispMUABox(dispMUABox) {
     org.mozdev.compactHeader.debug.log("hideDispMUABox start");
     dispMUABox.setAttribute("collapsed", "true"); // hide original
     var dispMUAicon = document.getElementById("dispMUAicon");
@@ -380,7 +380,7 @@ org.mozdev.compactHeader.toolbar = function() {
     org.mozdev.compactHeader.debug.log("hideDispMUABox stop");
   };
 
-  removeButtonDispMUA = function() {
+  function removeButtonDispMUA() {
     org.mozdev.compactHeader.debug.log("removeButtonDispMUA start");
     if (!document.getElementById("dispMUA")) {
       var button = document.getElementById("CompactHeader_button-dispMUA");
@@ -507,8 +507,15 @@ org.mozdev.compactHeader.toolbar = function() {
     org.mozdev.compactHeader.debug.log("onDoCustomizationHeaderViewToolbox done");
   };
 
+  var setToolboxRunning = false;
 
   pub.setCurrentToolboxPosition = function(aHeaderViewMode) {
+    if (setToolboxRunning) {
+      org.mozdev.compactHeader.debug.log("setCurrentToolboxPosition is running");
+      return;
+    }
+    setToolboxRunning = true;
+
     org.mozdev.compactHeader.debug.log("setCurrentToolboxPosition start");
 
     var singleMessage = document.getElementById("singlemessage");
@@ -520,10 +527,13 @@ org.mozdev.compactHeader.toolbar = function() {
       multiBBox = multiMessage.contentDocument.getElementById("header-view-toolbox");
     }
 
+    org.mozdev.compactHeader.debug.log("setCurrentToolboxPosition mid 0");
+
     var hdrViewToolbox = document.getElementById("header-view-toolbox");
     if (!hdrViewToolbox) {
       org.mozdev.compactHeader.debug.log("no header-view-toolbox!",
         org.mozdev.compactHeader.debug.LOGLEVEL.warn);
+      setToolboxRunning = false;
       return;
     }
 
@@ -535,6 +545,7 @@ org.mozdev.compactHeader.toolbar = function() {
         multiBBox.setAttribute("collapsed", "true");
       }
       org.mozdev.compactHeader.debug.log("none stop");
+      setToolboxRunning = false;
       return;
     }
     else {
@@ -575,9 +586,11 @@ org.mozdev.compactHeader.toolbar = function() {
       org.mozdev.compactHeader.debug.log("move to singlemessage");
       var targetToolbox;
       if (aHeaderViewMode) {
+        org.mozdev.compactHeader.debug.log("setCurrentToolboxPosition aHeaderViewMode");
         targetToolbox = getToolbarTarget(targetPos, "compact");
       }
       else {
+        org.mozdev.compactHeader.debug.log("setCurrentToolboxPosition no aHeaderViewMode");
         targetToolbox = getToolbarTarget(targetPos, "expanded");
       }
       if (targetToolbox) {
@@ -585,6 +598,7 @@ org.mozdev.compactHeader.toolbar = function() {
       }
     }
     org.mozdev.compactHeader.debug.log("setCurrentToolboxPosition stop");
+    setToolboxRunning = false;
   }
 
 
diff --git a/install.rdf b/install.rdf
index 9f2c388..35ea713 100644
--- a/install.rdf
+++ b/install.rdf
@@ -6,7 +6,7 @@
 
 	<RDF:Description about="urn:mozilla:install-manifest">
 		<em:name>CompactHeader</em:name>
-		<em:version>2.0.2beta1</em:version>
+		<em:version>2.0.2beta2</em:version>
 		<em:description>Add ability to reduce header size to one or two lines. Linkify subjects in RSS feeds.</em:description>
 		<em:creator>Joachim Herb</em:creator>
 		<em:contributor>Zamula</em:contributor>
diff --git a/test/compactheader/test-compactheader-collapse.js b/test/compactheader/test-compactheader-collapse.js
index 9732972..5201562 100644
--- a/test/compactheader/test-compactheader-collapse.js
+++ b/test/compactheader/test-compactheader-collapse.js
@@ -108,6 +108,45 @@ function setupModule(module) {
   add_message_to_folder(folder1, msg);
 }
 
+function test_wide_layout_and_compact() {
+  set_pane_layout(kWideMailLayout);
+  assert_pane_layout(kWideMailLayout);
+  let abwc = openAddressBook();
+  // The 3pane window is closed and opened again.
+  close3PaneWindow();
+
+  mc = open3PaneWindow();
+  abwc.window.close();
+
+  select_message_in_folder(folder1, 0, mc);
+  collapse_and_assert_header(mc);
+
+  let largeDispMUAIcon = mc.e("CompactHeader_dispMUAiconExp");
+  let twoLineDispMUAIcon = mc.e("CompactHeader_dispMUAicon2line");
+  let oneLineDispMUAIcon = mc.e("CompactHeader_dispMUAiconCompact");
+
+  let orignalDispMUA = mc.e("dispMUA");
+
+  if (orignalDispMUA == null) {
+    assert_equals(oneLineDispMUAIcon.getAttribute("collapsed"), "true");
+    assert_equals(twoLineDispMUAIcon.getAttribute("collapsed"), "true");
+  }
+
+  expand_and_assert_header(mc);
+  if (orignalDispMUA == null) {
+    assert_equals(oneLineDispMUAIcon.getAttribute("collapsed"), "true");
+    assert_equals(twoLineDispMUAIcon.getAttribute("collapsed"), "true");
+  }
+
+  set_pane_layout(kClassicMailLayout);
+  assert_pane_layout(kClassicMailLayout);
+  let abwc = openAddressBook();
+  // The 3pane window is closed and opened again.
+  close3PaneWindow();
+
+  mc = open3PaneWindow();
+  abwc.window.close();
+}
 function test_toggle_header_view_twoline(){
   select_message_in_folder(folder1, 0, mc);
   open_preferences_dialog(mc, set_preferences_twoline);
@@ -223,20 +262,3 @@ function test_neighbours_of_header_view_toolbox(){
   assert_equals(oldPreviousSibling, newPreviousSibling);
   assert_equals(oldNextSibling, newNextSibling);
 }
-
-function set_preferences_twoline(aController) {
-  let checkboxCompactTwolineView = aController.eid("CompactHeader_checkboxCompactTwolineView");
-  if (!checkboxCompactTwolineView.node.getAttribute("checked")) {
-    aController.click(checkboxCompactTwolineView);
-  }
-  close_preferences_dialog(aController);
-}
-
-function set_preferences_oneline(aController) {
-  let checkboxCompactTwolineView = aController.eid("CompactHeader_checkboxCompactTwolineView");
-  if (checkboxCompactTwolineView.node.getAttribute("checked")) {
-    aController.click(checkboxCompactTwolineView);
-  }
-  close_preferences_dialog(aController);
-}
-
diff --git a/test/compactheader/test-compactheader-toolbar.js b/test/compactheader/test-compactheader-toolbar.js
index 8e5336a..2780090 100644
--- a/test/compactheader/test-compactheader-toolbar.js
+++ b/test/compactheader/test-compactheader-toolbar.js
@@ -70,7 +70,7 @@ function setupModule(module) {
     close_window(wizard);
     mc = open3PaneWindow();
   }
-  
+
   folder1 = create_folder("MessageWindowB");
 
   // create a message that has the interesting headers that commonly
@@ -513,7 +513,7 @@ function test_customize_header_toolbar_add_all_buttons(){
   // Move the buttons back to palette
   let ctc = open_header_pane_toolbar_customization(mc);
   let target = ctc.e("palette-box");
-  for (let i=0; i<wrappedButtons.length; i++) {
+  for (let i=wrappedButtons.length-1; i>= 0; i--) {
     let button = mc.e(wrappedButtons[i]);
     drag_n_drop_element(button, mc.window, target, ctc.window, 0.5, 0.5, toolbar);
   }
@@ -531,7 +531,7 @@ function test_customize_header_toolbar_add_all_buttons(){
   let backButtons = new Array;
   let tmp = ctc.window.document.getElementById("palette-box").
     getElementsByTagName("toolbarpaletteitem");
-  for (let i=0; i<tmp.length; i++) {
+  for (let i=tmp.length-1; i>=0; i--) {
     let type = tmp[i].getAttribute("type");
     if ((type != "separator") &&
         (type != "spring") &&
@@ -551,7 +551,7 @@ function test_customize_header_toolbar_add_all_buttons(){
   let backButtons = new Array;
   let tmp = ctc.window.document.getElementById("palette-box").
     getElementsByTagName("toolbarpaletteitem");
-  for (let i=0; i<tmp.length; i++) {
+  for (let i=tmp.length-1; i>=0; i--) {
     let type = tmp[i].getAttribute("type");
     if ((type != "separator") &&
         (type != "spring") &&
diff --git a/test/compactheader/test-message-header.js b/test/compactheader/test-message-header.js
deleted file mode 100644
index 94950c3..0000000
--- a/test/compactheader/test-message-header.js
+++ /dev/null
@@ -1,837 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- *   Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Thunderbird Mail Client.
- *
- * The Initial Developer of the Original Code is
- * the Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2009
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Blake Winton <bwinton at latte.ca>
- *   Dan Mosedale <dmose at mozillamessaging.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/*
- * Test that we can add a tag to a message without messing up the header.
- */
-var MODULE_NAME = 'test-message-header';
-
-var RELATIVE_ROOT = '../shared-modules';
-var MODULE_REQUIRES = ['folder-display-helpers', 'window-helpers',
-                       'address-book-helpers'];
-
-var elib = {};
-Cu.import('resource://mozmill/modules/elementslib.js', elib);
-
-var folder;
-
-function setupModule(module) {
-  let fdh = collector.getModule('folder-display-helpers');
-  fdh.installInto(module);
-  let wh = collector.getModule('window-helpers');
-  wh.installInto(module);
-  let abh = collector.getModule('address-book-helpers');
-  abh.installInto(module);
-
-  folder = create_folder("MessageWindowA");
-
-  // create a message that has the interesting headers that commonly
-  // show up in the message header pane for testing
-  let msg = create_message({cc: msgGen.makeNamesAndAddresses(20), // YYY
-                            subject: "This is a really, really, really, really, really, really, really, really, long subject.",
-                            clobberHeaders: {
-                              "Newsgroups": "alt.test",
-                              "Reply-To": "J. Doe <j.doe at momo.invalid>",
-                              "Content-Base": "http://example.com/",
-                              "Bcc": "Richard Roe <richard.roe at momo.invalid>"
-                            }});
-
-  add_message_to_folder(folder, msg);
-
-  // create a message that has boring headers to be able to switch to and
-  // back from, to force the more button to collapse again.
-  msg = create_message();
-  add_message_to_folder(folder, msg);
-}
-
-function test_add_tag_with_really_long_label() {
-  be_in_folder(folder);
-
-  // select the first message, which will display it
-  let curMessage = select_click_row(0);
-
-  assert_selected_and_displayed(mc, curMessage);
-
-  let topColumn = mc.eid("expandedHeadersNameColumn").node;
-  let bottomColumn = mc.eid("expandedHeaders2NameColumn").node;
-
-  if (topColumn.clientWidth != bottomColumn.clientWidth)
-    throw new Error("Header columns have different widths!  " +
-                    topColumn.clientWidth + " != " + bottomColumn.clientWidth);
-  let defaultWidth = topColumn.clientWidth;
-
-  // Make the tags label really long.
-  let tagsLabel = mc.eid("expandedtagsLabel").node;
-  let oldTagsValue = tagsLabel.value;
-  tagsLabel.value = "taaaaaaaaaaaaaaaaaags";
-
-  if (topColumn.clientWidth != bottomColumn.clientWidth) {
-    tagsLabel.value = oldTagsValue;
-    throw new Error("Header columns have different widths!  " +
-                    topColumn.clientWidth + " != " + bottomColumn.clientWidth);
-  }
-  if (topColumn.clientWidth != defaultWidth) {
-    tagsLabel.value = oldTagsValue;
-    throw new Error("Header columns changed width!  " +
-                    topColumn.clientWidth + " != " + defaultWidth);
-  }
-
-  // Add the first tag, and make sure that the label are the same length.
-  mc.keypress(mc.eid("expandedHeadersNameColumn"), "1", {});
-
-  if (topColumn.clientWidth != bottomColumn.clientWidth) {
-    tagsLabel.value = oldTagsValue;
-    throw new Error("Header columns have different widths!  " +
-                    topColumn.clientWidth + " != " + bottomColumn.clientWidth);
-  }
-  if (topColumn.clientWidth == defaultWidth) {
-    tagsLabel.value = oldTagsValue;
-    throw new Error("Header columns didn't change width!  " +
-                    topColumn.clientWidth + " == " + defaultWidth);
-  }
-
-  // Remove the tag and put it back so that the a11y label gets regenerated
-  // with the normal value rather than "taaaaaaaags"
-  tagsLabel.value = oldTagsValue;
-  mc.keypress(mc.eid("expandedHeadersNameColumn"), "1", {});
-  mc.keypress(mc.eid("expandedHeadersNameColumn"), "1", {});
-}
-
-/**
- * @param headerName used for pretty-printing in exceptions
- * @param headerValueElement code to be eval()ed returning the DOM element
- *        with the data.
- * @param expectedName code to be eval()ed returning the expected value of
- *                     nsIAccessible.name for the DOM element in question
- * @param expectedRole the expected value for nsIAccessible.role
- */
-let headersToTest = [
-{
-  headerName: "Subject",
-  headerValueElement: "mc.a('expandedsubjectBox', {class: 'headerValue'})",
-  expectedName: "mc.e('expandedsubjectLabel').value.slice(0,-1) + ': ' + " +
-                "headerValueElement.textContent",
-  expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
-},
-{
-  headerName: "Content-Base",
-  headerValueElement: "mc.a('expandedcontent-baseBox', {class: 'headerValue text-link headerValueUrl'})",
-  expectedName: "mc.e('expandedcontent-baseLabel').value.slice(0,-1) + ': ' + " +
-                "headerValueElement.textContent",
-  expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
-},
-{
-  headerName: "From",
-  headerValueElement: "mc.window.document.getAnonymousElementByAttribute(" +
-                      "mc.a('expandedfromBox', {tagName: 'mail-emailaddress'})," +
-                      "'class', 'emailDisplayButton')",
-  expectedName: "mc.e('expandedfromLabel').value.slice(0,-1) + ': ' + " +
-                "headerValueElement.parentNode.getAttribute('fullAddress')",
-  expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
-},
-{
-  headerName: "To",
-  headerValueElement: "mc.window.document.getAnonymousElementByAttribute(" +
-                      "mc.a('expandedtoBox', {tagName: 'mail-emailaddress'})," +
-                      "'class', 'emailDisplayButton')",
-  expectedName: "mc.e('expandedtoLabel').value.slice(0,-1) + ': ' + " +
-                "headerValueElement.parentNode.getAttribute('fullAddress')",
-  expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
-},
-{
-  headerName: "Cc",
-  headerValueElement: "mc.window.document.getAnonymousElementByAttribute(" +
-                      "mc.a('expandedccBox', {tagName: 'mail-emailaddress'})," +
-                      "'class', 'emailDisplayButton')",
-  expectedName: "mc.e('expandedccLabel').value.slice(0,-1) + ': ' + " +
-                "headerValueElement.parentNode.getAttribute('fullAddress')",
-  expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
-},
-{
-  headerName: "Bcc",
-  headerValueElement: "mc.window.document.getAnonymousElementByAttribute(" +
-                      "mc.a('expandedbccBox', {tagName: 'mail-emailaddress'})," +
-                      "'class', 'emailDisplayButton')",
-  expectedName: "mc.e('expandedbccLabel').value.slice(0,-1) + ': ' + " +
-                "headerValueElement.parentNode.getAttribute('fullAddress')",
-  expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
-},
-{
-  headerName: "Reply-To",
-  headerValueElement: "mc.window.document.getAnonymousElementByAttribute(" +
-                      "mc.a('expandedreply-toBox', {tagName: 'mail-emailaddress'})," +
-                      "'class', 'emailDisplayButton')",
-  expectedName: "mc.e('expandedreply-toLabel').value.slice(0,-1) + ': ' + " +
-                "headerValueElement.parentNode.getAttribute('fullAddress')",
-  expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
-},
-{
-  headerName: "Newsgroups",
-  headerValueElement: "mc.window.document.getAnonymousElementByAttribute(" +
-                      "mc.a('expandednewsgroupsBox', {tagName: 'mail-newsgroup'})," +
-                      "'class', 'newsgrouplabel')",
-  expectedName: "mc.e('expandednewsgroupsLabel').value.slice(0,-1) + ': ' + " +
-                "headerValueElement.parentNode.parentNode.getAttribute('newsgroup')",
-  expectedRole: Ci.nsIAccessibleRole.ROLE_ENTRY
-},
-{
-  headerName: "Tags",
-  headerValueElement: "mc.a('expandedtagsBox', {class: 'tagvalue blc-FF0000'})",
-  expectedName: "mc.e('expandedtagsLabel').value.slice(0,-1) + ': ' + " +
-                "headerValueElement.getAttribute('value')",
-  expectedRole: Ci.nsIAccessibleRole.ROLE_LABEL
-}
-];
-
-// used to get the accessible object for a DOM node
-let gAccRetrieval = Cc["@mozilla.org/accessibleRetrieval;1"].
-                    getService(Ci.nsIAccessibleRetrieval);
-
-/**
- * Use the information from aHeaderInfo to verify that screenreaders will
- * do the right thing with the given message header.
- *
- * @param {Object} aHeaderInfo  Information about how to do the verification;
- *                              See the comments above the headersToTest array
- *                              for details.
- */
-function verify_header_a11y(aHeaderInfo) {
-  // XXX Don't use eval here.
-  let headerValueElement = eval(aHeaderInfo.headerValueElement);
-
-  let headerAccessible = gAccRetrieval.getAccessibleFor(headerValueElement);
-  if (headerAccessible.role != aHeaderInfo.expectedRole) {
-    throw new Error("role for " + aHeaderInfo.headerName + " was " +
-                    headerAccessible.role + "; should have been " +
-                    aHeaderInfo.expectedRole);
-  }
-
-  // XXX Don't use eval here.
-  let expectedName = eval(aHeaderInfo.expectedName);
-  if (headerAccessible.name != expectedName) {
-    throw new Error("headerAccessible.name for " + aHeaderInfo.headerName +
-                    " was '" + headerAccessible.name + "'; expected '" +
-                    expectedName + "'");
-  }
-}
-
-/**
- * Test the accessibility attributes of the various message headers.
- *
- * XXX This test used to be after test_more_button_with_many_recipients,
- * however, there were some accessibility changes that it didn't seem to play
- * nicely with, and the toggling of the "more" button on the cc field was
- * causing this test to fail on the cc element. Tests with accessibilty
- * hardware/software showed that the code was working fine. Therefore the test
- * may be suspect.
- */
-function test_a11y_attrs() {
-  // skip this test on platforms that don't support accessibility
-  if (!("nsIAccessibleRole" in Components.interfaces))
-    return;
-
-  be_in_folder(folder);
-
-  // select and open the first message
-  let curMessage = select_click_row(0);
-
-  // make sure it loads
-  wait_for_message_display_completion(mc);
-  assert_selected_and_displayed(mc, curMessage);
-
-  headersToTest.forEach(verify_header_a11y);
-}
-
-function test_more_button_with_many_recipients()
-{
-  // Start on the interesting message.
-  let curMessage = select_click_row(0);
-
-  // make sure it loads
-  wait_for_message_display_completion(mc);
-  assert_selected_and_displayed(mc, curMessage);
-
-  // Check the mode of the header.
-  let headerBox = mc.eid("expandedHeaderView");
-  let previousHeaderMode = headerBox.node.getAttribute("show_header_mode");
-
-  // Click the "more" button.
-  let moreIndicator = mc.eid("expandedccBox");
-  moreIndicator = mc.window.document.getAnonymousElementByAttribute(
-                    moreIndicator.node, "anonid", "more");
-  moreIndicator = new elementslib.Elem(moreIndicator);
-  mc.click(moreIndicator);
-
-  // Check the new mode of the header.
-  if (headerBox.node.getAttribute("show_header_mode") != "all")
-    throw new Error("Header Mode didn't change to 'all'!  " + "old=" +
-                    previousHeaderMode + ", new=" +
-                    headerBox.node.getAttribute("show_header_mode"));
-
-  // Switch to the boring message, to force the more button to collapse.
-  curMessage = select_click_row(1);
-
-  // make sure it loads
-  wait_for_message_display_completion(mc);
-  assert_selected_and_displayed(mc, curMessage);
-
-  // Check the even newer mode of the header.
-  if (headerBox.node.getAttribute("show_header_mode") != previousHeaderMode)
-    throw new Error("Header Mode changed from " + previousHeaderMode +
-                    " to " + headerBox.node.getAttribute("show_header_mode") +
-                    " and didn't change back.");
-}
-
-/**
- * Test that we can open up the inline contact editor when we
- * click on the star.
- */
-function test_clicking_star_opens_inline_contact_editor()
-{
-  // Make sure we're in the right folder
-  be_in_folder(folder);
-
-  // Add a new message
-  let msg = create_message();
-  add_message_to_folder(folder, msg);
-
-  // Open the latest message
-  let curMessage = select_click_row(-1);
-  // Make sure the star is clicked, and we add the
-  // new contact to our address book
-  let toDescription = mc.a('expandedtoBox', {class: "headerValue"});
-
-  // Ensure that the inline contact editing panel is not open
-  let contactPanel = mc.eid('editContactPanel').getNode();
-  assert_not_equals(contactPanel.state, "open");
-  subtest_more_widget_star_click(toDescription);
-
-  // Ok, if we're here, then the star has been clicked, and
-  // the contact has been added to our AB.
-  let addrs = toDescription.getElementsByTagName('mail-emailaddress');
-  let lastAddr = addrs[addrs.length-1];
-
-  // Click on the star, and ensure that the inline contact
-  // editing panel opens
-  mc.click(mc.aid(lastAddr, {class: 'emailStar'}));
-  assert_equals(contactPanel.state, "open");
-  contactPanel.hidePopup();
-}
-
-/**
- * Test that if a contact belongs to a mailing list within their
- * address book, then the inline contact editor will not allow
- * the user to change what address book the contact belongs to.
- * The editor should also show a message to explain why the
- * contact cannot be moved.
- */
-function test_address_book_switch_disabled_on_contact_in_mailing_list()
-{
-  const MAILING_LIST_DIRNAME = "Some Mailing List";
-  const ADDRESS_BOOK_NAME = "Some Address Book";
-  // Add a new message
-  let msg = create_message();
-  add_message_to_folder(folder, msg);
-
-  // Make sure we're in the right folder
-  be_in_folder(folder);
-
-  // Open the latest message
-  let curMessage = select_click_row(-1);
-
-  // Make sure the star is clicked, and we add the
-  // new contact to our address book
-  let toDescription = mc.a('expandedtoBox', {class: "headerValue"});
-
-  // Ensure that the inline contact editing panel is not open
-  let contactPanel = mc.eid('editContactPanel').getNode();
-  assert_not_equals(contactPanel.state, "open");
-
-  subtest_more_widget_star_click(toDescription);
-
-  // Ok, if we're here, then the star has been clicked, and
-  // the contact has been added to our AB.
-  let addrs = toDescription.getElementsByTagName('mail-emailaddress');
-  let lastAddr = addrs[addrs.length-1];
-
-  // Click on the star, and ensure that the inline contact
-  // editing panel opens
-  mc.click(mc.aid(lastAddr, {class: 'emailStar'}));
-  assert_equals(contactPanel.state, "open");
-
-  let abDrop = mc.eid('editContactAddressBookList').getNode();
-  let warningMsg = mc.eid('contactMoveDisabledText').getNode();
-
-  // Ensure that the address book dropdown is not disabled
-  assert_true(!abDrop.disabled);
-  // We should not be displaying any warning
-  assert_true(warningMsg.collapsed);
-
-  // Now close the popup
-  contactPanel.hidePopup();
-
-  // For the contact that was added, create a mailing list in the
-  // address book it resides in, and then add that contact to the
-  // mailing list
-  addrs = toDescription.getElementsByTagName('mail-emailaddress');
-  let targetAddr = addrs[addrs.length-1].getAttribute("emailAddress");
-
-  let cards = get_cards_in_all_address_books_for_email(targetAddr);
-
-  // There should be only one copy of this email address
-  // in the address books.
-  assert_equals(cards.length, 1);
-  let card = cards[0];
-
-  // Remove the card from any of the address books
-  ensure_no_card_exists(targetAddr);
-
-  // Add the card to a new address book, and insert it
-  // into a mailing list under that address book
-  let ab = create_mork_address_book(ADDRESS_BOOK_NAME);
-  ab.dropCard(card, false);
-  let ml = create_mailing_list(MAILING_LIST_DIRNAME);
-  ab.addMailList(ml);
-
-  // Now we have to retrieve the mailing list from
-  // the address book, in order for us to add and
-  // delete cards from it.
-  ml = get_mailing_list_from_address_book(ab, MAILING_LIST_DIRNAME);
-
-  ml.addressLists.appendElement(card, false);
-
-  // Re-open the inline contact editing panel
-  mc.click(mc.aid(lastAddr, {class: 'emailStar'}));
-  assert_equals(contactPanel.state, "open");
-
-  // The dropdown should be disabled now
-  assert_true(abDrop.disabled);
-  // We should be displaying a warning
-  assert_true(!warningMsg.collapsed);
-
-  contactPanel.hidePopup();
-
-  // And if we remove the contact from the mailing list, the
-  // warning should be gone and the address book switching
-  // menu re-enabled.
-
-  let cardArray = Cc["@mozilla.org/array;1"]
-                  .createInstance(Ci.nsIMutableArray);
-  cardArray.appendElement(card, false);
-  ml.deleteCards(cardArray);
-
-  // Re-open the inline contact editing panel
-  mc.click(mc.aid(lastAddr, {class: 'emailStar'}));
-  assert_equals(contactPanel.state, "open");
-
-  // Ensure that the address book dropdown is not disabled
-  assert_true(!abDrop.disabled);
-  // We should not be displaying any warning
-  assert_true(warningMsg.collapsed);
-
-  contactPanel.hidePopup();
-}
-
-/**
- * Test that clicking the adding an address node adds it to the address book.
- */
-function test_add_contact_from_context_menu() {
-  // Click the contact to show the emailAddressPopup popup menu.
-  mc.click(mc.aid("expandedfromBox", {tagName: "mail-emailaddress"}));
-
-  var addToAddressBookItem = mc.window.document.getElementById("addToAddressBookItem");
-  if (addToAddressBookItem.hidden)
-    throw new Error("addToAddressBookItem is hidden for unknown contact");
-  var editContactItem = mc.window.document.getElementById("editContactItem");
-  if (!editContactItem.getAttribute("hidden"))
-    throw new Error("editContactItem is NOT hidden for unknown contact");
-
-  // Click the Add to Address Book context menu entry.
-  mc.click(mc.eid("addToAddressBookItem"));
-  // (for reasons unknown, the pop-up does not close itself)
-  close_popup(mc, mc.eid("emailAddressPopup"));
-
-  // Now click the contact again, the context menu should now show the
-  // Edit Contact menu instead.
-  mc.click(mc.aid("expandedfromBox", {tagName: "mail-emailaddress"}));
-  // (for reasons unknown, the pop-up does not close itself)
-  close_popup(mc, mc.eid("emailAddressPopup"));
-
-  addToAddressBookItem = mc.window.document.getElementById("addToAddressBookItem");
-  if (!addToAddressBookItem.hidden)
-    throw new Error("addToAddressBookItem is NOT hidden for known contact");
-  editContactItem = mc.window.document.getElementById("editContactItem");
-  if (editContactItem.hidden)
-    throw new Error("editContactItem is hidden for known contact");
-}
-
-function test_that_msg_without_date_clears_previous_headers() {
-  be_in_folder(folder);
-
-  // create a message
-  let msg = create_message();
-
-  // ensure that this message doesn't have a Date header
-  delete msg.headers.Date;
-
-  // this will add the message to the end of the folder
-  add_message_to_folder(folder, msg);
-
-  // select and open the first message
-  let curMessage = select_click_row(0);
-
-  // make sure it loads
-  wait_for_message_display_completion(mc);
-  assert_selected_and_displayed(mc, curMessage);
-
-  // Since we didn't give create_message an argument that would create a
-  // Newsgroups header, the newsgroups <row> element should be collapsed.
-  // However, since the previously displayed message _did_ have such a header,
-  // certain bugs in the display of this header could cause the collapse
-  // never to have happened.
-  if (mc.e("expandednewsgroupsRow").collapsed != true) {
-    throw new Error("Expected <row> elemnent for Newsgroups header to be " +
-                    "collapsed, but it wasn't\n!");
-  }
-}
-
-/**
- * Test various aspects of the (n more) widgetry.
- */
-function test_more_widget() {
-  // generate message with 35 recips (effectively guarantees overflow for n=3)
-  be_in_folder(folder);
-  let msg = create_message({toCount: 35});
-
-  // add the message to the end of the folder
-  add_message_to_folder(folder, msg);
-
-  // select and open the last message
-  let curMessage = select_click_row(-1);
-
-  // make sure it loads
-  wait_for_message_display_completion(mc);
-  assert_selected_and_displayed(mc, curMessage);
-
-  // get the description element containing the addresses
-  let toDescription = mc.a('expandedtoBox', {class: "headerValue"});
-
-  subtest_more_widget_display(toDescription);
-  subtest_more_widget_click(toDescription);
-  subtest_more_widget_star_click(toDescription);
-}
-
-/**
- * Test that all addresses are shown in show all header mode
- */
-function test_show_all_header_mode() {
-  // generate message with 35 recips (effectively guarantees overflow for n=3)
-  be_in_folder(folder);
-  let msg = create_message({toCount: 35});
-
-  // add the message to the end of the folder
-  add_message_to_folder(folder, msg);
-
-  // select and open the last message
-  let curMessage = select_click_row(-1);
-
-  // make sure it loads
-  wait_for_message_display_completion(mc);
-  assert_selected_and_displayed(mc, curMessage);
-
-  // get the description element containing the addresses
-  let toDescription = mc.a('expandedtoBox', {class: "headerValue"});
-
-  change_to_header_normal_mode();
-  subtest_more_widget_display(toDescription);
-  subtest_change_to_all_header_mode(toDescription);
-  change_to_header_normal_mode();
-  subtest_more_widget_click(toDescription);
-}
-
-function change_to_header_normal_mode() {
-  // XXX Clicking on check menu items doesn't work in 1.4.1b1 (bug 474486)...
-  //  mc.click(new elib.Elem(mc.menus.View.viewheadersmenu.viewnormalheaders));
-  // ... so call the function instead.
-  mc.window.MsgViewNormalHeaders();
-  mc.sleep(0);
-}
-
-function change_to_all_header_mode() {
-  // XXX Clicking on check menu items doesn't work in 1.4.1b1 (bug 474486)...
-  //  mc.click(new elib.Elem(mc.menus.View.viewheadersmenu.viewallheaders));
-  // ... so call the function instead.
-  mc.window.MsgViewAllHeaders();
-  mc.sleep(0);
-}
-
-/**
- * Get the number of lines in one of the multi-address fields
- * @param node the description element containing the addresses
- * @return the number of lines
- */
-function help_get_num_lines(node) {
-  let style = mc.window.getComputedStyle(node, null);
-  return style.height / style.lineHeight;
-}
-
-/**
- * Test that the "more" widget displays when it should.
- * @param toDescription the description node for the "to" field
- */
-function subtest_more_widget_display(toDescription) {
-  // test that the to element doesn't have more than max lines
-  let numLines = help_get_num_lines(toDescription);
-
-  // get maxline pref
-  let prefBranch = Cc["@mozilla.org/preferences-service;1"]
-    .getService(Ci.nsIPrefService).getBranch(null);
-  let maxLines = prefBranch.getIntPref(
-    "mailnews.headers.show_n_lines_before_more");
-
-  // allow for a 15% tolerance for any padding that may be applied
-  if (numLines < 0.85*maxLines || numLines > 1.15*maxLines) {
-    throw new Error("expected == " + maxLines + "lines; found " + numLines);
-  }
-
-  // test that we've got a (more) node and that it's expanded
-  let moreNode = mc.a('expandedtoBox', {class: 'moreIndicator'});
-  if (!moreNode) {
-    throw new Error("more node not found before activation");
-  }
-  if (moreNode.collapsed) {
-    throw new Error("more node was collapsed when it should have been visible");
-  }
-}
-
-/**
- * Test that clicking the "more" widget displays all the addresses.
- * @param toDescription the description node for the "to" field
- */
-function subtest_more_widget_click(toDescription) {
-  let oldNumLines = help_get_num_lines(toDescription);
-
-  // activate (n more)
-  let moreNode = mc.aid('expandedtoBox', {class: 'moreIndicator'});
-  mc.click(moreNode);
-
-  // test that (n more) is gone
-  moreNode = mc.a('expandedtoBox', {class: 'moreIndicator'});
-  if (!moreNode.collapsed) {
-    throw new Error("more node should be collapsed after activation");
-  }
-
-  // test that we actually have more lines than we did before!
-  let newNumLines = help_get_num_lines(toDescription);
-  if (newNumLines <= oldNumLines) {
-    throw new Error("number of address lines present after more clicked = " +
-      newNumLines + "<= number of lines present beforehand = " + oldNumLines);
-  }
-}
-
-/**
- * Test that changing to all header lines mode displays all the addresses.
- * @param toDescription the description node for the "to" field
- */
-function subtest_change_to_all_header_mode(toDescription) {
-  let oldNumLines = help_get_num_lines(toDescription);
-
-  change_to_all_header_mode();
-  // test that (n more) is gone
-  let moreNode = mc.a('expandedtoBox', {class: 'moreIndicator'});
-  if (!moreNode.collapsed) {
-    throw new Error("more node should be collapsed in all header lines mode");
-  }
-
-  // test that we actually have more lines than we did before!
-  let newNumLines = help_get_num_lines(toDescription);
-  if (newNumLines <= oldNumLines) {
-    throw new Error("number of address lines present in all header lines mode = " +
-      newNumLines + "<= number of lines present beforehand = " + oldNumLines);
-  }
-}
-
-/**
- * Test that clicking the star updates the UI properly (see bug 563612).
- * @param toDescription the description node for the "to" field
- */
-function subtest_more_widget_star_click(toDescription) {
-  let addrs = toDescription.getElementsByTagName('mail-emailaddress');
-  let lastAddr = addrs[addrs.length-1];
-  ensure_no_card_exists(lastAddr.getAttribute("emailAddress"));
-
-  // scroll to the bottom first so the address is in view
-  let view = mc.e('expandedHeaderView');
-  view.scrollTop = view.scrollHeight - view.clientHeight;
-
-  mc.click(mc.aid(lastAddr, {class: 'emailStar'}));
-  if (lastAddr.getAttribute('hascard') == 'false') {
-    throw new Error("address not updated after clicking star");
-  }
-}
-
-/**
- * Make sure the (more) widget hidden pref actually works with a
- * non-default value.
- */
-function test_more_widget_with_maxlines_of_3(){
-
-  // set maxLines to 3
-  let prefBranch = Cc["@mozilla.org/preferences-service;1"]
-    .getService(Ci.nsIPrefService).getBranch(null);
-  let maxLines = prefBranch.setIntPref(
-    "mailnews.headers.show_n_lines_before_more", 3);
-
-  // call test_more_widget again
-  test_more_widget();
-}
-
-/**
- * Make sure the (more) widget hidden pref also works with an
- * "all" (0) non-default value.
- */
-function test_more_widget_with_disabled_more(){
-
-  // set maxLines to 0
-  let prefBranch = Cc["@mozilla.org/preferences-service;1"]
-    .getService(Ci.nsIPrefService).getBranch(null);
-  let maxLines = prefBranch.setIntPref(
-    "mailnews.headers.show_n_lines_before_more", 0);
-
-  // generate message with 35 recips (effectively guarantees overflow for n=3)
-  be_in_folder(folder);
-  let msg = create_message({toCount: 35});
-
-  // add the message to the end of the folder
-  add_message_to_folder(folder, msg);
-
-  // select and open the last message
-  let curMessage = select_click_row(-1);
-
-  // make sure it loads
-  wait_for_message_display_completion(mc);
-  assert_selected_and_displayed(mc, curMessage);
-
-  // test that (n more) is gone
-  let moreNode = mc.a('expandedtoBox', {class: 'moreIndicator'});
-  if (!moreNode.collapsed) {
-    throw new Error("more node should be collapsed in n=0 case");
-  }
-
-  // get the description element containing the addresses
-  let toDescription = mc.a('expandedtoBox', {class: "headerValue"});
-
-  // test that we actually have more lines than the 3 we know are filled
-  let newNumLines = help_get_num_lines(toDescription);
-  if (newNumLines <= 3) {
-    throw new Error("number of address lines present in all addresses mode = " +
-      newNumLines + "<= number of expected minimum of 3 lines filled");
-  }
-}
-
-/**
- * When the window gets too narrow the toolbar should float above the From
- *  line.  Then they need to return back to the right when we get large
- *  enough again.
- */
-function test_toolbar_collapse_and_expand() {
-  be_in_folder(folder);
-  // Select and open a message, in this case the last, for no particular reason.
-  let curMessage = select_click_row(-1);
-
-  try {
-    let expandedHeadersTopBox = mc.e("expandedHeadersTopBox");
-    let toolbar = mc.e("header-view-toolbar");
-    let mode = toolbar.getAttribute("mode");
-
-    // Get really big, so that we can figure out how big we actually want to be.
-    mc.window.resizeTo(1200, 600);
-    // spin the event loop once
-    mc.sleep(0);
-
-    let folderPaneWidth = mc.e("folderPaneBox").clientWidth;
-    let fromWidth = mc.e("expandedfromRow").clientWidth;
-
-    // This is the biggest we need to be.
-    let bigWidth = folderPaneWidth + fromWidth + toolbar.clientWidth;
-
-    // Now change to icons-only mode for a much smaller toolbar.
-    toolbar.setAttribute("mode", "icons");
-    let smallWidth = folderPaneWidth + fromWidth + toolbar.clientWidth;
-
-    // Re-set the mode to its original value.
-    toolbar.setAttribute("mode", mode);
-
-    // And resize to half way between the big and small widths, so that we
-    //  can toggle the mode to force the overflow.
-    mc.window.resizeTo((bigWidth + smallWidth) / 2, 600);
-    // spin the event loop once
-    mc.sleep(0);
-
-    // Make sure we are too small to contain the buttons and from line, so
-    //  we will be tall.
-    let tallHeight = expandedHeadersTopBox.clientHeight;
-
-    // Change from icons and text to just icons to make our toolbar
-    //  narrower, and by extension our header shorter.
-    toolbar.setAttribute("mode", "icons");
-
-    let shortHeight = expandedHeadersTopBox.clientHeight;
-    if (shortHeight >= tallHeight)
-      throw new Error("The header box should have been made smaller!");
-
-    // Change back to icons and text to make our toolbar wider and our
-    //   header taller again.
-    toolbar.setAttribute("mode", mode);
-    if (expandedHeadersTopBox.clientHeight != tallHeight)
-      throw new Error("The header box should have returned to its original size!");
-
-    // And make our window big to achieve the same effect as the just icons mode.
-    mc.window.resizeTo(1200, 600);
-    // spin the event loop once
-    mc.sleep(0);
-    if (expandedHeadersTopBox.clientHeight != shortHeight)
-      throw new Error("The header box should have returned to its wide size!");
-  }
-  finally {
-    // restore window to nominal dimensions; saving was not working out
-    //  See also: quick-filter-bar/test-display-issues.js if we change the
-    //            default window size.
-    mc.window.resizeTo(1024, 768);
-  }
-}
diff --git a/test/compactheader/test-more-button.js b/test/compactheader/test-more-button.js
new file mode 100644
index 0000000..bc47e84
--- /dev/null
+++ b/test/compactheader/test-more-button.js
@@ -0,0 +1,158 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ *   Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Thunderbird Mail Client.
+ *
+ * The Initial Developer of the Original Code is
+ * the Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Joachim Herb <Joachim.Herb at gmx.de>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var MODULE_NAME = 'test-compactheader-preferences';
+
+var RELATIVE_ROOT = '../shared-modules';
+var MODULE_REQUIRES = ['folder-display-helpers', 'window-helpers',
+                       'address-book-helpers', 'mouse-event-helpers',
+                       'compactheader-helpers'];
+
+var elib = {};
+Cu.import('resource://mozmill/modules/elementslib.js', elib);
+var controller = {};
+Cu.import('resource://mozmill/modules/controller.js', controller);
+
+// The WindowHelper module
+var WindowHelper;
+
+var folder1;
+
+var prefBranch = Cc["@mozilla.org/preferences-service;1"]
+                    .getService(Ci.nsIPrefService).getBranch(null);
+
+function setupModule(module) {
+  let fdh = collector.getModule('folder-display-helpers');
+  fdh.installInto(module);
+  WindowHelper = collector.getModule('window-helpers');
+  WindowHelper.installInto(module);
+  let abh = collector.getModule('address-book-helpers');
+  abh.installInto(module);
+  let meh = collector.getModule('mouse-event-helpers');
+  meh.installInto(module);
+  let meh = collector.getModule('mouse-event-helpers');
+  meh.installInto(module);
+  let chh = collector.getModule('compactheader-helpers');
+  chh.installInto(module);
+
+  folder1 = create_folder("testMoreButton");
+
+  let msg = create_message({cc: msgGen.makeNamesAndAddresses(10),
+    to: msgGen.makeNamesAndAddresses(10)
+  });
+
+  add_message_to_folder(folder1, msg);
+  let msg2 = create_message({cc: msgGen.makeNamesAndAddresses(10),
+    to: msgGen.makeNamesAndAddresses(10)
+  });
+  add_message_to_folder(folder1, msg2);
+
+  prefBranch.clearUserPref("mailnews.headers.show_n_lines_before_more");
+}
+
+function test_click_more(){
+  select_message_in_folder(folder1, 1, mc);
+  select_message_in_folder(folder1, 0, mc);
+  open_preferences_dialog(mc, set_preferences_twoline);
+  mc.sleep(10);
+  collapse_and_assert_header(mc);
+
+  // Click the "more" button.
+  let L2Box = mc.e("CompactHeader_collapsed2LtoCcBccBox");
+  let moreIndicator = mc.window.document.getAnonymousElementByAttribute(
+    L2Box, "anonid", "more");
+  moreIndicator = new elementslib.Elem(moreIndicator);
+  if (moreIndicator) {
+    mc.click(moreIndicator);
+  }
+
+  assert_expanded(mc);
+
+  let expandedToBox = mc.e("expandedtoBox");
+  let expandedCCBox = mc.e("expandedccBox");
+  let expandedBCCBox = mc.e("expandedbccBox");
+  let eTOmoreIndicator = mc.window.document.getAnonymousElementByAttribute(
+      expandedToBox, "anonid", "more");
+  let eCCmoreIndicator = mc.window.document.getAnonymousElementByAttribute(
+      expandedCCBox, "anonid", "more");
+  let eBCCmoreIndicator = mc.window.document.getAnonymousElementByAttribute(
+      expandedBCCBox, "anonid", "more");
+
+  assert_equals(eTOmoreIndicator.getAttribute("collapsed"), "true");
+  assert_equals(eCCmoreIndicator.getAttribute("collapsed"), "true");
+  assert_equals(eBCCmoreIndicator.getAttribute("collapsed"), "true");
+}
+
+function test_more_tooltip(){
+  select_message_in_folder(folder1, 0, mc);
+  let msg = select_message_in_folder(folder1, 1, mc);
+  open_preferences_dialog(mc, set_preferences_twoline);
+  mc.sleep(10);
+  collapse_and_assert_header(mc);
+
+  // Click the "more" button.
+  let moreIndicator = mc.eid("CompactHeader_collapsed2LtoCcBccBox");
+  moreIndicator = mc.window.document.getAnonymousElementByAttribute(
+                    moreIndicator.node, "anonid", "more");
+
+  let tooltiptext = moreIndicator.getAttribute("tooltiptext");
+
+  let headerParser = Cc["@mozilla.org/messenger/headerparser;1"]
+                        .getService(Ci.nsIMsgHeaderParser);
+  let addresses = {};
+  let fullNames = {};
+  let names = {};
+  let numAddresses = headerParser.parseHeadersWithArray(
+    msg.ccList, addresses, names, fullNames);
+
+  for (let i = 0; i < numAddresses; i++)
+  {
+    assert_true(tooltiptext.indexOf(fullNames.value[i]) != -1, fullNames.value[i]);
+  }
+
+  addresses = {};
+  fullNames = {};
+  names = {};
+  numAddresses = headerParser.parseHeadersWithArray(
+    msg.recipients, addresses, names, fullNames);
+
+  for (let i = 0; i < numAddresses; i++)
+  {
+    assert_true(tooltiptext.indexOf(fullNames.value[i]) != -1, fullNames.value[i]);
+  }
+}
+
diff --git a/test/executeTests.pl b/test/executeTests.pl
index 84a1b01..8291e5c 100644
--- a/test/executeTests.pl
+++ b/test/executeTests.pl
@@ -210,6 +210,8 @@ foreach my $pid (@children) {
     $python = "python"
   }
 
+  # We have own tests for this, so delete it
+  unlink("message-header/test-header-toolbar.js");
   my @compatibility_apps = (
     glob("../../ftp//$ostype-$hosttype-$version/lightning*.xpi"),
     "../../$dispMUAfile"
@@ -217,6 +219,7 @@ foreach my $pid (@children) {
   my $comp_apps = join(",", @compatibility_apps);
 #    print "$python runtest.py --binary=../thunderbird/$appbin -a $xpi -t compactheader 2>&1\n";
   $log = $log . `$python runtest.py --binary=../thunderbird/$appbin -a $xpi -t compactheader 2>&1`;
+  $log = $log . `$python runtest.py --binary=../thunderbird/$appbin -a $xpi -t message-header 2>&1`;
   $log = $log . `$python runtest.py --binary=../thunderbird/$appbin -a $xpi -t folder-display 2>&1`;
   $log = $log . `$python runtest.py --binary=../thunderbird/$appbin -a $xpi,$comp_apps -t compactheader/test-compactheader-toolbar.js 2>&1`;
   $log = $log . `$python runtest.py --binary=../thunderbird/$appbin -a $xpi,$comp_apps -t compactheader/test-compactheader-preferences.js 2>&1`;
diff --git a/test/shared-modules/test-compactheader-helpers.js b/test/shared-modules/test-compactheader-helpers.js
index b35a467..6e3daa8 100644
--- a/test/shared-modules/test-compactheader-helpers.js
+++ b/test/shared-modules/test-compactheader-helpers.js
@@ -83,6 +83,10 @@ function installInto(module) {
   module.set_and_assert_toolbox_position = set_and_assert_toolbox_position;
   module.subtest_change_oneline = subtest_change_oneline;
   module.subtest_change_twoline = subtest_change_twoline;
+  module.set_preferences_twoline = set_preferences_twoline;
+  module.set_preferences_oneline = set_preferences_oneline;
+  module.assert_collapsed = assert_collapsed;
+  module.assert_expanded = assert_expanded;
 }
 
 function reopen_3pane_window() {
@@ -175,6 +179,12 @@ function collapse_and_assert_header(aController) {
   if (collapsedHeaderView.getAttribute("collapsed")) {
     aController.click(aController.eid("CompactHeader_hideDetailsButton"));
   }
+  assert_collapsed(aController);
+}
+
+function assert_collapsed(aController) {
+  let collapsedHeaderView = aController.e("CompactHeader_collapsedHeaderView");
+  let expandedHeaderView = aController.e("expandedHeaderView");
   folderDisplayHelper.assert_true(!collapsedHeaderView.hasAttribute("collapsed"));
   folderDisplayHelper.assert_true(expandedHeaderView.getAttribute("collapsed"));
 }
@@ -186,6 +196,12 @@ function expand_and_assert_header(aController) {
       !collapsedHeaderView.getAttribute("collapsed")) {
     aController.click(aController.eid("CompactHeader_showDetailsButton"));
   }
+  assert_expanded(aController);
+}
+
+function assert_expanded(aController) {
+  let collapsedHeaderView = aController.e("CompactHeader_collapsedHeaderView");
+  let expandedHeaderView = aController.e("expandedHeaderView");
   folderDisplayHelper.assert_true(collapsedHeaderView.getAttribute("collapsed"));
   folderDisplayHelper.assert_true(!expandedHeaderView.hasAttribute("collapsed"));
 }
@@ -383,3 +399,19 @@ function subtest_change_twoline(aController) {
   close_preferences_dialog(aController);
 }
 
+function set_preferences_twoline(aController) {
+  let checkboxCompactTwolineView = aController.eid("CompactHeader_checkboxCompactTwolineView");
+  if (!checkboxCompactTwolineView.node.getAttribute("checked")) {
+    aController.click(checkboxCompactTwolineView);
+  }
+  close_preferences_dialog(aController);
+}
+
+function set_preferences_oneline(aController) {
+  let checkboxCompactTwolineView = aController.eid("CompactHeader_checkboxCompactTwolineView");
+  if (checkboxCompactTwolineView.node.getAttribute("checked")) {
+    aController.click(checkboxCompactTwolineView);
+  }
+  close_preferences_dialog(aController);
+}
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/compactheader.git



More information about the Pkg-mozext-commits mailing list