Skip to content

Commit 1716203

Browse files
committed
test: 增加单元测试
1 parent 52d82af commit 1716203

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/UnitTest/Services/MaskServiceTest.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// See the LICENSE file in the project root for more information.
44
// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone
55

6+
using Microsoft.AspNetCore.Components.Rendering;
7+
68
namespace UnitTest.Services;
79

810
/// <summary>
@@ -92,6 +94,10 @@ public async Task Show_Component()
9294
});
9395
var button = cut.Find("button");
9496
await cut.InvokeAsync(() => button.Click());
97+
98+
// close
99+
var close = cut.Find(".btn-mask-close");
100+
await cut.InvokeAsync(() => close.Click());
95101
}
96102

97103
[Fact]
@@ -114,6 +120,11 @@ public async Task Show_Type()
114120

115121
class MockComponent : ComponentBase
116122
{
117-
123+
protected override void BuildRenderTree(RenderTreeBuilder builder)
124+
{
125+
builder.OpenComponent<DialogCloseButton>(0);
126+
builder.AddAttribute(1, "class", "btn-mask-close");
127+
builder.CloseComponent();
128+
}
118129
}
119130
}

0 commit comments

Comments
 (0)