test(tree-view): coverage for expandAll and expandNodes (#2063)

This commit is contained in:
Eric Liu 2024-12-08 11:09:23 -08:00 committed by GitHub
commit f1a27ec855
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 97 additions and 3 deletions

View file

@ -7,7 +7,7 @@
let treeview: TreeView;
let activeId: TreeNodeId = "";
let selectedIds: TreeNodeId[] = [];
let expandedIds: TreeNodeId[] = [1];
let expandedIds: TreeNodeId[] = [];
let nodes: ComponentProps<TreeView>["nodes"] = [
{ id: 0, text: "AI / Machine learning", icon: Analytics },
{
@ -81,3 +81,12 @@
</TreeView>
<Button on:click={treeview.expandAll}>Expand all</Button>
<Button
on:click={() => {
treeview.expandNodes((node) => {
return /^IBM/.test(node.text);
});
}}
>
Expand some nodes
</Button>