/*!
- * QUnit 1.16.0
+ * QUnit 1.17.1
* http://qunitjs.com/
*
- * Copyright 2006, 2014 jQuery Foundation and other contributors
+ * Copyright jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*
- * Date: 2014-12-03T16:32Z
+ * Date: 2015-01-20T19:39Z
*/
(function( window ) {
// block until document ready
blocking: true,
- // when enabled, show only failing tests
- // gets persisted through sessionStorage and can be changed in UI via checkbox
- hidepassed: false,
-
// by default, run previously failed tests first
// very useful in combination with "Hide passed tests" checked
reorder: true,
}
}
+ if ( urlParams.filter === true ) {
+ delete urlParams.filter;
+ }
+
QUnit.urlParams = urlParams;
// String search anywhere in moduleName+testName
return undefined;
},
- url: function( params ) {
- params = extend( extend( {}, QUnit.urlParams ), params );
- var key,
- querystring = "?";
-
- for ( key in params ) {
- if ( hasOwn.call( params, key ) ) {
- querystring += encodeURIComponent( key );
- if ( params[ key ] !== true ) {
- querystring += "=" + encodeURIComponent( params[ key ] );
- }
- querystring += "&";
- }
- }
- return location.protocol + "//" + location.host +
- location.pathname + querystring.slice( 0, -1 );
- },
-
extend: extend,
load: function() {
process( last );
}
var start = now();
- config.depth = config.depth ? config.depth + 1 : 1;
+ config.depth = ( config.depth || 0 ) + 1;
while ( config.queue.length && !config.blocking ) {
if ( !defined.setTimeout || config.updateRate <= 0 ||
valid: function() {
var include,
- filter = config.filter && config.filter.toLowerCase(),
+ filter = config.filter,
module = QUnit.urlParams.module && QUnit.urlParams.module.toLowerCase(),
fullName = ( this.module.name + ": " + this.testName ).toLowerCase();
include = filter.charAt( 0 ) !== "!";
if ( !include ) {
- filter = filter.slice( 1 );
+ filter = filter.toLowerCase().slice( 1 );
}
// If the filter matches, we need to honour include
}
// For nodejs
-if ( typeof module !== "undefined" && module.exports ) {
+if ( typeof module !== "undefined" && module && module.exports ) {
module.exports = QUnit;
+
+ // For consistency with CommonJS environments' exports
+ module.exports.QUnit = QUnit;
}
// For CommonJS with exports, but without module.exports, like Rhino
-if ( typeof exports !== "undefined" ) {
+if ( typeof exports !== "undefined" && exports ) {
exports.QUnit = QUnit;
}
escaped = escapeText( val.id );
escapedTooltip = escapeText( val.tooltip );
- config[ val.id ] = QUnit.urlParams[ val.id ];
+ if ( config[ val.id ] === undefined ) {
+ config[ val.id ] = QUnit.urlParams[ val.id ];
+ }
+
if ( !val.value || typeof val.value === "string" ) {
urlConfigHtml += "<input id='qunit-urlconfig-" + escaped +
"' name='" + escaped + "' type='checkbox'" +
}
params[ field.name ] = value;
- updatedUrl = QUnit.url( params );
+ updatedUrl = setUrl( params );
if ( "hidepassed" === field.name && "replaceState" in window.history ) {
config[ field.name ] = value || false;
}
}
+function setUrl( params ) {
+ var key,
+ querystring = "?";
+
+ params = QUnit.extend( QUnit.extend( {}, QUnit.urlParams ), params );
+
+ for ( key in params ) {
+ if ( hasOwn.call( params, key ) ) {
+ if ( params[ key ] === undefined ) {
+ continue;
+ }
+ querystring += encodeURIComponent( key );
+ if ( params[ key ] !== true ) {
+ querystring += "=" + encodeURIComponent( params[ key ] );
+ }
+ querystring += "&";
+ }
+ }
+ return location.protocol + "//" + location.host +
+ location.pathname + querystring.slice( 0, -1 );
+}
+
+function applyUrlParams() {
+ var selectBox = id( "qunit-modulefilter" ),
+ selection = decodeURIComponent( selectBox.options[ selectBox.selectedIndex ].value ),
+ filter = id( "qunit-filter-input" ).value;
+
+ window.location = setUrl({
+ module: ( selection === "" ) ? undefined : selection,
+ filter: ( filter === "" ) ? undefined : filter,
+
+ // Remove testId filter
+ testId: undefined
+ });
+}
+
function toolbarUrlConfigContainer() {
var urlConfigContainer = document.createElement( "span" );
urlConfigContainer.innerHTML = getUrlConfigHtml();
+ addClass( urlConfigContainer, "qunit-url-config" );
// For oldIE support:
// * Add handlers to the individual elements instead of the container
return urlConfigContainer;
}
+function toolbarLooseFilter() {
+ var filter = document.createElement( "form" ),
+ label = document.createElement( "label" ),
+ input = document.createElement( "input" ),
+ button = document.createElement( "button" );
+
+ addClass( filter, "qunit-filter" );
+
+ label.innerHTML = "Filter: ";
+
+ input.type = "text";
+ input.value = config.filter || "";
+ input.name = "filter";
+ input.id = "qunit-filter-input";
+
+ button.innerHTML = "Go";
+
+ label.appendChild( input );
+
+ filter.appendChild( label );
+ filter.appendChild( button );
+ addEvent( filter, "submit", function( ev ) {
+ applyUrlParams();
+
+ if ( ev && ev.preventDefault ) {
+ ev.preventDefault();
+ }
+
+ return false;
+ });
+
+ return filter;
+}
+
function toolbarModuleFilterHtml() {
var i,
moduleFilterHtml = "";
moduleFilter = document.createElement( "span" ),
moduleFilterHtml = toolbarModuleFilterHtml();
- if ( !moduleFilterHtml ) {
+ if ( !toolbar || !moduleFilterHtml ) {
return false;
}
moduleFilter.setAttribute( "id", "qunit-modulefilter-container" );
moduleFilter.innerHTML = moduleFilterHtml;
- addEvent( moduleFilter.lastChild, "change", function() {
- var selectBox = moduleFilter.getElementsByTagName( "select" )[ 0 ],
- selection = decodeURIComponent( selectBox.options[ selectBox.selectedIndex ].value );
-
- window.location = QUnit.url({
- module: ( selection === "" ) ? undefined : selection,
-
- // Remove any existing filters
- filter: undefined,
- testId: undefined
- });
- });
+ addEvent( moduleFilter.lastChild, "change", applyUrlParams );
toolbar.appendChild( moduleFilter );
}
if ( toolbar ) {
toolbar.appendChild( toolbarUrlConfigContainer() );
+ toolbar.appendChild( toolbarLooseFilter() );
+ }
+}
+
+function appendHeader() {
+ var header = id( "qunit-header" );
+
+ if ( header ) {
+ header.innerHTML = "<a href='" +
+ setUrl({ filter: undefined, module: undefined, testId: undefined }) +
+ "'>" + header.innerHTML + "</a> ";
}
}
if ( banner ) {
banner.className = "";
- banner.innerHTML = "<a href='" +
- QUnit.url({ filter: undefined, module: undefined, testId: undefined }) +
- "'>" + banner.innerHTML + "</a> ";
}
}
function appendUserAgent() {
var userAgent = id( "qunit-userAgent" );
if ( userAgent ) {
- userAgent.innerHTML = navigator.userAgent;
+ userAgent.innerHTML = "";
+ userAgent.appendChild( document.createTextNode( navigator.userAgent ) );
}
}
rerunTrigger = document.createElement( "a" );
rerunTrigger.innerHTML = "Rerun";
- rerunTrigger.href = QUnit.url({ testId: testId });
+ rerunTrigger.href = setUrl({ testId: testId });
testBlock = document.createElement( "li" );
testBlock.appendChild( title );
// Fixture is the only one necessary to run without the #qunit element
storeFixture();
- if ( !qunit ) {
- return;
+ if ( qunit ) {
+ qunit.innerHTML =
+ "<h1 id='qunit-header'>" + escapeText( document.title ) + "</h1>" +
+ "<h2 id='qunit-banner'></h2>" +
+ "<div id='qunit-testrunner-toolbar'></div>" +
+ "<h2 id='qunit-userAgent'></h2>" +
+ "<ol id='qunit-tests'></ol>";
}
- qunit.innerHTML =
- "<h1 id='qunit-header'>" + escapeText( document.title ) + "</h1>" +
- "<h2 id='qunit-banner'></h2>" +
- "<div id='qunit-testrunner-toolbar'></div>" +
- "<h2 id='qunit-userAgent'></h2>" +
- "<ol id='qunit-tests'></ol>";
-
+ appendHeader();
appendBanner();
appendTestResults();
appendUserAgent();
appendTestsList( details.modules );
toolbarModuleFilter();
- if ( config.hidepassed ) {
+ if ( qunit && config.hidepassed ) {
addClass( qunit.lastChild, "hidepass" );
}
});
details.assertions.length + ")</b>";
if ( details.skipped ) {
- addClass( testItem, "skipped" );
+ testItem.className = "skipped";
skipped = document.createElement( "em" );
skipped.className = "qunit-skipped-label";
skipped.innerHTML = "skipped";