Skip to content

Commit

Permalink
test: 更新单元测试
Browse files Browse the repository at this point in the history
  • Loading branch information
ArgoZhang committed Nov 30, 2024
1 parent 435b9bc commit 91e7b3d
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion test/UnitTest/Components/CollapseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,26 @@ public void TitleColor_Ok()
builder.CloseComponent();
}));
});
cut.Contains("btn-secondary");
cut.Contains("bg-secondary");
}

[Fact]
public void HeaderTemplate_Ok()
{
var cut = Context.RenderComponent<Collapse>(pb =>
{
pb.Add(a => a.CollapseItems, new RenderFragment(builder =>
{
builder.OpenComponent<CollapseItem>(0);
builder.AddAttribute(1, nameof(CollapseItem.Text), "Item 1");
builder.AddAttribute(2, nameof(CollapseItem.ChildContent), new RenderFragment(b => b.AddContent(0, "1")));
builder.AddAttribute(3, nameof(CollapseItem.HeaderTemplate), new RenderFragment(b => b.AddMarkupContent(0, "<div>Header-Template</div>")));
builder.AddAttribute(4, nameof(CollapseItem.HeaderClass), "header-class-test");
builder.CloseComponent();
}));
});
cut.Contains("header-class-test");
cut.Contains("<div>Header-Template</div>");
}

[Fact]
Expand Down

0 comments on commit 91e7b3d

Please sign in to comment.