Bug 1137141: extend Loop toolbarbutton tests to check for correct panel states upon opening. r=Standard8

This commit is contained in:
Mike de Boer 2015-02-27 12:25:20 +01:00
parent c9cfc21136
commit ebbe86df47

View File

@ -38,6 +38,8 @@ add_task(function* test_LoopUI_getters() {
yield loadLoopPanel();
Assert.ok(LoopUI.browser, "Browser element should be there");
Assert.strictEqual(LoopUI.selectedTab, "rooms", "Initially the rooms tab should be selected");
let panelTabs = LoopUI.browser.contentDocument.querySelectorAll(".tab-view > li");
Assert.strictEqual(panelTabs.length, 1, "Only one tab, 'rooms', should be visible");
// Hide the panel.
yield LoopUI.togglePanel();
@ -48,6 +50,12 @@ add_task(function* test_LoopUI_getters() {
MozLoopServiceInternal.fxAOAuthProfile = fxASampleProfile;
yield MozLoopServiceInternal.notifyStatusChanged("login");
yield LoopUI.togglePanel();
Assert.strictEqual(LoopUI.selectedTab, "rooms", "Rooms tab should still be selected");
panelTabs = LoopUI.browser.contentDocument.querySelectorAll(".tab-view > li");
Assert.strictEqual(panelTabs.length, 2, "Two tabs should be visible");
yield LoopUI.togglePanel();
// Programmatically select the contacts tab.
yield LoopUI.togglePanel(null, "contacts");
Assert.strictEqual(LoopUI.selectedTab, "contacts", "Contacts tab should be selected now");