diff --git a/components/Dropdown.js b/components/Dropdown.js index 04d66a8..a019845 100644 --- a/components/Dropdown.js +++ b/components/Dropdown.js @@ -334,7 +334,7 @@ function (_React$Component) { var toggleContentComponent = this.getToggleContentComponent(); var Component = attrs.href ? 'a' : 'div'; return (// TODO: Fix a11y - // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions + // eslint-disable-next-line jsx-a11y/click-events-have-key-events React.createElement(Component, _extends({ onClick: onClick, className: fullClassName @@ -604,9 +604,7 @@ Dropdown.defaultProps = { isLevel2: false, isActive: false, toggleClassName: '', - toggleAttrs: { - href: '' - }, + toggleAttrs: {}, isStickedToParent: false, onClose: null }; diff --git a/components/Input.js b/components/Input.js index 5cad756..b153c1c 100644 --- a/components/Input.js +++ b/components/Input.js @@ -373,6 +373,10 @@ function (_React$Component) { key: "componentDidMount", value: function componentDidMount() { this.autoFocus(); + + if (this.isAutoResize()) { + this.handleAutoResize(); + } } }, { key: "componentWillReceiveProps", @@ -519,11 +523,8 @@ function (_React$Component) { }, { key: "isAutoResize", value: function isAutoResize() { - var _this$props7 = this.props, - resize = _this$props7.resize, - disabled = _this$props7.disabled, - readonly = _this$props7.readonly; - return resize === 'auto' && !disabled && !readonly; + var resize = this.props.resize; + return resize === 'auto'; } }, { key: "autoFocus", diff --git a/docs/index.html b/docs/index.html index 513f32d..caf81f3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ -react-design-system
\ No newline at end of file +react-design-system
\ No newline at end of file diff --git a/source/components/Input/__snapshots__/input.spec.js.snap b/source/components/Input/__snapshots__/input.spec.js.snap index 60eab5b..bc8daf5 100644 --- a/source/components/Input/__snapshots__/input.spec.js.snap +++ b/source/components/Input/__snapshots__/input.spec.js.snap @@ -47,6 +47,11 @@ exports[`Input autoresizing works correctly 1`] = ` placeholder={null} readOnly={false} rows={2} + style={ + Object { + "height": "1px", + } + } tabIndex={0} value="This is some value" > diff --git a/source/components/Input/index.js b/source/components/Input/index.js index a4de027..c4f4461 100644 --- a/source/components/Input/index.js +++ b/source/components/Input/index.js @@ -141,6 +141,9 @@ export default class Input extends React.Component { componentDidMount() { this.autoFocus(); + if (this.isAutoResize()) { + this.handleAutoResize(); + } } componentWillReceiveProps(newProps) { @@ -329,9 +332,9 @@ export default class Input extends React.Component { } isAutoResize() { - const { resize, disabled, readonly } = this.props; + const { resize } = this.props; - return resize === 'auto' && !disabled && !readonly; + return resize === 'auto'; } autoFocus() { diff --git a/source/components/Input/input.spec.js b/source/components/Input/input.spec.js index b1ae9cd..e079ac1 100644 --- a/source/components/Input/input.spec.js +++ b/source/components/Input/input.spec.js @@ -262,15 +262,15 @@ test('Input doAutoResize works correctly', () => { /> ); - expect(autoResizeStub.callCount).toBe(0); + expect(autoResizeStub.callCount).toBe(1); component.find('textarea').simulate('input', { target: { value: 'This is value to test \n if autoresizing works' } }); - expect(autoResizeStub.callCount).toBe(1); + expect(autoResizeStub.callCount).toBe(2); component.find('textarea').simulate('input', { target: { value: 'This \n this \n again' } }); - expect(autoResizeStub.callCount).toBe(2); + expect(autoResizeStub.callCount).toBe(3); }); test('Input can fire all default callbacks', () => { diff --git a/source/package.json b/source/package.json index 3ab8185..e9af655 100644 --- a/source/package.json +++ b/source/package.json @@ -27,7 +27,7 @@ "styleguide:watch": "styleguidist server --config ./config/styleguide.config.js", "ci": "yarn lint && yarn test --runInBand", "test": "jest --config ./config/jest.config.js", - "test:update": "yarn test -u", + "test:update": "jest -u --config ./config/jest.config.js", "test:watch": "yarn test --watchAll --notify" }, "dependencies": {