Skip to content

Commit 4b083a6

Browse files
committed
test: 增加单元测试
1 parent 985eed0 commit 4b083a6

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

test/UnitTest/Components/DrawerTest.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,21 @@ public void IsKeyboard_Ok()
182182
cut.DoesNotContain("data-bb-keyboard=\"true\"");
183183
}
184184

185+
[Fact]
186+
public void BodyScroll_Ok()
187+
{
188+
var cut = Context.RenderComponent<Drawer>(builder =>
189+
{
190+
builder.Add(a => a.BodyScroll, true);
191+
builder.Add(a => a.ChildContent, s =>
192+
{
193+
s.OpenComponent<Button>(0);
194+
s.CloseComponent();
195+
});
196+
});
197+
cut.Contains("data-bb-scroll=\"true\"");
198+
}
199+
185200
class MockContent : ComponentBase
186201
{
187202
[CascadingParameter(Name = "BodyContext")]

test/UnitTest/Services/DrawerServiceTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public async Task Show_Ok()
2424
Placement = Placement.Bottom,
2525
ShowBackdrop = true,
2626
BodyContext = "test-body-context",
27-
IsKeyboard = true
27+
IsKeyboard = true,
28+
BodyScroll = true
2829
};
2930
var service = Context.Services.GetRequiredService<DrawerService>();
3031
var cut = Context.RenderComponent<BootstrapBlazorRoot>();

0 commit comments

Comments
 (0)