[PR #30096] feat(web): add unit tests for Badge component #32684

Closed
opened 2026-02-21 20:51:53 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/30096

State: closed
Merged: Yes


What's this PR about?

Hey there! 👋

I noticed the Badge component was missing test coverage, so I went ahead and added a comprehensive test suite for it.

What's covered?

  • Basic rendering and children display
  • All three size variants (s, m, l)
  • State variants (Warning, Accent, Default)
  • iconOnly padding behavior for each size
  • uppercase text styling
  • Custom styleCss and className support
  • HTML attributes passthrough (data-*, id, aria-*, title)
  • Combined props scenarios

Test results

All 25 tests pass! 🎉

Related

This follows the same testing patterns used in button/index.spec.tsx, keeping things consistent across base components.


Happy to make any changes if needed!

**Original Pull Request:** https://github.com/langgenius/dify/pull/30096 **State:** closed **Merged:** Yes --- ## What's this PR about? Hey there! 👋 I noticed the Badge component was missing test coverage, so I went ahead and added a comprehensive test suite for it. ## What's covered? - ✅ Basic rendering and children display - ✅ All three size variants (`s`, `m`, `l`) - ✅ State variants (`Warning`, `Accent`, `Default`) - ✅ `iconOnly` padding behavior for each size - ✅ `uppercase` text styling - ✅ Custom `styleCss` and `className` support - ✅ HTML attributes passthrough (`data-*`, `id`, `aria-*`, `title`) - ✅ Combined props scenarios ## Test results All 25 tests pass! 🎉 ## Related This follows the same testing patterns used in `button/index.spec.tsx`, keeping things consistent across base components. --- Happy to make any changes if needed!
yindo added the pull-request label 2026-02-21 20:51:53 -05:00
yindo closed this issue 2026-02-21 20:51:53 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#32684