(rect)
| 623 | |
| 624 | describes.realWin('Resources discoverWork', {amp: true}, (env) => { |
| 625 | function createElement(rect) { |
| 626 | const element = env.win.document.createElement('amp-test'); |
| 627 | element.classList.add('i-amphtml-element'); |
| 628 | element.R1 = () => false; |
| 629 | element.signals = () => new Signals(); |
| 630 | element.whenBuilt = () => Promise.resolve(); |
| 631 | element.isBuilt = () => true; |
| 632 | element.buildInternal = () => Promise.resolve(); |
| 633 | element.isUpgraded = () => true; |
| 634 | element.updateLayoutBox = () => {}; |
| 635 | element.getPlaceholder = () => null; |
| 636 | element.getLayoutPriority = () => LayoutPriority_Enum.CONTENT; |
| 637 | element.getLayout = () => 'fixed'; |
| 638 | |
| 639 | element.idleRenderOutsideViewport = () => true; |
| 640 | element.isInViewport = () => false; |
| 641 | element.getAttribute = () => null; |
| 642 | element.hasAttribute = () => false; |
| 643 | element.getBoundingClientRect = () => rect; |
| 644 | element.layoutCallback = () => Promise.resolve(); |
| 645 | element.viewportCallback = sandbox.spy(); |
| 646 | element.prerenderAllowed = () => true; |
| 647 | element.previewAllowed = () => true; |
| 648 | element.renderOutsideViewport = () => true; |
| 649 | element.isRelayoutNeeded = () => true; |
| 650 | element.pause = () => {}; |
| 651 | element.unmount = () => {}; |
| 652 | element.unlayoutCallback = () => true; |
| 653 | element.togglePlaceholder = () => sandbox.spy(); |
| 654 | element.fakeComputedStyle = { |
| 655 | marginTop: '0px', |
| 656 | marginRight: '0px', |
| 657 | marginBottom: '0px', |
| 658 | marginLeft: '0px', |
| 659 | }; |
| 660 | env.win.document.body.appendChild(element); |
| 661 | return element; |
| 662 | } |
| 663 | |
| 664 | function createResource(id, rect) { |
| 665 | const resource = new Resource(id, createElement(rect), resources); |
no test coverage detected