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

Allow setting test_selector on select list options #2495

Merged
merged 3 commits into from
Jan 11, 2024

Conversation

antn
Copy link
Contributor

@antn antn commented Jan 10, 2024

Authors: Please fill out this form carefully and completely.

Reviewers: By approving this Pull Request you are approving the code change, as well as its deployment and mitigation plans.
Please read this description carefully. If you feel there is anything unclear or missing, please ask for updates.

What are you trying to accomplish?

I was working on converting a form on dotcom to use the Primer form components (see https://github.com/github/github/pull/307881). We need to test in our component to make sure that certain options are included in the select menu, so we need to allow setting a test selector.

Integration

I don't think we need to change anything in prod for this?

List the issues that this change affects.

Closes #2494.

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.

Just allows setting data-test-selector when test_selector is included in the option arguments.

What approach did you choose and why?

Used the add_test_selector helper to include the selector in non-production environments. I didn't include anything to do the Primer classify stuff since I don't think you can/should set other Primer arguments on select options.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Lookbook)
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@antn antn self-assigned this Jan 10, 2024
@antn antn requested review from a team and jonrohan January 10, 2024 12:09
Copy link

changeset-bot bot commented Jan 10, 2024

🦋 Changeset detected

Latest commit: c0b2f35

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/view-components Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@camertron camertron left a comment

Choose a reason for hiding this comment

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

Cool, thank you! We should probably do this everywhere :)

Copy link
Contributor

@camertron camertron left a comment

Choose a reason for hiding this comment

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

Actually, sorry, can you add a changeset? Run npx changeset and follow the prompts.

@camertron camertron merged commit fbaea76 into main Jan 11, 2024
31 checks passed
@camertron camertron deleted the select-option-test-selector branch January 11, 2024 17:45
@primer primer bot mentioned this pull request Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option on Primer::Alpha::Select does not allow including a test selector
2 participants