fix(select): fix set form to pristine if ng-model for multiple select is predefined. #6782
Conversation
@@ -228,9 +228,10 @@ function SelectDirective($mdSelect, $mdUtil, $mdTheming, $mdAria, $compile, $par | |||
}); | |||
} | |||
|
|||
if (formCtrl) { | |||
if (formCtrl && angular.isDefined(attr.multiple)) { |
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.
So if we are not using multiple
, then we never $setPristine()
? Is that valid logic?
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.
Yes that is valid, as you can see in 09bd5a3, we should only set the form to pristine if multiple
objects are pre-selected in the ngModel
.
I manually tested that too, if there is a predefined value for a single select
, we don't need to set the form pristine on initialization.
@devversion - for 99% of all PRs, each one will need 1 or more unit tests. Can you provide a unit test to validate and verify these changes? |
@ThomasBurleson - Yes, I will add a Unit Test for both cases. |
… is predefined. Bug introduced in 09bd5a3 Fixes angular#6556
e206ea6
to
531bc5c
Compare
@ThomasBurleson - Added two tests for the |
… is predefined. Bug introduced in 09bd5a3 Fixes angular#6556 Closes angular#6782 #breaking
Bug introduced in 09bd5a3
Fixes #6556