Skip to content

Commit adaad7c

Browse files
committed
test: 增加单元测试
1 parent f2fcd0d commit adaad7c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/UnitTest/Components/SelectTreeTest.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,20 @@ public void IsPopover_Ok()
190190
cut.DoesNotContain("data-bs-toggle=\"dropdown\"");
191191
}
192192

193+
[Fact]
194+
public void IsActive_Ok()
195+
{
196+
var items = TreeFoo.GetTreeItems();
197+
var cut = Context.RenderComponent<SelectTree<TreeFoo>>(builder =>
198+
{
199+
builder.Add(p => p.Items, items);
200+
builder.Add(p => p.Value, new TreeFoo() { Id = "1020", Text = "Navigation Two" });
201+
});
202+
var nodes = cut.FindAll(".tree-content");
203+
Assert.Equal(3, nodes.Count);
204+
Assert.True(nodes[1].ClassName == "tree-content active");
205+
}
206+
193207
private List<TreeViewItem<string>> BindItems { get; } =
194208
[
195209
new TreeViewItem<string>("Test1")

0 commit comments

Comments
 (0)