-
Notifications
You must be signed in to change notification settings - Fork 621
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 first option if disabled (#473) #583
Conversation
Thanks for this @markjoeljimenez. Could you add some tests to cover this change please? |
…into patch-1 Merge from master
Hey @jshjohnson, I haven't written tests before so please let me know if my tests are sufficient enough. |
.click(); | ||
}); | ||
|
||
it('first choice is disabled', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('first choice is disabled', () => { | |
it('disables the first choice', () => { |
|
||
let selectValue; | ||
|
||
it('first non-disabled choice is selected', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('first non-disabled choice is selected', () => { | |
it('selects the first non-disabled choice', () => { |
@@ -230,6 +236,29 @@ <h2>Select one inputs</h2> | |||
removeItemButton: true, | |||
}); | |||
|
|||
new Choices('#choices-disabled-first-choice-by-options', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new Choices('#choices-disabled-first-choice-by-options', { | |
new Choices('#choices-disabled-choice-via-options', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add tests
Hey - i've opened a new PR with your fix + some tweaks over latest master. Thanks 👍 |
Description
Fix issue #473.
The first disabled choice passed in as an option is not actually disabled.
Reproduced example
https://jsfiddle.net/uf9bmpy6/
Fix
We can simply pass in the disabled choice instead of checking whether it's preselected or not.