Align destructive-action source guards with captured page confirmations
This commit is contained in:
@@ -6,8 +6,8 @@ namespace ZB.MOM.WW.OtOpcUa.AdminUI.Tests.Uns;
|
||||
|
||||
/// <summary>
|
||||
/// R04 H1 source pin (no bUnit): every destructive button on the equipment page and the script editor
|
||||
/// opens a confirm dialog instead of deleting on the first click. The live check (each delete confirms)
|
||||
/// is in the Wave 4 docker-dev pass.
|
||||
/// opens a captured confirmation instead of deleting on the first click. Composed lifecycle and native
|
||||
/// confirmation checks are recorded in the Equipment and ScriptEdit OT-13 acceptance evidence.
|
||||
/// </summary>
|
||||
[Trait("Category", "Unit")]
|
||||
public sealed class DeleteConfirmationWiringTests
|
||||
@@ -17,10 +17,13 @@ public sealed class DeleteConfirmationWiringTests
|
||||
{
|
||||
var src = AdminUiSource.Read("Components", "Pages", "Uns", "EquipmentPage.razor");
|
||||
|
||||
src.ShouldContain("<RawConfirmDialog @bind-Visible=\"_confirmVisible\"");
|
||||
src.ShouldContain("@onclick=\"() => ConfirmRemoveReference(r)\"");
|
||||
src.ShouldContain("@onclick=\"() => ConfirmDeleteVirtualTag(v.VirtualTagId, v.Name)\"");
|
||||
src.ShouldContain("@onclick=\"() => ConfirmDeleteAlarm(a.ScriptedAlarmId, a.Name)\"");
|
||||
src.ShouldContain("<RawConfirmDialog Visible=\"_confirmVisible\"");
|
||||
src.ShouldContain("@onclick=\"() => ConfirmRemoveReference(presentation, equipmentId, r)\"");
|
||||
src.ShouldContain("@onclick=\"() => ConfirmDeleteVirtualTag(presentation, equipmentId, v.VirtualTagId, v.Name)\"");
|
||||
src.ShouldContain("@onclick=\"() => ConfirmDeleteAlarm(presentation, equipmentId, a.ScriptedAlarmId, a.Name)\"");
|
||||
|
||||
src.ShouldContain("VisibleChanged=\"value => SetConfirmVisible(presentation, equipmentId, confirmation, value)\"");
|
||||
src.ShouldContain("OnConfirm=\"() => RunConfirmedAsync(presentation, equipmentId, confirmation, confirmAction)\"");
|
||||
|
||||
// No danger button may call a delete handler directly.
|
||||
Regex.Matches(src, @"btn-outline-danger[^>]*@onclick=""\(\) => (Delete|Remove)\w*\(").Count.ShouldBe(0);
|
||||
@@ -58,8 +61,8 @@ public sealed class DeleteConfirmationWiringTests
|
||||
{
|
||||
var src = AdminUiSource.Read("Components", "Pages", "ScriptEdit.razor");
|
||||
|
||||
src.ShouldContain("@onclick=\"() => _confirmDeleteVisible = true\"");
|
||||
src.ShouldContain("OnConfirm=\"DeleteAsync\"");
|
||||
src.ShouldContain("@onclick=\"() => OpenDelete(presentation, form)\"");
|
||||
src.ShouldContain("OnConfirm=\"() => DeleteAsync(presentation, confirmation)\"");
|
||||
src.ShouldNotContain("@onclick=\"DeleteAsync\"");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user