feat(ui): MES reportable checkbox on the template alarm dialog + MES column on the Alarms tab
Claude-Session: https://claude.ai/code/session_01Y5ef34iUUMjmwnMpL9xgmB
This commit is contained in:
+67
@@ -0,0 +1,67 @@
|
||||
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Design;
|
||||
|
||||
/// <summary>
|
||||
/// The template alarm authoring surface exposes <c>TemplateAlarm.IsMesReportable</c>:
|
||||
/// an "MES reportable" checkbox in the dialog body and an MES column on the
|
||||
/// template's Alarms tab. <c>TemplateEdit</c> is a heavyweight page (~10 injected
|
||||
/// services with their own graphs), so — like the rest of the TemplateEdit coverage
|
||||
/// in this suite (see <c>TemplateNativeAlarmSourceEditorTests</c>) — these are
|
||||
/// structural assertions over the component source that pin the wiring so it cannot
|
||||
/// silently regress. The persistence behaviour itself is covered by the
|
||||
/// TemplateService / ManagementActor alarm tests.
|
||||
/// </summary>
|
||||
public class TemplateAlarmDialogMesReportableTests
|
||||
{
|
||||
private static string DesignComponentsRoot
|
||||
{
|
||||
get
|
||||
{
|
||||
var dir = AppContext.BaseDirectory;
|
||||
for (var i = 0; i < 6 && dir is not null; i++)
|
||||
dir = Directory.GetParent(dir)?.FullName;
|
||||
return Path.Combine(dir!, "src", "ZB.MOM.WW.ScadaBridge.CentralUI",
|
||||
"Components", "Pages", "Design");
|
||||
}
|
||||
}
|
||||
|
||||
private static string AlarmDialogMarkup
|
||||
=> File.ReadAllText(Path.Combine(DesignComponentsRoot, "TemplateAlarmDialog.razor"));
|
||||
|
||||
private static string TemplateEditMarkup
|
||||
=> File.ReadAllText(Path.Combine(DesignComponentsRoot, "TemplateEdit.razor"));
|
||||
|
||||
[Fact]
|
||||
public void AlarmDialog_HasMesReportableCheckbox()
|
||||
{
|
||||
var markup = AlarmDialogMarkup;
|
||||
Assert.Contains("@bind=\"_isMesReportable\"", markup);
|
||||
Assert.Contains("id=\"alarmMesReportable\"", markup);
|
||||
Assert.Contains("MES reportable", markup);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AlarmDialog_ThreadsMesReportableThroughParameterAndDraft()
|
||||
{
|
||||
var markup = AlarmDialogMarkup;
|
||||
Assert.Contains("InitialIsMesReportable", markup);
|
||||
Assert.Contains("_isMesReportable = InitialIsMesReportable", markup);
|
||||
Assert.Contains("bool IsMesReportable", markup);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AlarmsTab_HasMesColumn()
|
||||
{
|
||||
var markup = TemplateEditMarkup;
|
||||
Assert.Contains("<th>MES</th>", markup);
|
||||
Assert.Contains("data-test=\"alarm-mes-badge\"", markup);
|
||||
Assert.Contains("alarm.IsMesReportable", markup);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AlarmsTab_PassesMesReportableIntoAndOutOfTheDialog()
|
||||
{
|
||||
var markup = TemplateEditMarkup;
|
||||
Assert.Contains("InitialIsMesReportable=\"initial.IsMesReportable\"", markup);
|
||||
Assert.Contains("IsMesReportable = draft.IsMesReportable", markup);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user