Fix #10902. DRY up the ways to include src files in tests.

This commit is contained in:
Mike Sherov 2012-01-11 21:35:13 -05:00 committed by Dave Methvin
parent f724bc6c92
commit dd900460ac
21 changed files with 122 additions and 297 deletions

View File

@ -5,25 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSP Test Page</title> <title>CSP Test Page</title>
<script src="../src/core.js"></script> <script src="data/include_js.php"></script>
<script src="../src/deferred.js"></script>
<script src="../src/support.js"></script>
<script src="../src/data.js"></script>
<script src="../src/queue.js"></script>
<script src="../src/attributes.js"></script>
<script src="../src/event.js"></script>
<script src="../src/sizzle/sizzle.js"></script>
<script src="../src/sizzle-jquery.js"></script>
<script src="../src/traversing.js"></script>
<script src="../src/manipulation.js"></script>
<script src="../src/css.js"></script>
<script src="../src/ajax.js"></script>
<script src="../src/ajax/jsonp.js"></script>
<script src="../src/ajax/script.js"></script>
<script src="../src/ajax/xhr.js"></script>
<script src="../src/effects.js"></script>
<script src="../src/offset.js"></script>
<script src="../src/dimensions.js"></script>
</head> </head>
<body> <body>
<p>CSP Test Page</p> <p>CSP Test Page</p>

102
test/data/include_js.php Normal file
View File

@ -0,0 +1,102 @@
/*
<?php
// if php is available, close the comment so PHP can echo the appropriate JS
echo "*" . "/";
// initialize vars
$output = "";
$version = "";
// extract vars from referrer to determine version
if(isset($_SERVER['HTTP_REFERER'])){
$referrer = $_SERVER['HTTP_REFERER'];
$referrer_query_string = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY );
parse_str($referrer_query_string, $referrer_params);
if(isset($referrer_params['jquery'])){
$version = $referrer_params['jquery'];
}
}
// load up built versions of jquery
if( $version === "min" ) {
$output = @file_get_contents("../../dist/jquery.min.js");
}elseif( $version === "dist" ) {
$output = @file_get_contents("../../dist/jquery.js");
}elseif( ctype_digit( substr( $version, 0, 1 )) || $version === "git" ) {
$output = "document.write('<script src=\"http://code.jquery.com/jquery-" . $version . ".js\"><'+'/script>');";
}
// the concatenated version of the the src files is both the default and the fallback
// because it does not require you to "make" jquery for it to update
if( $output === "" ) {
$files = array(
"intro",
"core",
"callbacks",
"deferred",
"support",
"data",
"queue",
"attributes",
"event",
"sizzle/sizzle",
"sizzle-jquery",
"traversing",
"manipulation",
"css",
"ajax",
"ajax/jsonp",
"ajax/script",
"ajax/xhr",
"effects",
"offset",
"dimensions",
"exports",
"outro"
);
foreach ( $files as $file ) {
$output .= file_get_contents( "../../src/" . $file . ".js" );
}
$output = str_replace( "(function( jQuery ) {", "", $output );
$output = str_replace( "})( jQuery );", "", $output );
}
echo $output;
die();
?>
*/
// javascript fallback using src files in case this is not run on a PHP server!
var baseURL = document.location.href.replace( /\/test\/.+/, "/"),
files = [
"core",
"callbacks",
"deferred",
"support",
"data",
"queue",
"attributes",
"event",
"sizzle/sizzle",
"sizzle-jquery",
"traversing",
"manipulation",
"css",
"ajax",
"ajax/jsonp",
"ajax/script",
"ajax/xhr",
"effects",
"offset",
"dimensions",
"exports"
],
len = files.length,
i = 0;
for ( ; i < len; i++ ) {
document.write("<script src=\"" + baseURL + "src/" + files[ i ] + ".js\"><"+"/script>");
}

View File

@ -15,18 +15,7 @@
p.instructions { position: absolute; bottom: 0; } p.instructions { position: absolute; bottom: 0; }
#positionTest { position: absolute; } #positionTest { position: absolute; }
</style> </style>
<script src="../../../src/core.js"></script> <script src="../include_js.php"></script>
<script src="../../../src/callbacks.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/offset.js"></script>
<script type="text/javascript" src="../../../dist/jquery.js"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
jQuery(function($) { jQuery(function($) {
$('.absolute').click(function() { $('.absolute').click(function() {

View File

@ -8,17 +8,7 @@
body { margin: 1px; padding: 5px; } body { margin: 1px; padding: 5px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style> </style>
<script src="../../../src/core.js"></script> <script src="../include_js.php"></script>
<script src="../../../src/callbacks.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/offset.js"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
jQuery(function($) { jQuery(function($) {
$('body').click(function() { $('body').click(function() {

View File

@ -12,17 +12,7 @@
#forceScroll { width: 5000px; height: 5000px; } #forceScroll { width: 5000px; height: 5000px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style> </style>
<script src="../../../src/core.js"></script> <script src="../include_js.php"></script>
<script src="../../../src/callbacks.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/offset.js"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
jQuery(function($) { jQuery(function($) {
window.scrollTo(1000,1000); window.scrollTo(1000,1000);

View File

@ -10,17 +10,7 @@
#relative-2 { top: 20px; left: 20px; } #relative-2 { top: 20px; left: 20px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style> </style>
<script src="../../../src/core.js"></script> <script src="../include_js.php"></script>
<script src="../../../src/callbacks.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/offset.js"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
jQuery(function($) { jQuery(function($) {
$('.relative').click(function() { $('.relative').click(function() {

View File

@ -13,17 +13,7 @@
#forceScroll { width: 5000px; height: 5000px; } #forceScroll { width: 5000px; height: 5000px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style> </style>
<script src="../../../src/core.js"></script> <script src="../include_js.php"></script>
<script src="../../../src/callbacks.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/offset.js"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
jQuery(function($) { jQuery(function($) {
window.scrollTo(1000,1000); window.scrollTo(1000,1000);

View File

@ -10,17 +10,7 @@
#static-2 { top: 20px; left: 20px; } #static-2 { top: 20px; left: 20px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style> </style>
<script src="../../../src/core.js"></script> <script src="../include_js.php"></script>
<script src="../../../src/callbacks.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/offset.js"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
jQuery(function($) { jQuery(function($) {
$('.static').click(function() { $('.static').click(function() {

View File

@ -10,17 +10,7 @@
th, td { border: 1px solid #000; width: 100px; height: 100px; } th, td { border: 1px solid #000; width: 100px; height: 100px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; } #marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style> </style>
<script src="../../../src/core.js"></script> <script src="../include_js.php"></script>
<script src="../../../src/callbacks.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/offset.js"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
jQuery(function($) { jQuery(function($) {
$('table, th, td').click(function() { $('table, th, td').click(function() {

View File

@ -4,26 +4,7 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>jQuery selector - attributes</title> <title>jQuery selector - attributes</title>
<script src="../../../src/core.js"></script> <script src="../include_js.php"></script>
<script src="../../../src/callbacks.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/queue.js"></script>
<script src="../../../src/attributes.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/manipulation.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/ajax.js"></script>
<script src="../../../src/ajax/jsonp.js"></script>
<script src="../../../src/ajax/script.js"></script>
<script src="../../../src/ajax/xhr.js"></script>
<script src="../../../src/effects.js"></script>
<script src="../../../src/offset.js"></script>
<script src="../../../src/dimensions.js"></script>
<script id="script1" <script id="script1"
defer defer

View File

@ -8,26 +8,7 @@
<script> <script>
var $git = jQuery.noConflict(true); var $git = jQuery.noConflict(true);
</script> </script>
<script src="../../../src/core.js"></script> <script src="../include_js.php"></script>
<script src="../../../src/callbacks.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/queue.js"></script>
<script src="../../../src/attributes.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/manipulation.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/ajax.js"></script>
<script src="../../../src/ajax/jsonp.js"></script>
<script src="../../../src/ajax/script.js"></script>
<script src="../../../src/ajax/xhr.js"></script>
<script src="../../../src/effects.js"></script>
<script src="../../../src/offset.js"></script>
<script src="../../../src/dimensions.js"></script>
</head> </head>
<body> <body>

View File

@ -10,26 +10,7 @@
</head> </head>
<body> <body>
<div> <div>
<script src="../../../src/core.js"></script> <script src="../include_js.php"></script>
<script src="../../../src/callbacks.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/queue.js"></script>
<script src="../../../src/attributes.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/manipulation.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/ajax.js"></script>
<script src="../../../src/ajax/jsonp.js"></script>
<script src="../../../src/ajax/script.js"></script>
<script src="../../../src/ajax/xhr.js"></script>
<script src="../../../src/effects.js"></script>
<script src="../../../src/offset.js"></script>
<script src="../../../src/dimensions.js"></script>
</div> </div>
<script> <script>
jQuery(function() { jQuery(function() {

View File

@ -1,26 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> <html>
<body> <body>
<script src="../../../src/core.js"></script> <script src="../include_js.php"></script>
<script src="../../../src/callbacks.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/queue.js"></script>
<script src="../../../src/attributes.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/manipulation.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/ajax.js"></script>
<script src="../../../src/ajax/jsonp.js"></script>
<script src="../../../src/ajax/script.js"></script>
<script src="../../../src/ajax/xhr.js"></script>
<script src="../../../src/effects.js"></script>
<script src="../../../src/offset.js"></script>
<script src="../../../src/dimensions.js"></script>
<script> <script>
jQuery(function() { window.parent.supportCallback( document.compatMode, jQuery.support.boxModel ) }); jQuery(function() { window.parent.supportCallback( document.compatMode, jQuery.support.boxModel ) });
</script> </script>

View File

@ -1,25 +1,6 @@
<html> <html>
<head> <head>
<script src="../../../src/core.js"></script> <script src="../include_js.php"></script>
<script src="../../../src/callbacks.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/queue.js"></script>
<script src="../../../src/attributes.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/manipulation.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/ajax.js"></script>
<script src="../../../src/ajax/jsonp.js"></script>
<script src="../../../src/ajax/script.js"></script>
<script src="../../../src/ajax/xhr.js"></script>
<script src="../../../src/effects.js"></script>
<script src="../../../src/offset.js"></script>
<script src="../../../src/dimensions.js"></script>
</head> </head>
<body> <body>
</body> </body>

View File

@ -1,8 +0,0 @@
// Run minified source from dist (do make first)
// Should be loaded before QUnit but after src
(function() {
if ( /jquery\=min/.test( window.location.search ) ) {
jQuery.noConflict( true );
document.write(unescape("%3Cscript%20src%3D%27../dist/jquery.min.js%27%3E%3C/script%3E"));
}
})();

View File

@ -2,15 +2,7 @@
<html> <html>
<head> <head>
<title>Event Delegation Tests</title> <title>Event Delegation Tests</title>
<script> <script src="data/include_js.php"></script>
var version = location.search && location.search.substr(1);
if ( version ) {
version = "http://code.jquery.com/jquery-"+version+".js";
} else {
version = "../dist/jquery.js";
}
document.write('<script src="'+version+'"><'+'/script>');
</script>
<style> <style>
table { table {
border-collapse: collapse; border-collapse: collapse;
@ -31,7 +23,7 @@ th, td {
</style> </style>
</head> </head>
<body> <body>
<h2>Delegate Tests (<span id="version">BAD FILE IN URL</span>, <span id="fileversion">x</span>)</h2> <h2>Delegate Tests (<span id="fileversion">x</span>)</h2>
<table id="changes"> <table id="changes">
<thead> <thead>
@ -133,7 +125,6 @@ th, td {
<script type='text/javascript'> <script type='text/javascript'>
$("#version").text(version);
$("#fileversion").text($.fn.jquery); $("#fileversion").text($.fn.jquery);
// Try an auto-submit, it should only fire once // Try an auto-submit, it should only fire once

View File

@ -1,7 +1,7 @@
<html> <html>
<head> <head>
<title>Hover tests</title> <title>Hover tests</title>
<script src="../dist/jquery.js" type='text/javascript'></script> <script src="data/include_js.php"></script>
<style> <style>
/* Remove body dimensions so we can test enter/leave to surrounding browser chrome */ /* Remove body dimensions so we can test enter/leave to surrounding browser chrome */
body, html { body, html {

View File

@ -8,29 +8,7 @@
<!-- Includes --> <!-- Includes -->
<script src="data/testinit.js"></script> <script src="data/testinit.js"></script>
<script src="../src/core.js"></script> <script src="data/include_js.php"></script>
<script src="../src/callbacks.js"></script>
<script src="../src/deferred.js"></script>
<script src="../src/support.js"></script>
<script src="../src/data.js"></script>
<script src="../src/queue.js"></script>
<script src="../src/attributes.js"></script>
<script src="../src/event.js"></script>
<script src="../src/sizzle/sizzle.js"></script>
<script src="../src/sizzle-jquery.js"></script>
<script src="../src/traversing.js"></script>
<script src="../src/manipulation.js"></script>
<script src="../src/css.js"></script>
<script src="../src/ajax.js"></script>
<script src="../src/ajax/jsonp.js"></script>
<script src="../src/ajax/script.js"></script>
<script src="../src/ajax/xhr.js"></script>
<script src="../src/effects.js"></script>
<script src="../src/offset.js"></script>
<script src="../src/dimensions.js"></script>
<script src="../src/exports.js"></script>
<script src="data/versioncheck.js"></script>
<script src="qunit/qunit/qunit.js"></script> <script src="qunit/qunit/qunit.js"></script>
<script src="data/testrunner.js"></script> <script src="data/testrunner.js"></script>

View File

@ -4,25 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery Local File Test</title> <title>jQuery Local File Test</title>
<!-- Includes --> <!-- Includes -->
<script src="../src/core.js"></script> <script src="data/include_js.php"></script>
<script src="../src/deferred.js"></script>
<script src="../src/support.js"></script>
<script src="../src/data.js"></script>
<script src="../src/queue.js"></script>
<script src="../src/attributes.js"></script>
<script src="../src/event.js"></script>
<script src="../src/sizzle/sizzle.js"></script>
<script src="../src/sizzle-jquery.js"></script>
<script src="../src/traversing.js"></script>
<script src="../src/manipulation.js"></script>
<script src="../src/css.js"></script>
<script src="../src/ajax.js"></script>
<script src="../src/ajax/jsonp.js"></script>
<script src="../src/ajax/script.js"></script>
<script src="../src/ajax/xhr.js"></script>
<script src="../src/effects.js"></script>
<script src="../src/offset.js"></script>
<script src="../src/dimensions.js"></script>
<style> <style>
.error { color: red; } .error { color: red; }
.success { color: green; } .success { color: green; }

View File

@ -15,25 +15,7 @@
<style> <style>
div { margin-top: 10px; } div { margin-top: 10px; }
</style> </style>
<script src="../src/core.js"></script> <script src="data/include_js.php"></script>
<script src="../src/deferred.js"></script>
<script src="../src/support.js"></script>
<script src="../src/data.js"></script>
<script src="../src/queue.js"></script>
<script src="../src/attributes.js"></script>
<script src="../src/event.js"></script>
<script src="../src/sizzle/sizzle.js"></script>
<script src="../src/sizzle-jquery.js"></script>
<script src="../src/traversing.js"></script>
<script src="../src/manipulation.js"></script>
<script src="../src/css.js"></script>
<script src="../src/ajax.js"></script>
<script src="../src/ajax/jsonp.js"></script>
<script src="../src/ajax/script.js"></script>
<script src="../src/ajax/xhr.js"></script>
<script src="../src/effects.js"></script>
<script src="../src/offset.js"></script>
<script src="../src/dimensions.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$('button').live('click', function () { $('button').live('click', function () {
$.ajax({ $.ajax({

View File

@ -14,25 +14,7 @@
#output { background-color: green } #output { background-color: green }
#expectedOutput { background-color: green } #expectedOutput { background-color: green }
</style> </style>
<script src="../src/core.js"></script> <script src="data/include_js.php"></script>
<script src="../src/deferred.js"></script>
<script src="../src/support.js"></script>
<script src="../src/data.js"></script>
<script src="../src/queue.js"></script>
<script src="../src/attributes.js"></script>
<script src="../src/event.js"></script>
<script src="../src/sizzle/sizzle.js"></script>
<script src="../src/sizzle-jquery.js"></script>
<script src="../src/traversing.js"></script>
<script src="../src/manipulation.js"></script>
<script src="../src/css.js"></script>
<script src="../src/ajax.js"></script>
<script src="../src/ajax/jsonp.js"></script>
<script src="../src/ajax/script.js"></script>
<script src="../src/ajax/xhr.js"></script>
<script src="../src/effects.js"></script>
<script src="../src/offset.js"></script>
<script src="../src/dimensions.js"></script>
<!-- Load the script loader that uses <!-- Load the script loader that uses
jQuery.readyWait --> jQuery.readyWait -->