dify
dify copied to clipboard
feat(web): add unit tests for Badge component
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) - ✅
iconOnlypadding behavior for each size - ✅
uppercasetext styling - ✅ Custom
styleCssandclassNamesupport - ✅ 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!