Skip to content

Commit b2dc727

Browse files
committed
test: 增加单元测试
1 parent b39d269 commit b2dc727

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the Apache 2.0 License
3+
// See the LICENSE file in the project root for more information.
4+
// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone
5+
6+
namespace UnitTest.Components;
7+
8+
public class ToolbarTest : BootstrapBlazorTestBase
9+
{
10+
[Fact]
11+
public void Toolbar_Ok()
12+
{
13+
var cut = Context.RenderComponent<Toolbar>(pb =>
14+
{
15+
pb.Add(a => a.IsWrap, true);
16+
pb.AddChildContent<ToolbarItem>(pb =>
17+
{
18+
pb.AddChildContent<Button>();
19+
});
20+
pb.AddChildContent<ToolbarSeparator>();
21+
pb.AddChildContent<ToolbarButtonGroup>(pb =>
22+
{
23+
pb.AddChildContent<Button>();
24+
pb.AddChildContent<Button>();
25+
});
26+
pb.AddChildContent<ToolbarSpace>();
27+
});
28+
29+
// 检查 IsWrap 参数
30+
cut.Contains("flex-wrap: wrap;");
31+
32+
// 检查 Button 按钮
33+
cut.Contains("bb-toolbar-item");
34+
35+
// 检查 ButtonGroup
36+
cut.Contains("bb-toolbar-group btn-group");
37+
38+
// 检查 分隔符
39+
cut.Contains("bb-toolbar-vr vr");
40+
41+
// 检查 填充元素
42+
cut.Contains("bb-toolbar-space");
43+
}
44+
}

0 commit comments

Comments
 (0)