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

Function createFie

test/unit/test-friendly-iframe-embed.js:1105–1131  ·  view source on GitHub ↗
(bodyElementMock, parentType = 'amp-ad')

Source from the content-addressed store, hash-verified

1103 let win;
1104
1105 function createFie(bodyElementMock, parentType = 'amp-ad') {
1106 const iframe = document.createElement('iframe');
1107 const parent = document.createElement(parentType);
1108
1109 parent.appendChild(iframe);
1110 document.body.appendChild(parent);
1111
1112 env.sandbox
1113 ./*OK*/ stub(iframe, 'getBoundingClientRect')
1114 .returns(layoutRectLtwh(x, y, w, h));
1115
1116 const fie = new FriendlyIframeEmbed(
1117 iframe,
1118 {
1119 url: 'https://acme.org/url1',
1120 html: '<body></body>',
1121 },
1122 Promise.resolve()
1123 );
1124
1125 env.sandbox.stub(fie, 'getMutator_').returns(mutatorMock);
1126 env.sandbox.stub(fie, 'getBodyElement').returns(bodyElementMock);
1127
1128 fie.win = win;
1129
1130 return fie;
1131 }
1132
1133 beforeEach(() => {
1134 win = {

Callers 1

Calls 2

layoutRectLtwhFunction · 0.90
resolveMethod · 0.80

Tested by

no test coverage detected