Skip to content

feat(material-experimental): add test harness for select #16710

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
Aug 21, 2019

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Aug 7, 2019

Sets up the test harness for mat-select.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Aug 7, 2019
Sets up the test harness for `mat-select`.
@crisbeto crisbeto force-pushed the select-test-harness branch from 74f8994 to 5a3ddb7 Compare August 7, 2019 12:08
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent pr: merge safe labels Aug 7, 2019
@crisbeto crisbeto marked this pull request as ready for review August 7, 2019 12:21
}

/** Gets the select panel. */
async getPanel(): Promise<TestElement> {
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a reason to expose this element? what would a user do with it in a test?

Copy link
Member Author

Choose a reason for hiding this comment

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

You can use it to look at the scroll position and the position of the dropdown itself. We have a bunch of our own tests that deal with the dropdown.

}

/** Gets the options inside the select panel. */
async getOptions(): Promise<TestElement[]> {
Copy link
Contributor

Choose a reason for hiding this comment

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

We could potentially expose an OptionHarness and OptionGroupHarness to make it easier to work with these. I'm not sure if its overkill for this case, but I kind of like the idea of avoiding giving the user TestElement references when possible.

I would at least add an optional parameter to these methods so I can do something like getOptionGroups('Food') or getOptions('Pizza'). If you make a OptionHarness this could be an OptionHarnessFilters instead of a string.

Curious if @jelbourn has an opinion here

Copy link
Member Author

Choose a reason for hiding this comment

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

We can do it on the second pass once both the autocomplete and select harnesses get in since both of them use mat-option.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed, I think we should have harnesses for the options. It can go in a follow-up PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Add TODO for now

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM, can do options in a follow-up

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Aug 16, 2019
@mmalerba
Copy link
Contributor

LGTM, please just add a TODO about the option harness

@andrewseguin andrewseguin merged commit 89c784c into angular:master Aug 21, 2019
andrewseguin pushed a commit that referenced this pull request Aug 26, 2019
Sets up the test harness for `mat-select`.

(cherry picked from commit 89c784c)
crisbeto added a commit to crisbeto/material2 that referenced this pull request Sep 8, 2019
Follow-up from angular#16620 and angular#16710. Adds a dedicated harness for `mat-option` and `mat-optgroup`.

Note that some of the code is duplicated. This is because we don't have a shared place where to put the harness so that `mat-autocomplete` and `mat-select` don't have to depend on each other. I've intentionally kept the harnesses to only the methods we need, but once we have `experimental/core`, I'll combine them and implement all of the states that are supported by `mat-option`.
@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 21, 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 P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants