MCPcopy Create free account
hub / github.com/angular/components / checkNodeDescendants

Function checkNodeDescendants

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

Source from the content-addressed store, hash-verified

1701 }
1702
1703 function checkNodeDescendants(node: Element, expectedNode: any[], currentIndex: number) {
1704 let expectedDescendant = 0;
1705
1706 for (let i = currentIndex + 1; i < expectedTree.length; ++i) {
1707 if (expectedTree[i].length > expectedNode.length) {
1708 ++expectedDescendant;
1709 } else if (expectedTree[i].length === expectedNode.length) {
1710 break;
1711 }
1712 }
1713
1714 const actualDescendant = getNodes(node).length;
1715 if (actualDescendant !== expectedDescendant) {
1716 missedExpectations.push(
1717 `Expected node descendant num to be ${expectedDescendant} but was ${actualDescendant}`,
1718 );
1719 }
1720 }
1721
1722 getNodes(treeElement).forEach((node, index) => {
1723 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