Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DOM fixture for unmasking passwords #9269

Merged
merged 2 commits into from
Mar 30, 2017
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
1 change: 1 addition & 0 deletions fixtures/dom/src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const Header = React.createClass({
<option value="/range-inputs">Range Inputs</option>
<option value="/text-inputs">Text Inputs</option>
<option value="/number-inputs">Number Input</option>
<option value="/password-inputs">Password Input</option>
<option value="/selects">Selects</option>
<option value="/textareas">Textareas</option>
<option value="/input-change-events">Input change events</option>
Expand Down
5 changes: 4 additions & 1 deletion fixtures/dom/src/components/fixtures/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import TextInputFixtures from './text-inputs';
import SelectFixtures from './selects';
import TextAreaFixtures from './textareas';
import InputChangeEvents from './input-change-events';
import NumberInputFixtures from './number-inputs/';
import NumberInputFixtures from './number-inputs';
import PasswordInputFixtures from './password-inputs';
import ButtonFixtures from './buttons';

/**
Expand All @@ -26,6 +27,8 @@ const FixturesPage = React.createClass({
return <InputChangeEvents />;
case '/number-inputs':
return <NumberInputFixtures />;
case '/password-inputs':
return <PasswordInputFixtures />;
case '/buttons':
return <ButtonFixtures />
default:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const React = window.React;

import Fixture from '../../Fixture';

const PasswordTestCase = React.createClass({
getInitialState() {
return { value: '' };
},
onChange(event) {
this.setState({ value: event.target.value })
},
render() {
return (
<Fixture>
<div>{this.props.children}</div>

<div className="control-box">
<fieldset>
<legend>Controlled</legend>
<input type="password" value={this.state.value} onChange={this.onChange} />
<span className="hint"> Value: {JSON.stringify(this.state.value)}</span>
</fieldset>

<fieldset>
<legend>Uncontrolled</legend>
<input type="password" defaultValue="" />
</fieldset>
</div>
</Fixture>
);
},
});

export default PasswordTestCase;
33 changes: 33 additions & 0 deletions fixtures/dom/src/components/fixtures/password-inputs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const React = window.React;

import FixtureSet from '../../FixtureSet';
import TestCase from '../../TestCase';
import PasswordTestCase from './PasswordTestCase'

const NumberInputs = React.createClass({
render() {
return (
<FixtureSet title="Password inputs" description="">
<TestCase
title="The show password icon"
description={`
Some browsers have an unmask password icon that React accidentally
prevents the display of.
`}
affectedBrowsers="IE Edge, IE 11">
<TestCase.Steps>
<li>Type any string (not an actual password</li>
</TestCase.Steps>

<TestCase.ExpectedResult>
The field should include the "unmasking password" icon.
</TestCase.ExpectedResult>

<PasswordTestCase />
</TestCase>
</FixtureSet>
);
},
});

export default NumberInputs;