diff --git a/component.js b/component.js index 295bf79..ba440e9 100644 --- a/component.js +++ b/component.js @@ -304,9 +304,7 @@ function factory (initialOptions) { create = assign(create, methodStatics); } - create.type = Component; - - return create; + return assign(create, Component, { type: Component }); } } diff --git a/tests/component-test.js b/tests/component-test.js index 285efbd..6bacc76 100644 --- a/tests/component-test.js +++ b/tests/component-test.js @@ -643,6 +643,24 @@ describe('component', function () { Creator.type.should.equal(Type); }); + + it('will pass default props', function () { + var expectedPropValue = 'default-prop-value'; + + var lifecycleMethods = { + getDefaultProps: function () { + return { direction: expectedPropValue }; + } + }; + var Component = component(lifecycleMethods, function (props) { + should.equal(props.direction, expectedPropValue); + this.props.direction.should.equal(expectedPropValue); + return DOM.div(); + }); + + render(Component()); + render(React.createElement(Component)); // jsx + }); }); describe('should not re-render', function () {