First commit

This commit is contained in:
Theodotos Andreou 2018-01-14 13:10:16 +00:00
commit c6e2478c40
13918 changed files with 2303184 additions and 0 deletions

View file

@ -0,0 +1,12 @@
Composite - A QUnit Addon For Running Multiple Test Files
================================
Composite is a QUnit addon that, when handed an array of files, will
open each of those files inside of an iframe, run the tests and
display the results as a single suite of QUnit tests.
The Rerun link next to each suite allows you to quickly rerun that suite,
outside the composite runner.
If you want to see what assertion failed in a long list of assertions,
just use the regular "Hide passed tests" checkbox.

View file

@ -0,0 +1,26 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>QUnit SubsuiteRunner Test Suite</title>
<link rel="stylesheet" href="../../qunit/qunit.css" type="text/css" media="screen">
<link rel="stylesheet" href="qunit-composite.css">
<script src="../../qunit/qunit.js"></script>
<script src="qunit-composite.js"></script>
<script>
QUnit.testSuites([
"../../test/index.html",
"../canvas/canvas.html",
"../close-enough/close-enough.html",
"../step/step.html"
]);
</script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture">
</div>
</body>
</html>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Composite</title>
</head>
<body>
<h1>Composite</h1>
<h3>A QUnit Addon For Running Multiple Test Files</h3>
<p>Composite is a QUnit addon that, when handed an array of
files, will open each of those files inside of an iframe, run
the tests and display the results as a single suite of QUnit
tests.</p>
<h4>Using Composite</h4>
<p>To use Composite, setup a standard QUnit html page as you
would with other QUnit tests. Remember to include composite.js
and composite.css. Then, inside of either an external js file,
or a script block call the only new method that Composite
exposes, QUnit.testSuites().</p><p>QUnit.testSuites() is
passed an array of test files to run as follows:</p>
<pre>
QUnit.testSuites([
"test-file-1.html",
"test-file-2.html",
"test-file-3.html"
]);
</pre>
<h4>Tests</h4>
<p>
<a href="composite-demo-test.html">Composite Demo</a>: A suite which demoes how Composite is bootstrapped and run.
</p>
</body>
</html>

View file

@ -0,0 +1,13 @@
iframe.qunit-subsuite{
position: fixed;
bottom: 0;
left: 0;
margin: 0;
padding: 0;
border-width: 1px 0 0;
height: 45%;
width: 100%;
background: #fff;
}

View file

@ -0,0 +1,102 @@
(function( QUnit ) {
QUnit.extend( QUnit, {
testSuites: function( suites ) {
QUnit.begin(function() {
QUnit.initIframe();
});
for ( var i = 0; i < suites.length; i++ ) {
QUnit.runSuite( suites[i] );
}
QUnit.done(function() {
this.iframe.style.display = "none";
});
},
runSuite: function( suite ) {
asyncTest( suite, function() {
QUnit.iframe.setAttribute( "src", suite );
});
},
initIframe: function() {
var body = document.body,
iframe = this.iframe = document.createElement( "iframe" ),
iframeWin;
iframe.className = "qunit-subsuite";
body.appendChild( iframe );
function onIframeLoad() {
var module, test,
count = 0;
iframeWin.QUnit.moduleStart(function( data ) {
// capture module name for messages
module = data.name;
});
iframeWin.QUnit.testStart(function( data ) {
// capture test name for messages
test = data.name;
});
iframeWin.QUnit.testDone(function() {
test = null;
});
iframeWin.QUnit.log(function( data ) {
if (test === null) {
return;
}
// pass all test details through to the main page
var message = module + ": " + test + ": " + data.message;
expect( ++count );
QUnit.push( data.result, data.actual, data.expected, message );
});
iframeWin.QUnit.done(function() {
// start the wrapper test from the main page
start();
});
}
QUnit.addEvent( iframe, "load", onIframeLoad );
iframeWin = iframe.contentWindow;
}
});
QUnit.testStart(function( data ) {
// update the test status to show which test suite is running
QUnit.id( "qunit-testresult" ).innerHTML = "Running " + data.name + "...<br>&nbsp;";
});
QUnit.testDone(function() {
var i,
current = QUnit.id( this.config.current.id ),
children = current.children,
src = this.iframe.src;
// undo the auto-expansion of failed tests
for ( i = 0; i < children.length; i++ ) {
if ( children[i].nodeName === "OL" ) {
children[i].style.display = "none";
}
}
QUnit.addEvent(current, "dblclick", function( e ) {
var target = e && e.target ? e.target : window.event.srcElement;
if ( target.nodeName.toLowerCase() === "span" || target.nodeName.toLowerCase() === "b" ) {
target = target.parentNode;
}
if ( window.location && target.nodeName.toLowerCase() === "strong" ) {
window.location = src;
}
});
current.getElementsByTagName('a')[0].href = src;
});
}( QUnit ) );