Skip to content

Placeholder tests#348

Merged
JedWatson merged 2 commits intoJedWatson:masterfrom
bruderstein:placeholder-tests
Aug 3, 2015
Merged

Placeholder tests#348
JedWatson merged 2 commits intoJedWatson:masterfrom
bruderstein:placeholder-tests

Conversation

@bruderstein
Copy link
Collaborator

Adds tests for the placeholder functionality, including the fix in the recent PR (#334)

Also corrects the comparison - this was causing extra unnecessary work by comparing
to state.placeholder instead of props.placeholder

Includes tests for setting the placeholder dynamically,
and one obscure case where the placeholder is set to
the same as the currently selected value's label
Placeholder was compared to state.placeholder,
which in the case of a selected value when
multi=false, is actually the label of the
selected item. This means this comparison
was (almost) always returning true, and therefore
always recalculating the values.

This didn't cause any major issue, just
caused extra unnecessary work.

(It also meant that the options being
set later than the value worked, as
the value labels were always recalculated)
meant that
@bruderstein
Copy link
Collaborator Author

I've got the rest of the props tested too (see bruderstein/react-select/tree/even-more-tests), but they sadly rely on the small test refactoring that is in this PR. When/if this is merged, I'll rebase and send the rest.

JedWatson added a commit that referenced this pull request Aug 3, 2015
@JedWatson JedWatson merged commit 10b17ee into JedWatson:master Aug 3, 2015
@JedWatson
Copy link
Owner

Brilliant as usual, @bruderstein 😀 thanks!

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.

2 participants