Skip to content

Commit 2a2e562

Browse files
committed
test: 更新单元测试
1 parent f926fa1 commit 2a2e562

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/UnitTest/Components/SelectTableTest.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,31 @@ public void Items_Ok()
3636
});
3737
}
3838

39+
[Fact]
40+
public async Task QueryAsync_Ok()
41+
{
42+
var query = false;
43+
var localizer = Context.Services.GetRequiredService<IStringLocalizer<Foo>>();
44+
var items = Foo.GenerateFoo(localizer, 4);
45+
var cut = Context.RenderComponent<BootstrapBlazorRoot>(pb =>
46+
{
47+
pb.AddChildContent<SelectTable<Foo>>(pb =>
48+
{
49+
pb.Add(a => a.AutoGenerateColumns, false);
50+
pb.Add(a => a.OnQueryAsync, options =>
51+
{
52+
query = true;
53+
return OnFilterQueryAsync(options, items);
54+
});
55+
pb.Add(a => a.GetTextCallback, foo => foo.Name);
56+
});
57+
});
58+
var table = cut.FindComponent<SelectTable<Foo>>();
59+
query = false;
60+
await cut.InvokeAsync(table.Instance.QueryAsync);
61+
Assert.True(query);
62+
}
63+
3964
[Fact]
4065
public async Task IsClearable_Ok()
4166
{

0 commit comments

Comments
 (0)