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

Add ops.target to selectOptions #155

Conversation

michalchmura
Copy link

In some cases, the option.value and option.text are not tightly coupled.

Some developers want to hide the internal option.value and show nicely-formatted text.

This PR will provide a way to specify how the options should be extracted.

@codecov
Copy link

codecov bot commented Aug 6, 2019

Codecov Report

Merging #155 into master will increase coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #155      +/-   ##
==========================================
+ Coverage   96.58%   96.63%   +0.05%     
==========================================
  Files           1        1              
  Lines         117      119       +2     
  Branches       27       27              
==========================================
+ Hits          113      115       +2     
  Misses          4        4
Impacted Files Coverage Δ
src/index.js 96.63% <100%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c5df100...3bf1b68. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Aug 6, 2019

Codecov Report

Merging #155 into master will increase coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #155      +/-   ##
==========================================
+ Coverage   96.58%   96.63%   +0.05%     
==========================================
  Files           1        1              
  Lines         117      119       +2     
  Branches       27       27              
==========================================
+ Hits          113      115       +2     
  Misses          4        4
Impacted Files Coverage Δ
src/index.js 96.63% <100%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c5df100...3bf1b68. Read the comment docs.

@michalchmura
Copy link
Author

I tried recreating the PR with npm run cm from a new branch from within this repo but I don't have the write permissions 👎

@dougbacelar
Copy link
Contributor

I think this makes sense because:

  • You might have some option.text that you want to assert on e.g. translations, dynamically generated text
  • Users don't interact with select values

I think its important to at least display a warning when trying to select an option that doesn't exist--as its very likely a bug.


An alternative to that, would be selectOptions also accepting the option nodes themselves--like the single selectOption function:

userEvent.selectOptions(getByLabelText('Select'), [getByText('first option')])

That way you also get an error from getByText('first option') if first option doesn't exist.


Issue #203 has nice comments and is related to this PR.

@kentcdodds
Copy link
Member

This is managed best in #297 so I'm going to close this. Thanks!

@kentcdodds kentcdodds closed this May 26, 2020
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.

None yet

3 participants