Skip to content

Commit a6d7eeb

Browse files
committed
Inherit displayName.
1 parent c2283a8 commit a6d7eeb

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ let decoratorConstructor,
1515
*/
1616
functionConstructor = (Component, defaultStyles, options) => {
1717
return class extends Component {
18+
static displayName = Component.displayName;
19+
1820
render () {
1921
let renderResult,
2022
styles;

test/reactCssModules.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ import TestUtils from 'react-addons-test-utils';
77
import reactCssModules from './../src/index';
88

99
describe('reactCssModules', () => {
10+
context('a ReactComponent is decorated using react-css-modules', () => {
11+
it('inherits displayName', () => {
12+
let Foo;
13+
14+
Foo = class extends React.Component {
15+
static displayName = 'Foo';
16+
};
17+
18+
Foo = reactCssModules(Foo);
19+
20+
expect(Foo.displayName).to.equal('Foo');
21+
});
22+
});
1023
context('a ReactComponent renders an element with the styleName prop', () => {
1124
it('that element should contain the equivalent className', () => {
1225
let Foo,

0 commit comments

Comments
 (0)