Skip to content

Commit 81913a5

Browse files
committed
test: 增加单元测试
1 parent 9495e4c commit 81913a5

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/UnitTest/Components/ContextMenuTest.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,4 +247,31 @@ private static void TriggerTouchStart(IElement row)
247247
]
248248
});
249249
}
250+
251+
[Fact]
252+
public void ContextMenuDivider_Ok()
253+
{
254+
var cut = Context.RenderComponent<ContextMenuZone>(pb =>
255+
{
256+
pb.AddChildContent<ContextMenu>(pb =>
257+
{
258+
pb.AddChildContent<ContextMenuItem>(builder =>
259+
{
260+
builder.Add(a => a.Text, "Item1");
261+
});
262+
pb.AddChildContent<ContextMenuDivider>();
263+
pb.AddChildContent<ContextMenuItem>(builder =>
264+
{
265+
builder.Add(a => a.Text, "Item2");
266+
});
267+
});
268+
});
269+
270+
var menu = cut.Find(".dropdown-menu");
271+
var children = menu.Children;
272+
Assert.Equal(3, children.Length);
273+
Assert.Equal("dropdown-item", children[0].ClassName);
274+
Assert.Equal("divider", children[1].ClassName);
275+
Assert.Equal("dropdown-item", children[2].ClassName);
276+
}
250277
}

0 commit comments

Comments
 (0)