this.generate = function()

in 2020/harness/testView.js [104:206]


  this.generate = function() {
    var heading = '[' + this.testSuiteVer + '] ' +
        testSuiteDescriptions[harnessConfig.testType].heading + ' (v 20200212151848)';
    try {
      document.title = testSuiteDescriptions[harnessConfig.testType].title;
    } catch (e) {
      // Use default html title if UA can't control document.title.
    }
    document.body.appendChild(createElement('span', 'title', null, heading));
    document.body.appendChild(createElement('span', 'info', 'h4'));
    document.body.appendChild(createElement('span', 'usage', 'h4'));
    document.body.appendChild(createElement('div', 'testview'));

    var div = document.getElementById(this.divId);
    div.innerHTML = '';
    div.appendChild(createElement('div', 'testsuites', 'container'));
    div.appendChild(createElement('div', 'controls', 'container'));
    div.appendChild(createElement('div', 'switches', 'container'));

    var testContainer = createElement('div', null, 'container');
    testContainer.appendChild(createElement('div', 'testlist'));
    div.appendChild(testContainer);

    var outputArea = createElement('div', 'outputarea');
    var textArea = createElement('div', 'output');
    var textAreaContainer = createElement('div', 'outputcontainer');
    textAreaContainer.appendChild(textArea);
    outputArea.appendChild(textAreaContainer);
    outputArea.appendChild(createElement('div', 'testarea'));
    div.appendChild(outputArea);

    var switchDiv = document.getElementById('switches');
    for (var i = 0; i < switches.length; ++i) {
      var id = switches[i].id;
      switchDiv.appendChild(document.createTextNode(switches[i].text));
      switchDiv.appendChild(createAnchor(harnessConfig[id] ? 'on' : 'off', id));
      switchDiv.lastChild.href = 'javascript:;';
      switchDiv.lastChild.classList.add('focusable');
      switchDiv.lastChild.onclick = (function(id) {
        return function(e) {
          var wasOff = !util.stringToBoolean(e.target.innerHTML);
          e.target.innerHTML = wasOff ? 'on' : 'off';
          harnessConfig[id] = wasOff;
        };
      })(id);
      switchDiv.lastChild.exec = switchDiv.lastChild.onclick;
    }
    for (var i = 0; i < selectors.length; ++i) {
      switchDiv.appendChild(document.createTextNode(selectors[i].text));
      var select = document.createElement('select');
      for (var j = 0; j < selectors[i].optionTexts.length; ++j) {
        select.appendChild(createOption(selectors[i].optionTexts[j],
            selectors[i].values[j]));
      }
      select.onchange = selectors[i].cb;
      switchDiv.appendChild(select);
    }

    switchDiv.appendChild(
        createElement('span', 'finish-count', null, '0 tests finished'));

    var controlsDiv = document.getElementById('controls');
    for (var i = 0; i < commands.length; ++i) {
      controlsDiv.appendChild(createAnchor(commands[i].text, commands[i].id));
      controlsDiv.lastChild.href = 'javascript:;';
      controlsDiv.lastChild.onclick = commands[i].onclick;
      controlsDiv.lastChild.exec = controlsDiv.lastChild.onclick;
      controlsDiv.lastChild.title = commands[i].title;
      controlsDiv.lastChild.classList.add('focusable');
    }

    for (var i = 0; i < links.length; ++i) {
      controlsDiv.appendChild(createAnchor(links[i].text));
      controlsDiv.lastChild.setAttribute('data-href', links[i].href);
      controlsDiv.lastChild.onclick = window.navigate;
      controlsDiv.lastChild.classList.add('focusable');
    }

    var testSuitesDiv = document.getElementById('testsuites');
    for (var i = 0; i < testSuites.length; ++i) {
      testSuitesDiv.appendChild(createAnchor(testSuites[i].text));
      if (testSuites[i].href != null) {
        testSuitesDiv.lastChild.setAttribute('data-href', testSuites[i].href);
        testSuitesDiv.lastChild.onclick = window.navigate;
        testSuitesDiv.lastChild.classList.add('focusable');
      }
      else {
        // display the current test suite name in black border
        testSuitesDiv.lastChild.style.border = "solid #000000";
      }
    }

    document.addEventListener('keyup', e => {
      if (translateKeycode(e) === 'Back') {
        document.getElementById("login-pop-up").style.display = "none";
        if (util.tokenInterval) {
          window.clearInterval(util.tokenInterval);
        }
      }
    });

    this.testList.generate(document.getElementById('testlist'));
  };