Skip to content

test(HelperText): add unit test coverage and assert exact color classes - #1

Closed
olitreadwell wants to merge 3 commits into
mainfrom
test/helper-text-coverage
Closed

test(HelperText): add unit test coverage and assert exact color classes#1
olitreadwell wants to merge 3 commits into
mainfrom
test/helper-text-coverage

Conversation

@olitreadwell

@olitreadwell olitreadwell commented Aug 4, 2026

Copy link
Copy Markdown
Owner

HelperText was the only component in packages/ui/src/components with zero dedicated test coverage (verified by comparing .tsx source files against .test.tsx files across all 45 component folders).

It only showed up indirectly, rendered inside Label.test.tsx's integration test: its own rendering, color variants, className merging, ref forwarding, and theme overrides were never asserted directly.

Adds packages/ui/src/components/HelperText/HelperText.test.tsx, following the same Rendering / Classname / Ref / Theme structure used by sibling component tests (Badge, Spinner, Blockquote).

No source changes: test-only addition, 12 test cases.

Second commit tightens the color-variant assertions: the initial it.each only checked that className was non-empty, which passes even if the color prop had no effect (base classes are always present).

It now asserts the exact color classes instead of a non-empty check, matching the values in theme.ts.

Third commit (addressing CodeRabbit review on the upstream PR): the color cases now assert each color's dark-mode class (dark:*) alongside the light-mode class, matching theme.ts.

No breaking API changes.

No props, theme structure, or public API were added, removed, or changed.

Test plan

  • bun run test:coverage: all tests pass, including the 12 new HelperText tests
  • bun run lint: 0 errors
  • bun run typecheck: passes
  • bun run format:check: passes
  • bun run build: passes

Changeset: not included.

This is a test-only change with no effect on the published package's behavior or public API, so no version bump/changelog entry is warranted per this repo's Changesets convention.


How to verify

git fetch https://github.com/olitreadwell/flowbite-react.git test/helper-text-coverage
git checkout FETCH_HEAD
bun run test:coverage
bun run format:check
bun run typecheck

PROMOTION NOTE (remove this section before/when opening against upstream):

gh pr create --repo themesberg/flowbite-react --base main --head olitreadwell:test/helper-text-coverage

Prerequisites: none.

No CLA/DCO bot found in themesberg/flowbite-react (checked .github/workflows, CONTRIBUTING.md, branch protection); no signed-commit requirement found.

Branch name and commit message already match this repo's own conventions (commitizen-style type/description branch prefix, type(scope): description commit style seen in upstream history).

AI assistance

Drafted with AI assistance.

The gap was found and verified against the current code, the change was verified before opening, and this diff was reviewed line by line.

HelperText was the only remaining public component in packages/ui
with zero test coverage (verified across all 45 component folders).
It only appeared indirectly through Label's integration test, so its
own rendering, color variants, className merging, ref forwarding, and
theme overrides were never asserted directly.

Adds a dedicated HelperText.test.tsx following the same Rendering /
Classname / Ref / Theme structure used by sibling component tests
(e.g. Badge, Spinner, Blockquote).
The color it.each test only checked that className was non-empty,
which passes even if the color prop had no effect at all (base
classes are always present). Assert the specific expected class per
color instead, matching the values in theme.ts.
@olitreadwell
olitreadwell force-pushed the test/helper-text-coverage branch from f605c5f to 89217e1 Compare August 12, 2026 04:06
@olitreadwell olitreadwell changed the title test(HelperText): add unit test coverage test(HelperText): add unit test coverage and assert exact color classes Aug 19, 2026
@olitreadwell

Copy link
Copy Markdown
Owner Author

Closing as superseded: the same change is already open upstream in themesberg#1687. See themesberg#1687

@olitreadwell

Copy link
Copy Markdown
Owner Author

Superseded by upstream themesberg#1687.

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