Skip to content
This repository was archived by the owner on Jan 21, 2019. It is now read-only.
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
6 changes: 2 additions & 4 deletions components/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -604,9 +604,7 @@ Dropdown.defaultProps = {
isLevel2: false,
isActive: false,
toggleClassName: '',
toggleAttrs: {
href: ''
},
toggleAttrs: {},
isStickedToParent: false,
onClose: null
};
Expand Down
11 changes: 6 additions & 5 deletions components/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ function (_React$Component) {
key: "componentDidMount",
value: function componentDidMount() {
this.autoFocus();

if (this.isAutoResize()) {
this.handleAutoResize();
}
}
}, {
key: "componentWillReceiveProps",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>react-design-system</title><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Rubik:400,700"></head><body><div id="rsg-root"></div><div id="app"></div><script src="build/bundle.46116394.js"></script></body></html>
<!DOCTYPE html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>react-design-system</title><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Rubik:400,700"></head><body><div id="rsg-root"></div><div id="app"></div><script src="build/bundle.85669204.js"></script></body></html>
5 changes: 5 additions & 0 deletions source/components/Input/__snapshots__/input.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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"
>
Expand Down
7 changes: 5 additions & 2 deletions source/components/Input/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ export default class Input extends React.Component {

componentDidMount() {
this.autoFocus();
if (this.isAutoResize()) {
this.handleAutoResize();
}
}

componentWillReceiveProps(newProps) {
Expand Down Expand Up @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions source/components/Input/input.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion source/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down