mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Tests: Make iframe tests wait after checking isReady
Ref gh-3040
This commit is contained in:
@@ -232,37 +232,6 @@ this.ajaxTest = function( title, expect, options ) {
|
||||
} );
|
||||
};
|
||||
|
||||
this.testIframe = function( fileName, name, fn ) {
|
||||
QUnit.test( name, function( assert ) {
|
||||
var done = assert.async();
|
||||
|
||||
// load fixture in iframe
|
||||
var iframe = loadFixture(),
|
||||
win = iframe.contentWindow,
|
||||
interval = setInterval( function() {
|
||||
if ( win && win.jQuery && win.jQuery.isReady ) {
|
||||
clearInterval( interval );
|
||||
|
||||
// call actual tests passing the correct jQuery instance to use
|
||||
fn.call( this, win.jQuery, win, win.document, assert );
|
||||
done();
|
||||
document.body.removeChild( iframe );
|
||||
iframe = null;
|
||||
}
|
||||
}, 15 );
|
||||
} );
|
||||
|
||||
function loadFixture() {
|
||||
var src = url( "./data/" + fileName + ".html" ),
|
||||
iframe = jQuery( "<iframe />" ).appendTo( "body" )[ 0 ];
|
||||
iframe.style.cssText = "width: 500px; height: 500px; position: absolute; " +
|
||||
"top: -600px; left: -600px; visibility: hidden;";
|
||||
|
||||
iframe.contentWindow.location = src;
|
||||
return iframe;
|
||||
}
|
||||
};
|
||||
|
||||
this.testIframeWithCallback = function( title, fileName, func ) {
|
||||
QUnit.test( title, 1, function( assert ) {
|
||||
var iframe;
|
||||
|
||||
Reference in New Issue
Block a user