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

Function testLoadOrderFixture

test/integration/test-extensions-loading.js:21–42  ·  view source on GitHub ↗

* Check all elements in the fixture are upgraded correctly. * @param {string} fixtureName * @param {!Array} testElements

(fixtureName, testElements)

Source from the content-addressed store, hash-verified

19 * @param {!Array} testElements
20 */
21function testLoadOrderFixture(fixtureName, testElements) {
22 let fixture;
23 return createFixtureIframe(fixtureName, 500)
24 .then((f) => {
25 fixture = f;
26 for (let i = 0; i < testElements.length; i++) {
27 expect(fixture.doc.querySelectorAll(testElements[i])).to.have.length(1);
28 }
29 return fixture.awaitEvent(AmpEvents_Enum.LOAD_START, testElements.length);
30 })
31 .then(() => {
32 for (let i = 0; i < testElements.length; i++) {
33 const testElement = fixture.doc.querySelectorAll(testElements[i])[0];
34 checkElementUpgrade(testElement);
35 if (testElement.tagName == 'AMP-FIT-TEXT') {
36 expect(
37 fixture.doc.getElementsByClassName('i-amphtml-fit-text-content')
38 ).to.have.length(1);
39 }
40 }
41 });
42}
43
44describes.sandboxed(
45 'test extensions loading in multiple orders',

Callers 1

Calls 5

createFixtureIframeFunction · 0.90
expectFunction · 0.85
lengthMethod · 0.80
checkElementUpgradeFunction · 0.70
thenMethod · 0.45

Tested by

no test coverage detected