Skip to content

refactor(select): simplify option sync and more robust unit tests - #7807

Merged
tinayuangao merged 1 commit into
angular:masterfrom
crisbeto:select-control-provider
Oct 18, 2017
Merged

refactor(select): simplify option sync and more robust unit tests#7807
tinayuangao merged 1 commit into
angular:masterfrom
crisbeto:select-control-provider

Conversation

@crisbeto

@crisbetocrisbeto commented Oct 15, 2017

Copy link
Copy Markdown
Member
  • Currently the select sets the multiple and disableRipple values on its options manually. In order to avoid "changed after checked" errors we wrap the calls in promises, however this also forces us to have async tests which can time out if the browser is out of focus. These changes add a provider that allows for the options to take the value directly from the select.
  • Refactors some unit tests that have been timing out in Firefox to run in the fakeAsync zone instead of the async one.
  • Fixes a positioning test that fails occasionally in Firefox.

@crisbetocrisbeto added the in progress This issue is currently in progress label Oct 15, 2017
@crisbetocrisbeto self-assigned this Oct 15, 2017
@crisbeto
crisbeto requested a review from kara as a code ownerOctober 15, 2017 12:29
@googlebotgooglebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Oct 15, 2017
@crisbeto
crisbetoforce-pushed the select-control-provider branch 2 times, most recently from 7bd3930 to b8ce743CompareOctober 15, 2017 13:38
@crisbetocrisbeto added pr: needs review and removed in progress This issue is currently in progress labels Oct 15, 2017
@crisbetocrisbeto assigned jelbourn and kara and unassigned crisbetoOct 15, 2017

/**
* Injection token used to provide the parent control to options.
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hm, the name makes it sounds like we're getting a FormControl instance (and it's form related), when it's really the parent control component. Can we rename to MatOptionParentComponent?

constructor(public source: MatOption, public isUserInput = false) { }
}

/**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Typo: A list options -> A list of options

.toBe(0, 'Expected no ripples to show up after click on a disabled option.');
});

it('should not show ripples if the ripples are disabled using disableRipple', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you move this test to the select tests rather than removing? e.g. select.disableRipple = true.

Seems like a good one to have, given that select only tests the presence of the property.

@crisbeto
crisbetoforce-pushed the select-control-provider branch from b8ce743 to c0c9eb2CompareOctober 17, 2017 16:49
* Currently the select sets the `multiple` and `disableRipple` values on its options manually. In order to avoid "changed after checked" errors we wrap the calls in promises, however this also forces us to have `async` tests which can time out if the browser is out of focus. These changes add a provider that allows for the options to take the value directly from the select.
* Refactors some unit tests that have been timing out in Firefox to run in the `fakeAsync` zone instead of the `async` one.
@crisbeto
crisbetoforce-pushed the select-control-provider branch from c0c9eb2 to e77785dCompareOctober 17, 2017 16:55
@crisbeto

Copy link
Copy Markdown
MemberAuthor

I've addressed the feedback @kara, can you take another look?

@karakara left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@karakara removed their assignment Oct 17, 2017
@karakara added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Oct 17, 2017
@tinayuangao
tinayuangao merged commit 4fc3a0b into angular:masterOct 18, 2017
@angular-automatic-lock-bot

Copy link
Copy Markdown

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-botangular-automatic-lock-botBot locked and limited conversation to collaborators Sep 7, 2019
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: mergeThe PR is ready for merge by the caretakercla: yesPR author has agreed to Google's Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@crisbeto@kara@jelbourn@googlebot@tinayuangao