Skip to content

Commit fe0272c

Browse files
committed
test: 更新单元测试
1 parent c98db7b commit fe0272c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/UnitTest/Components/TableTest.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7702,7 +7702,7 @@ public async Task GetValue_LookupServiceKey()
77027702
}
77037703

77047704
[Fact]
7705-
public void Value_Formatter()
7705+
public async Task Value_Formatter()
77067706
{
77077707
var localizer = Context.Services.GetRequiredService<IStringLocalizer<Foo>>();
77087708
var cut = Context.RenderComponent<BootstrapBlazorRoot>(pb =>
@@ -7723,16 +7723,20 @@ public void Value_Formatter()
77237723
cut.Contains("010");
77247724

77257725
var col = cut.FindComponent<TableColumn<Foo, int>>();
7726+
var formatted = false;
77267727
col.SetParametersAndRender(pb =>
77277728
{
77287729
pb.Add(a => a.Formatter, new Func<object?, Task<string?>>(obj =>
77297730
{
7731+
formatted = true;
77307732
return Task.FromResult<string?>("test-formatter");
77317733
}));
77327734
});
77337735
var table = cut.FindComponent<MockTable>();
7734-
cut.InvokeAsync(() => table.Instance.QueryAsync());
7735-
cut.WaitForAssertion(() => cut.Contains("test-formatter"));
7736+
await cut.InvokeAsync(() => table.Instance.QueryAsync());
7737+
7738+
// Formatter 方法不被调用
7739+
Assert.False(formatted);
77367740
}
77377741

77387742
[Fact]

0 commit comments

Comments
 (0)