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

Function checkLevel

src/material/tree/tree-using-tree-control.spec.ts:774–791  ·  view source on GitHub ↗
(node: Element, expectedNode: NodeContent)

Source from the content-addressed store, hash-verified

772 }
773
774 function checkLevel(node: Element, expectedNode: NodeContent) {
775 const rawLevel = (node as HTMLElement).style.paddingLeft;
776
777 // Some browsers return 0, while others return 0px.
778 const actualLevel = rawLevel === '0' ? '0px' : rawLevel;
779 if (expectedNode.length === 1) {
780 if (actualLevel !== `` && actualLevel !== '0px') {
781 missedExpectations.push(`Expected node level to be 0px but was ${actualLevel}`);
782 }
783 } else {
784 const expectedLevel = `${(expectedNode.length - 1) * expectedPaddingIndent}px`;
785 if (actualLevel != expectedLevel) {
786 missedExpectations.push(
787 `Expected node level to be ${expectedLevel} but was ${actualLevel}`,
788 );
789 }
790 }
791 }
792
793 getNodes(treeElement).forEach((node, index) => {
794 const expected = expectedTree[index];

Callers 1

expectFlatTreeToMatchFunction · 0.70

Calls 1

pushMethod · 0.65

Tested by

no test coverage detected