-
-
Notifications
You must be signed in to change notification settings - Fork 254
Add missing tests for BitTooltip (#11636) #11637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing tests for BitTooltip (#11636) #11637
Conversation
WalkthroughA new unit test file for the BitTooltip Blazor component was added with four test methods covering text rendering, template content rendering, anchor rendering, and click-to-toggle visibility behavior. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/BlazorUI/Bit.BlazorUI.Tests/Components/Surfaces/Tooltip/BitTooltipTests.cs (1)
11-93: Consider adding tests for hover behavior and positioning.The current tests cover basic functionality well. However, tooltips typically support hover interactions (the primary use case), positioning options, and show/hide delays. Consider adding tests for:
- Hover interactions (onmouseenter/onmouseleave events)
- Positioning options (if BitTooltip supports top, bottom, left, right positioning)
- Show/hide delays (if the component supports them)
- Edge cases (both Text and Template provided, neither provided)
- Keyboard accessibility (if applicable)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (1)
src/BlazorUI/Bit.BlazorUI.Tests/Components/Surfaces/Tooltip/BitTooltipTests.cs(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build and test
🔇 Additional comments (6)
src/BlazorUI/Bit.BlazorUI.Tests/Components/Surfaces/Tooltip/BitTooltipTests.cs (6)
1-6: LGTM!The imports and namespace declaration are appropriate for a Bunit test file.
8-9: LGTM!The test class is correctly set up with the MSTest attribute and inherits from BunitTestContext.
35-48: LGTM!The test correctly verifies that template content is rendered in the tooltip. The use of
AddMarkupContentwith aRenderFragmentis appropriate for this scenario.
50-64: LGTM!The test properly verifies that the Anchor parameter renders correctly. The assertions appropriately check for both element existence and content.
66-93: LGTM!The test correctly verifies the toggle behavior when ShowOnClick is enabled. The test properly re-queries the wrapper element after each event to capture the updated state.
11-33: No issues found. Test is valid and correct.All CSS class names match the component implementation:
- "bit-ttp-wrp" wrapper class is rendered in BitTooltip.razor
- "bit-ttp-vis" class is correctly conditionally applied based on IsShown state (BitTooltip.razor.cs:207)
- DefaultIsShown parameter is properly implemented and used to initialize IsShown on component load
The test logic correctly validates both the default hidden state and the DefaultIsShown=true behavior.
closes #11636
Summary by CodeRabbit