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

Function checkNodeDescendants

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

Source from the content-addressed store, hash-verified

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