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:
@@ -12,6 +12,11 @@
|
||||
<body>
|
||||
<div>
|
||||
<script src="../../jquery.js"></script>
|
||||
<script>
|
||||
jQuery( function() {
|
||||
window.parent.iframeCallback( jQuery, window, document );
|
||||
} );
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
$(this).css({ top: pos.top, left: pos.left });
|
||||
return false;
|
||||
});
|
||||
window.parent.iframeCallback( jQuery, window, document );
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
$("marker").css( $(this).offset() );
|
||||
return false;
|
||||
});
|
||||
window.parent.iframeCallback( jQuery, window, document );
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
$("#marker").css( $(this).offset() );
|
||||
return false;
|
||||
});
|
||||
window.parent.iframeCallback( jQuery, window, document );
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
$(this).css({ position: 'absolute', top: pos.top, left: pos.left });
|
||||
return false;
|
||||
});
|
||||
window.parent.iframeCallback( jQuery, window, document );
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
$("#marker").css( $(this).offset() );
|
||||
return false;
|
||||
});
|
||||
window.parent.iframeCallback( jQuery, window, document );
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
$(this).css({ position: 'absolute', top: pos.top, left: pos.left });
|
||||
return false;
|
||||
});
|
||||
window.parent.iframeCallback( jQuery, window, document );
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
$("#marker").css( $(this).offset() );
|
||||
return false;
|
||||
});
|
||||
window.parent.iframeCallback( jQuery, window, document );
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
document.createElement('audio');
|
||||
document.createElement('article');
|
||||
document.createElement('details');
|
||||
|
||||
jQuery( function() {
|
||||
window.parent.iframeCallback( jQuery, window, document );
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -17,5 +17,10 @@
|
||||
<div class="test">
|
||||
<a href="#" id="collision">Worlds collide</a>
|
||||
</div>
|
||||
<script>
|
||||
jQuery( function() {
|
||||
window.parent.iframeCallback( jQuery, window, document );
|
||||
} );
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -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