!3582 test(#I64IUW): add unit test for ModalDialog

* test: 补充 ModalDialog 单元测试
* test: 修复失败的单元测试
This commit is contained in:
Argo 2022-12-04 15:53:19 +00:00
parent 2cb9b9a5e7
commit 5079a093eb
2 changed files with 6 additions and 14 deletions

View File

@ -322,6 +322,12 @@ public class DialogTest : DialogTestBase
cut.InvokeAsync(() => button.Instance.OnClick.InvokeAsync());
cut.InvokeAsync(() => modal.Instance.CloseCallback());
// 点击右上角关闭按钮
cut.InvokeAsync(() => dialog.ShowModal<MockModalDialog>(resultOption));
var btnElement = cut.Find(".btn-close");
cut.InvokeAsync(() => btnElement.Click());
cut.InvokeAsync(() => modal.Instance.CloseCallback());
cut.InvokeAsync(() => dialog.ShowModal<MockModalDialogClosingFalse>(resultOption));
button = cut.FindComponents<Button>().First(b => b.Instance.Text == "关闭");
cut.InvokeAsync(() => button.Instance.OnClick.InvokeAsync());

View File

@ -98,20 +98,6 @@ public class ImageTest : BootstrapBlazorTestBase
cut.Contains("error-template");
}
[Fact]
public async Task ShowPreviewList_Ok()
{
var cut = Context.RenderComponent<ImageViewer>(pb =>
{
pb.Add(a => a.Url, "https://www.blazor.zone/_content/BootstrapBlazor.Shared/images/logo.png");
pb.Add(a => a.PreviewList, new List<string> { "v1", "v2" });
});
cut.Contains("bb-previewer collapse active");
var img = cut.Find("img");
await cut.InvokeAsync(() => img.Click());
}
[Fact]
public void IsAsync_Ok()
{