Use QUnit's URL configs to simplify custom configuration. Closes gh-827

This commit is contained in:
Scott González 2012-06-15 08:22:58 -05:00 committed by Rick Waldron
parent 8f944a1b5c
commit a7430dfb12

View File

@ -9,35 +9,26 @@
<script src="data/testinit.js"></script> <script src="data/testinit.js"></script>
<!-- Loads minified version if version=min is present in the search --> <script src="qunit/qunit/qunit.js"></script>
<!-- Nullifies querySelectorAll if qsa=no is present --> <!-- Loads minified version if min=true is present in the search -->
<!-- Nullifies querySelectorAll if noqsa=true is present -->
<script> <script>
(function() { (function() {
var set, keyvals, params, var src = "../dist/jquery.js";
version = "";
if ( location.search ) { QUnit.config.urlConfig.push( "min" );
keyvals = location.search.slice(1).split("&"), if ( QUnit.urlParams.min ) {
params = {}; src = "../dist/jquery.min.js";
while ( keyvals.length ) {
set = keyvals.shift().split("=");
params[ set[0] ] = set[1];
}
if ( params.version && params.version === "min" ) {
version = params.version + ".";
}
if ( params.qsa && params.qsa === "no" ) {
document.querySelectorAll = null;
}
} }
document.write(
"<script src='../dist/jquery." + version + "js'><\/script>" QUnit.config.urlConfig.push( "noqsa" );
); if ( QUnit.urlParams.noqsa ) {
document.querySelectorAll = null;
}
document.write( "<script src='" + src + "'><\/script>" );
})(); })();
</script> </script>
<script src="qunit/qunit/qunit.js"></script>
<script src="data/testrunner.js"></script> <script src="data/testrunner.js"></script>
<script src="unit/core.js"></script> <script src="unit/core.js"></script>
@ -70,10 +61,7 @@
</head> </head>
<body id="body"> <body id="body">
<h1 id="qunit-header"><a href="/jquery/test/index.html">jQuery Test Suite</a> <h1 id="qunit-header"><a href="/jquery/test/index.html">jQuery Test Suite</a></h1>
<a href="?version=min">(minified)</a>
<a href="?qsa=no">(-querySelectorAll)</a>
</h1>
<h2 id="qunit-banner"></h2> <h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div> <div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2> <h2 id="qunit-userAgent"></h2>