Associate ScadaBridge controls, guidance and editor errors
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using Bunit;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using ZB.MOM.WW.ScadaBridge.CentralUI.Components.Shared;
|
||||
|
||||
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Shared;
|
||||
|
||||
/// <summary>Control names remain associated as search and selection values change.</summary>
|
||||
public class ControlLabelTests : BunitContext
|
||||
{
|
||||
/// <summary>Visible DataTable search label targets its instance-specific input.</summary>
|
||||
[Fact]
|
||||
public void TableSearch_HasAssociatedLabelAfterTyping()
|
||||
{
|
||||
var cut = Render<DataTable<string>>(p => p.Add(c => c.Items, new[] { "one", "two" })
|
||||
.Add(c => c.ShowSearch, true).Add(c => c.HeaderContent, (RenderFragment)(b => b.AddContent(0, "Value")))
|
||||
.Add(c => c.RowContent, (RenderFragment<string>)(v => b => b.AddContent(0, v))));
|
||||
var input = cut.Find("input");
|
||||
Assert.False(string.IsNullOrEmpty(input.Id));
|
||||
Assert.Equal("Search", cut.Find("label[for='" + input.Id + "']").TextContent.Trim());
|
||||
input.Input("one");
|
||||
Assert.NotNull(cut.Find("label[for='" + cut.Find("input").Id + "']"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user