Tests: Refactor testIframe() to make it DRYer and more consistent

Ref gh-3040
Closes gh-3049
This commit is contained in:
Dave Methvin
2016-04-10 15:42:44 -04:00
parent 08d73d7f9c
commit e5ffcb0838
42 changed files with 142 additions and 110 deletions

View File

@@ -2476,10 +2476,10 @@ QUnit.test( "focusin using non-element targets", function( assert ) {
} );
testIframeWithCallback(
testIframe(
"focusin from an iframe",
"event/focusinCrossFrame.html",
function( frameDoc, assert ) {
function( assert, framejQuery, frameWin, frameDoc ) {
assert.expect( 1 );
var input = jQuery( frameDoc ).find( "#frame-input" );
@@ -2507,10 +2507,10 @@ testIframeWithCallback(
}
);
testIframeWithCallback(
testIframe(
"jQuery.ready promise",
"event/promiseReady.html",
function( isOk, assert ) {
function( assert, jQuery, window, document, isOk ) {
assert.expect( 1 );
assert.ok( isOk, "$.when( $.ready ) works" );
}
@@ -2518,29 +2518,29 @@ testIframeWithCallback(
// need PHP here to make the incepted IFRAME hang
if ( hasPHP ) {
testIframeWithCallback(
testIframe(
"jQuery.ready uses interactive",
"event/interactiveReady.html",
function( isOk, assert ) {
function( assert, jQuery, window, document, isOk ) {
assert.expect( 1 );
assert.ok( isOk, "jQuery fires ready when the DOM can truly be interacted with" );
}
);
}
testIframeWithCallback(
testIframe(
"Focusing iframe element",
"event/focusElem.html",
function( isOk, assert ) {
function( assert, jQuery, window, document, isOk ) {
assert.expect( 1 );
assert.ok( isOk, "Focused an element in an iframe" );
}
);
testIframeWithCallback(
testIframe(
"triggerHandler(onbeforeunload)",
"event/triggerunload.html",
function( isOk, assert ) {
function( assert, jQuery, window, document, isOk ) {
assert.expect( 1 );
assert.ok( isOk, "Triggered onbeforeunload without an error" );
}
@@ -2548,10 +2548,10 @@ testIframeWithCallback(
// need PHP here to make the incepted IFRAME hang
if ( hasPHP ) {
testIframeWithCallback(
testIframe(
"jQuery.ready synchronous load with long loading subresources",
"event/syncReady.html",
function( isOk, assert ) {
function( assert, jQuery, window, document, isOk ) {
assert.expect( 1 );
assert.ok( isOk, "jQuery loaded synchronously fires ready when the DOM can truly be interacted with" );
}