Skip to content

Commit

Permalink
Fix #13655. Add test for jQuery.ready.promise fallback load. Close gh…
Browse files Browse the repository at this point in the history
  • Loading branch information
mgol authored and dmethvin committed Apr 4, 2013
1 parent 7049877 commit 32b066d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/data/core/dont_return.php
@@ -0,0 +1,3 @@
<?php
sleep(10000);
?>
35 changes: 35 additions & 0 deletions test/data/core/dynamic_ready.html
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../../jquery.js"></script>
<script>var $j = jQuery.noConflict();</script>
</head>
<body>
<iframe id="dont_return" src="dont_return.php"></iframe>
<script>
var timeoutId, $,
timeoutFired = false;

setTimeout(function () {
// Load another jQuery copy using the first one.
$j.getScript( "../../../dist/jquery.js", function () {
$j( "#dont_return" ).attr( "src", "about:blank" );

// document ready handled by the just-loaded jQuery copy.
$(function () {
clearTimeout( timeoutId );
if ( !timeoutFired ) {
window.parent.iframeCallback( true );
}
});
});

timeoutId = setTimeout(function () {
timeoutFired = true;
window.parent.iframeCallback( false );
}, 3000);
});
</script>
</body>
</html>
5 changes: 5 additions & 0 deletions test/unit/core.js
Expand Up @@ -24,6 +24,11 @@ testIframeWithCallback( "Conditional compilation compatibility (#13274)", "core/
ok( $(), "jQuery executes" ); ok( $(), "jQuery executes" );
}); });


testIframeWithCallback( "document ready when jQuery loaded asynchronously (#13655)", "core/dynamic_ready.html", function( ready ) {
expect( 1 );
equal( true, ready, "document ready correctly fired when jQuery is loaded after DOMContentLoaded" );
});

test("jQuery()", function() { test("jQuery()", function() {


var elem, i, var elem, i,
Expand Down

0 comments on commit 32b066d

Please sign in to comment.