Skip to content

Commit e03d20a

Browse files
committed
!3758 test(#I6AJ6Y): add unit test for GotoTemplate of table
* test: 增加 GogoTemplate 模板单元测试
1 parent 5a69563 commit e03d20a

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

test/UnitTest/Components/TableTest.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,33 @@ public void PageInfoTemplate_Ok()
748748
Assert.Contains("Test_PageInfoTemplate", cut.Markup);
749749
}
750750

751+
[Fact]
752+
public void GotoTemplate_Ok()
753+
{
754+
var localizer = Context.Services.GetRequiredService<IStringLocalizer<Foo>>();
755+
var cut = Context.RenderComponent<BootstrapBlazorRoot>(pb =>
756+
{
757+
pb.AddChildContent<Table<Foo>>(pb =>
758+
{
759+
pb.Add(a => a.RenderMode, TableRenderMode.Table);
760+
pb.Add(a => a.IsPagination, true);
761+
pb.Add(a => a.OnQueryAsync, OnQueryAsync(localizer));
762+
pb.Add(a => a.PageItems, 20);
763+
pb.Add(a => a.ShowGotoNavigator, true);
764+
pb.Add(a => a.GotoNavigatorLabelText, "Test_GotoNavigatorLabelText");
765+
pb.Add(a => a.GotoTemplate, builder => builder.AddContent(0, "Test_GotoTemplate"));
766+
pb.Add(a => a.TableColumns, foo => builder =>
767+
{
768+
builder.OpenComponent<TableColumn<Foo, string>>(0);
769+
builder.AddAttribute(1, "Field", "Name");
770+
builder.AddAttribute(2, "FieldExpression", Utility.GenerateValueExpression(foo, "Name", typeof(string)));
771+
builder.CloseComponent();
772+
});
773+
});
774+
});
775+
Assert.Contains("Test_GotoTemplate", cut.Markup);
776+
}
777+
751778
[Fact]
752779
public void PageInfoText_Ok()
753780
{

0 commit comments

Comments
 (0)