Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit dd900460ac6f77be71ceb878bc2cd1465397dc60 1 parent f724bc6
@mikesherov mikesherov authored dmethvin committed
View
20 test/csp.php
@@ -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>
View
102 test/data/include_js.php
@@ -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
13 test/data/offset/absolute.html
@@ -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
12 test/data/offset/body.html
@@ -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
12 test/data/offset/fixed.html
@@ -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
12 test/data/offset/relative.html
@@ -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
12 test/data/offset/scroll.html
@@ -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
12 test/data/offset/static.html
@@ -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
12 test/data/offset/table.html
@@ -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
21 test/data/selector/html5_selector.html
@@ -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
21 test/data/selector/sizzle_cache.html
@@ -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
21 test/data/support/bodyBackground.html
@@ -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
21 test/data/support/boxModelIE.html
@@ -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
21 test/data/support/hiddenIFrameFF.html
@@ -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
8 test/data/versioncheck.js
@@ -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
13 test/delegatetest.html
@@ -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 @@
</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 @@
<script type='text/javascript'>
-$("#version").text(version);
$("#fileversion").text($.fn.jquery);
// Try an auto-submit, it should only fire once
View
2  test/hovertest.html
@@ -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
24 test/index.html
@@ -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
20 test/localfile.html
@@ -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
20 test/networkerror.html
@@ -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
20 test/readywait.html
@@ -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 -->
Please sign in to comment.
Something went wrong with that request. Please try again.