-
Notifications
You must be signed in to change notification settings - Fork 27.4k
feat(jqLite): return [] for .val() on <select multiple> with no selection #15104
Conversation
LGTM - should the refactorings be backported to 1.5.x? |
Yes, I plan to backport them. On Wednesday, 7 September 2016, Pete Bacon Darwin [email protected]
Michał Gołębiowski |
toEqualOneOf: function(util) { | ||
return { | ||
compare: function(actual) { | ||
var expectedArgs = Array.prototype.slice.call(arguments, 1); |
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.
Can sliceArgs(arguments, 1)
be used here instead (for readability)?
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's kind of weird to use internal Angular functions in matchers. IMO tests shouldn't depend on the code they're testing. Also, all other relevant matchers in this file use this technique so changing it just here would be inconsistent.
LGTM2 😃 |
…tion Fixes angular#14370 BREAKING CHANGE: For the jqLite element representing a select element in the multiple variant with no options chosen the .val() getter used to return null and now returns an empty array. To migrate the code follow the example below: Before: HTML: <select multiple> <option>value 1</option> <option>value 2</option> </select> JavaScript: var value = $element.val(); if (value) { /* do something */ } After: HTML: <select multiple> <option>value 1</option> <option>value 2</option> </select> JavaScript: var value = $element.val(); if (value.length > 0) { /* do something */ }
Closed via d882fde (I forgot to update the commit message). |
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature (an API change).
What is the current behavior? (You can also link to an open issue here)
The
.val()
getter on<select multiple>...</select>
returnsnull
if no options are selected.What is the new behavior (if this is a feature change)?
The
.val()
getter on<select multiple>...</select>
returns an empty array if no options are selected.Does this PR introduce a breaking change?
Yes.
Please check if the PR fulfills these requirements
Other information:
Fixes #14370