summaryrefslogtreecommitdiffstats
path: root/comm/mail/test/browser/account/browser_accountHub.js
diff options
context:
space:
mode:
Diffstat (limited to 'comm/mail/test/browser/account/browser_accountHub.js')
-rw-r--r--comm/mail/test/browser/account/browser_accountHub.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/comm/mail/test/browser/account/browser_accountHub.js b/comm/mail/test/browser/account/browser_accountHub.js
new file mode 100644
index 0000000000..8fc459a666
--- /dev/null
+++ b/comm/mail/test/browser/account/browser_accountHub.js
@@ -0,0 +1,54 @@
+/* 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/. */
+
+"use strict";
+
+// TODO: Defer this for when the account hub replaces the account setup tab.
+// add_task(async function test_account_hub_opening_at_startup() {});
+
+add_task(async function test_account_hub_opening() {
+ // TODO: Use an actual button once it's implemented in the UI.
+ // Open the dialog.
+ await window.openAccountHub();
+
+ const hub = document.querySelector("account-hub-container");
+ await TestUtils.waitForCondition(
+ () => hub.modal,
+ "The dialog element was created"
+ );
+
+ const dialog = hub.shadowRoot.querySelector(".account-hub-dialog");
+ Assert.ok(dialog.open, "The dialog element was opened");
+
+ EventUtils.synthesizeKey("VK_ESCAPE", {}, window);
+ await TestUtils.waitForCondition(
+ () => !dialog.open,
+ "The dialog element was closed"
+ );
+
+ // Open the dialog again.
+ await window.openAccountHub();
+ Assert.ok(dialog.open, "The dialog element was opened");
+
+ // We already have a tinderbox account, so the default header should be
+ // visible and the welcome header should be hidden.
+ Assert.ok(
+ !hub.shadowRoot.querySelector("#defaultHeader").hidden,
+ "The #defaultHeader is visible"
+ );
+ Assert.ok(
+ hub.shadowRoot.querySelector("#welcomeHeader").hidden,
+ "The #welcomeHeader is hidden"
+ );
+
+ EventUtils.synthesizeMouseAtCenter(
+ hub.shadowRoot.querySelector("#closeButton"),
+ {},
+ window
+ );
+ await TestUtils.waitForCondition(
+ () => !dialog.open,
+ "The dialog element was closed"
+ );
+});