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

Function checkLevel

src/material/tree/tree.spec.ts:776–793  ·  view source on GitHub ↗
(node: Element, expectedNode: NodeContent)

Source from the content-addressed store, hash-verified

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

Callers 1

expectFlatTreeToMatchFunction · 0.70

Calls 1

pushMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…