Skip to content

Commit de865b6

Browse files
committed
test: 更新单元测试
1 parent debb9ac commit de865b6

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

test/UnitTest/Components/IFrameTest.cs

+19-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace UnitTest.Components;
88
public class IFrameTest : BootstrapBlazorTestBase
99
{
1010
[Fact]
11-
public void Frame_Ok()
11+
public async Task Frame_Ok()
1212
{
1313
var postData = false;
1414
var cut = Context.RenderComponent<IFrame>(pb =>
@@ -27,10 +27,26 @@ public void Frame_Ok()
2727
pb.Add(a => a.Data, new { Rows = new List<string>() { "1", "2" } });
2828
});
2929

30-
cut.InvokeAsync(async () =>
30+
await cut.InvokeAsync(async () =>
3131
{
32-
await cut.Instance.CallbackAsync(new List<string> { "2", "3" });
32+
await cut.Instance.TriggerPostData(new List<string> { "2", "3" });
3333
Assert.True(postData);
3434
});
35+
36+
var loaded = false;
37+
cut.SetParametersAndRender(pb =>
38+
{
39+
pb.Add(a => a.OnReadyAsync, () =>
40+
{
41+
loaded = true;
42+
return Task.CompletedTask;
43+
});
44+
});
45+
46+
await cut.InvokeAsync(async () =>
47+
{
48+
await cut.Instance.TriggerLoaded();
49+
});
50+
Assert.True(loaded);
3551
}
3652
}

0 commit comments

Comments
 (0)