MCPcopy Index your code
hub / github.com/angular/components / updateTreeItemByValue

Function updateTreeItemByValue

src/aria/tree/tree.spec.ts:115–135  ·  view source on GitHub ↗
(value: string, config: Partial<TestTreeNode<string>>)

Source from the content-addressed store, hash-verified

113 }
114
115 async function updateTreeItemByValue(value: string, config: Partial<TestTreeNode<string>>) {
116 const newNodes = JSON.parse(JSON.stringify(testComponent.nodes()));
117 const childrenList = [newNodes];
118 while (childrenList.length > 0) {
119 const list = childrenList.shift()!;
120 for (const node of list) {
121 if (node.value === value) {
122 if (config.value !== undefined) node.value = config.value;
123 if (config.label !== undefined) node.label = config.label;
124 if (config.children !== undefined) node.children = config.children;
125 if (config.disabled !== undefined) node.disabled = config.disabled;
126 if (config.selectable !== undefined) node.selectable = config.selectable;
127 await updateTree({nodes: newNodes});
128 return;
129 }
130 if (node.children) {
131 childrenList.push(node.children);
132 }
133 }
134 }
135 }
136
137 function getTreeItemElementByValue(value: string): HTMLElement | undefined {
138 return treeItemElements.find(el => el.getAttribute('data-value') === String(value));

Callers 1

tree.spec.tsFile · 0.85

Calls 3

updateTreeFunction · 0.85
pushMethod · 0.65
parseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…