MCPcopy Create free account
hub / github.com/ampproject/amphtml / stubComputedStyleElementOnly

Function stubComputedStyleElementOnly

test/unit/test-viewport.js:896–905  ·  view source on GitHub ↗
(element, style)

Source from the content-addressed store, hash-verified

894 // WebKit returns document.body, while others return documentElement.
895 for (const scrollingElementProperty of ['body', 'documentElement']) {
896 function stubComputedStyleElementOnly(element, style) {
897 env.sandbox
898 .stub(env.win, 'getComputedStyle')
899 .callsFake((checkElement) => {
900 if (element === checkElement) {
901 return style;
902 }
903 return {};
904 });
905 }
906
907 describe(`with scrollingElement = document.${scrollingElementProperty}`, () => {
908 let element;

Callers 1

test-viewport.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected