mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-20 12:21:52 +00:00
minor refactor to test suite runner, and js moved to head
This commit is contained in:
parent
fb0f6baf24
commit
1fd9af8e36
2 changed files with 15 additions and 18 deletions
|
|
@ -3,6 +3,9 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="../../external/qunit.css"></link>
|
||||
<script src="../../js/jquery.js"></script>
|
||||
<script src="../../external/qunit.js"></script>
|
||||
<script src="runner.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div style="float: left; width: 500px;">
|
||||
|
|
@ -15,8 +18,5 @@
|
|||
I think an entire link and stylesheet is a waste -->
|
||||
<iframe data-src="../../tests/unit/{{testdir}}" name="testFrame" id="testFrame" width="800px" height="100%" style="float: left; border: 0px; height: 100%;" scrolling="no">
|
||||
</iframe>
|
||||
<script src="../../js/jquery.js"></script>
|
||||
<script src="../../external/qunit.js"></script>
|
||||
<script src="runner.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -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) );
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue