MCPcopy
hub / github.com/ampproject/amphtml / testWindow

Function testWindow

test/unit/test-3p-environment.js:192–206  ·  view source on GitHub ↗
(win)

Source from the content-addressed store, hash-verified

190 });
191
192 function testWindow(win) {
193 expect(win.ampSeen).to.be.true;
194 expect(win.setTimeout).to.not.match(/native/);
195 expect(win.setInterval).to.not.match(/native/);
196 expect(win.alert.toString()).to.not.match(/native/);
197 expect(win.prompt.toString()).to.not.match(/native/);
198 expect(win.confirm.toString()).to.not.match(/native/);
199 expect(win.alert()).to.be.undefined;
200 expect(win.prompt()).to.equal('');
201 expect(win.confirm()).to.be.false;
202 // We only allow 3 calls to these functions.
203 expect(() => win.alert()).to.throw(/security error/);
204 expect(() => win.prompt()).to.throw(/security error/);
205 expect(() => win.confirm()).to.throw(/security error/);
206 }
207
208 function waitForMutationObserver(iframe) {
209 if (

Callers 1

Calls 2

expectFunction · 0.85
toStringMethod · 0.45

Tested by

no test coverage detected