mirror of
https://gitee.com/LongbowEnterprise/BootstrapBlazor.git
synced 2024-12-05 05:29:47 +08:00
!3582 test(#I64IUW): add unit test for ModalDialog
* test: 补充 ModalDialog 单元测试 * test: 修复失败的单元测试
This commit is contained in:
parent
2cb9b9a5e7
commit
5079a093eb
@ -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());
|
||||
|
@ -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()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user