fix(theme): TechButton honours a caller-supplied disabled; bump 0.5.1 (scadaproj#44)

The trailing disabled="@Busy" overrode the splatted attribute, so a caller's
disabled was dropped whenever Busy was false and the button stayed clickable.
The effective state is now Busy || caller disabled (Blazor splat semantics).

- tests: caller disabled (true/"disabled"/""), false, and re-render toggle
- Directory.Build.props 0.5.0 -> 0.5.1 (NOT packed or published)
- code-reviews: Theme-007 Resolved; README regenerated

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-09 14:44:14 -05:00
parent 6c81c0bc0a
commit a2e2f4b463
6 changed files with 61 additions and 11 deletions
@@ -56,6 +56,42 @@ public sealed class TechButtonExtensionsTests : BunitContext
Assert.DoesNotContain(cut.FindAll("span"), x => x.ClassList.Contains("spinner-border"));
}
[Theory]
[InlineData(true)]
[InlineData("disabled")]
[InlineData("")]
public void Caller_disabled_is_honoured_when_not_busy(object disabled)
{
// Theme-007 (scadaproj#44): the trailing disabled="@Busy" overwrote the splatted value, so
// a caller's disabled was silently dropped whenever Busy was false.
var cut = Render<TechButton>(p => p
.AddUnmatched("disabled", disabled)
.AddChildContent("Delete"));
var button = cut.Find("button");
Assert.True(button.HasAttribute("disabled"));
Assert.Empty(cut.FindAll(".spinner-border"));
}
[Fact]
public void Caller_disabled_false_leaves_the_button_enabled()
{
var cut = Render<TechButton>(p => p.AddUnmatched("disabled", false).AddChildContent("Go"));
Assert.False(cut.Find("button").HasAttribute("disabled"));
}
[Fact]
public void Caller_disabled_toggles_off_on_rerender()
{
var cut = Render<TechButton>(p => p.AddUnmatched("disabled", true).AddChildContent("Go"));
Assert.True(cut.Find("button").HasAttribute("disabled"));
cut.Render(p => p.AddUnmatched("disabled", false));
Assert.False(cut.Find("button").HasAttribute("disabled"));
}
[Fact]
public void Lowercase_class_attribute_preserves_required_button_classes()
{