JSFiddle - React, Tailwind, and code Playground

by Nicolas PUJOL

HTML

<script src="http://code.jquery.com/jquery-3.1.1.js"></script>
<script src="http://code.jquery.com/qunit/qunit-2.1.1.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-2.1.1.css">

<div id="qunit"></div>
<div id="qunit-fixture"></div>

JavaScript

"use strict";

$(function() {
  QUnit.module("Advert iframe", {});
  QUnit.test("should load iframe without error", function(assert) {
    var done = assert.async();
    var errorsCount = 0;

    $("body").append("<iframe id='advertIframe'>");
    $("#advertIframe").one("load", function() {
    //wait for one var from advert ?
      this.contentWindow.onerror = function(error, url, line) {
        console.log(error, url, line)
        errorsCount++;
        assert.throws(
          function() {
            throw "error"
          },
          "Err: " + error + ", Url: " + url + ", Line: " + line
        );

      };
      assert.deepEqual(0, errorsCount, "No errors in iframe console");
      done();
    });

    //$("#advertIframe")[0].src = "https://veads-ci.veinteractive.net/iframe.php?a=23832";
    $("#advertIframe")[0].src = "https://veads-ci.veinteractive.net/iframe.php?a=23832";

  });
});