dify icon indicating copy to clipboard operation
dify copied to clipboard

feat(web): add unit tests for Badge component

Open SherlockShemol opened this issue 2 weeks ago • 5 comments

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!

SherlockShemol avatar Dec 24 '25 08:12 SherlockShemol