From 6db218d8e721239ffe67faea5fe7772d2cbd5ed2 Mon Sep 17 00:00:00 2001 From: Argo-AsicoTech Date: Thu, 19 Dec 2024 17:19:28 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E6=9B=B4=E6=96=B0=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 | 41 --------------------------- test/UnitTest/Utils/UtilityTest.cs | 8 ++++-- 2 files changed, 6 insertions(+), 43 deletions(-) diff --git a/test/UnitTest/Components/TableTest.cs b/test/UnitTest/Components/TableTest.cs index aeb03bc9e9e..bece13e9b74 100644 --- a/test/UnitTest/Components/TableTest.cs +++ b/test/UnitTest/Components/TableTest.cs @@ -5161,47 +5161,6 @@ public void TableColumn_Align() Assert.Equal("table-cell center", css); } - [Fact] - public void TableColumn_Ignore() - { - var items = new List([ - new() { Name = "Test1", Foo = new() { Id = 1, Name = "Test_1" } }, - new() { Name = "Test2", Foo = new() { Id = 2, Name = "Test_2" } }, - new() { Name = "Test3", Foo = new() { Id = 3, Name = "Test_3" } }, - ]); - var cut = Context.RenderComponent(pb => - { - pb.AddChildContent>(pb => - { - pb.Add(a => a.Items, items); - pb.Add(a => a.AutoGenerateColumns, true); - pb.Add(a => a.RenderMode, TableRenderMode.Table); - - pb.Add(a => a.TableColumns, foo => builder => - { - builder.OpenComponent>(0); - builder.AddAttribute(1, "Field", 0); - builder.AddAttribute(2, "FieldExpression", Utility.GenerateValueExpression(foo, "Foo.Id", typeof(int))); - builder.CloseComponent(); - - builder.OpenComponent>(0); - builder.AddAttribute(1, "Field", "Test"); - builder.AddAttribute(2, "FieldExpression", Utility.GenerateValueExpression(foo, "Foo.Name", typeof(string))); - builder.CloseComponent(); - - builder.OpenComponent>(0); - builder.AddAttribute(1, "Field", "Test"); - builder.AddAttribute(2, "FieldExpression", Utility.GenerateValueExpression(foo, "Foo.Address", typeof(string))); - builder.CloseComponent(); - }); - }); - }); - - // 自动生成 2 列 手动 Id 列忽略 Name, Address 列追加 - var table = cut.FindComponent>(); - Assert.Equal(5, table.Instance.Columns.Count); - } - [Fact] public void TableColumn_ComplexObject() { diff --git a/test/UnitTest/Utils/UtilityTest.cs b/test/UnitTest/Utils/UtilityTest.cs index c8de533fd4c..d3d8759fd79 100644 --- a/test/UnitTest/Utils/UtilityTest.cs +++ b/test/UnitTest/Utils/UtilityTest.cs @@ -696,8 +696,12 @@ public void Format_Format() [Fact] public void GetTableColumns_Ok() { - var cols = Utility.GetTableColumns().ToList(); - Assert.Equal(2, cols.Count); + var columns = new InternalTableColumn[] + { + new("Name3", typeof(string)), + }; + var cols = Utility.GetTableColumns(columns).ToList(); + Assert.Equal(3, cols.Count); } [Fact]