Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/BootstrapBlazor/Components/Button/Button.razor.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use "../../wwwroot/scss/variables" as *;
@use "../../wwwroot/scss/variables" as *;

.btn {
--bs-btn-font-size: #{$bs-btn-font-size};
Expand Down Expand Up @@ -91,4 +91,14 @@
display: block;
}
}

> .input-group-text:not(:first-child) {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}

> .input-group-text:not(:last-child) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}
10 changes: 8 additions & 2 deletions src/BootstrapBlazor/Components/Input/BootstrapInputGroupLabel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License
// See the LICENSE file in the project root for more information.
// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
Expand Down Expand Up @@ -51,9 +51,15 @@ public sealed class BootstrapInputGroupLabel : DisplayBase<string>
[Parameter]
public RenderFragment? ChildContent { get; set; }

/// <summary>
/// 获得/设置 是否为 InputGroup 或 TableToolbar 内的标签 默认 null 未设置
/// </summary>
[Parameter]
public bool? IsGroupLabel { get; set; }
Comment on lines +54 to +58

Copilot AI Dec 5, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new IsGroupLabel parameter lacks test coverage. Consider adding test cases to verify:

  1. The parameter correctly overrides the automatic detection when set to true
  2. The parameter correctly overrides the automatic detection when set to false
  3. The behavior when the parameter is null (default) matches the existing auto-detection logic

Example test case structure:

[Fact]
public void IsGroupLabel_Override_Ok()
{
    // Test explicit true
    var cut = Context.Render<BootstrapInputGroupLabel>(builder =>
    {
        builder.Add(s => s.DisplayText, "Test");
        builder.Add(s => s.IsGroupLabel, true);
    });
    cut.MarkupMatches("<div class=\"input-group-text\">Test</div>");
    
    // Test explicit false
    cut.Render(pb => pb.Add(s => s.IsGroupLabel, false));
    cut.MarkupMatches("<label class=\"form-label\">Test</label>");
}

Copilot uses AI. Check for mistakes.

private string? Required => ShowRequiredMark ? "true" : null;

private bool IsInputGroupLabel => InputGroup != null;
private bool IsInputGroupLabel => IsGroupLabel ?? InputGroup != null;

/// <summary>
/// <inheritdoc/>
Expand Down
13 changes: 13 additions & 0 deletions test/UnitTest/Components/InputTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,19 @@ public void GroupLabel_Ok()
cut.DoesNotContain("DisplayText");
}

[Fact]
public void IsGroupLabel_Ok()
{
var cut = Context.Render<BootstrapInputGroupLabel>();
cut.DoesNotContain("input-group-text");

cut.Render(pb =>
{
pb.Add(a => a.IsGroupLabel, true);
});
cut.Contains("input-group-text");
}

[Fact]
public void ShowRequiredMark_Ok()
{
Expand Down