docs(tests): fix CommentChecker findings across tests/ — 13,392 → 0 (repo-wide scan clean)
Comment/XML-doc changes only: - add summaries to ~10k test methods, fixtures, fakes and helpers (+ <param> on theories, <returns> on async Task methods, <inheritdoc/> on interface implementations the checker can resolve) - strip ~2.6k project-tracking references (WP*, P*-*, row-NN, Task N, #NN, Component-0NN) from comments, keeping the explanatory text; reword false positives in comments only - real docs on fakes implementing BCL/library interfaces (IDisposable, ILogger, IOptionsMonitor, IAsyncLifetime) - reword the last 5 src/ false positives (CWE-1236, failures-1, year-0001, M365) Only non-comment edits: four one-line nested classes split across lines so members can carry docs. Build 0 errors / 0 warnings.
This commit is contained in:
@@ -14,6 +14,7 @@ namespace ZB.MOM.WW.ScadaBridge.CentralUI.Tests.Shared;
|
||||
/// </summary>
|
||||
public class InstancePickerTests : BunitContext
|
||||
{
|
||||
/// <summary>Initializes the test context with loose JS interop.</summary>
|
||||
public InstancePickerTests()
|
||||
{
|
||||
JSInterop.Mode = JSRuntimeMode.Loose;
|
||||
@@ -69,6 +70,7 @@ public class InstancePickerTests : BunitContext
|
||||
private static AngleSharp.Dom.IElement TreeItem(IRenderedComponent<InstancePicker> cut, int index) =>
|
||||
cut.FindAll("[role='treeitem']")[index];
|
||||
|
||||
/// <summary>Verifies that a closed picker renders only the input field.</summary>
|
||||
[Fact]
|
||||
public void Closed_ShowsNothingButTheField()
|
||||
{
|
||||
@@ -81,6 +83,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Equal("false", input.GetAttribute("aria-expanded"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that toggling opens the panel with all areas collapsed.</summary>
|
||||
[Fact]
|
||||
public void Toggle_OpensPanel_WithAreasCollapsed()
|
||||
{
|
||||
@@ -102,6 +105,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.False(areaRow.HasAttribute("data-instance-id"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that clicking an area label expands that area.</summary>
|
||||
[Fact]
|
||||
public void ClickingAnAreaLabel_ExpandsIt()
|
||||
{
|
||||
@@ -116,6 +120,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Single(cut.FindAll("[data-instance-id='7']"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that clicking an instance selects it, closes the panel and raises the selection callback.</summary>
|
||||
[Fact]
|
||||
public void ClickingAnInstance_Selects_Closes_AndRaisesTheCallback()
|
||||
{
|
||||
@@ -132,6 +137,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Equal("P1", InputValue(cut));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a disabled picker never opens.</summary>
|
||||
[Fact]
|
||||
public void Disabled_NeverOpens()
|
||||
{
|
||||
@@ -145,6 +151,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Empty(cut.FindAll("[data-test='t-panel']"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that clicking the backdrop closes the panel without changing the selection.</summary>
|
||||
[Fact]
|
||||
public void Backdrop_ClickClosesThePanel_WithoutChangingSelection()
|
||||
{
|
||||
@@ -159,6 +166,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Equal(string.Empty, InputValue(cut));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a selection set by the parent updates the field text.</summary>
|
||||
[Fact]
|
||||
public void ParentDrivenSelection_UpdatesTheFieldText()
|
||||
{
|
||||
@@ -171,6 +179,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Equal(string.Empty, InputValue(cut));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that supplying a new instances list after a site change clears the stale selection text.</summary>
|
||||
[Fact]
|
||||
public void SiteChange_NewInstancesList_ClearsAStaleSelectionText()
|
||||
{
|
||||
@@ -190,6 +199,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Empty(cut.FindAll("[data-test='t-panel']"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the item label function is used for both the rows and the field text.</summary>
|
||||
[Fact]
|
||||
public void ItemLabel_IsUsedForRowsAndField()
|
||||
{
|
||||
@@ -207,6 +217,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Equal("P1 (x)", InputValue(cut));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that typing filters the tree and expands it to the matches.</summary>
|
||||
[Fact]
|
||||
public void Typing_Filters_AndExpandsToTheMatches()
|
||||
{
|
||||
@@ -224,6 +235,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.DoesNotContain("Zulu", rows);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that clearing the filter restores the full tree in a collapsed state.</summary>
|
||||
[Fact]
|
||||
public void Clearing_RestoresTheFullTree_Collapsed()
|
||||
{
|
||||
@@ -239,6 +251,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Empty(cut.FindAll("[data-instance-id='7']"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that typing opens a closed panel.</summary>
|
||||
[Fact]
|
||||
public void Typing_OpensTheClosedPanel()
|
||||
{
|
||||
@@ -251,6 +264,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Equal(new[] { "Zulu" }, Rows(cut));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that pressing Enter with no matching instance does nothing.</summary>
|
||||
[Fact]
|
||||
public void Enter_WithNoMatch_DoesNothing()
|
||||
{
|
||||
@@ -265,6 +279,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Single(cut.FindAll("[data-test='t-panel']"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that pressing Enter picks the first visible match.</summary>
|
||||
[Fact]
|
||||
public void Enter_PicksTheFirstVisibleMatch()
|
||||
{
|
||||
@@ -281,6 +296,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Equal("Zulu", InputValue(cut));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that pressing Enter with no filter picks the first instance in document order.</summary>
|
||||
[Fact]
|
||||
public void Enter_WithNoFilter_PicksTheFirstInstanceInDocumentOrder()
|
||||
{
|
||||
@@ -296,6 +312,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Equal("Zulu", InputValue(cut));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that pressing Escape closes the panel and restores the selected text.</summary>
|
||||
[Fact]
|
||||
public void Escape_ClosesAndRestoresTheSelectedText()
|
||||
{
|
||||
@@ -319,6 +336,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Equal("P1", InputValue(cut));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that pressing ArrowDown moves focus into the tree.</summary>
|
||||
[Fact]
|
||||
public void ArrowDown_MovesFocusIntoTheTree()
|
||||
{
|
||||
@@ -345,6 +363,7 @@ public class InstancePickerTests : BunitContext
|
||||
i => i.Identifier.Contains("focus", StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that pressing ArrowDown on a closed picker opens the panel and focuses the first row.</summary>
|
||||
[Fact]
|
||||
public void ArrowDown_OnAClosedPicker_OpensThePanel_AndFocusesTheFirstRow()
|
||||
{
|
||||
@@ -359,6 +378,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Equal("0", cut.FindAll("[role='treeitem']")[0].GetAttribute("tabindex"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that pressing Escape on a closed picker has no effect.</summary>
|
||||
[Fact]
|
||||
public void Escape_WhenClosed_IsANoOp()
|
||||
{
|
||||
@@ -371,6 +391,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Equal("Zulu", InputValue(cut));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the filter text is not carried into the selection.</summary>
|
||||
[Fact]
|
||||
public void FilterIsNotCarriedIntoSelection()
|
||||
{
|
||||
@@ -390,6 +411,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Empty(cut.FindAll("[data-instance-id='7']"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that toggling while the panel is open closes it.</summary>
|
||||
[Fact]
|
||||
public void Toggle_WhileOpen_ClosesThePanel()
|
||||
{
|
||||
@@ -404,6 +426,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Equal("false", cut.Find("[data-test='t-input']").GetAttribute("aria-expanded"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the field sits above the backdrop so it stays clickable while the panel is open.</summary>
|
||||
[Fact]
|
||||
public void TheFieldSitsAboveTheBackdrop_SoItStaysClickableWhileOpen()
|
||||
{
|
||||
@@ -419,6 +442,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Single(cut.FindAll("[data-test='t-backdrop']"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that two pickers on the same page get distinct panel ids.</summary>
|
||||
[Fact]
|
||||
public void TwoPickers_GetDistinctPanelIds()
|
||||
{
|
||||
@@ -439,6 +463,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Equal(secondPanel, second.Find("[data-test='t-input']").GetAttribute("aria-controls"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that re-rendering with the same instances reference leaves the typed text and open panel unchanged.</summary>
|
||||
[Fact]
|
||||
public void SameInstancesReference_LeavesTheTypedTextAndOpenPanelAlone()
|
||||
{
|
||||
@@ -457,6 +482,7 @@ public class InstancePickerTests : BunitContext
|
||||
|
||||
// -- Keyboard activation on the tree itself --------------------------------
|
||||
|
||||
/// <summary>Verifies that keyboard activation on a tree row selects the instance.</summary>
|
||||
[Fact]
|
||||
public void KeyboardActivation_OnATreeRow_SelectsTheInstance()
|
||||
{
|
||||
@@ -475,6 +501,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Equal("Zulu", InputValue(cut));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that keyboard activation on an area row toggles it.</summary>
|
||||
[Fact]
|
||||
public void KeyboardActivation_OnAnAreaRow_TogglesIt()
|
||||
{
|
||||
@@ -497,6 +524,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.DoesNotContain("Cell A", Rows(cut));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that keyboard activation followed by a mouse click raises exactly one selection.</summary>
|
||||
[Fact]
|
||||
public void KeyboardActivation_AndMouseClick_RaiseExactlyOneSelection()
|
||||
{
|
||||
@@ -516,6 +544,7 @@ public class InstancePickerTests : BunitContext
|
||||
|
||||
// -- Accessible name / labelling -------------------------------------------
|
||||
|
||||
/// <summary>Verifies that the input carries an accessible name by default and from the parameter.</summary>
|
||||
[Fact]
|
||||
public void Input_CarriesAnAccessibleName_ByDefaultAndFromTheParameter()
|
||||
{
|
||||
@@ -526,6 +555,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Equal("Target instance", cut.Find("[data-test='t-input']").GetAttribute("aria-label"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the input id defaults to a generated id and honours the parameter.</summary>
|
||||
[Fact]
|
||||
public void InputId_DefaultsToAGeneratedId_AndHonoursTheParameter()
|
||||
{
|
||||
@@ -542,6 +572,7 @@ public class InstancePickerTests : BunitContext
|
||||
Assert.Equal("flow-instance", first.Find("[data-test='t-input']").Id);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that aria-controls is rendered only while the panel is open.</summary>
|
||||
[Fact]
|
||||
public void AriaControls_IsRenderedOnlyWhileThePanelIsOpen()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user