Skip to content

Commit 91e7b3d

Browse files
committed
test: 更新单元测试
1 parent 435b9bc commit 91e7b3d

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

test/UnitTest/Components/CollapseTest.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,26 @@ public void TitleColor_Ok()
8888
builder.CloseComponent();
8989
}));
9090
});
91-
cut.Contains("btn-secondary");
91+
cut.Contains("bg-secondary");
92+
}
93+
94+
[Fact]
95+
public void HeaderTemplate_Ok()
96+
{
97+
var cut = Context.RenderComponent<Collapse>(pb =>
98+
{
99+
pb.Add(a => a.CollapseItems, new RenderFragment(builder =>
100+
{
101+
builder.OpenComponent<CollapseItem>(0);
102+
builder.AddAttribute(1, nameof(CollapseItem.Text), "Item 1");
103+
builder.AddAttribute(2, nameof(CollapseItem.ChildContent), new RenderFragment(b => b.AddContent(0, "1")));
104+
builder.AddAttribute(3, nameof(CollapseItem.HeaderTemplate), new RenderFragment(b => b.AddMarkupContent(0, "<div>Header-Template</div>")));
105+
builder.AddAttribute(4, nameof(CollapseItem.HeaderClass), "header-class-test");
106+
builder.CloseComponent();
107+
}));
108+
});
109+
cut.Contains("header-class-test");
110+
cut.Contains("<div>Header-Template</div>");
92111
}
93112

94113
[Fact]

0 commit comments

Comments
 (0)