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

Function checkNodeDescendants

src/cdk/tree/tree.spec.ts:1688–1705  ·  view source on GitHub ↗
(node: Element, expectedNode: any[], currentIndex: number)

Source from the content-addressed store, hash-verified

1686 }
1687
1688 function checkNodeDescendants(node: Element, expectedNode: any[], currentIndex: number) {
1689 let expectedDescendant = 0;
1690
1691 for (let i = currentIndex + 1; i < expectedTree.length; ++i) {
1692 if (expectedTree[i].length > expectedNode.length) {
1693 ++expectedDescendant;
1694 } else if (expectedTree[i].length === expectedNode.length) {
1695 break;
1696 }
1697 }
1698
1699 const actualDescendant = getNodes(node).length;
1700 if (actualDescendant !== expectedDescendant) {
1701 missedExpectations.push(
1702 `Expected node descendant num to be ${expectedDescendant} but was ${actualDescendant}`,
1703 );
1704 }
1705 }
1706
1707 getNodes(treeElement).forEach((node, index) => {
1708 const expected = expectedTree ? expectedTree[index] : null;

Callers 1

expectNestedTreeToMatchFunction · 0.70

Calls 2

getNodesFunction · 0.70
pushMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…