Sha256: 2f14194e56bf8e879f7cd3e20dbf419f92b64248005d09ebff7eb7f5c1c8c995
Contents?: true
Size: 1.45 KB
Versions: 15
Compression:
Stored size: 1.45 KB
Contents
window.Konacha = { reset: function() { document.body = document.createElement('body'); document.body.id = 'konacha'; } }; // Push errors to parent iframe. window.onerror = function() { if (parent.onerror) { return parent.onerror.apply(parent, arguments); } }; window.Mocha = Object.create(parent.Mocha); window.mocha = Object.create(parent.mocha); // In order to isolate top-level before/beforeEach hooks, // the specs in each iframe are wrapped in an anonymous suite. mocha.suite = Mocha.Suite.create(mocha.suite); mocha.suite.path = document.documentElement.getAttribute("data-path"); // Override mocha.ui so that the pre-require event is emitted // with the iframe's `window` reference, rather than the parent's. mocha.ui = function (name) { this._ui = Mocha.interfaces[name]; if (!this._ui) throw new Error('invalid interface "' + name + '"'); this._ui = this._ui(this.suite); this.suite.emit('pre-require', window, null, this); return this; }; mocha.ui('bdd'); // Show only the current iframe. mocha.suite.beforeAll(function () { var contexts = parent.document.getElementsByClassName("test-context"); for (var i = 0; i < contexts.length; ++i) { if (contexts[i].contentWindow == window) { contexts[i].style.display = "block"; } else { contexts[i].style.display = null; } } }); mocha.suite.beforeEach(function () { Konacha.reset(); }); var expect = chai.expect, should = chai.should(), assert = chai.assert;
Version data entries
15 entries across 15 versions & 1 rubygems