test/integration/test-extensions-loading.js
/**
 * Check all elements in the fixture are upgraded correctly.
 * @param {string} fixtureName
 * @param {!Array} testElements
 */
Check all elements in the fixture are upgraded correctly.
@param {string} fixtureName
@param {!Array} testElements
Check all elements in the fixture are upgraded correctly . @param { string } fixtureName @param { !Array } testElements
function testLoadOrderFixture(fixtureName, testElements) {
  let fixture;
  return createFixtureIframe(fixtureName).then(f => {
    fixture = f;
    for (let i = 0; i < testElements.length; i++) {
      expect(fixture.doc.querySelectorAll(testElements[i]))
          .to.have.length(1);
    }
    return fixture.awaitEvent(AmpEvents.LOAD_START, testElements.length);
  }).then(() => {
    for (let i = 0; i < testElements.length; i++) {
      const testElement = fixture.doc.querySelectorAll(testElements[i])[0];
      checkElementUpgrade(testElement);
      if (testElement.tagName == 'AMP-FIT-TEXT') {
        expect(fixture.doc.getElementsByClassName('i-amphtml-fit-text-content'))
            .to.have.length(1);
      }
    }
  });
}
function testLoadOrderFixture ( fixtureName , testElements ) { let fixture ; return createFixtureIframe ( fixtureName ) . then ( f => { fixture = f ; for ( let i = 0 ; i < testElements . length ; i ++ ) { expect ( fixture . doc . querySelectorAll ( testElements [ i ] ) ) . to . have . length ( 1 ) ; } return fixture . awaitEvent ( AmpEvents . LOAD_START , testElements . length ) ; } ) . then ( ( ) => { for ( let i = 0 ; i < testElements . length ; i ++ ) { const testElement = fixture . doc . querySelectorAll ( testElements [ i ] ) [ 0 ] ; checkElementUpgrade ( testElement ) ; if ( testElement . tagName == 'AMP-FIT-TEXT' ) { expect ( fixture . doc . getElementsByClassName ( 'i-amphtml-fit-text-content' ) ) . to . have . length ( 1 ) ; } } } ) ; }
Check all elements in the fixture are upgraded correctly.
Check all elements in the fixture are upgraded correctly .