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:
@@ -77,6 +77,7 @@ public class TreeViewTests : BunitContext
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>Verifies that root-level items render with the correct labels.</summary>
|
||||
[Fact]
|
||||
public void RendersRootLevelItems_WithCorrectLabels()
|
||||
{
|
||||
@@ -89,6 +90,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Equal("Beta", labels[1].TextContent);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that empty content renders when there are no items.</summary>
|
||||
[Fact]
|
||||
public void RendersEmptyContent_WhenItemsEmpty()
|
||||
{
|
||||
@@ -104,6 +106,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Throws<Bunit.ElementNotFoundException>(() => cut.Find("ul[role='tree']"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that leaf nodes have no expand toggle.</summary>
|
||||
[Fact]
|
||||
public void LeafNodes_HaveNoToggle()
|
||||
{
|
||||
@@ -118,6 +121,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.NotNull(betaLi.QuerySelector(".tv-spacer"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that branch nodes show a collapsed toggle.</summary>
|
||||
[Fact]
|
||||
public void BranchNodes_ShowCollapsedToggle()
|
||||
{
|
||||
@@ -131,6 +135,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.NotNull(toggle!.QuerySelector("i.bi.bi-chevron-right"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the children of a collapsed branch are not in the DOM.</summary>
|
||||
[Fact]
|
||||
public void CollapsedBranch_ChildrenNotInDom()
|
||||
{
|
||||
@@ -141,6 +146,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Empty(groups);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that clicking the toggle expands the node and shows its children.</summary>
|
||||
[Fact]
|
||||
public void ClickToggle_ExpandsNode_ShowsChildren()
|
||||
{
|
||||
@@ -160,6 +166,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Contains(labels, l => l.TextContent == "Alpha-2");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that clicking an expanded toggle collapses the node and hides its children.</summary>
|
||||
[Fact]
|
||||
public void ClickExpandedToggle_Collapses_HidesChildren()
|
||||
{
|
||||
@@ -182,6 +189,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Empty(cut.FindAll("ul[role='group']"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that expanding a parent and then its child shows the grandchildren.</summary>
|
||||
[Fact]
|
||||
public void DeepNesting_ExpandParentThenChild_ShowsGrandchildren()
|
||||
{
|
||||
@@ -190,29 +198,31 @@ public class TreeViewTests : BunitContext
|
||||
// Expand Alpha
|
||||
cut.Find(".tv-toggle").Click();
|
||||
|
||||
// Now find Alpha-2's toggle (Alpha-2 is a branch)
|
||||
// Now find Alpha 2's toggle (Alpha 2 is a branch)
|
||||
var toggles = cut.FindAll(".tv-toggle");
|
||||
// toggles[0] = Alpha (now expanded, shows minus), toggles[1] = Alpha-2
|
||||
// toggles[0] = Alpha (now expanded, shows minus), toggles[1] = Alpha 2
|
||||
Assert.True(toggles.Count >= 2);
|
||||
toggles[1].Click();
|
||||
|
||||
// Alpha-2-X should be visible
|
||||
// Alpha 2 X should be visible
|
||||
var labels = cut.FindAll(".node-label");
|
||||
Assert.Contains(labels, l => l.TextContent == "Alpha-2-X");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the initially-expanded predicate expands the matching nodes.</summary>
|
||||
[Fact]
|
||||
public void InitiallyExpanded_ExpandsMatchingNodes()
|
||||
{
|
||||
var cut = RenderTreeView(initiallyExpanded: n => n.Key == "a" || n.Key == "a2");
|
||||
|
||||
// Alpha and Alpha-2 should be expanded, so Alpha-2-X should be visible
|
||||
// Alpha and Alpha 2 should be expanded, so Alpha 2 X should be visible
|
||||
var labels = cut.FindAll(".node-label");
|
||||
Assert.Contains(labels, l => l.TextContent == "Alpha-1");
|
||||
Assert.Contains(labels, l => l.TextContent == "Alpha-2");
|
||||
Assert.Contains(labels, l => l.TextContent == "Alpha-2-X");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the root list has the tree role.</summary>
|
||||
[Fact]
|
||||
public void RootUl_HasRoleTree()
|
||||
{
|
||||
@@ -222,6 +232,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.NotNull(rootUl);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that each node item has the treeitem role.</summary>
|
||||
[Fact]
|
||||
public void NodeLi_HasRoleTreeitem()
|
||||
{
|
||||
@@ -231,6 +242,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Equal(2, items.Count); // Two root nodes
|
||||
}
|
||||
|
||||
/// <summary>Verifies that an expanded branch has aria-expanded set to true.</summary>
|
||||
[Fact]
|
||||
public void ExpandedBranch_HasAriaExpandedTrue()
|
||||
{
|
||||
@@ -240,6 +252,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Equal("true", alphaLi.GetAttribute("aria-expanded"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a child list has the group role.</summary>
|
||||
[Fact]
|
||||
public void ChildGroup_HasRoleGroup()
|
||||
{
|
||||
@@ -249,6 +262,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Single(groups);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that children are indented by the configured pixels per depth level.</summary>
|
||||
[Fact]
|
||||
public void Children_IndentedByIndentPxPerDepth()
|
||||
{
|
||||
@@ -263,15 +277,16 @@ public class TreeViewTests : BunitContext
|
||||
var alphaRow = rows[0];
|
||||
Assert.Contains("padding-left: 0px", alphaRow.GetAttribute("style"));
|
||||
|
||||
// Find Alpha-1 row (depth 1)
|
||||
// Find Alpha 1 row (depth 1)
|
||||
var alpha1Row = rows[1];
|
||||
Assert.Contains("padding-left: 30px", alpha1Row.GetAttribute("style"));
|
||||
|
||||
// Find Alpha-2-X row (depth 2) - it's after Alpha-2 at index 3
|
||||
// Find Alpha 2 X row (depth 2) - it's after Alpha 2 at index 3
|
||||
var alpha2xRow = rows[3];
|
||||
Assert.Contains("padding-left: 60px", alpha2xRow.GetAttribute("style"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that clicking a node with selection disabled does not fire the callback.</summary>
|
||||
[Fact]
|
||||
public void Selection_Disabled_ClickDoesNotFireCallback()
|
||||
{
|
||||
@@ -283,6 +298,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Null(selected);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that clicking node content with selection enabled fires the callback.</summary>
|
||||
[Fact]
|
||||
public void Selection_Enabled_ClickContentFiresCallback()
|
||||
{
|
||||
@@ -294,6 +310,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Equal("a", selected);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that clicking the toggle does not change the selection.</summary>
|
||||
[Fact]
|
||||
public void Selection_ClickToggle_DoesNotChangeSelection()
|
||||
{
|
||||
@@ -305,6 +322,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Null(selected);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the selected node has the selected CSS class.</summary>
|
||||
[Fact]
|
||||
public void Selection_SelectedNode_HasCssClass()
|
||||
{
|
||||
@@ -314,6 +332,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Contains("bg-primary", alphaRow.GetAttribute("class"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a custom selected CSS class is applied.</summary>
|
||||
[Fact]
|
||||
public void Selection_CustomCssClass_Applied()
|
||||
{
|
||||
@@ -323,6 +342,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Contains("my-highlight", alphaRow.GetAttribute("class"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that aria-selected is set on the selected node.</summary>
|
||||
[Fact]
|
||||
public void Selection_AriaSelected_SetOnSelectedNode()
|
||||
{
|
||||
@@ -332,6 +352,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Equal("true", alphaLi.GetAttribute("aria-selected"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a null storage key makes no JS interop calls.</summary>
|
||||
[Fact]
|
||||
public void SessionStorage_NullKey_NoJsInteropCalls()
|
||||
{
|
||||
@@ -344,6 +365,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Empty(JSInterop.Invocations);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that expanding a node writes the expanded state to session storage.</summary>
|
||||
[Fact]
|
||||
public void SessionStorage_Set_ExpandWritesToStorage()
|
||||
{
|
||||
@@ -362,6 +384,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Single(saveInvocations);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the expanded state is restored from session storage on mount.</summary>
|
||||
[Fact]
|
||||
public void SessionStorage_RestoresExpandedOnMount()
|
||||
{
|
||||
@@ -376,6 +399,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Contains(labels, l => l.TextContent == "Alpha-2");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that stored session state takes precedence over the initially-expanded predicate.</summary>
|
||||
[Fact]
|
||||
public void SessionStorage_TakesPrecedenceOverInitiallyExpanded()
|
||||
{
|
||||
@@ -392,6 +416,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.DoesNotContain(labels, l => l.TextContent == "Alpha-1");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that ExpandAll expands all branches.</summary>
|
||||
[Fact]
|
||||
public void ExpandAll_ExpandsAllBranches()
|
||||
{
|
||||
@@ -408,6 +433,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Contains(labels, l => l.TextContent == "Alpha-2-X");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that CollapseAll collapses all branches.</summary>
|
||||
[Fact]
|
||||
public void CollapseAll_CollapsesAllBranches()
|
||||
{
|
||||
@@ -425,6 +451,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.DoesNotContain(labels, l => l.TextContent == "Alpha-1");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that revealing a node expands its ancestors.</summary>
|
||||
[Fact]
|
||||
public void RevealNode_ExpandsAncestors()
|
||||
{
|
||||
@@ -435,13 +462,14 @@ public class TreeViewTests : BunitContext
|
||||
|
||||
cut.InvokeAsync(() => cut.Instance.RevealNode("a2x"));
|
||||
|
||||
// Alpha-2-X should now be visible (Alpha and Alpha-2 expanded)
|
||||
// Alpha 2 X should now be visible (Alpha and Alpha 2 expanded)
|
||||
var labels = cut.FindAll(".node-label");
|
||||
Assert.Contains(labels, l => l.TextContent == "Alpha-2-X");
|
||||
Assert.Contains(labels, l => l.TextContent == "Alpha-1"); // sibling also visible since Alpha is expanded
|
||||
Assert.Contains(labels, l => l.TextContent == "Alpha-2");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that revealing a node with select also selects it.</summary>
|
||||
[Fact]
|
||||
public void RevealNode_WithSelect_SelectsNode()
|
||||
{
|
||||
@@ -453,6 +481,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Equal("a2x", selected);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that revealing an unknown key has no effect.</summary>
|
||||
[Fact]
|
||||
public void RevealNode_UnknownKey_NoOp()
|
||||
{
|
||||
@@ -467,6 +496,7 @@ public class TreeViewTests : BunitContext
|
||||
|
||||
// ── External filtering tests (R8) ──────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that a reduced item list hides the removed roots.</summary>
|
||||
[Fact]
|
||||
public void Filtering_ReducedItems_HidesRemovedRoots()
|
||||
{
|
||||
@@ -497,6 +527,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Equal("Alpha", labels[0].TextContent);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the expansion state is preserved when the items are filtered.</summary>
|
||||
[Fact]
|
||||
public void Filtering_ExpansionStatePreserved()
|
||||
{
|
||||
@@ -522,7 +553,7 @@ public class TreeViewTests : BunitContext
|
||||
}));
|
||||
});
|
||||
|
||||
// Alpha-1 still visible (expansion state preserved)
|
||||
// Alpha 1 still visible (expansion state preserved)
|
||||
Assert.Contains(cut.FindAll(".node-label"), l => l.TextContent == "Alpha-1");
|
||||
|
||||
// Re-render with full list again
|
||||
@@ -539,10 +570,11 @@ public class TreeViewTests : BunitContext
|
||||
}));
|
||||
});
|
||||
|
||||
// Alpha-1 still visible after restoration
|
||||
// Alpha 1 still visible after restoration
|
||||
Assert.Contains(cut.FindAll(".node-label"), l => l.TextContent == "Alpha-1");
|
||||
}
|
||||
|
||||
/// <summary>Verifies that the selection is cleared when the selected node disappears.</summary>
|
||||
[Fact]
|
||||
public void Filtering_SelectionCleared_WhenNodeDisappears()
|
||||
{
|
||||
@@ -578,6 +610,7 @@ public class TreeViewTests : BunitContext
|
||||
|
||||
// ── Context menu tests ──────────────────────────────────────────────
|
||||
|
||||
/// <summary>Verifies that no menu renders when the context menu is null.</summary>
|
||||
[Fact]
|
||||
public void ContextMenu_Null_NoMenuRendered()
|
||||
{
|
||||
@@ -591,6 +624,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Throws<Bunit.ElementNotFoundException>(() => cut.Find(".dropdown-menu"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a right-click shows the context menu.</summary>
|
||||
[Fact]
|
||||
public void ContextMenu_RightClickShowsMenu()
|
||||
{
|
||||
@@ -611,6 +645,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Equal("Alpha", btn!.TextContent);
|
||||
}
|
||||
|
||||
/// <summary>Verifies that pressing Escape dismisses the context menu.</summary>
|
||||
[Fact]
|
||||
public void ContextMenu_EscapeKeyDismissesMenu()
|
||||
{
|
||||
@@ -631,6 +666,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.Empty(cut.FindAll(".dropdown-menu"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a key other than Escape does not dismiss the context menu.</summary>
|
||||
[Fact]
|
||||
public void ContextMenu_NonEscapeKey_DoesNotDismiss()
|
||||
{
|
||||
@@ -648,6 +684,7 @@ public class TreeViewTests : BunitContext
|
||||
Assert.NotEmpty(cut.FindAll(".dropdown-menu"));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that right-clicking a different node replaces the open menu.</summary>
|
||||
[Fact]
|
||||
public void ContextMenu_RightClickDifferentNode_ReplacesMenu()
|
||||
{
|
||||
@@ -662,11 +699,11 @@ public class TreeViewTests : BunitContext
|
||||
var rows = cut.FindAll(".tv-row");
|
||||
rows[0].TriggerEvent("oncontextmenu", new MouseEventArgs { ClientX = 100, ClientY = 200 });
|
||||
|
||||
// Now right-click Alpha-1
|
||||
// Now right-click Alpha 1
|
||||
rows = cut.FindAll(".tv-row");
|
||||
rows[1].TriggerEvent("oncontextmenu", new MouseEventArgs { ClientX = 150, ClientY = 250 });
|
||||
|
||||
// Should be only one dropdown-menu, showing Alpha-1
|
||||
// Should be only one dropdown-menu, showing Alpha 1
|
||||
var menus = cut.FindAll(".dropdown-menu");
|
||||
Assert.Single(menus);
|
||||
var btn = menus[0].QuerySelector(".ctx-btn");
|
||||
|
||||
Reference in New Issue
Block a user