Update QUnit

This commit is contained in:
Jörn Zaefferer 2011-05-11 21:34:57 +02:00
parent caca915888
commit 3eda502555
2 changed files with 24 additions and 11 deletions

12
external/qunit.css vendored
View File

@ -1,7 +1,17 @@
/**
* QUnit - A JavaScript Unit Testing Framework
*
* http://docs.jquery.com/QUnit
*
* Copyright (c) 2011 John Resig, Jörn Zaefferer
* Dual licensed under the MIT (MIT-LICENSE.txt)
* or GPL (GPL-LICENSE.txt) licenses.
*/
/** Font Family and Sizes */ /** Font Family and Sizes */
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult { #qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial; font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
} }
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; } #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }

23
external/qunit.js vendored
View File

@ -1,4 +1,4 @@
/* /**
* QUnit - A JavaScript Unit Testing Framework * QUnit - A JavaScript Unit Testing Framework
* *
* http://docs.jquery.com/QUnit * http://docs.jquery.com/QUnit
@ -154,9 +154,9 @@ Test.prototype = {
// store result when possible // store result when possible
if ( QUnit.config.reorder && defined.sessionStorage ) { if ( QUnit.config.reorder && defined.sessionStorage ) {
if (bad) { if (bad) {
sessionStorage.setItem("qunit-" + this.module + "-" + this.testName, bad) sessionStorage.setItem("qunit-" + this.module + "-" + this.testName, bad);
} else { } else {
sessionStorage.removeItem("qunit-" + this.testName); sessionStorage.removeItem("qunit-" + this.module + "-" + this.testName);
} }
} }
@ -536,9 +536,9 @@ extend(QUnit, {
*/ */
reset: function() { reset: function() {
if ( window.jQuery ) { if ( window.jQuery ) {
jQuery( "#main, #qunit-fixture" ).html( config.fixture ); jQuery( "#qunit-fixture" ).html( config.fixture );
} else { } else {
var main = id( 'main' ) || id( 'qunit-fixture' ); var main = id( 'qunit-fixture' );
if ( main ) { if ( main ) {
main.innerHTML = config.fixture; main.innerHTML = config.fixture;
} }
@ -730,7 +730,7 @@ addEvent(window, "load", function() {
toolbar.appendChild( label ); toolbar.appendChild( label );
} }
var main = id('main') || id('qunit-fixture'); var main = id('qunit-fixture');
if ( main ) { if ( main ) {
config.fixture = main.innerHTML; config.fixture = main.innerHTML;
} }
@ -778,6 +778,11 @@ function done() {
id( "qunit-testresult" ).innerHTML = html; id( "qunit-testresult" ).innerHTML = html;
} }
if ( typeof document !== "undefined" && document.title ) {
// TODO what are the unicode codes for these? as-is fails if qunit.js isn't served with the right mimetype/charset
document.title = (config.stats.bad ? "✖" : "✔") + " " + document.title;
}
QUnit.done( { QUnit.done( {
failed: config.stats.bad, failed: config.stats.bad,
passed: passed, passed: passed,
@ -881,16 +886,14 @@ function checkPollution( name ) {
var old = config.pollution; var old = config.pollution;
saveGlobal(); saveGlobal();
var newGlobals = diff( old, config.pollution ); var newGlobals = diff( config.pollution, old );
if ( newGlobals.length > 0 ) { if ( newGlobals.length > 0 ) {
ok( false, "Introduced global variable(s): " + newGlobals.join(", ") ); ok( false, "Introduced global variable(s): " + newGlobals.join(", ") );
config.current.expected++;
} }
var deletedGlobals = diff( config.pollution, old ); var deletedGlobals = diff( old, config.pollution );
if ( deletedGlobals.length > 0 ) { if ( deletedGlobals.length > 0 ) {
ok( false, "Deleted global variable(s): " + deletedGlobals.join(", ") ); ok( false, "Deleted global variable(s): " + deletedGlobals.join(", ") );
config.current.expected++;
} }
} }