feat(centralui): grouped Connection Bindings panel — rows sourced from the flattened config (composed module members were invisible; flatten failure falls back to direct attributes with a banner), per-module connection + Object apply, unbound/mixed pills, show-only-unbound filter, Test Bindings covers composed rows, per-row Browse retained
This commit is contained in:
+1
-1
@@ -158,7 +158,7 @@ public class InstanceConfigureAuditDrillinTests : BunitContext
|
||||
|
||||
cut.WaitForAssertion(() =>
|
||||
{
|
||||
var testButton = cut.FindAll("button").Single(b => b.TextContent.Trim() == "Test Bindings");
|
||||
var testButton = cut.FindAll("button").Single(b => b.TextContent.Trim().StartsWith("Test Bindings", StringComparison.Ordinal));
|
||||
Assert.False(testButton.HasAttribute("disabled"),
|
||||
$"Test Bindings should be enabled for a {protocol} binding.");
|
||||
});
|
||||
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Deployment;
|
||||
|
||||
/// <summary>
|
||||
/// Design 2026-08-20: the Connection Bindings panel renders one collapsible group
|
||||
/// per module with a header-level connection + Object apply, unbound/mixed pills and
|
||||
/// a show-only-unbound filter. Structural pins over the page source.
|
||||
/// </summary>
|
||||
public class InstanceConfigureBindingGroupsTests
|
||||
{
|
||||
private static string Markup => InstanceConfigureBindingRowsTests.ReadMarkup();
|
||||
|
||||
[Fact]
|
||||
public void GroupHeader_HasConnectionObjectAndApply()
|
||||
{
|
||||
var m = Markup;
|
||||
Assert.Contains("data-test=\"binding-group-header\"", m);
|
||||
Assert.Contains("data-test=\"binding-group-connection\"", m);
|
||||
Assert.Contains("data-test=\"binding-group-object\"", m);
|
||||
Assert.Contains("data-test=\"binding-group-apply\"", m);
|
||||
Assert.Contains("ApplyGroupObject(", m);
|
||||
Assert.Contains("BindingGroupBuilder.ApplyObject(", m);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GroupHeader_ShowsUnboundAndMixedPills()
|
||||
{
|
||||
var m = Markup;
|
||||
Assert.Contains("data-test=\"binding-group-unbound\"", m);
|
||||
Assert.Contains("data-test=\"binding-group-mixed\"", m);
|
||||
Assert.Contains("data-test=\"binding-total-unbound\"", m);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Toolbar_HasUnboundFilterAndExpandAll()
|
||||
{
|
||||
var m = Markup;
|
||||
Assert.Contains("_showOnlyUnbound", m);
|
||||
Assert.Contains("data-test=\"binding-expand-all\"", m);
|
||||
Assert.Contains("data-test=\"binding-bulk-select\"", m); // existing all-groups connection select retained
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ComposedBareDefault_IsFlagged()
|
||||
{
|
||||
Assert.Contains("data-test=\"binding-bare-default\"", Markup);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void OldFlatTable_IsGone()
|
||||
{
|
||||
Assert.DoesNotContain("_bindingDataSourceAttrs", Markup);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PerRowBrowseButton_IsRetained()
|
||||
{
|
||||
// The OPC UA / MxGateway tag browser per row predates the grouped panel and must survive it.
|
||||
var m = Markup;
|
||||
Assert.Contains("OpenBrowser(name)", m);
|
||||
Assert.Contains("IsBrowsable(", m);
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Deployment;
|
||||
|
||||
/// <summary>
|
||||
/// Design 2026-08-20: the Connection Bindings panel must be driven by the flattened
|
||||
/// configuration (every composed module member), not by the template's direct
|
||||
/// attributes — 264 of Z28061's 280 bindings were invisible on QA. Structural pins
|
||||
/// over the page source, matching the existing InstanceConfigure coverage style.
|
||||
/// </summary>
|
||||
public class InstanceConfigureBindingRowsTests
|
||||
{
|
||||
internal static string ReadMarkup()
|
||||
{
|
||||
var dir = AppContext.BaseDirectory;
|
||||
for (var i = 0; i < 6 && dir is not null; i++) dir = Directory.GetParent(dir)?.FullName;
|
||||
return File.ReadAllText(Path.Combine(dir!, "src", "ZB.MOM.WW.ScadaBridge.CentralUI",
|
||||
"Components", "Pages", "Deployment", "InstanceConfigure.razor"));
|
||||
}
|
||||
|
||||
private static string Markup => ReadMarkup();
|
||||
|
||||
[Fact]
|
||||
public void BindingRows_ComeFromFlattenedConfiguration_NotTemplateAttributes()
|
||||
{
|
||||
var m = Markup;
|
||||
Assert.Contains("LoadBindingRowsAsync", m);
|
||||
Assert.Contains("BindingGroupBuilder.Build(", m);
|
||||
// The old direct-attribute projection must be gone from the bindings path.
|
||||
Assert.DoesNotContain("_bindingDataSourceAttrs = attrs.Where(a => !string.IsNullOrEmpty(a.DataSourceReference))", m);
|
||||
Assert.Contains("DefaultDataSourceReference", m);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BindingRows_FallBackToDirectAttributes_WithBanner_WhenFlattenFails()
|
||||
{
|
||||
var m = Markup;
|
||||
Assert.Contains("_bindingSourceWarning", m);
|
||||
Assert.Contains("data-test=\"binding-source-warning\"", m);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SaveAndTest_CoverEveryRow()
|
||||
{
|
||||
var m = Markup.Replace("\r\n", "\n");
|
||||
// Save posts the whole selection dictionary (hidden-row survival property).
|
||||
Assert.Contains("_bindingSelections\n .Select(kv => new ConnectionBinding(", m);
|
||||
// Test Bindings iterates the grouped rows, not the legacy attr list.
|
||||
Assert.Contains("foreach (var g in _bindingGroups)", m);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user