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 ReactDOMFiberSelect to set the initial values #8349

Merged
merged 1 commit into from Nov 18, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 0 additions & 17 deletions scripts/fiber/tests-failing.txt
Expand Up @@ -88,23 +88,6 @@ src/renderers/dom/shared/eventPlugins/__tests__/SimpleEventPlugin-test.js
src/renderers/dom/shared/wrappers/__tests__/ReactDOMInput-test.js
* should control a value in reentrant events

src/renderers/dom/shared/wrappers/__tests__/ReactDOMOption-test.js
* should allow ignoring `value` on option

src/renderers/dom/shared/wrappers/__tests__/ReactDOMSelect-test.js
* should allow setting `defaultValue`
* should not control when using `defaultValue`
* should allow setting `defaultValue` with multiple
* should allow setting `value`
* should allow setting `value` with multiple
* should not select other options automatically
* should allow setting `value` with `objectToString`
* should allow switching to multiple
* should allow switching from multiple
* should remember value when switching to uncontrolled
* should not control defaultValue if readding options
* should select grandchild options nested inside an optgroup

src/renderers/dom/stack/client/__tests__/ReactDOM-test.js
* throws in render() if the mount callback is not a function
* throws in render() if the update callback is not a function
Expand Down
13 changes: 13 additions & 0 deletions scripts/fiber/tests-passing.txt
Expand Up @@ -831,18 +831,31 @@ src/renderers/dom/shared/wrappers/__tests__/ReactDOMOption-test.js
* should ignore null/undefined/false children without warning
* should be able to use dangerouslySetInnerHTML on option
* should set attribute for empty value
* should allow ignoring `value` on option

src/renderers/dom/shared/wrappers/__tests__/ReactDOMSelect-test.js
* should allow setting `defaultValue`
* should not throw with `defaultValue` and without children
* should not control when using `defaultValue`
* should allow setting `defaultValue` with multiple
* should allow setting `value`
* should not throw with `value` and without children
* should allow setting `value` with multiple
* should not select other options automatically
* should reset child options selected when they are changed and `value` is set
* should allow setting `value` with `objectToString`
* should allow switching to multiple
* should allow switching from multiple
* should remember value when switching to uncontrolled
* should remember updated value when switching to uncontrolled
* should support server-side rendering
* should support server-side rendering with defaultValue
* should support server-side rendering with multiple
* should not control defaultValue if readding options
* should refresh state on change
* should warn if value and defaultValue props are specified
* should be able to safely remove select onChange
* should select grandchild options nested inside an optgroup

src/renderers/dom/shared/wrappers/__tests__/ReactDOMTextarea-test.js
* should allow setting `defaultValue`
Expand Down
7 changes: 7 additions & 0 deletions src/renderers/dom/fiber/wrappers/ReactDOMFiberSelect.js
Expand Up @@ -153,6 +153,13 @@ var ReactDOMSelect = {
);
didWarnValueDefaultValue = true;
}

node.multiple = Boolean(props.multiple);
if (value != null) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: inconsistent style between value/defaultValue

Copy link
Collaborator

Choose a reason for hiding this comment

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

never mind

updateOptions(node, Boolean(props.multiple), value);
} else if (props.defaultValue != null) {
updateOptions(node, Boolean(props.multiple), props.defaultValue);
}
},

postUpdateWrapper: function(element : Element, props : Object) {
Expand Down