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

Function checkNodeDescendants

src/material/tree/tree.spec.ts:819–836  ·  view source on GitHub ↗
(node: Element, expectedNode: NodeContent, currentIndex: number)

Source from the content-addressed store, hash-verified

817 }
818
819 function checkNodeDescendants(node: Element, expectedNode: NodeContent, currentIndex: number) {
820 let expectedDescendant = 0;
821
822 for (let i = currentIndex + 1; i < expectedTree.length; ++i) {
823 if (expectedTree[i].length > expectedNode.length) {
824 ++expectedDescendant;
825 } else if (expectedTree[i].length === expectedNode.length) {
826 break;
827 }
828 }
829
830 const actualDescendant = getNodes(node).length;
831 if (actualDescendant !== expectedDescendant) {
832 missedExpectations.push(
833 `Expected node descendant num to be ${expectedDescendant} but was ${actualDescendant}`,
834 );
835 }
836 }
837
838 getNodes(treeElement).forEach((node, index) => {
839 const expected = expectedTree[index];

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…