Skip to content

Commit

Permalink
Fix #7099 (#7251)
Browse files Browse the repository at this point in the history
* Set step prop before value prop

* Embed comments on .step sequence behavior

(cherry picked from commit fc04310)
  • Loading branch information
troydemonbreun authored and zpao committed Jul 13, 2016
1 parent b1e1ccf commit 14e6a69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
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,
}, DisabledInputUtils.getHostProps(inst, props), {
defaultChecked: undefined,
defaultValue: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,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 @@ -740,12 +740,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

0 comments on commit 14e6a69

Please sign in to comment.