Skip to content

Conversation

@msynk
Copy link
Member

@msynk msynk commented Nov 15, 2025

closes #11636

Summary by CodeRabbit

  • Tests
    • Added comprehensive unit tests for the Tooltip component, covering rendering behavior, content templates, and interaction patterns.

@coderabbitai
Copy link

coderabbitai bot commented Nov 15, 2025

Walkthrough

A 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

Cohort / File(s) Summary
BitTooltip Unit Tests
src/BlazorUI/Bit.BlazorUI.Tests/Components/Surfaces/Tooltip/BitTooltipTests.cs
New test class with four unit tests: text rendering with DefaultIsShown parameter, template content rendering, anchor RenderFragment rendering, and pointer-up toggle visibility when ShowOnClick is enabled.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Focus areas: Verify test assertions accurately validate tooltip behavior (text display, template injection, anchor presence, visibility toggling logic)
  • Consistency check: Ensure test patterns align with other component test files in the project

Poem

🐰 A tooltip needs tests, don't you know?
Four methods to let the checking flow,
Rendering, toggling, templates take flight—
This coverage shines oh-so-bright! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change—adding missing unit tests for the BitTooltip component.
Linked Issues check ✅ Passed The pull request adds comprehensive unit tests for BitTooltip component as required by issue #11636, covering key functionality scenarios.
Out of Scope Changes check ✅ Passed All changes are directly scoped to adding unit tests for BitTooltip component as specified in the linked issue; no unrelated modifications detected.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 7cc6247 and a72f2eb.

📒 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 AddMarkupContent with a RenderFragment is 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.

@msynk msynk merged commit d8f2581 into bitfoundation:develop Nov 15, 2025
3 checks passed
@msynk msynk deleted the 11636-blazorui-tooltip-tests branch November 15, 2025 14:59
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.

The BitTooltip component is missing its unit tests from the Tests project

1 participant