Merge branch 'worktree-agent-a9d87141c744e7733' into feat/instance-picker

This commit is contained in:
Joseph Doherty
2026-09-08 09:48:25 -04:00
2 changed files with 37 additions and 12 deletions
@@ -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>&lt;select&gt;</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"));
}
}