Skip to content

Commit 2d5c5d2

Browse files
jzaefferermarkelog
authored andcommitted
Build: Update QUnit to latest (1.17.1)
Closes jquerygh-2038
1 parent 0c46643 commit 2d5c5d2

File tree

4 files changed

+141
-69
lines changed

4 files changed

+141
-69
lines changed

external/qunit/LICENSE.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Copyright 2006, 2014 jQuery Foundation and other contributors,
2-
https://jquery.org/
1+
Copyright jQuery Foundation and other contributors, https://jquery.org/
32

43
This software consists of voluntary contributions made by many
54
individuals. For exact contribution history, see the revision history

external/qunit/qunit.css

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*!
2-
* QUnit 1.16.0
2+
* QUnit 1.17.1
33
* http://qunitjs.com/
44
*
5-
* Copyright 2006, 2014 jQuery Foundation and other contributors
5+
* Copyright jQuery Foundation and other contributors
66
* Released under the MIT license
77
* http://jquery.org/license
88
*
9-
* Date: 2014-12-03T16:32Z
9+
* Date: 2015-01-20T19:39Z
1010
*/
1111

1212
/** Font Family and Sizes */
@@ -77,6 +77,18 @@
7777

7878
#qunit-modulefilter-container {
7979
float: right;
80+
padding: 0.2em;
81+
}
82+
83+
.qunit-url-config {
84+
display: inline-block;
85+
padding: 0.1em;
86+
}
87+
88+
.qunit-filter {
89+
display: block;
90+
float: right;
91+
margin-left: 1em;
8092
}
8193

8294
/** Tests: Pass/Fail */
@@ -95,11 +107,15 @@
95107
display: none;
96108
}
97109

98-
#qunit-tests li.pass, #qunit-tests li.running, #qunit-tests li.fail {
110+
#qunit-tests li.running,
111+
#qunit-tests li.pass,
112+
#qunit-tests li.fail,
113+
#qunit-tests li.skipped {
99114
display: list-item;
100115
}
101116

102-
#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
117+
#qunit-tests.hidepass li.running,
118+
#qunit-tests.hidepass li.pass {
103119
display: none;
104120
}
105121

external/qunit/qunit.js

Lines changed: 117 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*!
2-
* QUnit 1.16.0
2+
* QUnit 1.17.1
33
* http://qunitjs.com/
44
*
5-
* Copyright 2006, 2014 jQuery Foundation and other contributors
5+
* Copyright jQuery Foundation and other contributors
66
* Released under the MIT license
77
* http://jquery.org/license
88
*
9-
* Date: 2014-12-03T16:32Z
9+
* Date: 2015-01-20T19:39Z
1010
*/
1111

1212
(function( window ) {
@@ -103,10 +103,6 @@ config = {
103103
// block until document ready
104104
blocking: true,
105105

106-
// when enabled, show only failing tests
107-
// gets persisted through sessionStorage and can be changed in UI via checkbox
108-
hidepassed: false,
109-
110106
// by default, run previously failed tests first
111107
// very useful in combination with "Hide passed tests" checked
112108
reorder: true,
@@ -180,6 +176,10 @@ config.modules.push( config.currentModule );
180176
}
181177
}
182178

179+
if ( urlParams.filter === true ) {
180+
delete urlParams.filter;
181+
}
182+
183183
QUnit.urlParams = urlParams;
184184

185185
// String search anywhere in moduleName+testName
@@ -363,24 +363,6 @@ extend( QUnit, {
363363
return undefined;
364364
},
365365

366-
url: function( params ) {
367-
params = extend( extend( {}, QUnit.urlParams ), params );
368-
var key,
369-
querystring = "?";
370-
371-
for ( key in params ) {
372-
if ( hasOwn.call( params, key ) ) {
373-
querystring += encodeURIComponent( key );
374-
if ( params[ key ] !== true ) {
375-
querystring += "=" + encodeURIComponent( params[ key ] );
376-
}
377-
querystring += "&";
378-
}
379-
}
380-
return location.protocol + "//" + location.host +
381-
location.pathname + querystring.slice( 0, -1 );
382-
},
383-
384366
extend: extend,
385367

386368
load: function() {
@@ -578,7 +560,7 @@ function process( last ) {
578560
process( last );
579561
}
580562
var start = now();
581-
config.depth = config.depth ? config.depth + 1 : 1;
563+
config.depth = ( config.depth || 0 ) + 1;
582564

583565
while ( config.queue.length && !config.blocking ) {
584566
if ( !defined.setTimeout || config.updateRate <= 0 ||
@@ -1141,7 +1123,7 @@ Test.prototype = {
11411123

11421124
valid: function() {
11431125
var include,
1144-
filter = config.filter && config.filter.toLowerCase(),
1126+
filter = config.filter,
11451127
module = QUnit.urlParams.module && QUnit.urlParams.module.toLowerCase(),
11461128
fullName = ( this.module.name + ": " + this.testName ).toLowerCase();
11471129

@@ -1164,7 +1146,7 @@ Test.prototype = {
11641146

11651147
include = filter.charAt( 0 ) !== "!";
11661148
if ( !include ) {
1167-
filter = filter.slice( 1 );
1149+
filter = filter.toLowerCase().slice( 1 );
11681150
}
11691151

11701152
// If the filter matches, we need to honour include
@@ -1987,12 +1969,15 @@ if ( typeof window !== "undefined" ) {
19871969
}
19881970

19891971
// For nodejs
1990-
if ( typeof module !== "undefined" && module.exports ) {
1972+
if ( typeof module !== "undefined" && module && module.exports ) {
19911973
module.exports = QUnit;
1974+
1975+
// For consistency with CommonJS environments' exports
1976+
module.exports.QUnit = QUnit;
19921977
}
19931978

19941979
// For CommonJS with exports, but without module.exports, like Rhino
1995-
if ( typeof exports !== "undefined" ) {
1980+
if ( typeof exports !== "undefined" && exports ) {
19961981
exports.QUnit = QUnit;
19971982
}
19981983

@@ -2340,7 +2325,10 @@ function getUrlConfigHtml() {
23402325
escaped = escapeText( val.id );
23412326
escapedTooltip = escapeText( val.tooltip );
23422327

2343-
config[ val.id ] = QUnit.urlParams[ val.id ];
2328+
if ( config[ val.id ] === undefined ) {
2329+
config[ val.id ] = QUnit.urlParams[ val.id ];
2330+
}
2331+
23442332
if ( !val.value || typeof val.value === "string" ) {
23452333
urlConfigHtml += "<input id='qunit-urlconfig-" + escaped +
23462334
"' name='" + escaped + "' type='checkbox'" +
@@ -2399,7 +2387,7 @@ function toolbarChanged() {
23992387
}
24002388

24012389
params[ field.name ] = value;
2402-
updatedUrl = QUnit.url( params );
2390+
updatedUrl = setUrl( params );
24032391

24042392
if ( "hidepassed" === field.name && "replaceState" in window.history ) {
24052393
config[ field.name ] = value || false;
@@ -2416,10 +2404,47 @@ function toolbarChanged() {
24162404
}
24172405
}
24182406

2407+
function setUrl( params ) {
2408+
var key,
2409+
querystring = "?";
2410+
2411+
params = QUnit.extend( QUnit.extend( {}, QUnit.urlParams ), params );
2412+
2413+
for ( key in params ) {
2414+
if ( hasOwn.call( params, key ) ) {
2415+
if ( params[ key ] === undefined ) {
2416+
continue;
2417+
}
2418+
querystring += encodeURIComponent( key );
2419+
if ( params[ key ] !== true ) {
2420+
querystring += "=" + encodeURIComponent( params[ key ] );
2421+
}
2422+
querystring += "&";
2423+
}
2424+
}
2425+
return location.protocol + "//" + location.host +
2426+
location.pathname + querystring.slice( 0, -1 );
2427+
}
2428+
2429+
function applyUrlParams() {
2430+
var selectBox = id( "qunit-modulefilter" ),
2431+
selection = decodeURIComponent( selectBox.options[ selectBox.selectedIndex ].value ),
2432+
filter = id( "qunit-filter-input" ).value;
2433+
2434+
window.location = setUrl({
2435+
module: ( selection === "" ) ? undefined : selection,
2436+
filter: ( filter === "" ) ? undefined : filter,
2437+
2438+
// Remove testId filter
2439+
testId: undefined
2440+
});
2441+
}
2442+
24192443
function toolbarUrlConfigContainer() {
24202444
var urlConfigContainer = document.createElement( "span" );
24212445

24222446
urlConfigContainer.innerHTML = getUrlConfigHtml();
2447+
addClass( urlConfigContainer, "qunit-url-config" );
24232448

24242449
// For oldIE support:
24252450
// * Add handlers to the individual elements instead of the container
@@ -2430,6 +2455,40 @@ function toolbarUrlConfigContainer() {
24302455
return urlConfigContainer;
24312456
}
24322457

2458+
function toolbarLooseFilter() {
2459+
var filter = document.createElement( "form" ),
2460+
label = document.createElement( "label" ),
2461+
input = document.createElement( "input" ),
2462+
button = document.createElement( "button" );
2463+
2464+
addClass( filter, "qunit-filter" );
2465+
2466+
label.innerHTML = "Filter: ";
2467+
2468+
input.type = "text";
2469+
input.value = config.filter || "";
2470+
input.name = "filter";
2471+
input.id = "qunit-filter-input";
2472+
2473+
button.innerHTML = "Go";
2474+
2475+
label.appendChild( input );
2476+
2477+
filter.appendChild( label );
2478+
filter.appendChild( button );
2479+
addEvent( filter, "submit", function( ev ) {
2480+
applyUrlParams();
2481+
2482+
if ( ev && ev.preventDefault ) {
2483+
ev.preventDefault();
2484+
}
2485+
2486+
return false;
2487+
});
2488+
2489+
return filter;
2490+
}
2491+
24332492
function toolbarModuleFilterHtml() {
24342493
var i,
24352494
moduleFilterHtml = "";
@@ -2463,25 +2522,14 @@ function toolbarModuleFilter() {
24632522
moduleFilter = document.createElement( "span" ),
24642523
moduleFilterHtml = toolbarModuleFilterHtml();
24652524

2466-
if ( !moduleFilterHtml ) {
2525+
if ( !toolbar || !moduleFilterHtml ) {
24672526
return false;
24682527
}
24692528

24702529
moduleFilter.setAttribute( "id", "qunit-modulefilter-container" );
24712530
moduleFilter.innerHTML = moduleFilterHtml;
24722531

2473-
addEvent( moduleFilter.lastChild, "change", function() {
2474-
var selectBox = moduleFilter.getElementsByTagName( "select" )[ 0 ],
2475-
selection = decodeURIComponent( selectBox.options[ selectBox.selectedIndex ].value );
2476-
2477-
window.location = QUnit.url({
2478-
module: ( selection === "" ) ? undefined : selection,
2479-
2480-
// Remove any existing filters
2481-
filter: undefined,
2482-
testId: undefined
2483-
});
2484-
});
2532+
addEvent( moduleFilter.lastChild, "change", applyUrlParams );
24852533

24862534
toolbar.appendChild( moduleFilter );
24872535
}
@@ -2491,6 +2539,17 @@ function appendToolbar() {
24912539

24922540
if ( toolbar ) {
24932541
toolbar.appendChild( toolbarUrlConfigContainer() );
2542+
toolbar.appendChild( toolbarLooseFilter() );
2543+
}
2544+
}
2545+
2546+
function appendHeader() {
2547+
var header = id( "qunit-header" );
2548+
2549+
if ( header ) {
2550+
header.innerHTML = "<a href='" +
2551+
setUrl({ filter: undefined, module: undefined, testId: undefined }) +
2552+
"'>" + header.innerHTML + "</a> ";
24942553
}
24952554
}
24962555

@@ -2499,9 +2558,6 @@ function appendBanner() {
24992558

25002559
if ( banner ) {
25012560
banner.className = "";
2502-
banner.innerHTML = "<a href='" +
2503-
QUnit.url({ filter: undefined, module: undefined, testId: undefined }) +
2504-
"'>" + banner.innerHTML + "</a> ";
25052561
}
25062562
}
25072563

@@ -2533,7 +2589,8 @@ function storeFixture() {
25332589
function appendUserAgent() {
25342590
var userAgent = id( "qunit-userAgent" );
25352591
if ( userAgent ) {
2536-
userAgent.innerHTML = navigator.userAgent;
2592+
userAgent.innerHTML = "";
2593+
userAgent.appendChild( document.createTextNode( navigator.userAgent ) );
25372594
}
25382595
}
25392596

@@ -2568,7 +2625,7 @@ function appendTest( name, testId, moduleName ) {
25682625

25692626
rerunTrigger = document.createElement( "a" );
25702627
rerunTrigger.innerHTML = "Rerun";
2571-
rerunTrigger.href = QUnit.url({ testId: testId });
2628+
rerunTrigger.href = setUrl({ testId: testId });
25722629

25732630
testBlock = document.createElement( "li" );
25742631
testBlock.appendChild( title );
@@ -2590,25 +2647,24 @@ QUnit.begin(function( details ) {
25902647
// Fixture is the only one necessary to run without the #qunit element
25912648
storeFixture();
25922649

2593-
if ( !qunit ) {
2594-
return;
2650+
if ( qunit ) {
2651+
qunit.innerHTML =
2652+
"<h1 id='qunit-header'>" + escapeText( document.title ) + "</h1>" +
2653+
"<h2 id='qunit-banner'></h2>" +
2654+
"<div id='qunit-testrunner-toolbar'></div>" +
2655+
"<h2 id='qunit-userAgent'></h2>" +
2656+
"<ol id='qunit-tests'></ol>";
25952657
}
25962658

2597-
qunit.innerHTML =
2598-
"<h1 id='qunit-header'>" + escapeText( document.title ) + "</h1>" +
2599-
"<h2 id='qunit-banner'></h2>" +
2600-
"<div id='qunit-testrunner-toolbar'></div>" +
2601-
"<h2 id='qunit-userAgent'></h2>" +
2602-
"<ol id='qunit-tests'></ol>";
2603-
2659+
appendHeader();
26042660
appendBanner();
26052661
appendTestResults();
26062662
appendUserAgent();
26072663
appendToolbar();
26082664
appendTestsList( details.modules );
26092665
toolbarModuleFilter();
26102666

2611-
if ( config.hidepassed ) {
2667+
if ( qunit && config.hidepassed ) {
26122668
addClass( qunit.lastChild, "hidepass" );
26132669
}
26142670
});
@@ -2788,7 +2844,7 @@ QUnit.testDone(function( details ) {
27882844
details.assertions.length + ")</b>";
27892845

27902846
if ( details.skipped ) {
2791-
addClass( testItem, "skipped" );
2847+
testItem.className = "skipped";
27922848
skipped = document.createElement( "em" );
27932849
skipped.className = "qunit-skipped-label";
27942850
skipped.innerHTML = "skipped";

0 commit comments

Comments
 (0)