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): unable to programmatically select falsy values #4868

Merged
merged 1 commit into from
Jun 5, 2017

Conversation

crisbeto
Copy link
Member

Fixes not being able to set falsy values progammatically in md-select.

Fixes #4854.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label May 29, 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.

LGTM, but some nits. Apply merge label when ready.

@@ -449,6 +450,22 @@ describe('MdSelect', () => {
expect(fixture.componentInstance.select.selected).not.toBeDefined();
});

it('should be able to programmatically select a falsy option', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Why is this in its own section? Seems like it would better fit under forms integration since it has to do with setting the form control value.

it('should be able to programmatically select a falsy option', () => {
fixture.destroy();

let falsyFixture = TestBed.createComponent(FalsyValueSelect);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: const

let falsyFixture = TestBed.createComponent(FalsyValueSelect);

falsyFixture.detectChanges();
falsyFixture.debugElement.query(By.css('.mat-select-trigger')).nativeElement.click();
Copy link
Contributor

Choose a reason for hiding this comment

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

Clicking on the trigger doesn't seem necessary if you're trying to test setting the value programmatically. Remove?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's there since we're also doing an extra check that the selected option has the proper class.

@kara kara assigned crisbeto and unassigned kara May 30, 2017
Fixes not being able to set falsy values progammatically in `md-select`.

Fixes angular#4854.
@crisbeto crisbeto force-pushed the 4854/select-falsy-values branch from 99ecc03 to d734c60 Compare May 31, 2017 17:52
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label May 31, 2017
@andrewseguin andrewseguin merged commit 2e3910c into angular:master Jun 5, 2017
@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 not set to ngModel initial value
4 participants