summaryrefslogtreecommitdiffstats
path: root/comm/mail/test/browser/shared-modules/PrefTabHelpers.jsm
diff options
context:
space:
mode:
Diffstat (limited to 'comm/mail/test/browser/shared-modules/PrefTabHelpers.jsm')
-rw-r--r--comm/mail/test/browser/shared-modules/PrefTabHelpers.jsm53
1 files changed, 53 insertions, 0 deletions
diff --git a/comm/mail/test/browser/shared-modules/PrefTabHelpers.jsm b/comm/mail/test/browser/shared-modules/PrefTabHelpers.jsm
new file mode 100644
index 0000000000..9f56fd2c25
--- /dev/null
+++ b/comm/mail/test/browser/shared-modules/PrefTabHelpers.jsm
@@ -0,0 +1,53 @@
+/* -*- Mode: JavaScript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/*
+ * Helpers to deal with the preferences tab.
+ */
+
+"use strict";
+
+const EXPORTED_SYMBOLS = ["close_pref_tab", "open_pref_tab"];
+
+var utils = ChromeUtils.import("resource://testing-common/mozmill/utils.jsm");
+
+var fdh = ChromeUtils.import(
+ "resource://testing-common/mozmill/FolderDisplayHelpers.jsm"
+);
+var cth = ChromeUtils.import(
+ "resource://testing-common/mozmill/ContentTabHelpers.jsm"
+);
+
+/**
+ * Open the preferences tab with the given pane displayed. The pane needs to
+ * be one of the prefpane ids in mail/components/preferences/preferences.xhtml.
+ *
+ * @param aPaneID The ID of the pref pane to display (see
+ * mail/components/preferences/preferences.xhtml for valid IDs.)
+ */
+function open_pref_tab(aPaneID, aScrollTo) {
+ let tab = cth.open_content_tab_with_click(
+ function () {
+ fdh.mc.window.openOptionsDialog(aPaneID, aScrollTo);
+ },
+ "about:preferences",
+ fdh.mc,
+ "preferencesTab"
+ );
+ utils.waitFor(
+ () => tab.browser.contentWindow.gLastCategory.category == aPaneID,
+ "Timed out waiting for prefpane " + aPaneID + " to load."
+ );
+ return tab;
+}
+
+/**
+ * Close the preferences tab.
+ *
+ * @param aTab The content tab to close.
+ */
+function close_pref_tab(aTab) {
+ fdh.mc.window.document.getElementById("tabmail").closeTab(aTab);
+}