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

fix(dom): make selectOption wait for options #5036

Merged
merged 6 commits into from
Jan 19, 2021

Conversation

yury-s
Copy link
Member

@yury-s yury-s commented Jan 16, 2021

Ideally we'd use InjectedScriptPollHandler for polling options but that may result in an exception if selecting an option triggers navigation.

Fixes #4921

@yury-s yury-s requested a review from dgozman January 16, 2021 01:50
@yury-s yury-s force-pushed the select-option-wait branch from ea1cf5f to b306626 Compare January 16, 2021 03:20
if (select.multiple) {
remainingOptionsToSelect = remainingOptionsToSelect.filter(o => !filter(o));
} else {
remainingOptionsToSelect = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic seems strange. I guess we should throw when multiple options are passed for non-multiple select? Otherwise there is no way we select them all.

Copy link
Member Author

Choose a reason for hiding this comment

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

From our docs: " If the has the multiple attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected."

src/server/injected/injectedScript.ts Outdated Show resolved Hide resolved
@yury-s yury-s force-pushed the select-option-wait branch from 9ae2edd to e86354c Compare January 19, 2021 19:14
@yury-s yury-s merged commit 615954b into microsoft:master Jan 19, 2021
@yury-s yury-s deleted the select-option-wait branch January 19, 2021 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] selectOption doesn't auto-wait for the options being selected
2 participants