From df6eb8328b33a74a85c20d80cc187b610b2321fd Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Thu, 12 Sep 2024 09:28:17 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E6=B8=85=E7=A9=BA=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=A0=8F=E8=A7=A6=E5=8F=91=20SelectedItemChanged=20=E5=9B=9E?= =?UTF-8?q?=E8=B0=83=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Select/Select.razor.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/Select/Select.razor.cs b/src/BootstrapBlazor/Components/Select/Select.razor.cs index d1dbf3944c7..9e421165b97 100644 --- a/src/BootstrapBlazor/Components/Select/Select.razor.cs +++ b/src/BootstrapBlazor/Components/Select/Select.razor.cs @@ -432,7 +432,12 @@ private async Task OnClearValue() { await OnClearAsync(); } - CurrentValue = default; + + var item = DataSource.FirstOrDefault(); + if (item != null) + { + await SelectedItemChanged(item); + } } private string? ReadonlyString => IsEditable ? null : "readonly"; From f9752db09314a1570c0790bc0dfa8b85eb3c01d3 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Thu, 12 Sep 2024 09:29:04 +0800 Subject: [PATCH 2/3] chore: bump version 8.9.2-beta07 --- src/BootstrapBlazor/BootstrapBlazor.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index 6bf9e1e245d..050b7a3e16b 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 8.9.2-beta06 + 8.9.2-beta07 From f9451ec1c56e128bc3da30f7c4217672da467f36 Mon Sep 17 00:00:00 2001 From: Argo-AscioTech Date: Thu, 12 Sep 2024 09:38:12 +0800 Subject: [PATCH 3/3] =?UTF-8?q?test:=20=E6=9B=B4=E6=96=B0=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Components/SelectTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/UnitTest/Components/SelectTest.cs b/test/UnitTest/Components/SelectTest.cs index 601c867822f..3feae3fec5b 100644 --- a/test/UnitTest/Components/SelectTest.cs +++ b/test/UnitTest/Components/SelectTest.cs @@ -97,7 +97,7 @@ public void IsClearable_Ok() new("2", "Test2"), new("3", "Test3") }); - pb.Add(a => a.Value, ""); + pb.Add(a => a.Value, "2"); pb.Add(a => a.OnValueChanged, v => { val = v; @@ -106,7 +106,7 @@ public void IsClearable_Ok() }); var clearButton = cut.Find(".clear-icon"); cut.InvokeAsync(() => clearButton.Click()); - Assert.Null(val); + Assert.Empty(val); // 提高代码覆盖率 var select = cut;