Skip to content

chore(select): organize tests to better scope compilation #8342

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

Merged
merged 1 commit into from
Nov 14, 2017

Conversation

jelbourn
Copy link
Member

@jelbourn jelbourn commented Nov 9, 2017

None of the tests are changed, just reorganized. I tweaked a few test names / assertions to fit on one line.

@jelbourn jelbourn requested review from crisbeto and mmalerba November 9, 2017 23:39
@jelbourn jelbourn requested a review from kara as a code owner November 9, 2017 23:39
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Nov 9, 2017
@jelbourn jelbourn changed the title chore(select): organize up tests to better scope compilation chore(select): organize tests to better scope compilation Nov 9, 2017
const commonProviders = [
{
provide: OverlayContainer, useFactory: () => {
overlayContainerElement = document.createElement('div') as HTMLElement;
Copy link
Member

Choose a reason for hiding this comment

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

I might have it in another PR somewhere, but we shouldn't be creating thing element in the first place, we should just inject the OverlayContainer.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd rather address that in a different PR because I don't want to actually change any logic in this one

* overall test time.
* @param declarations Components to declare for this block
*/
function configureMatSelectTestingModule(declarations) {
Copy link
Member

Choose a reason for hiding this comment

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

The declarations could at least be any[] to give it a little bit of type safety.

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe TypeScript infers the type here from how the argument is used

it('should clear the selection when the control is reset', fakeAsync(() => {
fixture.componentInstance.control.setValue('pizza-1');
fixture.detectChanges();
describe('aria-owns', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Is this one supposed to be empty?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed- I copied the contents to a different describe

Copy link
Member

Choose a reason for hiding this comment

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

It seems like the empty describe is still there.

trigger.click();
fixture.detectChanges();
expect(optionInstances[0].selected)
.toBe(false, 'Expected first option to no longer be
Copy link
Member

Choose a reason for hiding this comment

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

Since it's a single test it doesn't need the beforeEach, it could be moved outside or into the "special cases".

trigger.click();
fixture.detectChanges();
expect(optionInstances[0].selected)
.toBe(false, 'Expected first option to no longer be
Copy link
Member

Choose a reason for hiding this comment

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

We don't need a beforeEach for a single test suite. I doubt that we'll add any more tests to it.

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, added a couple of more nits. Add the label when ready.


return {getContainerElement: () => overlayContainerElement};
},
},
Copy link
Member

Choose a reason for hiding this comment

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

The indentation here and the ScrollDispatcher override is a little weird. The lambas need to be indented.

it('should clear the selection when the control is reset', fakeAsync(() => {
fixture.componentInstance.control.setValue('pizza-1');
fixture.detectChanges();
describe('aria-owns', () => {
Copy link
Member

Choose a reason for hiding this comment

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

It seems like the empty describe is still there.

@jelbourn
Copy link
Member Author

Done; I hadn't exported my changes when I made the comment

@jelbourn jelbourn added action: merge The PR is ready for merge by the caretaker pr: merge safe labels Nov 10, 2017
@jelbourn jelbourn merged commit cd12561 into angular:master Nov 14, 2017
@jelbourn jelbourn deleted the select-test-split branch April 2, 2018 22:30
@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 8, 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.

3 participants