-
Notifications
You must be signed in to change notification settings - Fork 47.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't set empty placeholder to work around IE11 bug (#11177)
* Don't set empty placeholder to work around IE11 bug * Add fixture for textarea placeholders
- Loading branch information
Showing
2 changed files
with
45 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,47 @@ | ||
import FixtureSet from '../../FixtureSet'; | ||
import TestCase from '../../TestCase'; | ||
|
||
const React = window.React; | ||
|
||
class TextAreaFixtures extends React.Component { | ||
export default class TextAreaFixtures extends React.Component { | ||
state = {value: ''}; | ||
onChange = event => { | ||
this.setState({value: event.target.value}); | ||
}; | ||
render() { | ||
return ( | ||
<div> | ||
<form className="container"> | ||
<fieldset> | ||
<legend>Controlled</legend> | ||
<textarea value={this.state.value} onChange={this.onChange} /> | ||
</fieldset> | ||
|
||
<fieldset> | ||
<legend>Uncontrolled</legend> | ||
<textarea defaultValue="" /> | ||
</fieldset> | ||
</form> | ||
|
||
<div className="container"> | ||
<h4>Controlled Output:</h4> | ||
<div className="output"> | ||
{this.state.value} | ||
<FixtureSet title="Textareas"> | ||
<TestCase | ||
title="Kitchen Sink" | ||
description="Verify that the controlled textarea displays its value under 'Controlled Output', and that both textareas can be typed in"> | ||
<div> | ||
<form className="container"> | ||
<fieldset> | ||
<legend>Controlled</legend> | ||
<textarea value={this.state.value} onChange={this.onChange} /> | ||
</fieldset> | ||
<fieldset> | ||
<legend>Uncontrolled</legend> | ||
<textarea defaultValue="" /> | ||
</fieldset> | ||
</form> | ||
<div className="container"> | ||
<h4>Controlled Output:</h4> | ||
<div className="output"> | ||
{this.state.value} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</TestCase> | ||
<TestCase title="Placeholders"> | ||
<TestCase.ExpectedResult> | ||
The textarea should be rendered with the placeholder "Hello, world" | ||
</TestCase.ExpectedResult> | ||
<div style={{margin: '10px 0px'}}> | ||
<textarea placeholder="Hello, world" /> | ||
</div> | ||
</TestCase> | ||
</FixtureSet> | ||
); | ||
} | ||
} | ||
|
||
module.exports = TextAreaFixtures; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters