diff --git a/tests/unit/index.php b/tests/unit/index.php index 35dbb90e..cdc127fe 100644 --- a/tests/unit/index.php +++ b/tests/unit/index.php @@ -3,6 +3,9 @@ + + +
@@ -15,8 +18,5 @@ I think an entire link and stylesheet is a waste --> - - - diff --git a/tests/unit/runner.js b/tests/unit/runner.js index bc741e96..0e341c01 100644 --- a/tests/unit/runner.js +++ b/tests/unit/runner.js @@ -11,6 +11,15 @@ $(function() { onTimeout: QUnit.start, + onFrameLoad: function() { + // establish a timeout for a given suite in case of async tests hanging + self.testTimer = setTimeout( self.onTimeout, self.testTimeout ); + + // when the QUnit object reports done in the iframe + // run the onFrameDone method + self.frame.QUnit.done = self.onFrameDone; + }, + onFrameDone: function( failed, passed, total, runtime ){ // record success self.recordResult( false , failed ); @@ -33,25 +42,13 @@ $(function() { } }, - createTest: function( dir ) { - // check for the frames jquery object each time - $( "iframe#testFrame" ).one( "load", function() { - - // establish a timeout for a given suite in case of async tests hanging - self.testTimer = setTimeout( self.onTimeout, self.testTimeout ); - - // when the QUnit object reports done in the iframe - // run the onFrameDone method - self.frame.QUnit.done = self.onFrameDone; - }); - }, - exec: function( data ) { var template = self.$frameElem.attr( "data-src" ); $.each( data.directories, function(i, dir) { - asyncTest( dir, function() { - self.createTest( dir ); + QUnit.asyncTest( dir, function() { + self.dir = dir; + self.$frameElem.one( "load", self.onFrameLoad ); self.$frameElem.attr( "src", template.replace("{{testdir}}", dir) ); }); });