Skip to content

feat(material/autocomplete): test harness should throw when options are requested but panel is closed #24494

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

Conversation

devversion
Copy link
Member

The autocomplete harness has methods for retrieving the options of an
autocomplete. When this method is invoked, the options are determined
from the overlay DOM element, if available. If the panel is not in the DOM
(due to the autocomplete not being focused), the method will just return
an empty array, indicating that there are no options.

This is confusing for test authors and currently not well-defined, potentially
causing invalid tests that just pass by coincidence.

We want to throw when the panel is not open, raising awareness for such invalid
tests. In the future we may want to auto-focus the autocomplete to open the
panel (like selectOption).

@devversion devversion marked this pull request as ready for review February 28, 2022 18:53
@devversion devversion requested a review from crisbeto as a code owner February 28, 2022 18:53
…re requested but panel is closed

The autocomplete harness has methods for retrieving the options of an
autocomplete. When this method is invoked, the options are determined
from the overlay DOM element, if available. If the panel is not in the DOM
(due to the autocomplete not being focused), the method will just return
an empty array, indicating that there are no options.

This is confusing for test authors and currently not well-defined, potentially
causing invalid tests that just pass by coincidence.

We want to throw when the panel is not open, raising awareness for such invalid
tests. In the future we may want to auto-focus the autocomplete to open the
panel (like `selectOption`).
@devversion devversion force-pushed the select-error-options-panel-closed branch from 3b12a0f to ac7df56 Compare February 28, 2022 18:55
@devversion devversion changed the title fix(material/autocomplete/testing): harness should throw when options are requested but panel is closed feat(material/autocomplete): test harness should throw when options are requested but panel is closed Feb 28, 2022
@devversion devversion added the target: minor This PR is targeted for the next minor release label Feb 28, 2022
@andrewseguin
Copy link
Contributor

Looking forward to seeing all the failing tests that thought the panel was open....

@andrewseguin andrewseguin added the action: merge The PR is ready for merge by the caretaker label Feb 28, 2022
@andrewseguin andrewseguin merged commit 60bbd19 into angular:master Mar 7, 2022
@andrewseguin
Copy link
Contributor

Only 31 clients needed to be changed =P

forsti0506 pushed a commit to forsti0506/components that referenced this pull request Apr 3, 2022
…re requested but panel is closed (angular#24494)

The autocomplete harness has methods for retrieving the options of an
autocomplete. When this method is invoked, the options are determined
from the overlay DOM element, if available. If the panel is not in the DOM
(due to the autocomplete not being focused), the method will just return
an empty array, indicating that there are no options.

This is confusing for test authors and currently not well-defined, potentially
causing invalid tests that just pass by coincidence.

We want to throw when the panel is not open, raising awareness for such invalid
tests. In the future we may want to auto-focus the autocomplete to open the
panel (like `selectOption`).
@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 Apr 7, 2022
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 target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants