summaryrefslogtreecommitdiff
path: root/src/main/webapp/jquery-ui-1.9pre/tests/unit/subsuiteRunner.js
diff options
context:
space:
mode:
authorLeif Johansson <leifj@sunet.se>2011-11-25 21:18:19 +0100
committerLeif Johansson <leifj@sunet.se>2011-11-25 21:18:19 +0100
commit3909e6d89e01e4cd8777377c63037896bb95aa2f (patch)
tree59679df287c2bee55087fb5afb8d42e7f93a44fb /src/main/webapp/jquery-ui-1.9pre/tests/unit/subsuiteRunner.js
parente5f94e9be5017f627c1ccd8c6306c5cc2e200432 (diff)
new jq layout
Diffstat (limited to 'src/main/webapp/jquery-ui-1.9pre/tests/unit/subsuiteRunner.js')
-rw-r--r--src/main/webapp/jquery-ui-1.9pre/tests/unit/subsuiteRunner.js82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/main/webapp/jquery-ui-1.9pre/tests/unit/subsuiteRunner.js b/src/main/webapp/jquery-ui-1.9pre/tests/unit/subsuiteRunner.js
new file mode 100644
index 0000000..ddfccc7
--- /dev/null
+++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/subsuiteRunner.js
@@ -0,0 +1,82 @@
+(function( QUnit ) {
+
+var subsuiteFrame;
+
+QUnit.extend( QUnit, {
+ testSuites: function( suites ) {
+ for ( var i = 0; i < suites.length; i++ ) {
+ (function( suite ) {
+ asyncTest( suite, function() {
+ QUnit.runSuite( suite );
+ });
+ }( suites[i] ) );
+ }
+ QUnit.done = function() {
+ subsuiteFrame.style.display = "none";
+ };
+ },
+
+ testStart: function( data ) {
+ // update the test status to show which test suite is running
+ QUnit.id( "qunit-testresult" ).innerHTML = "Running " + data.name + "...<br>&nbsp;";
+ },
+
+ testDone: function() {
+ var current = QUnit.id( this.config.current.id ),
+ children = current.children;
+
+ // undo the auto-expansion of failed tests
+ for ( var i = 0; i < children.length; i++ ) {
+ if ( children[i].nodeName === "OL" ) {
+ children[i].style.display = "none";
+ }
+ }
+ },
+
+ runSuite: function( suite ) {
+ var body = document.getElementsByTagName( "body" )[0],
+ iframe = subsuiteFrame = document.createElement( "iframe" ),
+ iframeWin;
+
+ iframe.className = "qunit-subsuite";
+ body.appendChild( iframe );
+
+ function onIframeLoad() {
+ var module, test,
+ count = 0;
+
+ QUnit.extend( iframeWin.QUnit, {
+ moduleStart: function( data ) {
+ // capture module name for messages
+ module = data.name;
+ },
+
+ testStart: function( data ) {
+ // capture test name for messages
+ test = data.name;
+ },
+
+ log: function( data ) {
+ // 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 );
+ },
+
+ done: function() {
+ // start the wrapper test from the main page
+ start();
+ }
+ });
+ }
+ QUnit.addEvent( iframe, "load", onIframeLoad );
+
+ iframeWin = iframe.contentWindow;
+ iframe.setAttribute( "src", suite );
+
+ this.runSuite = function( suite ) {
+ iframe.setAttribute( "src", suite );
+ };
+ }
+});
+}( QUnit ) );