mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
test(tree-view): test updated TreeView accessors
This commit is contained in:
parent
4f22c7fc1c
commit
01ec827cd9
1 changed files with 13 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
import type { TreeNodeId } from "../types/TreeView/TreeView";
|
||||
import Analytics16 from "carbon-icons-svelte/lib/Analytics16";
|
||||
|
||||
let treeview: TreeView;
|
||||
let activeId: TreeNodeId = "";
|
||||
let selectedIds = [];
|
||||
let expandedIds = [1];
|
||||
|
@ -46,9 +47,21 @@
|
|||
children: [{ id: 15, text: "IBM API Connect", disabled: true }],
|
||||
},
|
||||
];
|
||||
|
||||
$: if (treeview) {
|
||||
treeview.expandAll();
|
||||
treeview.expandNodes((node) => {
|
||||
return node.id > 0;
|
||||
});
|
||||
treeview.collapseAll();
|
||||
treeview.collapseNodes((node) => {
|
||||
return node.disabled;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<TreeView
|
||||
bind:this="{treeview}"
|
||||
size="compact"
|
||||
labelText="Cloud Products"
|
||||
children="{children}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue