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): remove selection if option is removed #2560

Merged
merged 6 commits into from Jan 18, 2017

Conversation

devversion
Copy link
Member

  • Currenty when an option is selected and the option is somehow programmatically removed the select updates its options.

    Right now it does not remove the selection if the selection has been removed from the options.

Fixes #2524

@devversion devversion requested a review from kara January 7, 2017 15:36
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jan 7, 2017
Copy link
Contributor

@kara kara left a comment

Choose a reason for hiding this comment

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

This should actually be fixed by one of @crisbeto's existing PRs, #2499. But we should really have a test for this too. Can you remove the code fix and we can get the test change in once the other is merged?

firstOption.click();
fixture.detectChanges();

expect(select.selected).toBe(select.options.first);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add fallback messages for both assertions if the test fails? e.g. Expected first option to be selected.

@devversion
Copy link
Member Author

devversion commented Jan 12, 2017

@kara Alright, only kept the test for now. Let's see if #2499 makes this PR green (once it's merged)

Copy link
Contributor

@kara kara left a comment

Choose a reason for hiding this comment

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

LGTM

@kara kara added pr: lgtm blocked This issue is blocked by some external factor, such as a prerequisite PR and removed pr: needs review labels Jan 12, 2017
* Currenty when an option is selected and the option is somehow programmatically removed the select updates its options.
  Right now it does not remove the selection if the selection has been removed from the options.

Fixes angular#2524
@kara kara removed the blocked This issue is blocked by some external factor, such as a prerequisite PR label Jan 13, 2017
@devversion devversion added the action: merge The PR is ready for merge by the caretaker label Jan 13, 2017
@kara kara removed their assignment Jan 17, 2017
@mmalerba mmalerba merged commit 300b6d5 into angular:master Jan 18, 2017
@devversion devversion deleted the fix/selection-options-change branch January 18, 2017 17:14
kara pushed a commit to kara/material2 that referenced this pull request Jan 20, 2017
* fix(select): remove selection if option is removed

* Currenty when an option is selected and the option is somehow programmatically removed the select updates its options.
  Right now it does not remove the selection if the selection has been removed from the options.

Fixes angular#2524

* Update spec name

* Remove check logic and just keep test

* Update expectation message

* Fix linting

* Wait for zone to be stable
@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.

MdSelect selected value not cleared if option is removed
4 participants