-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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(select): deselect old options when programmatically setting value #4658
fix(select): deselect old options when programmatically setting value #4658
Conversation
Off the top of my head, I can't think of anything that it might break, but let me play around with it a bit more tomorrow. |
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.
Logic seems fine, just a couple of nitpicks.
@@ -544,12 +544,12 @@ export class MdSelect implements AfterContentInit, OnDestroy, OnInit, ControlVal | |||
throw getMdSelectNonArrayValueError(); | |||
} | |||
|
|||
this._clearSelection(); |
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.
nit: Can you add a new line after this one?
src/lib/select/select.spec.ts
Outdated
|
||
options = | ||
overlayContainerElement.querySelectorAll('md-option') as NodeListOf<HTMLElement>; | ||
expect(options[0].classList).not.toContain('mat-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.
Could you add a description to the expectations in the test? It makes it easier to parse if one of them fails. E.g. expect(options[0].classList).not.toContain('mat-selected', 'Expected first option not to be selected');
.
@crisbeto changes have been made |
Seems like there are a couple of linter errors. The Closure failure should be fixed by #4709. |
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.
@willshowell the two PRs got merged. Can you rebase from master? |
2cadd47
to
885db05
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes #4476
This may be naive regarding selection change events, but existing tests pass and it fixes the issue.
cc @crisbeto