Skip to content

Commit d643d3a

Browse files
committed
test: 增加单元测试
1 parent 7e8f280 commit d643d3a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/UnitTest/Components/TreeViewTest.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,23 @@ public async Task Items_SetActive()
150150
await cut.InvokeAsync(() => cut.Instance.SetActiveItem(activeItem));
151151
}
152152

153+
[Fact]
154+
public void AppendNode_Ok()
155+
{
156+
var items = TreeFoo.GetAccordionItems();
157+
var cut = Context.RenderComponent<TreeView<TreeFoo>>(pb =>
158+
{
159+
pb.Add(a => a.Items, items);
160+
});
161+
var contents = cut.FindAll(".tree-content");
162+
Assert.Equal(2, contents.Count);
163+
164+
items.Add(new TreeViewItem<TreeFoo>(new TreeFoo()) { Text = "append-text" });
165+
cut.SetParametersAndRender();
166+
contents = cut.FindAll(".tree-content");
167+
Assert.Equal(3, contents.Count);
168+
}
169+
153170
[Fact]
154171
public async Task OnClick_Checkbox_Ok()
155172
{

0 commit comments

Comments
 (0)