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

Fix #7099 #7251

Merged
merged 2 commits into from
Jul 13, 2016
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
3 changes: 3 additions & 0 deletions src/renderers/dom/client/wrappers/ReactDOMInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ var ReactDOMInput = {
// Make sure we set .type before any other properties (setting .value
// before .type means .value is lost in IE11 and below)
type: undefined,
// Make sure we set .step before .value (setting .value before .step
// means .value is rounded on mount, based upon step precision)
step: undefined,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment about why we're setting step as well.

}, DisabledInputUtils.getHostProps(inst, props), {
defaultChecked: undefined,
defaultValue: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ describe('ReactDOMInput', function() {
);
});

it('sets type before value always', function() {
it('sets type and step before value always', function() {
if (!ReactDOMFeatureFlags.useCreateElement) {
return;
}
Expand All @@ -749,12 +749,14 @@ describe('ReactDOMInput', function() {
return el;
});

ReactTestUtils.renderIntoDocument(<input value="hi" type="radio" />);
// Setting value before type does bad things. Make sure we set type first.
ReactTestUtils.renderIntoDocument(<input value="0" type="range" min="0" max="100" step="1" />);
expect(log).toEqual([
'set data-reactroot',
'set type',
'set step',
'set value',
'set min',
'set max',
'set value',
'set checked',
'set checked',
Expand Down