feat(Slider): add OnBlurAsync parameter (#4525)

* feat(FloatingLabel): add OnBlurAsync parameter

* feat: 增加 OnBlurAsync 回调方法

* refactor: 移动参数到基类

* refactor: 移动参数到基类

* refactor: 重构 AutoComplete 组件

* refactor: 重构 AutoFill 组件

* doc: 更新文档注释

* refactor: 复用基类事件

* refactor: 使用基类事件

* feat(Slider): add OnBlurAsync parameter

* test: 更新单元测试
This commit is contained in:
Argo Zhang 2024-10-23 21:37:56 -07:00 committed by GitHub
parent 420f7f7689
commit 44c229c343
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 1 deletions

View File

@ -20,5 +20,5 @@ else
@code {
RenderFragment RenderRange =>
@<input type="range" id="@Id" @attributes="@AdditionalAttributes" class="@ClassString" disabled="@IsDisabled" @bind-value="CurrentValueAsString" @bind-value:event="@EventString" step="@StepString" min="@MinString" max="@MaxString">;
@<input type="range" id="@Id" @attributes="@AdditionalAttributes" class="@ClassString" disabled="@IsDisabled" @bind-value="CurrentValueAsString" @bind-value:event="@EventString" step="@StepString" min="@MinString" max="@MaxString" @onblur="OnBlur">;
}

View File

@ -110,6 +110,23 @@ public class SliderTest : BootstrapBlazorTestBase
Assert.Equal(1, expected);
}
[Fact]
public async Task OnBlurAsync_Ok()
{
var blur = false;
var cut = Context.RenderComponent<Slider<int>>(builder =>
{
builder.Add(a => a.OnBlurAsync, v =>
{
blur = true;
return Task.CompletedTask;
});
});
var input = cut.Find("input");
await cut.InvokeAsync(() => { input.Blur(); });
Assert.True(blur);
}
[Fact]
public void Range_OK()
{