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" />
<title>CSP Test Page</title>
<script src="../src/core.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="data/include_js.php"></script>
</head>
<body>
<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; }
#positionTest { position: absolute; }
</style>
<script src="../../../src/core.js"></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 src="../include_js.php"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
$('.absolute').click(function() {

View File

@ -8,17 +8,7 @@
body { margin: 1px; padding: 5px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style>
<script src="../../../src/core.js"></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 src="../include_js.php"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
$('body').click(function() {

View File

@ -12,17 +12,7 @@
#forceScroll { width: 5000px; height: 5000px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style>
<script src="../../../src/core.js"></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 src="../include_js.php"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
window.scrollTo(1000,1000);

View File

@ -10,17 +10,7 @@
#relative-2 { top: 20px; left: 20px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style>
<script src="../../../src/core.js"></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 src="../include_js.php"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
$('.relative').click(function() {

View File

@ -13,17 +13,7 @@
#forceScroll { width: 5000px; height: 5000px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style>
<script src="../../../src/core.js"></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 src="../include_js.php"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
window.scrollTo(1000,1000);

View File

@ -10,17 +10,7 @@
#static-2 { top: 20px; left: 20px; }
#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
</style>
<script src="../../../src/core.js"></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 src="../include_js.php"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function($) {
$('.static').click(function() {

View File

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

View File

@ -4,26 +4,7 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>jQuery selector - attributes</title>
<script src="../../../src/core.js"></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="../include_js.php"></script>
<script id="script1"
defer

View File

@ -8,26 +8,7 @@
<script>
var $git = jQuery.noConflict(true);
</script>
<script src="../../../src/core.js"></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="../include_js.php"></script>
</head>
<body>

View File

@ -10,26 +10,7 @@
</head>
<body>
<div>
<script src="../../../src/core.js"></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="../include_js.php"></script>
</div>
<script>
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">
<html>
<body>
<script src="../../../src/core.js"></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="../include_js.php"></script>
<script>
jQuery(function() { window.parent.supportCallback( document.compatMode, jQuery.support.boxModel ) });
</script>

View File

@ -1,25 +1,6 @@
<html>
<head>
<script src="../../../src/core.js"></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="../include_js.php"></script>
</head>
<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>
<head>
<title>Event Delegation Tests</title>
<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>
<script src="data/include_js.php"></script>
<style>
table {
border-collapse: collapse;
@ -31,7 +23,7 @@ th, td {
</style>
</head>
<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">
<thead>
@ -133,7 +125,6 @@ th, td {
<script type='text/javascript'>
$("#version").text(version);
$("#fileversion").text($.fn.jquery);
// Try an auto-submit, it should only fire once

View File

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

View File

@ -8,29 +8,7 @@
<!-- Includes -->
<script src="data/testinit.js"></script>
<script src="../src/core.js"></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="data/include_js.php"></script>
<script src="qunit/qunit/qunit.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" />
<title>jQuery Local File Test</title>
<!-- Includes -->
<script src="../src/core.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="data/include_js.php"></script>
<style>
.error { color: red; }
.success { color: green; }

View File

@ -15,25 +15,7 @@
<style>
div { margin-top: 10px; }
</style>
<script src="../src/core.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="data/include_js.php"></script>
<script type="text/javascript">
$('button').live('click', function () {
$.ajax({

View File

@ -14,25 +14,7 @@
#output { background-color: green }
#expectedOutput { background-color: green }
</style>
<script src="../src/core.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="data/include_js.php"></script>
<!-- Load the script loader that uses
jQuery.readyWait -->