Skip to content

Commit 087d1fe

Browse files
committed
test: 增加单元测试
1 parent 0bb48e9 commit 087d1fe

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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 LayoutSplitebarTest : BootstrapBlazorTestBase
9+
{
10+
[Fact]
11+
public void LayoutSplitebar_Ok()
12+
{
13+
var cut = Context.RenderComponent<LayoutSplitebar>(pb =>
14+
{
15+
pb.Add(a => a.ContainerSelector, ".layout");
16+
});
17+
cut.Contains("data-bb-selector=\".layout\"");
18+
19+
cut.SetParametersAndRender(pb =>
20+
{
21+
pb.Add(a => a.Min, 100);
22+
pb.Add(a => a.Max, 200);
23+
});
24+
cut.Contains("data-bb-min=\"100\"");
25+
cut.Contains("data-bb-max=\"200\"");
26+
}
27+
}

test/UnitTest/Components/LayoutTest.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,23 @@ public void UseTabSet_Layout()
237237
cut.WaitForAssertion(() => cut.Contains("<div class=\"tabs-body-content\">Binder</div>"));
238238
}
239239

240+
[Fact]
241+
public void ShowLayouSidebar_Ok()
242+
{
243+
var cut = Context.RenderComponent<Layout>(pb =>
244+
{
245+
pb.Add(a => a.UseTabSet, true);
246+
pb.Add(a => a.AdditionalAssemblies, new Assembly[] { GetType().Assembly });
247+
pb.Add(a => a.IsFullSide, true);
248+
pb.Add(a => a.ShowSplitBar, true);
249+
pb.Add(a => a.Side, new RenderFragment(builder =>
250+
{
251+
builder.AddContent(0, "test");
252+
}));
253+
});
254+
cut.Contains("layout-splitebar");
255+
}
256+
240257
[Fact]
241258
public void UseTabSet_Menus()
242259
{

0 commit comments

Comments
 (0)