Skip to content
This repository has been archived by the owner on May 2, 2018. It is now read-only.

allow window rep title customization from grip #74

Merged
merged 1 commit into from
Feb 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/reps/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ let Window = React.createClass({
mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])),
object: React.PropTypes.object.isRequired,
objectLink: React.PropTypes.func,
title: React.PropTypes.string,
},

getTitle: function (object) {
let title = this.props.title || object.class || "Window";
let title = object.displayClass || object.class || "Window";
if (this.props.objectLink) {
return DOM.span({className: "objectBox"},
this.props.objectLink({
Expand Down
17 changes: 8 additions & 9 deletions src/test/mochitest/test_reps_window.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,20 @@
is(longRenderedComponent.textContent, "Window about:newtab",
"Window rep has expected text content in LONG mode");

const customTitleRenderedComponent = renderComponent(Window.rep, {
object: gripStub,
const displayClassRenderedComponent = renderComponent(Window.rep, {
object: Object.assign({}, gripStub, {displayClass : "Custom"}),
mode: MODE.TINY,
title: "Custom"
});
is(customTitleRenderedComponent.textContent, "Custom",
"Window rep has expected text content in TINY mode with Custom title");
is(displayClassRenderedComponent.textContent, "Custom",
"Window rep has expected text content in TINY mode with Custom display class");

const customTitleLongRenderedComponent = renderComponent(Window.rep, {
object: gripStub,
const displayClassLongRenderedComponent = renderComponent(Window.rep, {
object: Object.assign({}, gripStub, {displayClass : "Custom"}),
mode: MODE.LONG,
title: "Custom"
});
is(customTitleLongRenderedComponent.textContent, "Custom about:newtab",
"Window rep has expected text content in LONG mode with Custom title");
is(displayClassLongRenderedComponent.textContent, "Custom about:newtab",
"Window rep has expected text content in LONG mode with Custom display class");
} catch(e) {
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
} finally {
Expand Down