Skip to content

Commit 46c55d7

Browse files
committed
test: 增加单元测试提高覆盖率
1 parent 48ccbc4 commit 46c55d7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/UnitTest/Components/TableTest.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8721,22 +8721,26 @@ public void Modify_Ok()
87218721
}
87228722

87238723
[Fact]
8724-
public async Task Table_Sortable()
8724+
public void Table_Sortable()
87258725
{
8726-
var cut = Context.RenderComponent<Table<Foo>(pb =>
8726+
var localizer = Context.Services.GetRequiredService<IStringLocalizer<Foo>>();
8727+
var cut = Context.RenderComponent<Table<Foo>>(pb =>
87278728
{
8729+
pb.AddCascadingValue<ISortableList>(new SortableList());
87288730
pb.Add(a => a.TableColumns, foo => builder =>
87298731
{
87308732
builder.OpenComponent<TableColumn<Foo, string>>(0);
87318733
builder.AddAttribute(1, "Field", "Name");
87328734
builder.AddAttribute(2, "FieldExpression", Utility.GenerateValueExpression(foo, "Name", typeof(string)));
87338735
builder.CloseComponent();
87348736
});
8735-
pb.Add(a => a.ShowExtendEditButton, false);
8736-
pb.Add(a => a.ShowExtendDeleteButton, false);
8737+
pb.Add(a => a.RenderMode, TableRenderMode.Table);
8738+
pb.Add(a => a.Items, Foo.GenerateFoo(localizer));
87378739
});
87388740
}
87398741

8742+
class SortableList : ISortableList { }
8743+
87408744
static bool ProhibitEdit(Table<Foo> @this)
87418745
{
87428746
var ret = false;

0 commit comments

Comments
 (0)