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 tests 1.0 #610

Merged
merged 28 commits into from
Nov 22, 2015
Merged

Fix tests 1.0 #610

merged 28 commits into from
Nov 22, 2015

Conversation

bruderstein
Copy link
Collaborator

This is where I am up to. Please don't merge this yet, this is just to keep public where I'm up to. Should hopefully finish this weekend.

These tests were to do with entering and leaving the options, where the 
behaviour is now that the option remains focussed. Probably need some new tests
to cover this
This is a hangover from the old version where it produced the same result.
When the `value` prop is set to a value not in the options, previously the value
would be shown as the label, now nothing is selected. Need to decide if this is
a valid change.
This is as passed as a prop to `createControlWithWrapper`, but is then removed
This means that onChange calls cause the value to be set.
The test for a single value of 0 was already there, and it caught the bug for the simple 
test of `if (!value) ...`.  Yay for tests :)
onChange now called with array of option objects
There are now two ways to pass the value, either as the original object,
or as the value property from the option. Both are now explicitely tested.
@bruderstein
Copy link
Collaborator Author

This will be the fix for #571

After selecting an item in a non-searchable Selectbox, the menu is no longer closed
Tests changed to use this behaviour.
After searching, this left the select box closed, but displaying no value, even though
the value was actually selected. 

Tests corrected.

Added `clearable` to single select example
onChange now called only with the concatenated value when simpleValue=true
Not sure if this is the right behaviour, but it does make much of the logic simpler.
It is also possibly easier for a control that is part of a form, where one select influences 
the filtering of another. The current implementation means the filter gets called each
time, which makes the logic of such a form much simpler.

Tests have been amended such that the control is not initially focused, but the 
`filterOption` callback is still called for each option once.
Using the internal ref. This is a bit dangerous, but I can't think of a better way
to do it now.
This is a hangover from pre-1.0, when the current value was held in the 
place-holder, hence this was never noticed.
If the focus is somewhere else on the node, then the blur is ignored.
This makes the "clicking away" test much simpler :)
This is now in the README, so we have fixed the test to match
These will be re-enabled / moved in a future commit
@bruderstein bruderstein changed the title Fix tests 1.0 (not yet ready) Fix tests 1.0 Nov 22, 2015
@bruderstein
Copy link
Collaborator Author

@JedWatson This is ready to go now - together with #609 from @MrLeebo, we're back to green \o/ - Thank you @MrLeebo for the PR!

I think there's only two bug fixes - 9767a8d and 4d5eaf5

The rest, as usual, I've tried to keep each change or fix in a separate commit, so it's possible to see why each change was made. Hope that's ok.

I'll open a new issue for the async tests, as I'd like to do those separately. At least we're back to green, and can work from there. There's probably one or two other bits that need tests now (simpleValue={true}, for example), but I'll add those as I see them.

JedWatson added a commit that referenced this pull request Nov 22, 2015
@JedWatson JedWatson merged commit 0e6d6e9 into JedWatson:master Nov 22, 2015
@JedWatson
Copy link
Owner

Brilliant - thank you so much @bruderstein and @MrLeebo!

I promise not to do any more major test-breaking refactoring on react-select this year 😉

@MrLeebo
Copy link
Contributor

MrLeebo commented Nov 23, 2015

@JedWatson @bruderstein Glad to see this done. When I made my PR I flirted with fixing the Select tests, but I quit when I realized how much work that was going to be.

Would you say this merits an NPM release?

@bruderstein bruderstein deleted the fix-tests-1.0 branch November 23, 2015 19:07
@bruderstein
Copy link
Collaborator Author

@MrLeebo I don't think there's any pressing reason to. There are only two tiny fixes, that fix edge cases (neither of which are serious), so can easily just be lumped in with the next release. Not sure when I'll get the async tests done, but when they're in, they may turn up some stuff, which would may make a release worth it.

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.

3 participants