From d92a5361ec1a471d94db5482e3f73b88c4367438 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 29 Dec 2024 10:56:40 +0800 Subject: [PATCH 1/6] chore: bump version 9.2.0-beta02 Co-Authored-By: caics --- 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 0a287c487e4..8323ae27b7a 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 8.5.12-beta02 + 9.2.0-beta02 From 101a378c08e2b4df4d08e01bd677ede57d0b0f07 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 29 Dec 2024 11:10:37 +0800 Subject: [PATCH 2/6] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Display/Display.razor.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/BootstrapBlazor/Components/Display/Display.razor.cs b/src/BootstrapBlazor/Components/Display/Display.razor.cs index edf186f47ed..ca08706ceca 100644 --- a/src/BootstrapBlazor/Components/Display/Display.razor.cs +++ b/src/BootstrapBlazor/Components/Display/Display.razor.cs @@ -137,11 +137,11 @@ private async Task FormatValueString() return ret ?? string.Empty; } - private Func? _arrayConvertoString; + private Func? _arrayConvertToString; private string ArrayConvertToString(TValue value) { - _arrayConvertoString ??= LambdaExtensions.ArrayConvertToStringLambda(TypeResolver).Compile(); - return _arrayConvertoString(value); + _arrayConvertToString ??= LambdaExtensions.ArrayConvertToStringLambda(TypeResolver).Compile(); + return _arrayConvertToString(value); } private static Func? _enumerableConvertToString; From 9119551220c95c1cf16c101591f4dbecee7208cd Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 29 Dec 2024 11:10:45 +0800 Subject: [PATCH 3/6] =?UTF-8?q?refactor:=20=E7=B2=BE=E7=AE=80=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Display/Display.razor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/Display/Display.razor.cs b/src/BootstrapBlazor/Components/Display/Display.razor.cs index ca08706ceca..712780bc332 100644 --- a/src/BootstrapBlazor/Components/Display/Display.razor.cs +++ b/src/BootstrapBlazor/Components/Display/Display.razor.cs @@ -128,7 +128,7 @@ private async Task FormatText([DisallowNull] TValue value) private async Task FormatValueString() { - string? ret = Value?.ToString() ?? string.Empty; + var ret = Value?.ToString(); var lookup = await GetLookup(); if (lookup != null) { From d8a9a9d06bbcd051969ed53843530b0fea99a75f Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 29 Dec 2024 11:10:54 +0800 Subject: [PATCH 4/6] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=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/DisplayTest.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/UnitTest/Components/DisplayTest.cs b/test/UnitTest/Components/DisplayTest.cs index 3f2f6b7cc2c..0059aa7f9de 100644 --- a/test/UnitTest/Components/DisplayTest.cs +++ b/test/UnitTest/Components/DisplayTest.cs @@ -59,6 +59,14 @@ public async Task LookupService_Ok() }); await Task.Delay(20); Assert.Contains("Test1,Test2", cut.Markup); + + cut.SetParametersAndRender(pb => + { + pb.Add(a => a.LookupServiceKey, null); + pb.Add(a => a.Lookup, new List { new("v1", "Test3"), new("v2", "Test4") }); + }); + await Task.Delay(20); + Assert.Contains("Test3,Test4", cut.Markup); } [Fact] From 51d4bb12cb198824279d79897417b35867afbe84 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 29 Dec 2024 11:11:03 +0800 Subject: [PATCH 5/6] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=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/EditorFormTest.cs | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/UnitTest/Components/EditorFormTest.cs b/test/UnitTest/Components/EditorFormTest.cs index 949717bd9bb..36203771e51 100644 --- a/test/UnitTest/Components/EditorFormTest.cs +++ b/test/UnitTest/Components/EditorFormTest.cs @@ -480,6 +480,30 @@ public async Task LookupService_Ok() Assert.Equal("LookupService-Test-1-async", select.Instance.Items.First().Text); } + [Fact] + public void Lookup_Ok() + { + var foo = new Foo(); + var lookup = new List() { new("v1", "test1"), new("v2", "test2") }; + var cut = Context.RenderComponent>(pb => + { + pb.Add(a => a.Model, foo); + pb.Add(a => a.AutoGenerateAllItem, false); + pb.Add(a => a.FieldItems, f => builder => + { + var index = 0; + builder.OpenComponent>(index++); + builder.AddAttribute(index++, nameof(EditorItem.Field), f.Name); + builder.AddAttribute(index++, nameof(EditorItem.FieldExpression), Utility.GenerateValueExpression(foo, nameof(Foo.Name), typeof(string))); + builder.AddAttribute(index++, nameof(EditorItem.Text), "Test-Text"); + builder.AddAttribute(index++, nameof(EditorItem.Lookup), lookup); + builder.CloseComponent(); + }); + }); + var select = cut.FindComponent>(); + Assert.Equal(2, select.Instance.Items.Count()); + } + [Theory] [InlineData(true)] [InlineData(false)] From bc3309ed2491ec6e7f28dfb730e106b74aecb1de Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 29 Dec 2024 11:12:34 +0800 Subject: [PATCH 6/6] chore: bump version 9.2.0-beta02 --- 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 46b5ff3f9b1..b921a79d2aa 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 9.2.0-beta01 + 9.2.0-beta02