Skip to content

Commit 8b9a4a8

Browse files
authored
fix(DialogCloseButton): missing theme button icon (#4809)
* fix(DialogCloseButton): 修复丢失 Icon 问题 * chore: bump version 9.1.3-beta01 * test: 补充单元测试 * test: 更新单元测试
1 parent efc7c4a commit 8b9a4a8

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

src/BootstrapBlazor/BootstrapBlazor.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Razor">
1+
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.1.2</Version>
4+
<Version>9.1.3-beta01</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

src/BootstrapBlazor/Components/Dialog/DialogCloseButton.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ public partial class DialogCloseButton : Button
3030
/// </summary>
3131
protected override void OnParametersSet()
3232
{
33-
base.OnParametersSet();
34-
3533
Icon ??= IconTheme.GetIconByKey(ComponentIcons.DialogCloseButtonIcon);
3634
Text ??= Localizer[nameof(ModalDialog.CloseButtonText)];
35+
36+
base.OnParametersSet();
3737
}
3838

3939
/// <summary>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the Apache 2.0 License
3+
// See the LICENSE file in the project root for more information.
4+
// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
5+
6+
namespace UnitTest.Components;
7+
8+
public class DialogCloseButtonTest : BootstrapBlazorTestBase
9+
{
10+
[Fact]
11+
public void Icon_Ok()
12+
{
13+
var cut = Context.RenderComponent<DialogCloseButton>();
14+
Assert.Equal("fa-solid fa-xmark", cut.Instance.Icon);
15+
cut.Contains("fa-solid fa-xmark");
16+
17+
cut.SetParametersAndRender(pb => pb.Add(p => p.Icon, "test-icon"));
18+
Assert.Equal("test-icon", cut.Instance.Icon);
19+
cut.Contains("test-icon");
20+
}
21+
}

0 commit comments

Comments
 (0)