Skip to content

Fix behavior of ReactDOMSelect with defaultValue#251

Merged
yungsters merged 1 commit intofacebook:masterfrom
sophiebits:select-value
Aug 18, 2013
Merged

Fix behavior of ReactDOMSelect with defaultValue#251
yungsters merged 1 commit intofacebook:masterfrom
sophiebits:select-value

Conversation

@sophiebits
Copy link
Copy Markdown
Collaborator

Closes #250.

Test Plan:
With multiple and not, verified: With defaultValue, the correct option is picked initially, user changes change the selection, and changes to defaultValue have no effect. With value, the correct option is picked initially, user changes do nothing, and changes to value change the selection.

cc @yungsters

@zpao
Copy link
Copy Markdown
Member

zpao commented Aug 12, 2013

You don't by chance want to write tests for this do you? I know we don't have much coverage for our form components...

@sophiebits
Copy link
Copy Markdown
Collaborator Author

Sure, I can.

@sophiebits
Copy link
Copy Markdown
Collaborator Author

@zpao Tests added! Hard to simulate user interaction but I am testing what was broken.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not a huge deal, but formatting nit - move <select ...> to new line, indented. There are a few instances of this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done, sorry. Still haven't figured out exactly what your indentation rules are. :)

@yungsters
Copy link
Copy Markdown
Contributor

By the way, thanks for fixing this and writing unit tests. Sorry for the delay in review.

Closes facebook#250.

Test Plan:
With multiple and not, verified: With defaultValue, the correct option is picked initially, user changes change the selection, and changes to defaultValue have no effect. With value, the correct option is picked initially, user changes do nothing, and changes to value change the selection.

Also ran the tests.
@sophiebits
Copy link
Copy Markdown
Collaborator Author

@yungsters okay, added back the multiple handling, added tests for it, and inlined getValue. Let me know if there's anything else.

@yungsters
Copy link
Copy Markdown
Contributor

Awesome, this looks great. Thanks!

yungsters added a commit that referenced this pull request Aug 18, 2013
Fix behavior of ReactDOMSelect with `defaultValue`
@yungsters yungsters merged commit e1c1d86 into facebook:master Aug 18, 2013
bvaughn pushed a commit to bvaughn/react that referenced this pull request Aug 13, 2019
Use WebpackDevServer for local testing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

defaultValue for select not working

3 participants