feat(material/autocomplete): test harness should throw when options are requested but panel is closed #24494
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
).