Skip to content
Permalink
Browse files

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

  • Loading branch information...
scottgonzalez authored and rwaldron committed Jun 15, 2012
1 parent 8f944a1 commit a7430dfb12f2bcf10bd51ec0bab4832791c0aa9f
Showing with 16 additions and 28 deletions.
  1. +16 −28 test/index.html
@@ -9,35 +9,26 @@

<script src="data/testinit.js"></script>

<!-- Loads minified version if version=min is present in the search -->
<!-- Nullifies querySelectorAll if qsa=no is present -->
<script src="qunit/qunit/qunit.js"></script>
<!-- Loads minified version if min=true is present in the search -->
<!-- Nullifies querySelectorAll if noqsa=true is present -->
<script>
(function() {
var set, keyvals, params,
version = "";
if ( location.search ) {
keyvals = location.search.slice(1).split("&"),
params = {};
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;
}
var src = "../dist/jquery.js";
QUnit.config.urlConfig.push( "min" );
if ( QUnit.urlParams.min ) {
src = "../dist/jquery.min.js";
}
QUnit.config.urlConfig.push( "noqsa" );
if ( QUnit.urlParams.noqsa ) {
document.querySelectorAll = null;
}
document.write(
"<script src='../dist/jquery." + version + "js'><\/script>"
);
document.write( "<script src='" + src + "'><\/script>" );
})();
</script>

<script src="qunit/qunit/qunit.js"></script>
<script src="data/testrunner.js"></script>

<script src="unit/core.js"></script>
@@ -70,10 +61,7 @@
</head>

<body id="body">
<h1 id="qunit-header"><a href="/jquery/test/index.html">jQuery Test Suite</a>
<a href="?version=min">(minified)</a>
<a href="?qsa=no">(-querySelectorAll)</a>
</h1>
<h1 id="qunit-header"><a href="/jquery/test/index.html">jQuery Test Suite</a></h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>

5 comments on commit a7430df

@timmywil

This comment has been minimized.

Copy link
Member

timmywil replied Jun 15, 2012

Nice

@rwaldron

This comment has been minimized.

Copy link
Member

rwaldron replied Jun 15, 2012

Agreed, I'm glad @scottgonzalez spotted that - much nicer now

@rwaldron

This comment has been minimized.

Copy link
Member

rwaldron replied Jun 15, 2012

I just realized that it needs support for git and arbitrary jQuery version (from http://code.jquery.com/jquery-X.X.X.js) builds added to it - not urgent.

@scottgonzalez

This comment has been minimized.

Copy link
Member Author

scottgonzalez replied Jun 15, 2012

Yeah, that didn't exist before. There was support for custom versions, but it always went to /dist. I asked @dmethvin about it and we agreed that we'd just wait until core was actually going to use it. Also, running against a git version isn't very useful, since that's essentially what the default is.

@scottgonzalez

This comment has been minimized.

Copy link
Member Author

scottgonzalez replied Jun 15, 2012

My thought for testing against previous builds was that we could reintroduce version but only to support code.jquery.com URLs. So version=1.6 would test against http://code.jquery.com/jquery-1.6.js and version=1.7.2.min would test against http://code.jquery.com/jquery-1.7.2.min.js. This would be mutually exclusive with min, which would continue to run against /dist builds.

I didn't want to go down this road yet since I don't know what the plan is for testing modular builds and how new test suites would be determined to be successful or not when run against older jQuery versions.

Please sign in to comment.
You can’t perform that action at this time.