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(select): deselect old options when programmatically setting value #4658

Merged
merged 3 commits into from
May 23, 2017

Conversation

willshowell
Copy link
Contributor

Fixes #4476

This may be naive regarding selection change events, but existing tests pass and it fixes the issue.

cc @crisbeto

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label May 18, 2017
@crisbeto crisbeto self-assigned this May 18, 2017
@crisbeto
Copy link
Member

crisbeto commented May 18, 2017

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.

Copy link
Member

@crisbeto crisbeto left a 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();
Copy link
Member

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?


options =
overlayContainerElement.querySelectorAll('md-option') as NodeListOf<HTMLElement>;
expect(options[0].classList).not.toContain('mat-selected');
Copy link
Member

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');.

@willshowell
Copy link
Contributor Author

@crisbeto changes have been made

@crisbeto
Copy link
Member

Seems like there are a couple of linter errors. The Closure failure should be fixed by #4709.

Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I'll defer adding the merge-ready label until #4662 and #4709 are merged, which should fix the test failures.

@crisbeto crisbeto added pr: lgtm blocked This issue is blocked by some external factor, such as a prerequisite PR and removed pr: needs review labels May 22, 2017
@crisbeto
Copy link
Member

@willshowell the two PRs got merged. Can you rebase from master?

@willshowell willshowell force-pushed the fix/select-option-styling branch from 2cadd47 to 885db05 Compare May 22, 2017 16:57
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker and removed blocked This issue is blocked by some external factor, such as a prerequisite PR labels May 22, 2017
@tinayuangao tinayuangao merged commit db72b06 into angular:master May 23, 2017
@willshowell willshowell deleted the fix/select-option-styling branch May 23, 2017 20:58
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Select option styling bug
4 participants