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

Function checkLevel

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

Source from the content-addressed store, hash-verified

1655 }
1656
1657 function checkLevel(node: Element, expectedNode: any[]) {
1658 const rawLevel = (node as HTMLElement).style.paddingLeft;
1659
1660 // Some browsers return 0, while others return 0px.
1661 const actualLevel = rawLevel === '0' ? '0px' : rawLevel;
1662 const expectedLevel = `${expectedNode.length * expectedPaddingIndent}${expectedPaddingUnits}`;
1663 if (actualLevel != expectedLevel) {
1664 missedExpectations.push(`Expected node level to be ${expectedLevel} but was ${actualLevel}`);
1665 }
1666 }
1667
1668 getNodes(treeElement).forEach((node, index) => {
1669 const expected = expectedTree ? expectedTree[index] : null;

Callers 1

expectFlatTreeToMatchFunction · 0.70

Calls 1

pushMethod · 0.65

Tested by

no test coverage detected