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

Commit

Permalink
Merge pull request #74 from juliandescottes/window-title
Browse files Browse the repository at this point in the history
allow window rep title customization from grip
  • Loading branch information
nchevobbe authored Feb 14, 2017
2 parents 2e7621c + 2e4dfd6 commit 5aa76f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
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

0 comments on commit 5aa76f5

Please sign in to comment.