Skip to content

Commit f6ac77e

Browse files
committed
!3750 test(#I6AAWZ): add unit test for table fix column
* test: 增加固定列单元测试
1 parent f8eee46 commit f6ac77e

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

test/UnitTest/Components/TableTest.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,38 @@ public void ColumnFixed_Ok(bool showExtendButton, bool isFixedHeader)
10351035
}
10361036
}
10371037

1038+
[Fact]
1039+
public void Column_IsFixedMultipleColumn()
1040+
{
1041+
var localizer = Context.Services.GetRequiredService<IStringLocalizer<Foo>>();
1042+
var cut = Context.RenderComponent<BootstrapBlazorRoot>(pb =>
1043+
{
1044+
pb.AddChildContent<Table<Foo>>(pb =>
1045+
{
1046+
pb.Add(a => a.RenderMode, TableRenderMode.Table);
1047+
pb.Add(a => a.Items, Foo.GenerateFoo(localizer, 2));
1048+
pb.Add(a => a.IsMultipleSelect, true);
1049+
pb.Add(a => a.FixedMultipleColumn, true);
1050+
pb.Add(a => a.ShowLineNo, true);
1051+
pb.Add(a => a.LineNoColumnWidth, 100);
1052+
pb.Add(a => a.TableColumns, foo => builder =>
1053+
{
1054+
builder.OpenComponent<TableColumn<Foo, string>>(0);
1055+
builder.AddAttribute(1, "Field", foo.Name);
1056+
builder.AddAttribute(2, "FieldExpression", Utility.GenerateValueExpression(foo, "Name", typeof(string)));
1057+
builder.AddAttribute(3, nameof(TableColumn<Foo, string>.Fixed), true);
1058+
builder.CloseComponent();
1059+
});
1060+
pb.Add(a => a.DetailColumnWidth, 100);
1061+
pb.Add(a => a.DetailRowTemplate, foo => builder =>
1062+
{
1063+
builder.AddContent(1, foo.Name);
1064+
});
1065+
});
1066+
});
1067+
cut.Contains("style=\"left: 236px;\"");
1068+
}
1069+
10381070
[Fact]
10391071
public void ColumnFixed_Null()
10401072
{

0 commit comments

Comments
 (0)