Skip to content

Commit 4c978c5

Browse files
committed
test: 更新单元测试
1 parent f732d67 commit 4c978c5

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/UnitTest/Components/CalendarTest.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,33 @@ public void CellTemplate_Ok()
5757
});
5858
}
5959

60+
[Fact]
61+
public void HeaderTemplate_Ok()
62+
{
63+
var cut = Context.RenderComponent<Calendar>(builder =>
64+
{
65+
builder.Add(a => a.ViewMode, CalendarViewMode.Month);
66+
builder.Add(a => a.HeaderTemplate, builder =>
67+
{
68+
builder.AddContent(0, "HeaderTemplate");
69+
});
70+
builder.Add(a => a.BodyTemplate, context => builder =>
71+
{
72+
builder.OpenElement(0, "div");
73+
builder.AddAttribute(1, "data-bb-value", context.Values.Count);
74+
builder.CloseElement();
75+
});
76+
});
77+
78+
Assert.Contains("HeaderTemplate", cut.Markup);
79+
Assert.Contains("data-bb-value=\"7\"", cut.Markup);
80+
81+
cut.SetParametersAndRender(pb =>
82+
{
83+
pb.Add(a => a.ViewMode, CalendarViewMode.Week);
84+
});
85+
}
86+
6087
[Fact]
6188
public async Task ButtonClick_Ok()
6289
{

0 commit comments

Comments
 (0)