Skip to content

Commit 21494c8

Browse files
committed
test: 更新单元测试
1 parent b34d62c commit 21494c8

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

test/UnitTest/Components/OtpInputTest.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,23 @@ public void Type_Ok()
7474
item = cut.Find(".bb-opt-item");
7575
Assert.Equal("<input type=\"password\" class=\"bb-opt-item\" maxlength=\"1\">", item.OuterHtml);
7676
}
77+
78+
[Fact]
79+
public async Task TriggerSetValue_Ok()
80+
{
81+
var v = "123456";
82+
var cut = Context.RenderComponent<OtpInput>(pb =>
83+
{
84+
pb.Add(a => a.Type, OtpInputType.Text);
85+
pb.Add(a => a.Value, v);
86+
pb.Add(a => a.OnValueChanged, val =>
87+
{
88+
v = val;
89+
return Task.CompletedTask;
90+
});
91+
});
92+
93+
await cut.InvokeAsync(() => cut.Instance.TriggerSetValue("234567"));
94+
Assert.Equal("234567", v);
95+
}
7796
}

0 commit comments

Comments
 (0)