Skip to content

refactor(IssueLabel): update types, tests, and stories for usage #6265

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

joshblack
Copy link
Member

@joshblack joshblack commented Jul 1, 2025

Update our IssueLabel component to prepare for its documentation to be published on our site. These updates include:

  • Update TypeScript types to support polymorphic as along with defaulting to specific element types (like button, a, span) based on certain props
  • Add tests to Vitest and update e2e VRT tests

Changelog

New

Changed

  • Update IssueLabel component
    • Add tests and update VRT tests
    • Update TypeScript types to support as and children for content
    • Add types test

Removed

Rollout strategy

  • Minor release

Copy link

changeset-bot bot commented Jul 1, 2025

🦋 Changeset detected

Latest commit: ee0180b

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

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

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

@github-actions github-actions bot added the staff Author is a staff member label Jul 1, 2025
Copy link
Contributor

github-actions bot commented Jul 1, 2025

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Jul 1, 2025
Copy link
Contributor

github-actions bot commented Jul 1, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 92.26 KB (0%)
packages/react/dist/browser.umd.js 92.35 KB (0%)

@joshblack joshblack changed the title refactor(IssueLabel): update TypeScript types and add initial tests refactor(IssueLabel): update types, tests, and stories for usage Jul 18, 2025
@github-actions github-actions bot requested a deployment to storybook-preview-6265 July 18, 2025 18:16 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-6265 July 18, 2025 18:26 Inactive
@joshblack joshblack marked this pull request as ready for review July 18, 2025 18:34
@Copilot Copilot AI review requested due to automatic review settings July 18, 2025 18:34
@joshblack joshblack requested review from a team as code owners July 18, 2025 18:35
@joshblack joshblack requested a review from langermank July 18, 2025 18:35
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the IssueLabel component to prepare it for documentation publication by updating its TypeScript types, adding comprehensive tests, and modernizing its API. The main changes include replacing the text prop with children, adding polymorphic as prop support, and implementing proper type discrimination based on props.

  • Add comprehensive test coverage with Vitest unit tests and enhanced e2e VRT tests
  • Update TypeScript types to support polymorphic as prop with proper type discrimination
  • Replace text prop with children for more flexible content support

Reviewed Changes

Copilot reviewed 11 out of 254 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/react/src/experimental/IssueLabel/IssueLabel.tsx Core component refactor with new polymorphic types and implementation
packages/react/src/experimental/IssueLabel/IssueLabel.test.tsx New comprehensive unit tests for all component variants and behaviors
packages/react/src/experimental/IssueLabel/IssueLabel.types.test.tsx New TypeScript type tests to verify polymorphic behavior
packages/react/src/experimental/IssueLabel/IssueLabel.stories.tsx Updated Storybook stories to use new children API
packages/react/src/experimental/IssueLabel/IssueLabel.features.stories.tsx Updated feature stories with new API and added interaction handling
packages/react/src/experimental/IssueLabel/IssueLabel.module.css Added CSS layer and removed :where() selectors for better specificity
packages/react/src/experimental/IssueLabel/IssueLabel.docs.json Updated documentation metadata and prop definitions
packages/react/vitest.config.browser.mts Added IssueLabel tests to browser test configuration
packages/react/jest.config.js Added IssueLabel to Jest test configuration
e2e/components/IssueLabel.test.ts Enhanced e2e tests with interaction testing for button and link variants
.changeset/dry-chairs-start.md Added changeset for minor release

@github-actions github-actions bot requested a deployment to storybook-preview-6265 July 18, 2025 18:38 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-6265 July 18, 2025 18:47 Inactive
@github-actions github-actions bot requested a deployment to storybook-preview-6265 July 23, 2025 15:41 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-6265 July 23, 2025 15:49 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm staff Author is a staff member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant