fix(central-ui): Debug View picker — disabled-while-connected test; drop no-op handler; static label
Task 5 review follow-ups: - New DebugViewInstancePickerTests.WhileConnected_ThePickerIsDisabled pins that a live connection locks the picker: both the input and the chevron carry `disabled`. It marks the page connected by reflection, the way the other DebugView page tests do (DebugViewAlarmTableTests) — driving the real gRPC stream is not available to a bUnit render. - OnInstanceSelectionChanged() was already a no-op and its comment described the @bind that the picker replaced; deleted, and OnInstancePicked now just records the id (XML-documented). - The ItemLabel lambda is hoisted to a private static InstanceLabel(Instance), passed as a method group. Claude-Session: https://claude.ai/code/session_01NcMG6xXdsJbmD2wYAgkK29
This commit is contained in:
+21
-1
@@ -1,3 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Security.Claims;
|
||||
using Bunit;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
@@ -21,7 +22,8 @@ namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Deployment;
|
||||
/// <c><select></c> to the shared <c>InstancePicker</c> area-tree combobox
|
||||
/// (design 2026-09-08). Pins that the page hands the picker the site's areas and
|
||||
/// its Enabled-only instance list, that drilling down the tree selects an instance,
|
||||
/// and that the selection still enables <em>Connect</em>.
|
||||
/// that the selection still enables <em>Connect</em>, and that a live connection
|
||||
/// locks the picker down.
|
||||
/// </summary>
|
||||
public class DebugViewInstancePickerTests : BunitContext
|
||||
{
|
||||
@@ -153,4 +155,22 @@ public class DebugViewInstancePickerTests : BunitContext
|
||||
.First(b => b.TextContent.Contains("Connect"));
|
||||
Assert.False(connect.HasAttribute("disabled"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WhileConnected_ThePickerIsDisabled()
|
||||
{
|
||||
RegisterServices();
|
||||
var cut = Render<DebugViewPage>();
|
||||
cut.Find("[data-test='debug-site-select']").Change(SiteId.ToString());
|
||||
|
||||
// Mark the page connected the way the other DebugView page tests do —
|
||||
// driving the real gRPC stream is not available to a bUnit render.
|
||||
cut.InvokeAsync(() => typeof(DebugViewPage)
|
||||
.GetField("_connected", BindingFlags.Instance | BindingFlags.NonPublic)!
|
||||
.SetValue(cut.Instance, true));
|
||||
cut.Render();
|
||||
|
||||
Assert.True(cut.Find("[data-test='debug-instance-input']").HasAttribute("disabled"));
|
||||
Assert.True(cut.Find("[data-test='debug-instance-toggle']").HasAttribute("disabled"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user