From 538e7b8a923d4ae8fad71a986fc6ee278163c816 Mon Sep 17 00:00:00 2001 From: AiYuZhen Date: Sat, 31 Jan 2026 11:49:53 +0800 Subject: [PATCH 1/8] =?UTF-8?q?#7605=20=E5=A2=9E=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E6=96=87=E8=8F=9C=E5=8D=95=E9=A1=B9=E5=8F=8D=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E3=80=82=20=E5=A2=9E=E5=8A=A0=20TrimStartAndEndDivide?= =?UTF-8?q?r=20=E5=8F=82=E6=95=B0=EF=BC=8C=E7=A1=AE=E5=AE=9A=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=E5=8F=8A=E7=BB=93=E5=B0=BE=E8=8F=9C=E5=8D=95=E9=A1=B9?= =?UTF-8?q?=E4=B8=8D=E6=98=AF=E5=88=86=E5=89=B2=E7=BA=BF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/ContextMenu/ContextMenu.razor | 4 +- .../ContextMenu/ContextMenu.razor.cs | 30 +++++++++ .../ContextMenu/ContextMenuDivider.cs | 6 ++ .../Components/ContextMenu/ContextMenuItem.cs | 6 ++ .../ContextMenu/IContextMenuItem.cs | 5 +- test/UnitTest/Components/ContextMenuTest.cs | 62 +++++++++++++++++++ 6 files changed, 110 insertions(+), 3 deletions(-) diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor index 64d0b0843ae..b3a44baf4cc 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor @@ -1,4 +1,4 @@ -@namespace BootstrapBlazor.Components +@namespace BootstrapBlazor.Components @inherits BootstrapModuleComponentBase @attribute [BootstrapModuleAutoLoader] @@ -7,7 +7,7 @@ @ChildContent - @foreach (var context in _contextMenuItems) + @foreach (var context in GetContextMenuItems()) { if (context is ContextMenuDivider) { diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs index fcfdc42bfd0..f85d5d01a8e 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs @@ -34,6 +34,12 @@ public partial class ContextMenu [Parameter] public RenderFragment? ChildContent { get; set; } + /// + /// 获得/设置 是否裁剪开始及结尾处的 项 + /// + [Parameter] + public bool TrimStartAndEndDivider { get; set; } = false; + [CascadingParameter] [NotNull] private ContextMenuZone? ContextMenuZone { get; set; } @@ -47,6 +53,30 @@ public partial class ContextMenu private readonly List _contextMenuItems = []; + /// + /// 获取实际需要渲染的菜单项。 + /// + /// + private List GetContextMenuItems() + { + var tempItems = _contextMenuItems.OrderBy(x => x.Order).ToList(); + + if (TrimStartAndEndDivider) + { + //确保第一项不是分割线。 + while (tempItems.Count > 0 && tempItems.First() is ContextMenuDivider) + { + tempItems.RemoveAt(0); + } + //确保最后一项不是分割线。 + while (tempItems.Count > 0 && tempItems.Last() is ContextMenuDivider) + { + tempItems.RemoveAt(tempItems.Count - 1); + } + } + return tempItems; + } + private static string? GetItemClassString(bool disabled) => CssBuilder.Default("dropdown-item") .AddClass("disabled", disabled) .Build(); diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuDivider.cs b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuDivider.cs index 0aec3acb720..405d6bf31d8 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuDivider.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuDivider.cs @@ -17,6 +17,12 @@ public class ContextMenuDivider : Divider, IContextMenuItem, IDisposable [NotNull] private ContextMenu? ContextMenu { get; set; } + /// + /// 获得/设置 显示顺序 + /// + [Parameter] + public int Order { get; set; } + /// /// /// diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs index 98caf264315..7775878491a 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs @@ -18,6 +18,12 @@ public class ContextMenuItem : ComponentBase, IContextMenuItem, IDisposable [Parameter] public string? Text { get; set; } + /// + /// 获得/设置 显示顺序 + /// + [Parameter] + public int Order { get; set; } + /// /// 获得/设置 图标 /// The CSS class name that represents an icon (if any) diff --git a/src/BootstrapBlazor/Components/ContextMenu/IContextMenuItem.cs b/src/BootstrapBlazor/Components/ContextMenu/IContextMenuItem.cs index 8f1af1f40ea..53ad83ae4d8 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/IContextMenuItem.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/IContextMenuItem.cs @@ -11,5 +11,8 @@ namespace BootstrapBlazor.Components; /// public interface IContextMenuItem { - + /// + /// 菜单项显示顺序。 + /// + public int Order { get; } } diff --git a/test/UnitTest/Components/ContextMenuTest.cs b/test/UnitTest/Components/ContextMenuTest.cs index 998195cdf4b..0029d6671ad 100644 --- a/test/UnitTest/Components/ContextMenuTest.cs +++ b/test/UnitTest/Components/ContextMenuTest.cs @@ -327,4 +327,66 @@ public void ContextMenuDivider_Ok() Assert.Equal("divider", children[1].ClassName); Assert.Equal("dropdown-item", children[2].ClassName); } + + [Fact] + public void ContextMenu_TrimStartAndEndDivider_Ok() + { + var cut = Context.Render(pb => + { + pb.AddChildContent(pb => + { + pb.Add(x => x.TrimStartAndEndDivider, true); + pb.AddChildContent(); + pb.AddChildContent(builder => + { + builder.Add(a => a.Text, "Item1"); + }); + pb.AddChildContent(); + pb.AddChildContent(builder => + { + builder.Add(a => a.Text, "Item2"); + }); + pb.AddChildContent(); + }); + }); + + var menu = cut.Find(".dropdown-menu"); + var children = menu.Children; + Assert.Equal(3, children.Length); + Assert.Equal("dropdown-item", children[0].ClassName); + Assert.Equal("divider", children[1].ClassName); + Assert.Equal("dropdown-item", children[2].ClassName); + } + + [Fact] + public void ContextMenuItem_Order_Ok() + { + var cut = Context.Render(pb => + { + pb.AddChildContent(pb => + { + pb.AddChildContent(builder => + { + builder.Add(x => x.Order, 1); + }); + pb.AddChildContent(builder => + { + builder.Add(x => x.Order, 0); + builder.Add(a => a.Text, "Item1"); + }); + pb.AddChildContent(builder => + { + builder.Add(x => x.Order, 2); + builder.Add(a => a.Text, "Item2"); + }); + }); + }); + + var menu = cut.Find(".dropdown-menu"); + var children = menu.Children; + Assert.Equal(3, children.Length); + Assert.Equal("dropdown-item", children[0].ClassName); + Assert.Equal("divider", children[1].ClassName); + Assert.Equal("dropdown-item", children[2].ClassName); + } } From df336eaf6cb0f63fa4eba027685595f53299a4ad Mon Sep 17 00:00:00 2001 From: AiYuZhen Date: Sat, 31 Jan 2026 12:11:43 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A6=86=E7=9B=96=E5=BA=A6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/ContextMenu/ContextMenu.razor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs index f85d5d01a8e..98e6993e064 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs @@ -64,12 +64,12 @@ private List GetContextMenuItems() if (TrimStartAndEndDivider) { //确保第一项不是分割线。 - while (tempItems.Count > 0 && tempItems.First() is ContextMenuDivider) + while (tempItems.FirstOrDefault() is ContextMenuDivider) { tempItems.RemoveAt(0); } //确保最后一项不是分割线。 - while (tempItems.Count > 0 && tempItems.Last() is ContextMenuDivider) + while (tempItems.LastOrDefault() is ContextMenuDivider) { tempItems.RemoveAt(tempItems.Count - 1); } From ec2cb3856cef7e57397b4ff93109edaefeb80aeb Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 31 Jan 2026 15:52:17 +0800 Subject: [PATCH 3/8] feat(ContextMenuItem): add IsShow parameter --- .../Components/ContextMenu/ContextMenuItem.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs index 98caf264315..5cfeb8d3ac3 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs @@ -51,6 +51,14 @@ public class ContextMenuItem : ComponentBase, IContextMenuItem, IDisposable [Parameter] public Func? OnClick { get; set; } + /// + /// 获得/设置 是否显示,默认为 true 显示 + /// Gets or sets whether to display. Default is true + /// + /// 一般是通过业务逻辑判断是否显示 + [Parameter] + public bool IsShow { get; set; } = true; + [CascadingParameter] [NotNull] private ContextMenu? ContextMenu { get; set; } From ae79b7502570ff331f25bda7a90ba1fe47d32f6f Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 31 Jan 2026 15:53:13 +0800 Subject: [PATCH 4/8] =?UTF-8?q?Revert=20"=E8=B0=83=E6=95=B4=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=A6=86=E7=9B=96=E5=BA=A6=E3=80=82"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit df336eaf6cb0f63fa4eba027685595f53299a4ad. --- .../Components/ContextMenu/ContextMenu.razor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs index 98e6993e064..f85d5d01a8e 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs @@ -64,12 +64,12 @@ private List GetContextMenuItems() if (TrimStartAndEndDivider) { //确保第一项不是分割线。 - while (tempItems.FirstOrDefault() is ContextMenuDivider) + while (tempItems.Count > 0 && tempItems.First() is ContextMenuDivider) { tempItems.RemoveAt(0); } //确保最后一项不是分割线。 - while (tempItems.LastOrDefault() is ContextMenuDivider) + while (tempItems.Count > 0 && tempItems.Last() is ContextMenuDivider) { tempItems.RemoveAt(tempItems.Count - 1); } From 3997cc2d03c38b6bec57cb67d2d1faaaeb0433fa Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 31 Jan 2026 15:53:17 +0800 Subject: [PATCH 5/8] Revert "#7605" This reverts commit 538e7b8a923d4ae8fad71a986fc6ee278163c816. --- .../Components/ContextMenu/ContextMenu.razor | 4 +- .../ContextMenu/ContextMenu.razor.cs | 30 --------- .../ContextMenu/ContextMenuDivider.cs | 6 -- .../Components/ContextMenu/ContextMenuItem.cs | 6 -- .../ContextMenu/IContextMenuItem.cs | 5 +- test/UnitTest/Components/ContextMenuTest.cs | 62 ------------------- 6 files changed, 3 insertions(+), 110 deletions(-) diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor index b3a44baf4cc..64d0b0843ae 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor @@ -1,4 +1,4 @@ -@namespace BootstrapBlazor.Components +@namespace BootstrapBlazor.Components @inherits BootstrapModuleComponentBase @attribute [BootstrapModuleAutoLoader] @@ -7,7 +7,7 @@ @ChildContent - @foreach (var context in GetContextMenuItems()) + @foreach (var context in _contextMenuItems) { if (context is ContextMenuDivider) { diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs index f85d5d01a8e..fcfdc42bfd0 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs @@ -34,12 +34,6 @@ public partial class ContextMenu [Parameter] public RenderFragment? ChildContent { get; set; } - /// - /// 获得/设置 是否裁剪开始及结尾处的 项 - /// - [Parameter] - public bool TrimStartAndEndDivider { get; set; } = false; - [CascadingParameter] [NotNull] private ContextMenuZone? ContextMenuZone { get; set; } @@ -53,30 +47,6 @@ public partial class ContextMenu private readonly List _contextMenuItems = []; - /// - /// 获取实际需要渲染的菜单项。 - /// - /// - private List GetContextMenuItems() - { - var tempItems = _contextMenuItems.OrderBy(x => x.Order).ToList(); - - if (TrimStartAndEndDivider) - { - //确保第一项不是分割线。 - while (tempItems.Count > 0 && tempItems.First() is ContextMenuDivider) - { - tempItems.RemoveAt(0); - } - //确保最后一项不是分割线。 - while (tempItems.Count > 0 && tempItems.Last() is ContextMenuDivider) - { - tempItems.RemoveAt(tempItems.Count - 1); - } - } - return tempItems; - } - private static string? GetItemClassString(bool disabled) => CssBuilder.Default("dropdown-item") .AddClass("disabled", disabled) .Build(); diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuDivider.cs b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuDivider.cs index 405d6bf31d8..0aec3acb720 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuDivider.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuDivider.cs @@ -17,12 +17,6 @@ public class ContextMenuDivider : Divider, IContextMenuItem, IDisposable [NotNull] private ContextMenu? ContextMenu { get; set; } - /// - /// 获得/设置 显示顺序 - /// - [Parameter] - public int Order { get; set; } - /// /// /// diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs index 7775878491a..98caf264315 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs @@ -18,12 +18,6 @@ public class ContextMenuItem : ComponentBase, IContextMenuItem, IDisposable [Parameter] public string? Text { get; set; } - /// - /// 获得/设置 显示顺序 - /// - [Parameter] - public int Order { get; set; } - /// /// 获得/设置 图标 /// The CSS class name that represents an icon (if any) diff --git a/src/BootstrapBlazor/Components/ContextMenu/IContextMenuItem.cs b/src/BootstrapBlazor/Components/ContextMenu/IContextMenuItem.cs index 53ad83ae4d8..8f1af1f40ea 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/IContextMenuItem.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/IContextMenuItem.cs @@ -11,8 +11,5 @@ namespace BootstrapBlazor.Components; /// public interface IContextMenuItem { - /// - /// 菜单项显示顺序。 - /// - public int Order { get; } + } diff --git a/test/UnitTest/Components/ContextMenuTest.cs b/test/UnitTest/Components/ContextMenuTest.cs index 0029d6671ad..998195cdf4b 100644 --- a/test/UnitTest/Components/ContextMenuTest.cs +++ b/test/UnitTest/Components/ContextMenuTest.cs @@ -327,66 +327,4 @@ public void ContextMenuDivider_Ok() Assert.Equal("divider", children[1].ClassName); Assert.Equal("dropdown-item", children[2].ClassName); } - - [Fact] - public void ContextMenu_TrimStartAndEndDivider_Ok() - { - var cut = Context.Render(pb => - { - pb.AddChildContent(pb => - { - pb.Add(x => x.TrimStartAndEndDivider, true); - pb.AddChildContent(); - pb.AddChildContent(builder => - { - builder.Add(a => a.Text, "Item1"); - }); - pb.AddChildContent(); - pb.AddChildContent(builder => - { - builder.Add(a => a.Text, "Item2"); - }); - pb.AddChildContent(); - }); - }); - - var menu = cut.Find(".dropdown-menu"); - var children = menu.Children; - Assert.Equal(3, children.Length); - Assert.Equal("dropdown-item", children[0].ClassName); - Assert.Equal("divider", children[1].ClassName); - Assert.Equal("dropdown-item", children[2].ClassName); - } - - [Fact] - public void ContextMenuItem_Order_Ok() - { - var cut = Context.Render(pb => - { - pb.AddChildContent(pb => - { - pb.AddChildContent(builder => - { - builder.Add(x => x.Order, 1); - }); - pb.AddChildContent(builder => - { - builder.Add(x => x.Order, 0); - builder.Add(a => a.Text, "Item1"); - }); - pb.AddChildContent(builder => - { - builder.Add(x => x.Order, 2); - builder.Add(a => a.Text, "Item2"); - }); - }); - }); - - var menu = cut.Find(".dropdown-menu"); - var children = menu.Children; - Assert.Equal(3, children.Length); - Assert.Equal("dropdown-item", children[0].ClassName); - Assert.Equal("divider", children[1].ClassName); - Assert.Equal("dropdown-item", children[2].ClassName); - } } From f48500c6be41a282007ab3a42890bc4753d6d172 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 31 Jan 2026 16:33:16 +0800 Subject: [PATCH 6/8] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0=20IsShow=20?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/ContextMenu/ContextMenu.razor | 4 ++-- .../Components/ContextMenu/ContextMenuDivider.cs | 7 +++++++ .../Components/ContextMenu/ContextMenuItem.cs | 3 +-- .../Components/ContextMenu/IContextMenuItem.cs | 7 ++++++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor index 64d0b0843ae..feacbeda74f 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor @@ -1,4 +1,4 @@ -@namespace BootstrapBlazor.Components +@namespace BootstrapBlazor.Components @inherits BootstrapModuleComponentBase @attribute [BootstrapModuleAutoLoader] @@ -7,7 +7,7 @@ @ChildContent - @foreach (var context in _contextMenuItems) + @foreach (var context in _contextMenuItems.Where(i => i.IsShow)) { if (context is ContextMenuDivider) { diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuDivider.cs b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuDivider.cs index 0aec3acb720..f543cff2726 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuDivider.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuDivider.cs @@ -13,6 +13,13 @@ namespace BootstrapBlazor.Components; /// public class ContextMenuDivider : Divider, IContextMenuItem, IDisposable { + /// + /// + /// + /// 一般是通过业务逻辑判断是否显示 + [Parameter] + public bool IsShow { get; set; } = true; + [CascadingParameter] [NotNull] private ContextMenu? ContextMenu { get; set; } diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs index 5cfeb8d3ac3..6d144218041 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs @@ -52,8 +52,7 @@ public class ContextMenuItem : ComponentBase, IContextMenuItem, IDisposable public Func? OnClick { get; set; } /// - /// 获得/设置 是否显示,默认为 true 显示 - /// Gets or sets whether to display. Default is true + /// /// /// 一般是通过业务逻辑判断是否显示 [Parameter] diff --git a/src/BootstrapBlazor/Components/ContextMenu/IContextMenuItem.cs b/src/BootstrapBlazor/Components/ContextMenu/IContextMenuItem.cs index 8f1af1f40ea..f1c282bf726 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/IContextMenuItem.cs +++ b/src/BootstrapBlazor/Components/ContextMenu/IContextMenuItem.cs @@ -11,5 +11,10 @@ namespace BootstrapBlazor.Components; /// public interface IContextMenuItem { - + /// + /// 获得/设置 是否显示,默认为 true 显示 + /// Gets or sets whether to display. Default is true + /// + /// 一般是通过业务逻辑判断是否显示 + bool IsShow { get; set; } } From 42b140ad1a12c8fc96f5eb7af1ac12af3f9b53d2 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 31 Jan 2026 16:33:23 +0800 Subject: [PATCH 7/8] =?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?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Components/ContextMenuTest.cs | 30 +++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/UnitTest/Components/ContextMenuTest.cs b/test/UnitTest/Components/ContextMenuTest.cs index 998195cdf4b..b91cd791c48 100644 --- a/test/UnitTest/Components/ContextMenuTest.cs +++ b/test/UnitTest/Components/ContextMenuTest.cs @@ -107,6 +107,36 @@ public async Task ContextMenu_Ok() Assert.True(clicked); } + [Theory] + [InlineData(true, true)] + [InlineData(false, false)] + public void IsShow_Ok(bool show, bool expected) + { + var cut = Context.Render(pb => + { + pb.AddChildContent(pb => + { + pb.AddChildContent(pb => + { + pb.Add(a => a.Icon, "fa fa-test"); + pb.Add(a => a.Text, "Test1"); + pb.Add(a => a.IsShow, show); + }); + pb.AddChildContent(pb => + { + pb.Add(a => a.IsShow, show); + }); + pb.AddChildContent(pb => + { + pb.Add(a => a.Icon, "fa fa-test"); + pb.Add(a => a.Text, "Test2"); + }); + }); + }); + var actual = cut.Markup.Contains("Test1"); + Assert.Equal(expected, actual); + } + [Fact] public async Task ContextMenu_TouchWithTimeout_Ok() { From a6920caa960b88fa9549b828c039c234f6784fad Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 31 Jan 2026 16:44:09 +0800 Subject: [PATCH 8/8] chore: bump version 10.3.1-beta02 --- 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 e8243e1f171..093db25ddde 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@  - 10.3.1-beta01 + 10.3.1-beta02