Skip to content

Conversation

joshfarrant
Copy link
Contributor

@joshfarrant joshfarrant commented Aug 22, 2025

Summary

Backfills tests for useTabs hook to bring coverage up to (nearly) 100%.

These tests highlighted some incorrect types in the useTabs hook which I plan to resolve in a subsequent PR (#1138), keeping this PR focused on coverage.

The recent modifications made to this hook in the recently merged Tabs component PR have introduced a line which is proving tricky to test. The subsequent PR mentioned above will address that and bring coverage up to 100%, which isn't possible here as it will require a modification to the hook's implementation.

Supporting resources (related issues, external links, etc)

Contributor checklist

  • All new and existing CI checks pass
  • Tests prove that the feature works and covers both happy and unhappy paths
  • Any drop in coverage, breaking changes or regressions have been documented above
  • UI Changes contain new visual snapshots (generated by adding update snapshots label to the PR)
  • All developer debugging and non-functional logging has been removed
  • Related issues have been referenced in the PR description

Reviewer checklist

  • Check that pull request and proposed changes adhere to our contribution guidelines and code of conduct
  • Check that tests prove the feature works and covers both happy and unhappy paths
  • Check that there aren't other open Pull Requests for the same update/change

Copy link

changeset-bot bot commented Aug 22, 2025

⚠️ No Changeset found

Latest commit: a3cd51a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link
Contributor

github-actions bot commented Aug 22, 2025

🟢 No design token changes found

Copy link
Contributor

github-actions bot commented Aug 22, 2025

🟢 Unit test coverage changes found

Unit test coverage has been updated through this PR.

Changes: 1 new tests, 0 removed tests, 0 improved, 0 decreased

Component/Hook Statements Functions Branches Change
useTabs 97.9% 100.0% 97.9% NEW

Copy link
Contributor

github-actions bot commented Aug 22, 2025

🟢 No visual differences found

Our visual comparison tests did not find any differences in the UI.

@joshfarrant joshfarrant force-pushed the joshfarrant/test-coverage-use-tabs branch from 7ea36b0 to 3ea3747 Compare August 22, 2025 10:33
@joshfarrant joshfarrant marked this pull request as ready for review August 22, 2025 10:48
@Copilot Copilot AI review requested due to automatic review settings August 22, 2025 10:48
Copy link

@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 adds comprehensive test coverage for the useTabs hook to achieve 100% code coverage. The tests validate all aspects of the hook's functionality including tab activation, keyboard navigation, accessibility attributes, and event handling.

Key Changes

  • Creates a complete test suite with 1,229 lines covering all hook behaviors
  • Implements a custom hook testing utility that simulates real DOM interactions
  • Tests all keyboard navigation patterns, accessibility compliance, and edge cases

@joshfarrant joshfarrant requested a review from rezrah August 22, 2025 10:52
@joshfarrant joshfarrant mentioned this pull request Aug 22, 2025
9 tasks
@joshfarrant joshfarrant marked this pull request as draft September 3, 2025 10:14
@joshfarrant joshfarrant force-pushed the joshfarrant/test-coverage-use-tabs branch from 6842b42 to ae060a0 Compare September 3, 2025 12:09
@joshfarrant joshfarrant marked this pull request as ready for review September 3, 2025 12:09
@joshfarrant joshfarrant requested a review from a team as a code owner September 3, 2025 12:09
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.

1 participant