@@ -5161,47 +5161,6 @@ public void TableColumn_Align()
51615161 Assert . Equal ( "table-cell center" , css ) ;
51625162 }
51635163
5164- [ Fact ]
5165- public void TableColumn_Ignore ( )
5166- {
5167- var items = new List < MockComplexFoo > ( [
5168- new ( ) { Name = "Test1" , Foo = new ( ) { Id = 1 , Name = "Test_1" } } ,
5169- new ( ) { Name = "Test2" , Foo = new ( ) { Id = 2 , Name = "Test_2" } } ,
5170- new ( ) { Name = "Test3" , Foo = new ( ) { Id = 3 , Name = "Test_3" } } ,
5171- ] ) ;
5172- var cut = Context . RenderComponent < BootstrapBlazorRoot > ( pb =>
5173- {
5174- pb . AddChildContent < Table < MockComplexFoo > > ( pb =>
5175- {
5176- pb . Add ( a => a . Items , items ) ;
5177- pb . Add ( a => a . AutoGenerateColumns , true ) ;
5178- pb . Add ( a => a . RenderMode , TableRenderMode . Table ) ;
5179-
5180- pb . Add ( a => a . TableColumns , foo => builder =>
5181- {
5182- builder . OpenComponent < TableColumn < MockComplexFoo , int > > ( 0 ) ;
5183- builder . AddAttribute ( 1 , "Field" , 0 ) ;
5184- builder . AddAttribute ( 2 , "FieldExpression" , Utility . GenerateValueExpression ( foo , "Foo.Id" , typeof ( int ) ) ) ;
5185- builder . CloseComponent ( ) ;
5186-
5187- builder . OpenComponent < TableColumn < MockComplexFoo , string > > ( 0 ) ;
5188- builder . AddAttribute ( 1 , "Field" , "Test" ) ;
5189- builder . AddAttribute ( 2 , "FieldExpression" , Utility . GenerateValueExpression ( foo , "Foo.Name" , typeof ( string ) ) ) ;
5190- builder . CloseComponent ( ) ;
5191-
5192- builder . OpenComponent < TableColumn < MockComplexFoo , string > > ( 0 ) ;
5193- builder . AddAttribute ( 1 , "Field" , "Test" ) ;
5194- builder . AddAttribute ( 2 , "FieldExpression" , Utility . GenerateValueExpression ( foo , "Foo.Address" , typeof ( string ) ) ) ;
5195- builder . CloseComponent ( ) ;
5196- } ) ;
5197- } ) ;
5198- } ) ;
5199-
5200- // 自动生成 2 列 手动 Id 列忽略 Name, Address 列追加
5201- var table = cut . FindComponent < Table < MockComplexFoo > > ( ) ;
5202- Assert . Equal ( 5 , table . Instance . Columns . Count ) ;
5203- }
5204-
52055164 [ Fact ]
52065165 public void TableColumn_ComplexObject ( )
52075166 {
0 commit comments