-
-
Notifications
You must be signed in to change notification settings - Fork 254
Add tests for BitSplitter component (#11656) #11657
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 tests for BitSplitter component (#11656) #11657
Conversation
WalkthroughA new test suite is added for the BitSplitter component. The BitSplitterTests class contains six test methods that verify DOM structure, CSS variables, styling, icon rendering, and child content handling using BUnit. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 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/Splitter/BitSplitterTests.cs (1)
44-56: LGTM! Consider adding a negative test case.The test correctly verifies icon rendering. For completeness, consider adding a test to verify that no icon is rendered when
GutterIconis not provided.
📜 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/Splitter/BitSplitterTests.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/Splitter/BitSplitterTests.cs (6)
1-9: LGTM! Clean test class setup.The test class properly inherits from
BunitTestContextand follows standard BUnit/MSTest conventions.
10-26: LGTM! Solid baseline DOM structure test.This test appropriately verifies the default DOM structure of the BitSplitter component using
MarkupMatches.
58-68: LGTM! Clean verification of vertical layout.The test appropriately verifies that the vertical class is applied when
Verticalis set to true.
70-95: Verify CSS variable formatting for panel sizes.Lines 88-94 check for CSS variables without spaces after colons (e.g.,
--first-panel:128px). This has the same potential brittleness as the GutterSize test. If Blazor renders these with spaces (e.g.,--first-panel: 128px), all six assertions would fail despite correct component behavior.The verification script from the GutterSize test will also check these panel size CSS variables.
97-114: LGTM! Solid child content verification.The test correctly verifies that
RenderFragmentcontent is rendered in the appropriate panels. The inline creation ofRenderFragmentinstances and subsequent content verification are well-implemented.
28-42: The review comment assumes the component renders CSS variables with spaces after colons (e.g.,--gutter-size: 20px). However, the actual implementation at line 102 of BitSplitter.cs registers the CSS variable without spaces:$"--gutter-size:{GutterSize}px". The test at line 41 correctly matches this exact format. The test is not brittle; it properly aligns with the actual implementation behavior.Likely an incorrect or invalid review comment.
closes #11656
Summary by CodeRabbit