Skip to content

Commit 56a943b

Browse files
committed
test: 更新单元测试
1 parent 44897ff commit 56a943b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

test/UnitTest/Components/SearchTest.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,21 @@ public void IsClearable_Ok()
210210
[Fact]
211211
public void ButtonTemplate_Ok()
212212
{
213+
SearchContext<string?>? val = null;
213214
var cut = Context.RenderComponent<Search<string?>>(pb =>
214215
{
215-
pb.Add(a => a.ButtonTemplate, context => builder => builder.AddContent(0, "button-template"));
216+
pb.Add(a => a.ButtonTemplate, context => builder =>
217+
{
218+
val = context;
219+
builder.AddContent(0, "button-template");
220+
});
216221
});
217222
cut.Contains("button-template");
223+
Assert.NotNull(val);
224+
Assert.NotNull(val.Search);
225+
Assert.Equal(cut.Instance, val.Search);
226+
Assert.NotNull(val.OnSearchAsync);
227+
Assert.NotNull(val.OnClearAsync);
218228

219229
cut.SetParametersAndRender(pb =>
220230
{

0 commit comments

Comments
 (0)