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

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

Merged
merged 1 commit into from
Oct 18, 2017

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Oct 15, 2017

  • 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.

@crisbeto crisbeto added the in progress This issue is currently in progress label Oct 15, 2017
@crisbeto crisbeto self-assigned this Oct 15, 2017
@crisbeto crisbeto requested a review from kara as a code owner October 15, 2017 12:29
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Oct 15, 2017
@crisbeto crisbeto force-pushed the select-control-provider branch 2 times, most recently from 7bd3930 to b8ce743 Compare October 15, 2017 13:38
@crisbeto crisbeto added pr: needs review and removed in progress This issue is currently in progress labels Oct 15, 2017
@crisbeto crisbeto assigned jelbourn and kara and unassigned crisbeto Oct 15, 2017
/**
* Injection token used to provide the parent control to options.
*/
export const MAT_OPTION_PARENT_CONTROL =
Copy link
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?

@@ -34,6 +36,22 @@ export class MatOptionSelectionChange {
}

/**
* Describes a parent form control that manages a list options.
Copy link
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

@@ -54,20 +54,6 @@ describe('MatOption component', () => {
.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
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.

* 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
Copy link
Member Author

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

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 removed their assignment Oct 17, 2017
@kara kara 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:master Oct 18, 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 7, 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.

5 participants