mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
test(tree-view): coverage for expandAll
and expandNodes
(#2063)
This commit is contained in:
parent
18c964e579
commit
f1a27ec855
3 changed files with 97 additions and 3 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue