From 9e0d10efe619311eece96a10e3449967222c87c7 Mon Sep 17 00:00:00 2001 From: Argo-AsicoTech Date: Sat, 30 Nov 2024 08:40:28 +0800 Subject: [PATCH 01/12] =?UTF-8?q?doc:=20=E6=9B=B4=E6=AD=A3=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E6=96=87=E4=BB=B6=E9=94=AE=E5=80=BC=E4=B8=8D=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Server/Components/App.razor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/App.razor b/src/BootstrapBlazor.Server/Components/App.razor index 22c4becbfff..880a316b682 100644 --- a/src/BootstrapBlazor.Server/Components/App.razor +++ b/src/BootstrapBlazor.Server/Components/App.razor @@ -1,5 +1,5 @@ @inject IWebHostEnvironment Env -@inject IStringLocalizer Localizer +@inject IStringLocalizer Localizer @@ -12,7 +12,7 @@ - @Localizer["Title"] + @Localizer["SiteTitle"] From 45ef9aa80caa2e203071d6f02cf70e248dcef5ef Mon Sep 17 00:00:00 2001 From: Argo-AsicoTech Date: Sat, 30 Nov 2024 08:40:38 +0800 Subject: [PATCH 02/12] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=E5=AE=8F?= =?UTF-8?q?=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/StaticFileResponseContextExtensions.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/BootstrapBlazor.Server/Extensions/StaticFileResponseContextExtensions.cs b/src/BootstrapBlazor.Server/Extensions/StaticFileResponseContextExtensions.cs index e13e9b94bae..823012e8bfa 100644 --- a/src/BootstrapBlazor.Server/Extensions/StaticFileResponseContextExtensions.cs +++ b/src/BootstrapBlazor.Server/Extensions/StaticFileResponseContextExtensions.cs @@ -53,12 +53,10 @@ public static RenderFragment RenderAssets(this ComponentBase component) => build private static void RenderCss(this RenderTreeBuilder builder, string url) { -#if NET9_0_OR_GREATER builder.OpenElement(0, "link"); builder.AddAttribute(1, "rel", "stylesheet"); builder.AddAttribute(2, "href", url); builder.CloseElement(); -#endif } public static void ProcessCache(this StaticFileResponseContext context, IConfiguration configuration) From 9f5fc646748f4e823a7ecf4ad7f8bbdd5ec70993 Mon Sep 17 00:00:00 2001 From: Argo-AsicoTech Date: Sat, 30 Nov 2024 08:42:56 +0800 Subject: [PATCH 03/12] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=AD=A3=E5=8D=95?= =?UTF-8?q?=E8=AF=8D=E6=8B=BC=E5=86=99=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Collapse/CollapseItem.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs b/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs index 5de4047f73f..8eda752b3b7 100644 --- a/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs +++ b/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs @@ -50,7 +50,7 @@ public class CollapseItem : BootstrapComponentBase, IDisposable /// 获得/设置 所属 Collapse 实例 /// [CascadingParameter] - protected Collapse? Collpase { get; set; } + protected Collapse? Collapse { get; set; } /// /// OnInitialized 方法 @@ -59,7 +59,7 @@ protected override void OnInitialized() { base.OnInitialized(); - Collpase?.AddItem(this); + Collapse?.AddItem(this); } /// @@ -82,7 +82,7 @@ protected virtual void Dispose(bool disposing) if (disposing) { - Collpase?.RemoveItem(this); + Collapse?.RemoveItem(this); } } } From eaebc99656618ccb6cde97642bbded0ef8941c1b Mon Sep 17 00:00:00 2001 From: Argo-AsicoTech Date: Sat, 30 Nov 2024 08:43:25 +0800 Subject: [PATCH 04/12] =?UTF-8?q?doc:=20=E5=A2=9E=E5=8A=A0=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Collapse/CollapseItem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs b/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs index 8eda752b3b7..df55e6764a2 100644 --- a/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs +++ b/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs @@ -71,7 +71,7 @@ protected override void OnInitialized() private bool disposedValue; /// - /// + /// 资源销毁 /// /// protected virtual void Dispose(bool disposing) @@ -88,7 +88,7 @@ protected virtual void Dispose(bool disposing) } /// - /// + /// /// public void Dispose() { From 2fa10f777edea523d327aa624a14660e2d810b28 Mon Sep 17 00:00:00 2001 From: Argo-AsicoTech Date: Sat, 30 Nov 2024 08:43:49 +0800 Subject: [PATCH 05/12] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20HeaderClass?= =?UTF-8?q?=20=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Collapse/CollapseItem.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs b/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs index df55e6764a2..02ac703e6b9 100644 --- a/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs +++ b/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs @@ -40,12 +40,24 @@ public class CollapseItem : BootstrapComponentBase, IDisposable [Parameter] public string? Class { get; set; } + /// + /// 获得/设置 Header CSS 样式名称 默认 null + /// + [Parameter] + public string? HeaderClass { get; set; } + /// /// 获得/设置 组件内容 /// [Parameter] public RenderFragment? ChildContent { get; set; } + /// + /// 获得/设置 组件 Header 模板 + /// + [Parameter] + public RenderFragment? HeaderTemplate { get; set; } + /// /// 获得/设置 所属 Collapse 实例 /// From 74aa3cec1334b7aee631537480edb1bea70c0c0b Mon Sep 17 00:00:00 2001 From: Argo-AsicoTech Date: Sat, 30 Nov 2024 09:58:03 +0800 Subject: [PATCH 06/12] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20HeaderTempla?= =?UTF-8?q?te=20=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Collapse/Collapse.razor | 16 ++++++- .../Components/Collapse/Collapse.razor.cs | 13 ++++- .../Components/Collapse/Collapse.razor.scss | 48 ++++++++++--------- .../Components/Collapse/CollapseItem.cs | 8 ++-- 4 files changed, 55 insertions(+), 30 deletions(-) diff --git a/src/BootstrapBlazor/Components/Collapse/Collapse.razor b/src/BootstrapBlazor/Components/Collapse/Collapse.razor index dd0c9dbd0bf..a92f1529cbf 100644 --- a/src/BootstrapBlazor/Components/Collapse/Collapse.razor +++ b/src/BootstrapBlazor/Components/Collapse/Collapse.razor @@ -9,8 +9,20 @@ @foreach (var item in Children) {
-
-
public partial class Collapse { - private static string? GetButtonClassString(CollapseItem item) => CssBuilder.Default("accordion-button") + private static string? GetHeaderButtonClassString(CollapseItem item) => CssBuilder.Default("accordion-button") .AddClass("collapsed", item.IsCollapsed) + .AddClass($"bg-{item.TitleColor.ToDescriptionString()}", item.TitleColor != Color.None) + .Build(); + + private static string? GetItemIconString(CollapseItem item) => CssBuilder.Default("accordion-item-icon") + .AddClass(item.Icon) + .Build(); + + private static string? GetHeaderClassString(CollapseItem item) => CssBuilder.Default("accordion-header") + .AddClass("collapsed", item.IsCollapsed) + .AddClass($"bg-{item.TitleColor.ToDescriptionString()}", item.TitleColor != Color.None) + .AddClass(item.HeaderClass) .Build(); private static string? GetClassString(bool collapsed) => CssBuilder.Default("accordion-collapse collapse") diff --git a/src/BootstrapBlazor/Components/Collapse/Collapse.razor.scss b/src/BootstrapBlazor/Components/Collapse/Collapse.razor.scss index d2f3d22a7a4..c27ac3a50e8 100644 --- a/src/BootstrapBlazor/Components/Collapse/Collapse.razor.scss +++ b/src/BootstrapBlazor/Components/Collapse/Collapse.razor.scss @@ -3,37 +3,39 @@ --bs-accordion-btn-padding-x: 1rem; --bs-accordion-btn-padding-y: .5rem; - .accordion-button { - &.btn-primary { - background-color: var(--bs-primary); - } - - &.btn-secondary { - background-color: var(--bs-secondary); - } - - &.btn-success { - background-color: var(--bs-success); - } + .accordion-header { + display: flex; + align-items: center; + width: 100%; + overflow: hidden; - &.btn-info { - background-color: var(--bs-info); + &:not(.collapsed) { + background-color: var(--bs-accordion-active-bg); } - &.btn-warning { - background-color: var(--bs-warning); - } + .accordion-button { + --bs-accordion-inner-border-radius: 0; + flex: 1 1 auto; + width: 1%; + cursor: pointer; - &.btn-danger { - background-color: var(--bs-danger); + .accordion-item-icon { + margin-inline-end: .5rem; + } } + } - &.btn-light { - background-color: var(--bs-light); + .accordion-item:first-of-type { + .accordion-header { + border-top-left-radius: var(--bs-accordion-inner-border-radius); + border-top-right-radius: var(--bs-accordion-inner-border-radius); } + } - &.btn-dark { - background-color: var(--bs-dark); + .accordion-item:last-of-type { + .accordion-header.collapsed { + border-bottom-left-radius: var(--bs-accordion-inner-border-radius); + border-bottom-right-radius: var(--bs-accordion-inner-border-radius); } } } diff --git a/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs b/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs index 02ac703e6b9..30aeb7bc290 100644 --- a/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs +++ b/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs @@ -41,16 +41,16 @@ public class CollapseItem : BootstrapComponentBase, IDisposable public string? Class { get; set; } /// - /// 获得/设置 Header CSS 样式名称 默认 null + /// 获得/设置 组件内容 /// [Parameter] - public string? HeaderClass { get; set; } + public RenderFragment? ChildContent { get; set; } /// - /// 获得/设置 组件内容 + /// 获得/设置 Header CSS 样式名称 默认 null /// [Parameter] - public RenderFragment? ChildContent { get; set; } + public string? HeaderClass { get; set; } /// /// 获得/设置 组件 Header 模板 From 977c7c7fd6d78d16d14df53fc9caaf3575cc3972 Mon Sep 17 00:00:00 2001 From: Argo-AsicoTech Date: Sat, 30 Nov 2024 09:58:13 +0800 Subject: [PATCH 07/12] =?UTF-8?q?doc:=20=E6=96=87=E6=A1=A3=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor b/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor index d133414783a..823fec767f6 100644 --- a/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor +++ b/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor @@ -118,7 +118,7 @@ } - From 3f8a7be93d815174c5368facee9d6c49015e76f4 Mon Sep 17 00:00:00 2001 From: Argo-AsicoTech Date: Sat, 30 Nov 2024 09:58:30 +0800 Subject: [PATCH 08/12] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=20HeaderTemplat?= =?UTF-8?q?e=20=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/Collapses.razor | 37 +++++++++++++++++++ .../Components/Samples/Collapses.razor.cs | 8 ++++ 2 files changed, 45 insertions(+) diff --git a/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor b/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor index 823fec767f6..76e9d356591 100644 --- a/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor +++ b/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor @@ -140,4 +140,41 @@ + + + + + +
+ +
+
+ +
@Localizer["ConsistencyItem1"]
+
@Localizer["ConsistencyItem2"]
+
@Value
+
+
+ + +
Header-Test
+
+ +
@Localizer["FeedbackItem1"]
+
@Localizer["FeedbackItem2"]
+
+
+ + +
Header-Test
+
+ +
@Localizer["ControllabilityItem1"]
+
@Localizer["ControllabilityItem2"]
+
+
+
+
+
+ diff --git a/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor.cs b/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor.cs index 23238f33971..8aabf84e124 100644 --- a/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor.cs +++ b/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor.cs @@ -26,6 +26,14 @@ private void OnToggle() State = !State; } + private string Value { get; set; } + + private IEnumerable Items { get; set; } = new[] + { + new SelectedItem ("Beijing", "北京"), + new SelectedItem ("Shanghai", "上海") { Active = true }, + }; + /// /// 获得属性方法 /// From 94a9488e0a356d5a201d90d622a2a938b315ff8e Mon Sep 17 00:00:00 2001 From: Argo-AsicoTech Date: Sat, 30 Nov 2024 10:26:48 +0800 Subject: [PATCH 09/12] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Collapse/CollapseItem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs b/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs index 30aeb7bc290..3df59a1a73f 100644 --- a/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs +++ b/src/BootstrapBlazor/Components/Collapse/CollapseItem.cs @@ -17,7 +17,7 @@ public class CollapseItem : BootstrapComponentBase, IDisposable public string? Text { get; set; } /// - /// 获得/设置 当前状态是否激活 默认 true + /// 获得/设置 当前状态是否收缩 默认 true /// [Parameter] public bool IsCollapsed { get; set; } = true; From 12d06af3dc616268139b5f70885881c2cda6b755 Mon Sep 17 00:00:00 2001 From: Argo-AsicoTech Date: Sat, 30 Nov 2024 10:27:05 +0800 Subject: [PATCH 10/12] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=20CollapseItem?= =?UTF-8?q?=20=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/Collapses.razor | 2 + .../Components/Samples/Collapses.razor.cs | 64 +++++++++++++++++-- src/BootstrapBlazor.Shared/Locales/en-US.json | 11 +++- src/BootstrapBlazor.Shared/Locales/zh-CN.json | 11 +++- 4 files changed, 82 insertions(+), 6 deletions(-) diff --git a/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor b/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor index 76e9d356591..05735f8df81 100644 --- a/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor +++ b/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor @@ -178,3 +178,5 @@ + + diff --git a/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor.cs b/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor.cs index 8aabf84e124..2b072dc9f23 100644 --- a/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor.cs +++ b/src/BootstrapBlazor.Shared/Components/Samples/Collapses.razor.cs @@ -34,10 +34,6 @@ private void OnToggle() new SelectedItem ("Shanghai", "上海") { Active = true }, }; - /// - /// 获得属性方法 - /// - /// private AttributeItem[] GetAttributes() => [ new() @@ -65,4 +61,64 @@ private AttributeItem[] GetAttributes() => DefaultValue = " — " } ]; + + private AttributeItem[] GetCollapseItemAttributes() => + [ + new() + { + Name = "Text", + Description = Localizer["CollapseItemAttributeText"], + Type = "RenderFragment", + ValueList = " — ", + DefaultValue = " — " + }, + new() + { + Name = "Icon", + Description = Localizer["CollapseItemAttributeIcon"], + Type = "Func", + ValueList = " — ", + DefaultValue = " — " + }, + new() + { + Name = "TitleColor", + Description = Localizer["CollapseItemAttributeTitleColor"], + Type = "Func", + ValueList = " — ", + DefaultValue = " — " + }, + new() + { + Name = "Class", + Description = Localizer["CollapseItemAttributeClass"], + Type = "Func", + ValueList = " — ", + DefaultValue = " — " + }, + new() + { + Name = "HeaderClass", + Description = Localizer["CollapseItemAttributeHeaderClass"], + Type = "Func", + ValueList = " — ", + DefaultValue = " — " + }, + new() + { + Name = "HeaderTemplate", + Description = Localizer["CollapseItemAttributeHeaderTemplate"], + Type = "Func", + ValueList = " — ", + DefaultValue = " — " + }, + new() + { + Name = "IsCollapsed", + Description = Localizer["CollapseItemAttributeIsCollapsed"], + Type = "bool", + ValueList = "true|false", + DefaultValue = "false" + } + ]; } diff --git a/src/BootstrapBlazor.Shared/Locales/en-US.json b/src/BootstrapBlazor.Shared/Locales/en-US.json index 1c8413edb08..037b8b1eba8 100644 --- a/src/BootstrapBlazor.Shared/Locales/en-US.json +++ b/src/BootstrapBlazor.Shared/Locales/en-US.json @@ -3859,7 +3859,16 @@ "Controllability": "Controllability", "ControllabilityItem1": "User decision-making: according to the scene can give the user action advice or security tips, but can not replace the user to make decisions;", "ControllabilityItem2": "Results controllable: Users are free to perform actions, including undoing, falling back, and terminating the current operation.", - "ButtonText": "Toggle" + "ButtonText": "Toggle", + "HeaderTemplateTitle": "Header Template", + "HeaderTemplateIntro": "Customize the Header display content by setting HeaderTemplate", + "CollapseItemAttributeText": "The title of header", + "CollapseItemAttributeIcon": "The icon of header", + "CollapseItemAttributeTitleColor": "The color of header", + "CollapseItemAttributeClass": "The class of item", + "CollapseItemAttributeHeaderClass": "The class of header", + "CollapseItemAttributeHeaderTemplate": "Header template", + "CollapseItemAttributeIsCollapsed": "The item status collapsed" }, "BootstrapBlazor.Shared.Components.Samples.DateTimeRanges": { "Title": "Date Time Range Picker", diff --git a/src/BootstrapBlazor.Shared/Locales/zh-CN.json b/src/BootstrapBlazor.Shared/Locales/zh-CN.json index 0c35a88aa2f..f8cdc912c8e 100644 --- a/src/BootstrapBlazor.Shared/Locales/zh-CN.json +++ b/src/BootstrapBlazor.Shared/Locales/zh-CN.json @@ -3859,7 +3859,16 @@ "Controllability": "可控 Controllability", "ControllabilityItem1": "用户决策:根据场景可给予用户操作建议或安全提示,但不能代替用户进行决策;", "ControllabilityItem2": "结果可控:用户可以自由的进行操作,包括撤销、回退和终止当前操作等。", - "ButtonText": "切换" + "ButtonText": "切换", + "HeaderTemplateTitle": "Header 模板", + "HeaderTemplateIntro": "通过设置 HeaderTemplate 自定义 Header 显示内容", + "CollapseItemAttributeText": "文本文字", + "CollapseItemAttributeIcon": "图标字符串", + "CollapseItemAttributeTitleColor": "标题颜色", + "CollapseItemAttributeClass": "样式名称", + "CollapseItemAttributeHeaderClass": "Header CSS 样式名称", + "CollapseItemAttributeHeaderTemplate": "Header 模板", + "CollapseItemAttributeIsCollapsed": "当前状态是否收缩" }, "BootstrapBlazor.Shared.Components.Samples.DateTimeRanges": { "Title": "DateTimeRange 日期时间段选择器", From 435b9bc920023cdaae5c346c349304ce400ee18d Mon Sep 17 00:00:00 2001 From: Argo-AsicoTech Date: Sat, 30 Nov 2024 10:28:32 +0800 Subject: [PATCH 11/12] chore: bump version 9.0.2-beta07 --- src/BootstrapBlazor/BootstrapBlazor.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index 1269bb4861d..61ef2c1c1b3 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@  - 9.0.2-beta06 + 9.0.2-beta07 From 91e7b3deb4b5d253ece0075be0d5055409a512bb Mon Sep 17 00:00:00 2001 From: Argo-AsicoTech Date: Sat, 30 Nov 2024 10:40:53 +0800 Subject: [PATCH 12/12] =?UTF-8?q?test:=20=E6=9B=B4=E6=96=B0=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Components/CollapseTest.cs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/test/UnitTest/Components/CollapseTest.cs b/test/UnitTest/Components/CollapseTest.cs index 04b8a1ae916..cb421ee0d95 100644 --- a/test/UnitTest/Components/CollapseTest.cs +++ b/test/UnitTest/Components/CollapseTest.cs @@ -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(pb => + { + pb.Add(a => a.CollapseItems, new RenderFragment(builder => + { + builder.OpenComponent(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, "
Header-Template
"))); + builder.AddAttribute(4, nameof(CollapseItem.HeaderClass), "header-class-test"); + builder.CloseComponent(); + })); + }); + cut.Contains("header-class-test"); + cut.Contains("
Header-Template
"); } [Fact]