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:
Joseph Doherty
2026-10-07 15:05:49 -04:00
parent 0ffd4bdbea
commit 513fa1aa16
998 changed files with 17896 additions and 2395 deletions
@@ -22,9 +22,9 @@ public class TreeViewKeyboardNavigationTests : BunitContext
private record TestNode(string Key, string Label, List<TestNode> Children);
// Alpha (branch)
// ├── Alpha-1 (leaf)
// └── Alpha-2 (branch)
// └── Alpha-2-X (leaf)
// ├── Alpha.1 (leaf)
// └── Alpha.2 (branch)
// └── Alpha.2.X (leaf)
// Beta (leaf)
private static List<TestNode> SimpleRoots() => new()
{
@@ -122,6 +122,7 @@ public class TreeViewKeyboardNavigationTests : BunitContext
// ── Roving tabindex ────────────────────────────────────────────────────────
/// <summary>Verifies that on initial render exactly one node is tabbable and it is the first node.</summary>
[Fact]
public void InitialRender_ExactlyOneNodeIsTabbable_AndItIsTheFirst()
{
@@ -132,6 +133,7 @@ public class TreeViewKeyboardNavigationTests : BunitContext
Assert.Equal(0, TabbableIndex(cut));
}
/// <summary>Verifies that on initial render the selected node owns the tab stop.</summary>
[Fact]
public void InitialRender_SelectedNode_OwnsTheTabStop()
{
@@ -141,16 +143,17 @@ public class TreeViewKeyboardNavigationTests : BunitContext
Assert.Equal(1, TabbableIndex(cut));
}
/// <summary>Verifies that the tab stop falls back to the first node when the focused node is collapsed out of view.</summary>
[Fact]
public void TabStop_FallsBackToFirstNode_WhenFocusedNodeIsCollapsedAway()
{
var cut = RenderTreeView(initiallyExpanded: n => n.Key == "a");
// Visible: Alpha, Alpha-1, Alpha-2, Beta. Move onto Alpha-1.
// Visible: Alpha, Alpha.1, Alpha.2, Beta. Move onto Alpha.1.
PressKey(cut, 0, "ArrowDown");
Assert.Equal(1, TabbableIndex(cut));
// Collapsing Alpha removes Alpha-1 from the visible set; the tab stop must
// Collapsing Alpha removes Alpha.1 from the visible set; the tab stop must
// not vanish with it.
cut.InvokeAsync(() => cut.Instance.CollapseAll());
Assert.Equal(0, TabbableIndex(cut));
@@ -158,12 +161,13 @@ public class TreeViewKeyboardNavigationTests : BunitContext
// ── ArrowDown / ArrowUp ────────────────────────────────────────────────────
/// <summary>Verifies that ArrowDown moves focus to the next visible node.</summary>
[Fact]
public void ArrowDown_MovesToNextVisibleNode()
{
var cut = RenderTreeView(initiallyExpanded: n => n.Key == "a");
// Visible order: Alpha(0), Alpha-1(1), Alpha-2(2), Beta(3).
// Visible order: Alpha(0), Alpha.1(1), Alpha.2(2), Beta(3).
Assert.Equal(4, TreeItems(cut).Count);
PressKey(cut, 0, "ArrowDown");
@@ -173,18 +177,20 @@ public class TreeViewKeyboardNavigationTests : BunitContext
Assert.Equal(2, TabbableIndex(cut));
}
/// <summary>Verifies that ArrowDown skips the children of a collapsed branch.</summary>
[Fact]
public void ArrowDown_SkipsChildrenOfCollapsedBranch()
{
var cut = RenderTreeView();
// Alpha is collapsed, so the next visible node is Beta — not Alpha-1.
// Alpha is collapsed, so the next visible node is Beta — not Alpha.1.
PressKey(cut, 0, "ArrowDown");
Assert.Equal(2, TreeItems(cut).Count);
Assert.Equal(1, TabbableIndex(cut));
}
/// <summary>Verifies that ArrowDown on the last visible node does nothing.</summary>
[Fact]
public void ArrowDown_AtLastVisibleNode_IsNoOp()
{
@@ -197,6 +203,7 @@ public class TreeViewKeyboardNavigationTests : BunitContext
Assert.Equal(1, TabbableIndex(cut));
}
/// <summary>Verifies that ArrowUp moves focus to the previous visible node.</summary>
[Fact]
public void ArrowUp_MovesToPreviousVisibleNode()
{
@@ -209,6 +216,7 @@ public class TreeViewKeyboardNavigationTests : BunitContext
Assert.Equal(1, TabbableIndex(cut));
}
/// <summary>Verifies that ArrowUp on the first visible node does nothing.</summary>
[Fact]
public void ArrowUp_AtFirstVisibleNode_IsNoOp()
{
@@ -221,6 +229,7 @@ public class TreeViewKeyboardNavigationTests : BunitContext
// ── ArrowRight ─────────────────────────────────────────────────────────────
/// <summary>Verifies that ArrowRight on a collapsed branch expands it without moving focus.</summary>
[Fact]
public void ArrowRight_OnCollapsedBranch_Expands_WithoutMovingFocus()
{
@@ -230,21 +239,23 @@ public class TreeViewKeyboardNavigationTests : BunitContext
var items = TreeItems(cut);
Assert.Equal("true", items[0].GetAttribute("aria-expanded"));
Assert.Equal(4, items.Count); // Alpha, Alpha-1, Alpha-2, Beta
Assert.Equal(4, items.Count); // Alpha, Alpha.1, Alpha.2, Beta
Assert.Equal(0, TabbableIndex(cut));
}
/// <summary>Verifies that ArrowRight on an expanded branch moves focus to its first child.</summary>
[Fact]
public void ArrowRight_OnExpandedBranch_MovesToFirstChild()
{
var cut = RenderTreeView();
PressKey(cut, 0, "ArrowRight"); // expand
PressKey(cut, 0, "ArrowRight"); // move onto Alpha-1
PressKey(cut, 0, "ArrowRight"); // move onto Alpha.1
Assert.Equal(1, TabbableIndex(cut));
}
/// <summary>Verifies that ArrowRight on a leaf node does nothing.</summary>
[Fact]
public void ArrowRight_OnLeaf_IsNoOp()
{
@@ -262,6 +273,7 @@ public class TreeViewKeyboardNavigationTests : BunitContext
// ── ArrowLeft ──────────────────────────────────────────────────────────────
/// <summary>Verifies that ArrowLeft on an expanded branch collapses it without moving focus.</summary>
[Fact]
public void ArrowLeft_OnExpandedBranch_Collapses_WithoutMovingFocus()
{
@@ -275,12 +287,13 @@ public class TreeViewKeyboardNavigationTests : BunitContext
Assert.Equal(0, TabbableIndex(cut));
}
/// <summary>Verifies that ArrowLeft on a child node moves focus to its parent.</summary>
[Fact]
public void ArrowLeft_OnChildNode_MovesToParent()
{
var cut = RenderTreeView(initiallyExpanded: n => n.Key == "a");
// Alpha-1 (index 1) is a collapsed leaf → ArrowLeft goes up to Alpha.
// Alpha.1 (index 1) is a collapsed leaf → ArrowLeft goes up to Alpha.
PressKey(cut, 1, "ArrowLeft");
Assert.Equal(0, TabbableIndex(cut));
@@ -288,17 +301,19 @@ public class TreeViewKeyboardNavigationTests : BunitContext
Assert.Equal("true", TreeItems(cut)[0].GetAttribute("aria-expanded"));
}
/// <summary>Verifies that ArrowLeft on a collapsed branch that is a child moves focus to its parent.</summary>
[Fact]
public void ArrowLeft_OnCollapsedBranchChild_MovesToParent()
{
var cut = RenderTreeView(initiallyExpanded: n => n.Key == "a");
// Alpha-2 (index 2) is a branch but collapsed → move to its parent Alpha.
// Alpha.2 (index 2) is a branch but collapsed → move to its parent Alpha.
PressKey(cut, 2, "ArrowLeft");
Assert.Equal(0, TabbableIndex(cut));
}
/// <summary>Verifies that ArrowLeft on a root-level leaf does nothing.</summary>
[Fact]
public void ArrowLeft_OnRootLeaf_IsNoOp()
{
@@ -313,6 +328,7 @@ public class TreeViewKeyboardNavigationTests : BunitContext
// ── Home / End ─────────────────────────────────────────────────────────────
/// <summary>Verifies that Home moves focus to the first visible node.</summary>
[Fact]
public void Home_MovesToFirstVisibleNode()
{
@@ -323,12 +339,13 @@ public class TreeViewKeyboardNavigationTests : BunitContext
Assert.Equal(0, TabbableIndex(cut));
}
/// <summary>Verifies that End moves focus to the last visible node.</summary>
[Fact]
public void End_MovesToLastVisibleNode()
{
var cut = RenderTreeView(initiallyExpanded: n => n.Key == "a" || n.Key == "a2");
// Visible: Alpha(0), Alpha-1(1), Alpha-2(2), Alpha-2-X(3), Beta(4).
// Visible: Alpha(0), Alpha.1(1), Alpha.2(2), Alpha.2.X(3), Beta(4).
Assert.Equal(5, TreeItems(cut).Count);
PressKey(cut, 0, "End");
@@ -338,6 +355,7 @@ public class TreeViewKeyboardNavigationTests : BunitContext
// ── Enter / Space activation ───────────────────────────────────────────────
/// <summary>Verifies that Enter selects the focused node in single-selection mode.</summary>
[Fact]
public void Enter_SelectsNode_InSingleMode()
{
@@ -347,11 +365,12 @@ public class TreeViewKeyboardNavigationTests : BunitContext
selectable: true,
onSelectedKeyChanged: k => selected = k);
PressKey(cut, 1, "Enter"); // Alpha-1
PressKey(cut, 1, "Enter"); // Alpha.1
Assert.Equal("a1", selected);
}
/// <summary>Verifies that Space selects the focused node in single-selection mode.</summary>
[Fact]
public void Space_SelectsNode_InSingleMode()
{
@@ -365,6 +384,7 @@ public class TreeViewKeyboardNavigationTests : BunitContext
Assert.Equal("b", selected);
}
/// <summary>Verifies that Enter raises no selection callback when the tree is not selectable.</summary>
[Fact]
public void Enter_WhenNotSelectable_RaisesNoCallback()
{
@@ -376,6 +396,7 @@ public class TreeViewKeyboardNavigationTests : BunitContext
Assert.Null(selected);
}
/// <summary>Verifies that Space toggles the focused node in checkbox mode.</summary>
[Fact]
public void Space_InCheckboxMode_TogglesTheNode()
{
@@ -386,14 +407,15 @@ public class TreeViewKeyboardNavigationTests : BunitContext
selectedKeys: new HashSet<object>(),
onSelectedKeysChanged: keys => captured = keys);
// Visible: Alpha(0), Alpha-1(1), Alpha-2(2), Alpha-2-X(3), Beta(4).
// Space on Alpha-1 selects that one leaf.
// Visible: Alpha(0), Alpha.1(1), Alpha.2(2), Alpha.2.X(3), Beta(4).
// Space on Alpha.1 selects that one leaf.
PressKey(cut, 1, " ");
Assert.NotNull(captured);
Assert.Equal(new HashSet<object> { "a1" }, captured);
}
/// <summary>Verifies that Enter on a folder in checkbox mode cascades the selection to its descendant leaves.</summary>
[Fact]
public void Enter_InCheckboxMode_OnFolder_CascadesToDescendantLeaves()
{
@@ -412,6 +434,7 @@ public class TreeViewKeyboardNavigationTests : BunitContext
Assert.Contains((object)"a2x", captured);
}
/// <summary>Verifies that a keydown on a nested node does not also activate its ancestor.</summary>
[Fact]
public void Keydown_OnNestedNode_DoesNotAlsoActivateItsAncestor()
{
@@ -423,13 +446,14 @@ public class TreeViewKeyboardNavigationTests : BunitContext
selectable: true,
onSelectedKeyChanged: k => selected = k);
PressKey(cut, 1, "Enter"); // Alpha-1, nested inside Alpha
PressKey(cut, 1, "Enter"); // Alpha.1, nested inside Alpha
Assert.Equal("a1", selected);
}
// ── Existing chevron behaviour (regression) ────────────────────────────────
/// <summary>Verifies that pressing Enter on the chevron toggle still expands the node and does not select it.</summary>
[Fact]
public void ChevronToggle_EnterKey_StillExpands_AndDoesNotSelect()
{
@@ -443,6 +467,7 @@ public class TreeViewKeyboardNavigationTests : BunitContext
Assert.Null(selected);
}
/// <summary>Verifies that pressing Space on the chevron toggle still expands the node.</summary>
[Fact]
public void ChevronToggle_SpaceKey_StillExpands()
{
@@ -455,13 +480,14 @@ public class TreeViewKeyboardNavigationTests : BunitContext
// ── ARIA structure ─────────────────────────────────────────────────────────
/// <summary>Verifies that tree items carry a one-based aria-level.</summary>
[Fact]
public void TreeItems_CarryOneBasedAriaLevel()
{
var cut = RenderTreeView(initiallyExpanded: n => n.Key == "a" || n.Key == "a2");
var items = TreeItems(cut);
// Alpha, Alpha-1, Alpha-2, Alpha-2-X, Beta
// Alpha, Alpha.1, Alpha.2, Alpha.2.X, Beta
Assert.Equal("1", items[0].GetAttribute("aria-level"));
Assert.Equal("2", items[1].GetAttribute("aria-level"));
Assert.Equal("2", items[2].GetAttribute("aria-level"));
@@ -469,6 +495,7 @@ public class TreeViewKeyboardNavigationTests : BunitContext
Assert.Equal("1", items[4].GetAttribute("aria-level"));
}
/// <summary>Verifies that tree items carry aria-posinset and aria-setsize values.</summary>
[Fact]
public void TreeItems_CarryAriaPosInSetAndSetSize()
{
@@ -491,6 +518,7 @@ public class TreeViewKeyboardNavigationTests : BunitContext
Assert.Equal("2", items[3].GetAttribute("aria-setsize"));
}
/// <summary>Verifies that the tree structure uses the tree, group and treeitem roles.</summary>
[Fact]
public void TreeStructure_UsesRoleTree_RoleGroup_AndRoleTreeitem()
{
@@ -501,6 +529,7 @@ public class TreeViewKeyboardNavigationTests : BunitContext
Assert.Equal(4, TreeItems(cut).Count);
}
/// <summary>Verifies that aria-selected is present on selectable nodes and tracks the selection.</summary>
[Fact]
public void AriaSelected_IsPresentOnSelectableNodes_AndTracksSelection()
{
@@ -511,6 +540,7 @@ public class TreeViewKeyboardNavigationTests : BunitContext
Assert.Equal("false", items[1].GetAttribute("aria-selected"));
}
/// <summary>Verifies that the root tree suppresses the default browser scrolling for navigation keys.</summary>
[Fact]
public void RootTree_SuppressesBrowserScrollDefaults_ForNavigationKeys()
{
@@ -532,6 +562,7 @@ public class TreeViewKeyboardNavigationTests : BunitContext
}
}
/// <summary>Verifies that aria-selected is absent when the tree is not selectable.</summary>
[Fact]
public void AriaSelected_IsAbsent_WhenTreeIsNotSelectable()
{