Skip to content

Commit

Permalink
[Input] No focus state when read only
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Jul 1, 2018
1 parent aa8ee1a commit 15f53fd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 10 additions & 0 deletions docs/src/pages/demos/text-fields/TextFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ class TextFields extends React.Component {
autoComplete="current-password"
margin="normal"
/>
<TextField
id="read-only-input"
label="Read Only"
defaultValue="Hello World"
className={classes.textField}
margin="normal"
InputProps={{
readOnly: true,
}}
/>
<TextField
id="multiline-flexible"
label="Multiline"
Expand Down
8 changes: 4 additions & 4 deletions packages/material-ui/src/Input/Input.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,11 +470,11 @@ describe('<Input />', () => {

describe('prop: inputProps', () => {
it('should apply the props on the input', () => {
const wrapper = shallow(<Input inputProps={{ className: 'foo', readOnly: true }} />);
const wrapper = shallow(<Input inputProps={{ className: 'foo', maxLength: true }} />);
const input = wrapper.find('input');
assert.strictEqual(input.hasClass('foo'), true, 'should have the foo class');
assert.strictEqual(input.hasClass(classes.input), true, 'should still have the input class');
assert.strictEqual(input.props().readOnly, true, 'should have the readOnly prop');
assert.strictEqual(input.hasClass('foo'), true);
assert.strictEqual(input.hasClass(classes.input), true);
assert.strictEqual(input.props().maxLength, true);
});

it('should be able to get a ref', () => {
Expand Down

0 comments on commit 15f53fd

Please sign in to comment.