MudAutocomplete: Fix search not being triggered when the text is cleared#9599
MudAutocomplete: Fix search not being triggered when the text is cleared#9599henon merged 4 commits intoMudBlazor:devfrom
Conversation
|
A hack in Next I will push the fix and finally restore the hack. |
|
In the GitHub action, the added test After the fix is pushed, in the GitHub action the added test Finally, after the hack was restored, all tests success in the GitHub action. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #9599 +/- ##
==========================================
+ Coverage 89.82% 90.55% +0.72%
==========================================
Files 412 405 -7
Lines 11878 12751 +873
Branches 2364 2469 +105
==========================================
+ Hits 10670 11547 +877
+ Misses 681 644 -37
- Partials 527 560 +33 ☔ View full report in Codecov by Sentry. |
You can't do this in bUnit since it always executes in a standard .NET environment. What we can do, and I believe this is the correct approach, is to implement something like this: namespace MudBlazor.Utilities;
/// <summary>
/// Provides methods to determine whether the application is running on the client-side or server-side.
/// </summary>
[ExcludeFromCodeCoverage]
public class RuntimeLocation
{
/// <summary>
/// An instance of the platform detector used to check the current runtime environment.
/// </summary>
internal static readonly IPlatformDetector PlatformDetector = new BrowserPlatformDetector();
/// <summary>
/// Gets a value indicating whether the application is running on the client-side (in a browser).
/// </summary>
public static bool IsClientSide => PlatformDetector.IsBrowser();
/// <summary>
/// Gets a value indicating whether the application is running on the server-side.
/// </summary>
public static bool IsServerSide => !PlatformDetector.IsBrowser();
/// <summary>
/// Defines an interface for detecting the platform on which the code is running.
/// </summary>
internal interface IPlatformDetector
{
/// <summary>
/// Determines whether the application is running in a browser environment.
/// </summary>
/// <returns><c>true</c> if the application is running in a browser; otherwise, <c>false</c>.</returns>
bool IsBrowser();
}
/// <summary>
/// Detects if the current platform is a browser.
/// </summary>
internal class BrowserPlatformDetector : IPlatformDetector
{
/// <inheritdoc />
public bool IsBrowser() => OperatingSystem.IsBrowser();
}
}Now, you can create your own implementation of |
|
@vernou I sent a DM on Discord but you didn't respond, so I am pinging you here. |
I answered. |
|
@ScarletKuro, I created the issue #9629 to improve it, so it can be done later. |
|
@henon Can you review this PR? |
|
OK, I'll do it this weekend, I promise. |
|
Thanks Cedric, you found a very good fix. |
Description
This PR fixes #9495 :
How Has This Been Tested?
I added a test to simulate the case.
Type of Changes
Checklist
dev).