-
-
Notifications
You must be signed in to change notification settings - Fork 365
feat(Textarea): add OnBlurAsync parameter #4518
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
Conversation
WalkthroughThe changes introduce a new event handler for the Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4518 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 631 631
Lines 27051 27058 +7
Branches 3924 3925 +1
=========================================
+ Hits 27051 27058 +7 ☔ View full report in Codecov by Sentry. |
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: 2
🧹 Outside diff range and nitpick comments (1)
src/BootstrapBlazor/Components/Textarea/Textarea.razor.cs (1)
37-41: Enhance parameter documentation for clarity.The parameter implementation is correct, but consider enhancing the documentation to include:
- Parameter usage examples
- Expected behavior when the callback is triggered
- Whether the string parameter represents the current or previous value
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
- src/BootstrapBlazor/Components/Textarea/Textarea.razor (1 hunks)
- src/BootstrapBlazor/Components/Textarea/Textarea.razor.cs (2 hunks)
- test/UnitTest/Components/TextareaTest.cs (1 hunks)
🔇 Additional comments (3)
src/BootstrapBlazor/Components/Textarea/Textarea.razor (1)
9-9: LGTM! The blur event handler is correctly implemented.The addition of
@onblur="OnBlur"follows Blazor conventions and integrates well with the existing textarea bindings.Let's verify the OnBlur implementation in the code-behind:
✅ Verification successful
Let me try a different approach to verify the implementation.
The previous ast-grep patterns might have failed due to syntax issues or whitespace sensitivity. Let's try with ripgrep to find any mentions of these methods and also directly check the component's code-behind file to verify the implementation.
Implementation of OnBlur and OnBlurAsync is correctly implemented
The verification confirms that:
- The
OnBlurAsyncparameter is properly declared asFunc<string?, Task>?in the Textarea component- The
OnBlurmethod is correctly implemented to invoke theOnBlurAsynccallback with the current value- The implementation matches the usage in the Razor template
- Unit tests exist that verify the OnBlur functionality
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the OnBlur method implementation and OnBlurAsync parameter # Expected: Find the OnBlur method that invokes OnBlurAsync parameter # Search for the OnBlur method implementation ast-grep --pattern 'protected virtual async Task OnBlur() { $$$ }' # Search for OnBlurAsync parameter declaration ast-grep --pattern 'public Func<string?, Task>? OnBlurAsync { get; set; }'Length of output: 147
Script:
#!/bin/bash # Search for the OnBlur method and OnBlurAsync parameter with ripgrep # Using -A and -B flags to get context rg -B 2 -A 5 "OnBlur|OnBlurAsync" --type cs # Also check the component's code-behind file directly fd "Textarea.razor.cs" --exec cat {}Length of output: 14550
src/BootstrapBlazor/Components/Textarea/Textarea.razor.cs (1)
66-66: Verify OnBlur event binding in Textarea.razor.Ensure that the OnBlur method is properly bound to the textarea's blur event in the Razor file.
✅ Verification successful
Let me try a different approach to verify the Textarea component's blur event binding.
OnBlur event is correctly bound in Textarea.razor
The verification confirms that the
OnBlurmethod is properly bound to the textarea's blur event using@onblur="OnBlur"in the Textarea.razor file. The implementation is correct and follows Blazor's event binding syntax.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for @onblur binding in Textarea.razor rg "@onblur=\"OnBlur\"" --type razorLength of output: 66
Script:
#!/bin/bash # Search for the Textarea.razor file and show its content fd "Textarea.razor$" --type f --exec cat {}Length of output: 575
test/UnitTest/Components/TextareaTest.cs (1)
58-72: LGTM! Clean and effective test implementation.The test follows good practices:
- Uses async/await correctly
- Follows AAA pattern
- Has clear assertion
- Properly tests the async event handler
add OnBlurAsync parameter
Summary of the changes (Less than 80 chars)
简单描述你更改了什么, 不超过80个字符;如果有关联 Issue 请在下方填写相关编号
Description
fixes #4517
Regression?
[If yes, specify the version the behavior has regressed from]
[是否影响老版本]
Risk
[Justify the selection above]
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by CodeRabbit
New Features
<textarea>component to respond to the blur event, enhancing interactivity.Bug Fixes