Skip to content

Commit a26444e

Browse files
committed
test: 增加单元测试
1 parent 459ab2f commit a26444e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/UnitTest/Components/UploadCardTest.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,24 @@ await cut.InvokeAsync(() => input.Instance.OnChange.InvokeAsync(new InputFileCha
220220
btn.InnerHtml.Contains("disabled=\"disabled\"");
221221
}
222222

223+
[Fact]
224+
public void ActionButtonTemplate_Ok()
225+
{
226+
var cut = Context.RenderComponent<CardUpload<string>>(pb =>
227+
{
228+
pb.Add(a => a.DefaultFileList,
229+
[
230+
new() { FileName = "test.png" }
231+
]);
232+
pb.Add(a => a.ActionButtonTemplate, file => pb =>
233+
{
234+
pb.AddMarkupContent(0, "<button class=\"action-button-test\"></button>");
235+
});
236+
});
237+
238+
cut.Contains("action-button-test");
239+
}
240+
223241
private class MockBrowserFile(string name = "UploadTestFile", string contentType = "text", TimeSpan? delay = null) : IBrowserFile
224242
{
225243
public string Name { get; } = name;

0 commit comments

Comments
 (0)