| 56 | // machinery that AMP expects it to have, so just no-op the irrelevant |
| 57 | // functions. |
| 58 | function noopMethods( |
| 59 | impl, |
| 60 | ampdoc, |
| 61 | sandbox, |
| 62 | pageLayoutBox = { |
| 63 | top: 11.1, |
| 64 | left: 12.1, |
| 65 | width: 0, |
| 66 | height: 0, |
| 67 | } |
| 68 | ) { |
| 69 | const noop = () => {}; |
| 70 | impl.element.buildInternal = noop; |
| 71 | impl.element.getPlaceholder = noop; |
| 72 | impl.element.createPlaceholder = noop; |
| 73 | sandbox.stub(impl, 'getAmpDoc').returns(ampdoc); |
| 74 | sandbox.stub(impl.element, 'offsetParent').value(null); |
| 75 | sandbox.stub(impl.element, 'offsetTop').value(pageLayoutBox.top); |
| 76 | sandbox.stub(impl.element, 'offsetLeft').value(pageLayoutBox.left); |
| 77 | sandbox.stub(impl.element, 'offsetWidth').value(pageLayoutBox.width); |
| 78 | sandbox.stub(impl.element, 'offsetHeight').value(pageLayoutBox.height); |
| 79 | } |
| 80 | |
| 81 | describes.sandboxed('Google A4A utils', {}, (env) => { |
| 82 | //TODO: Add tests for other utils functions. |