From a3e9381f180ed4f58f2c2760f044ade67218882d Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Tue, 11 Feb 2025 13:39:46 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Components/TableTest.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/UnitTest/Components/TableTest.cs b/test/UnitTest/Components/TableTest.cs index 74d75177b07..f8d2fbd2fec 100644 --- a/test/UnitTest/Components/TableTest.cs +++ b/test/UnitTest/Components/TableTest.cs @@ -5184,6 +5184,32 @@ public void TableColumn_ComplexObject() Assert.Equal("Name", v); } + [Fact] + public void Table_ComplexColumn_Ok() + { + var localizer = Context.Services.GetRequiredService>(); + var items = new MockComplexFoo[] + { + new() { Name = "test1", Foo = Foo.Generate(localizer) } + }; + var cut = Context.RenderComponent(pb => + { + pb.AddChildContent>(pb => + { + pb.Add(a => a.Items, items); + pb.Add(a => a.RenderMode, TableRenderMode.Table); + pb.Add(a => a.TableColumns, context => builder => + { + builder.OpenComponent>(0); + builder.AddAttribute(1, "FieldName", "Foo.Name"); + builder.AddAttribute(2, "FieldExpression", Utility.GenerateValueExpression(context, "Foo.Name", typeof(string))); + builder.CloseComponent(); + }); + }); + }); + cut.Contains(items[0].Foo.Name!); + } + [Fact] public async Task SelectedRowsChanged_Ok() {