Skip to content

Commit

Permalink
Use QUnit's URL configs to simplify custom configuration. Closes gh-827
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgonzalez authored and rwaldron committed Jun 15, 2012
1 parent 8f944a1 commit a7430df
Showing 1 changed file with 16 additions and 28 deletions.
44 changes: 16 additions & 28 deletions test/index.html
Expand Up @@ -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 = "";

QUnit.config.urlConfig.push( "min" );
if ( location.search ) { if ( QUnit.urlParams.min ) {
keyvals = location.search.slice(1).split("&"), src = "../dist/jquery.min.js";
params = {}; }


while ( keyvals.length ) { QUnit.config.urlConfig.push( "noqsa" );
set = keyvals.shift().split("="); if ( QUnit.urlParams.noqsa ) {
params[ set[0] ] = set[1]; document.querySelectorAll = null;
}
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>" 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>
Expand Down Expand Up @@ -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>
Expand Down

5 comments on commit a7430df

@timmywil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@rwaldron
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@rwaldron
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.