Skip to content

Commit

Permalink
Bug 1398727 - Fix missing tab title on devtools.panels.elements.creat…
Browse files Browse the repository at this point in the history
…eSidebarPane tabs. r=gl

MozReview-Commit-ID: G5F9uEC6izs

--HG--
extra : rebase_source : 1e34ddf1d2ee4fe5db7886d824c4279ffcbc7674
  • Loading branch information
rpl committed Sep 9, 2017
1 parent 00681c0 commit 86c4053
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ XPCOMUtils.defineLazyModuleGetter(this, "gDevTools",
XPCOMUtils.defineLazyModuleGetter(this, "devtools",
"resource://devtools/shared/Loader.jsm");

function isActiveSidebarTabTitle(inspector, expectedTabTitle, message) {
const actualTabTitle = inspector.panelDoc.querySelector(".tabs-menu-item.is-active").innerText;
is(actualTabTitle, expectedTabTitle, message);
}

add_task(async function test_devtools_panels_elements_sidebar() {
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "http://mochi.test:8888/");

Expand Down Expand Up @@ -70,6 +75,9 @@ add_task(async function test_devtools_panels_elements_sidebar() {

is(shownSidebarInstance, "sidebar1", "Got the shown event on the first extension sidebar");

isActiveSidebarTabTitle(inspector, "Test Sidebar 1",
"Got the expected title on the active sidebar tab");

const sidebarPanel1 = inspector.sidebar.getTabPanel(sidebarIds[0]);

ok(sidebarPanel1, "Got a rendered sidebar panel for the first registered extension sidebar");
Expand All @@ -94,6 +102,9 @@ add_task(async function test_devtools_panels_elements_sidebar() {
is(shownSidebarInstance2, "sidebar2", "Got the shown event on the second extension sidebar");
is(hiddenSidebarInstance1, "sidebar1", "Got the hidden event on the first extension sidebar");

isActiveSidebarTabTitle(inspector, "Test Sidebar 2",
"Got the expected title on the active sidebar tab");

const sidebarPanel2 = inspector.sidebar.getTabPanel(sidebarIds[1]);

ok(sidebarPanel2, "Got a rendered sidebar panel for the second registered extension sidebar");
Expand Down
1 change: 1 addition & 0 deletions devtools/client/inspector/extensions/extension-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class ExtensionSidebar {
this._provider = createElement(Provider, {
store: this.store,
key: this.id,
title: this.title,
}, ExtensionSidebarComponent({
id: this.id,
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ add_task(async function () {

is(sidebar.title, sidebarTitle,
"Got the expected title in the extension sidebar instance");
is(sidebar.provider.props.title, sidebarTitle,
"Got the expeted title in the provider props");

let inspectorStoreState = inspector.store.getState();

Expand Down

0 comments on commit 86c4053

Please sign in to comment.