Skip to content

Commit

Permalink
test: 增加单元测试
Browse files Browse the repository at this point in the history
  • Loading branch information
ArgoZhang committed Dec 26, 2024
1 parent 7e8f280 commit d643d3a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/UnitTest/Components/TreeViewTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,23 @@ public async Task Items_SetActive()
await cut.InvokeAsync(() => cut.Instance.SetActiveItem(activeItem));
}

[Fact]
public void AppendNode_Ok()
{
var items = TreeFoo.GetAccordionItems();
var cut = Context.RenderComponent<TreeView<TreeFoo>>(pb =>
{
pb.Add(a => a.Items, items);
});
var contents = cut.FindAll(".tree-content");
Assert.Equal(2, contents.Count);

items.Add(new TreeViewItem<TreeFoo>(new TreeFoo()) { Text = "append-text" });
cut.SetParametersAndRender();
contents = cut.FindAll(".tree-content");
Assert.Equal(3, contents.Count);
}

[Fact]
public async Task OnClick_Checkbox_Ok()
{
Expand Down

0 comments on commit d643d3a

Please # to comment.