From 497b3f3acce8c981ddf1ca215de3845f6da6c301 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Fri, 4 Feb 2022 00:03:04 +0800 Subject: [PATCH 01/10] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=20ServiceP?= =?UTF-8?q?roviderExtensions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/ServiceProviderExtensions.cs | 21 ------------------- 1 file changed, 21 deletions(-) delete mode 100644 src/BootstrapBlazor/Extensions/ServiceProviderExtensions.cs diff --git a/src/BootstrapBlazor/Extensions/ServiceProviderExtensions.cs b/src/BootstrapBlazor/Extensions/ServiceProviderExtensions.cs deleted file mode 100644 index f89335e9e..000000000 --- a/src/BootstrapBlazor/Extensions/ServiceProviderExtensions.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -// Website: https://www.blazor.zone or https://argozhang.github.io/ - -namespace BootstrapBlazor.Components; - -/// -/// -/// -public static class ServiceProviderExtensions -{ - /// - /// - /// - /// - [Obsolete("可删除此行代码")] - public static void RegisterProvider(this IServiceProvider provider) - { - //TODO: 请移除此代码 - } -} -- Gitee From fe133196fc0c9a0d0fd8f6e87bc7764e1d09b5da Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Fri, 4 Feb 2022 00:11:32 +0800 Subject: [PATCH 02/10] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=20IsShadow=20?= =?UTF-8?q?=E5=8D=95=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/CardTest.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/UnitTest/Components/CardTest.cs b/test/UnitTest/Components/CardTest.cs index c306a2ef0..3fde497a7 100644 --- a/test/UnitTest/Components/CardTest.cs +++ b/test/UnitTest/Components/CardTest.cs @@ -43,6 +43,12 @@ public class CardTest : TestBase Assert.Contains("text-center", cut.Markup); } + [Fact] + public void IsShadow_Ok() + { + var cut = Context.RenderComponent(builder => builder.Add(a => a.IsShadow, true)); + Assert.Contains("card-shadow", cut.Markup); + } private static RenderFragment CreateComponent() => builder => { -- Gitee From 6e258086e23cd362c738e15487e3feb9f3b1c443 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Fri, 4 Feb 2022 00:11:51 +0800 Subject: [PATCH 03/10] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=20HeaderText?= =?UTF-8?q?=20=E5=8D=95=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/CardTest.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/UnitTest/Components/CardTest.cs b/test/UnitTest/Components/CardTest.cs index 3fde497a7..884a70be1 100644 --- a/test/UnitTest/Components/CardTest.cs +++ b/test/UnitTest/Components/CardTest.cs @@ -50,6 +50,12 @@ public class CardTest : TestBase Assert.Contains("card-shadow", cut.Markup); } + [Fact] + public void HeaderText_Ok() + { + var cut = Context.RenderComponent(builder => builder.Add(a => a.HeaderText, "Header")); + Assert.Contains("Header", cut.Markup); + } private static RenderFragment CreateComponent() => builder => { builder.OpenElement(0, "div"); -- Gitee From b157184ad06deb377663a40eed74bf56d1003c38 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Fri, 4 Feb 2022 00:12:02 +0800 Subject: [PATCH 04/10] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=E6=94=B6?= =?UTF-8?q?=E7=BC=A9=E5=8D=95=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/CardTest.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/UnitTest/Components/CardTest.cs b/test/UnitTest/Components/CardTest.cs index 884a70be1..24314c44b 100644 --- a/test/UnitTest/Components/CardTest.cs +++ b/test/UnitTest/Components/CardTest.cs @@ -56,6 +56,19 @@ public class CardTest : TestBase var cut = Context.RenderComponent(builder => builder.Add(a => a.HeaderText, "Header")); Assert.Contains("Header", cut.Markup); } + + [Fact] + public void IsCollapsible_Ok() + { + var cut = Context.RenderComponent(builder => + { + builder.Add(a => a.IsCollapsible, true); + builder.Add(a => a.HeaderText, "Header"); + }); + Assert.Contains("card-collapse", cut.Markup); + } + + private static RenderFragment CreateComponent() => builder => { builder.OpenElement(0, "div"); -- Gitee From 4d720228dde516a3c0bdd4ed9885fbf4db2caba4 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Fri, 4 Feb 2022 00:26:30 +0800 Subject: [PATCH 05/10] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4=20DividerBase?= =?UTF-8?q?=20=E5=9F=BA=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Divider/Divider.razor | 2 +- .../Divider/{DividerBase.cs => Divider.razor.cs} | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) rename src/BootstrapBlazor/Components/Divider/{DividerBase.cs => Divider.razor.cs} (85%) diff --git a/src/BootstrapBlazor/Components/Divider/Divider.razor b/src/BootstrapBlazor/Components/Divider/Divider.razor index dabd8e690..3ba34e2db 100644 --- a/src/BootstrapBlazor/Components/Divider/Divider.razor +++ b/src/BootstrapBlazor/Components/Divider/Divider.razor @@ -1,5 +1,5 @@ @namespace BootstrapBlazor.Components -@inherits DividerBase +@inherits BootstrapComponentBase
diff --git a/src/BootstrapBlazor/Components/Divider/DividerBase.cs b/src/BootstrapBlazor/Components/Divider/Divider.razor.cs similarity index 85% rename from src/BootstrapBlazor/Components/Divider/DividerBase.cs rename to src/BootstrapBlazor/Components/Divider/Divider.razor.cs index 6993c570a..24939f069 100644 --- a/src/BootstrapBlazor/Components/Divider/DividerBase.cs +++ b/src/BootstrapBlazor/Components/Divider/Divider.razor.cs @@ -7,9 +7,9 @@ using Microsoft.AspNetCore.Components; namespace BootstrapBlazor.Components; /// -/// Divider 组件基类 +/// Divider 组件 /// -public abstract class DividerBase : ComponentBase +public partial class Divider { /// /// 获得 class 样式集合 @@ -29,13 +29,6 @@ public abstract class DividerBase : ComponentBase .AddClass("is-right", Alignment.Right == Alignment) .Build(); - /// - /// 获得/设置 用户自定义属性 - /// - /// - [Parameter(CaptureUnmatchedValues = true)] - public IDictionary? AdditionalAttributes { get; set; } - /// /// 获得/设置 是否为垂直显示 默认为 false /// -- Gitee From 1bccfcc5d9d9451e4d2ff0a9567d326a6d488d68 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Fri, 4 Feb 2022 00:26:55 +0800 Subject: [PATCH 06/10] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Components/DividerTest.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/UnitTest/Components/DividerTest.cs diff --git a/test/UnitTest/Components/DividerTest.cs b/test/UnitTest/Components/DividerTest.cs new file mode 100644 index 000000000..e569ebefa --- /dev/null +++ b/test/UnitTest/Components/DividerTest.cs @@ -0,0 +1,10 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +namespace UnitTest.Components; + +public class DividerTest : TestBase +{ + +} -- Gitee From 28a78d59c9efd1d8b15e2a8c1e06354099d14555 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Fri, 4 Feb 2022 00:27:24 +0800 Subject: [PATCH 07/10] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=20TextIcon=20?= =?UTF-8?q?=E5=8D=95=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/DividerTest.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/UnitTest/Components/DividerTest.cs b/test/UnitTest/Components/DividerTest.cs index e569ebefa..19a75aec4 100644 --- a/test/UnitTest/Components/DividerTest.cs +++ b/test/UnitTest/Components/DividerTest.cs @@ -6,5 +6,16 @@ namespace UnitTest.Components; public class DividerTest : TestBase { + [Fact] + public void TextIcon_Ok() + { + var cut = Context.RenderComponent(pb => + { + pb.Add(a => a.Text, "Test"); + pb.Add(a => a.Icon, "fa fa-fa"); + }); + Assert.Contains("Test", cut.Markup); + Assert.Contains("fa fa-fa", cut.Markup); + } } -- Gitee From 6ad11995aff111af83aa7d5200f3a776635c538a Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Fri, 4 Feb 2022 00:27:36 +0800 Subject: [PATCH 08/10] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=20Vertical=20?= =?UTF-8?q?=E5=8D=95=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/DividerTest.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/UnitTest/Components/DividerTest.cs b/test/UnitTest/Components/DividerTest.cs index 19a75aec4..a219576dc 100644 --- a/test/UnitTest/Components/DividerTest.cs +++ b/test/UnitTest/Components/DividerTest.cs @@ -18,4 +18,14 @@ public class DividerTest : TestBase Assert.Contains("fa fa-fa", cut.Markup); } + [Fact] + public void IsVertical_Ok() + { + var cut = Context.RenderComponent(pb => + { + pb.Add(a => a.IsVertical, true); + pb.Add(a => a.Text, "Test"); + }); + Assert.Contains("divider-vertical", cut.Markup); + } } -- Gitee From c2b570c51c7f844556170ff5dc52369748360ba4 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Fri, 4 Feb 2022 00:27:51 +0800 Subject: [PATCH 09/10] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=20ChildContent?= =?UTF-8?q?=20=E5=8D=95=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/DividerTest.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/UnitTest/Components/DividerTest.cs b/test/UnitTest/Components/DividerTest.cs index a219576dc..e157fbb48 100644 --- a/test/UnitTest/Components/DividerTest.cs +++ b/test/UnitTest/Components/DividerTest.cs @@ -28,4 +28,14 @@ public class DividerTest : TestBase }); Assert.Contains("divider-vertical", cut.Markup); } + + [Fact] + public void ChildContent_Ok() + { + var cut = Context.RenderComponent(pb => + { + pb.Add(a => a.ChildContent, new RenderFragment(builder => builder.AddContent(0, "Test"))); + }); + Assert.Contains("Test", cut.Markup); + } } -- Gitee From 9ff3a4bb6f49e8210a47173ef93158c635ff3d1b Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Fri, 4 Feb 2022 00:28:12 +0800 Subject: [PATCH 10/10] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=20Alignment=20?= =?UTF-8?q?=E5=8D=95=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/DividerTest.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/UnitTest/Components/DividerTest.cs b/test/UnitTest/Components/DividerTest.cs index e157fbb48..9d22ef543 100644 --- a/test/UnitTest/Components/DividerTest.cs +++ b/test/UnitTest/Components/DividerTest.cs @@ -38,4 +38,27 @@ public class DividerTest : TestBase }); Assert.Contains("Test", cut.Markup); } + + [Fact] + public void Alignment_Ok() + { + var cut = Context.RenderComponent(pb => + { + pb.Add(a => a.Alignment, Alignment.Left); + pb.Add(a => a.Text, "Test"); + }); + Assert.Contains("is-left", cut.Markup); + + cut.SetParametersAndRender(pb => + { + pb.Add(a => a.Alignment, Alignment.Center); + }); + Assert.Contains("is-center", cut.Markup); + + cut.SetParametersAndRender(pb => + { + pb.Add(a => a.Alignment, Alignment.Right); + }); + Assert.Contains("is-right", cut.Markup); + } } -- Gitee