using Bunit;
using Microsoft.AspNetCore.Components;
using ScadaLink.CentralUI.Components.Shared;
namespace ScadaLink.CentralUI.Tests;
///
/// bUnit tests for TreeView's Checkbox-selection mode (T19 of the Transport
/// feature). Verifies that:
/// - a checkbox renders next to every node in Checkbox mode,
/// - clicking a folder checkbox cascades selection to every descendant leaf,
/// - clicking a leaf produces a partial parent state (Indeterminate),
/// - Single-mode behaviour is preserved (regression).
///
public class TreeViewMultiSelectTests : BunitContext
{
private record TestNode(string Key, string Label, List Children);
private static List TwoFoldersThreeLeaves() => new()
{
// Folder1 → Leaf1a, Leaf1b
new("f1", "Folder1", new()
{
new("l1a", "Leaf1a", new()),
new("l1b", "Leaf1b", new()),
}),
// Folder2 → Leaf2a
new("f2", "Folder2", new()
{
new("l2a", "Leaf2a", new()),
}),
};
private IRenderedComponent> RenderCheckboxTree(
List? items = null,
HashSet