Tests: Make iframe tests wait after checking isReady

Ref gh-3040
This commit is contained in:
Dave Methvin
2016-04-08 12:00:17 -04:00
parent 755e7ccf01
commit 08d73d7f9c
15 changed files with 50 additions and 74 deletions

View File

@@ -12,6 +12,11 @@
<body>
<div>
<script src="../../jquery.js"></script>
<script>
jQuery( function() {
window.parent.iframeCallback( jQuery, window, document );
} );
</script>
</div>
</body>
</html>

View File

@@ -24,6 +24,7 @@
$(this).css({ top: pos.top, left: pos.left });
return false;
});
window.parent.iframeCallback( jQuery, window, document );
});
</script>
</head>

View File

@@ -16,6 +16,7 @@
$("marker").css( $(this).offset() );
return false;
});
window.parent.iframeCallback( jQuery, window, document );
});
</script>
</head>

View File

@@ -20,6 +20,7 @@
$("#marker").css( $(this).offset() );
return false;
});
window.parent.iframeCallback( jQuery, window, document );
});
</script>
</head>

View File

@@ -20,6 +20,7 @@
$(this).css({ position: 'absolute', top: pos.top, left: pos.left });
return false;
});
window.parent.iframeCallback( jQuery, window, document );
});
</script>
</head>

View File

@@ -24,6 +24,7 @@
$("#marker").css( $(this).offset() );
return false;
});
window.parent.iframeCallback( jQuery, window, document );
});
</script>
</head>

View File

@@ -19,6 +19,7 @@
$(this).css({ position: 'absolute', top: pos.top, left: pos.left });
return false;
});
window.parent.iframeCallback( jQuery, window, document );
});
</script>
</head>

View File

@@ -17,6 +17,7 @@
$("#marker").css( $(this).offset() );
return false;
});
window.parent.iframeCallback( jQuery, window, document );
});
</script>
</head>

View File

@@ -15,6 +15,10 @@
document.createElement('audio');
document.createElement('article');
document.createElement('details');
jQuery( function() {
window.parent.iframeCallback( jQuery, window, document );
} );
</script>
</head>
<body>

View File

@@ -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>

View File

@@ -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;