diff --git a/test/vendor/qunit/qunit.css b/test/vendor/qunit/qunit.css
index a6a831c..c85f36a 100644
--- a/test/vendor/qunit/qunit.css
+++ b/test/vendor/qunit/qunit.css
@@ -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 */
#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; }
@@ -27,7 +37,7 @@
font-size: 1.5em;
line-height: 1em;
font-weight: normal;
-
+
border-radius: 15px 15px 0 0;
-moz-border-radius: 15px 15px 0 0;
-webkit-border-top-right-radius: 15px;
@@ -74,20 +84,34 @@
list-style-position: inside;
}
+#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
+ display: none;
+}
+
#qunit-tests li strong {
cursor: pointer;
}
+#qunit-tests li a {
+ padding: 0.5em;
+ color: #c2ccd1;
+ text-decoration: none;
+}
+#qunit-tests li a:hover,
+#qunit-tests li a:focus {
+ color: #000;
+}
+
#qunit-tests ol {
margin-top: 0.5em;
padding: 0.5em;
-
+
background-color: #fff;
-
+
border-radius: 15px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
-
+
box-shadow: inset 0px 2px 13px #999;
-moz-box-shadow: inset 0px 2px 13px #999;
-webkit-box-shadow: inset 0px 2px 13px #999;
@@ -150,7 +174,7 @@
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
#qunit-tests .pass .test-name { color: #366097; }
-
+
#qunit-tests .pass .test-actual,
#qunit-tests .pass .test-expected { color: #999999; }
@@ -162,6 +186,14 @@
color: #710909;
background-color: #fff;
border-left: 26px solid #EE5757;
+ white-space: pre;
+}
+
+#qunit-tests > li:last-child {
+ border-radius: 0 0 15px 15px;
+ -moz-border-radius: 0 0 15px 15px;
+ -webkit-border-bottom-right-radius: 15px;
+ -webkit-border-bottom-left-radius: 15px;
}
#qunit-tests .fail { color: #000000; background-color: #EE5757; }
@@ -174,7 +206,7 @@
#qunit-banner.qunit-fail { background-color: #EE5757; }
-/** Footer */
+/** Result */
#qunit-testresult {
padding: 0.5em 0.5em 0.5em 2.5em;
@@ -182,10 +214,7 @@
color: #2b81af;
background-color: #D2E0E6;
- border-radius: 0 0 15px 15px;
- -moz-border-radius: 0 0 15px 15px;
- -webkit-border-bottom-right-radius: 15px;
- -webkit-border-bottom-left-radius: 15px;
+ border-bottom: 1px solid white;
}
/** Fixture */
diff --git a/test/vendor/qunit/qunit.js b/test/vendor/qunit/qunit.js
index 30e0395..09eb1a5 100644
--- a/test/vendor/qunit/qunit.js
+++ b/test/vendor/qunit/qunit.js
@@ -1,6 +1,6 @@
-/*
+/**
* QUnit - A JavaScript Unit Testing Framework
- *
+ *
* http://docs.jquery.com/QUnit
*
* Copyright (c) 2011 John Resig, Jörn Zaefferer
@@ -15,11 +15,11 @@ var defined = {
sessionStorage: (function() {
try {
return !!sessionStorage.getItem;
- } catch(e){
+ } catch(e) {
return false;
}
- })()
-}
+ })()
+};
var testId = 0;
@@ -40,6 +40,7 @@ Test.prototype = {
b.innerHTML = "Running " + this.name;
var li = document.createElement("li");
li.appendChild( b );
+ li.className = "running";
li.id = this.id = "test-output" + testId++;
tests.appendChild( li );
}
@@ -47,7 +48,7 @@ Test.prototype = {
setup: function() {
if (this.module != config.previousModule) {
if ( config.previousModule ) {
- QUnit.moduleDone( {
+ runLoggingCallbacks('moduleDone', QUnit, {
name: config.previousModule,
failed: config.moduleStats.bad,
passed: config.moduleStats.all - config.moduleStats.bad,
@@ -56,7 +57,7 @@ Test.prototype = {
}
config.previousModule = this.module;
config.moduleStats = { all: 0, bad: 0 };
- QUnit.moduleStart( {
+ runLoggingCallbacks( 'moduleStart', QUnit, {
name: this.module
} );
}
@@ -70,14 +71,14 @@ Test.prototype = {
extend(this.testEnvironment, this.testEnvironmentArg);
}
- QUnit.testStart( {
+ runLoggingCallbacks( 'testStart', QUnit, {
name: this.testName
} );
// allow utility functions to access the current test environment
// TODO why??
QUnit.current_testEnvironment = this.testEnvironment;
-
+
try {
if ( !config.pollution ) {
saveGlobal();
@@ -113,8 +114,8 @@ Test.prototype = {
},
teardown: function() {
try {
- checkPollution();
this.testEnvironment.teardown.call(this.testEnvironment);
+ checkPollution();
} catch(e) {
QUnit.ok( false, "Teardown failed on " + this.testName + ": " + e.message );
}
@@ -123,7 +124,7 @@ Test.prototype = {
if ( this.expected && this.expected != this.assertions.length ) {
QUnit.ok( false, "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" );
}
-
+
var good = 0, bad = 0,
tests = id("qunit-tests");
@@ -131,7 +132,7 @@ Test.prototype = {
config.moduleStats.all += this.assertions.length;
if ( tests ) {
- var ol = document.createElement("ol");
+ var ol = document.createElement("ol");
for ( var i = 0; i < this.assertions.length; i++ ) {
var assertion = this.assertions[i];
@@ -151,7 +152,13 @@ Test.prototype = {
}
// store result when possible
- defined.sessionStorage && sessionStorage.setItem("qunit-" + this.testName, bad);
+ if ( QUnit.config.reorder && defined.sessionStorage ) {
+ if (bad) {
+ sessionStorage.setItem("qunit-" + this.module + "-" + this.testName, bad);
+ } else {
+ sessionStorage.removeItem("qunit-" + this.module + "-" + this.testName);
+ }
+ }
if (bad == 0) {
ol.style.display = "none";
@@ -159,27 +166,32 @@ Test.prototype = {
var b = document.createElement("strong");
b.innerHTML = this.name + " (" + bad + ", " + good + ", " + this.assertions.length + ")";
-
+
+ var a = document.createElement("a");
+ a.innerHTML = "Rerun";
+ a.href = QUnit.url({ filter: getText([b]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") });
+
addEvent(b, "click", function() {
- var next = b.nextSibling, display = next.style.display;
+ var next = b.nextSibling.nextSibling,
+ display = next.style.display;
next.style.display = display === "none" ? "block" : "none";
});
-
+
addEvent(b, "dblclick", function(e) {
var target = e && e.target ? e.target : window.event.srcElement;
if ( target.nodeName.toLowerCase() == "span" || target.nodeName.toLowerCase() == "b" ) {
target = target.parentNode;
}
if ( window.location && target.nodeName.toLowerCase() === "strong" ) {
- window.location.search = "?" + encodeURIComponent(getText([target]).replace(/\(.+\)$/, "").replace(/(^\s*|\s*$)/g, ""));
+ window.location = QUnit.url({ filter: getText([target]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") });
}
});
var li = id(this.id);
li.className = bad ? "fail" : "pass";
- li.style.display = resultDisplayStyle(!bad);
li.removeChild( li.firstChild );
li.appendChild( b );
+ li.appendChild( a );
li.appendChild( ol );
} else {
@@ -198,14 +210,14 @@ Test.prototype = {
fail("reset() failed, following Test " + this.testName + ", exception and reset fn follows", e, QUnit.reset);
}
- QUnit.testDone( {
+ runLoggingCallbacks( 'testDone', QUnit, {
name: this.testName,
failed: bad,
passed: this.assertions.length - bad,
total: this.assertions.length
} );
},
-
+
queue: function() {
var test = this;
synchronize(function() {
@@ -227,15 +239,15 @@ Test.prototype = {
});
}
// defer when previous test run passed, if storage is available
- var bad = defined.sessionStorage && +sessionStorage.getItem("qunit-" + this.testName);
+ var bad = QUnit.config.reorder && defined.sessionStorage && +sessionStorage.getItem("qunit-" + this.module + "-" + this.testName);
if (bad) {
run();
} else {
synchronize(run);
};
}
-
-}
+
+};
var QUnit = {
@@ -253,7 +265,7 @@ var QUnit = {
QUnit.test(testName, expected, callback, true);
},
-
+
test: function(testName, expected, callback, async) {
var name = '' + testName + '', testEnvironmentArg;
@@ -263,7 +275,7 @@ var QUnit = {
}
// is 2nd argument a testEnvironment?
if ( expected && typeof expected === 'object') {
- testEnvironmentArg = expected;
+ testEnvironmentArg = expected;
expected = null;
}
@@ -274,13 +286,13 @@ var QUnit = {
if ( !validTest(config.currentModule + ": " + testName) ) {
return;
}
-
+
var test = new Test(name, testName, expected, testEnvironmentArg, async, callback);
test.module = config.currentModule;
test.moduleTestEnvironment = config.currentModuleTestEnviroment;
test.queue();
},
-
+
/**
* Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
*/
@@ -299,7 +311,7 @@ var QUnit = {
message: msg
};
msg = escapeHtml(msg);
- QUnit.log(details);
+ runLoggingCallbacks( 'log', QUnit, details );
config.current.assertions.push({
result: a,
message: msg
@@ -325,7 +337,7 @@ var QUnit = {
notEqual: function(actual, expected, message) {
QUnit.push(expected != actual, actual, expected, message);
},
-
+
deepEqual: function(actual, expected, message) {
QUnit.push(QUnit.equiv(actual, expected), actual, expected, message);
},
@@ -344,34 +356,34 @@ var QUnit = {
raises: function(block, expected, message) {
var actual, ok = false;
-
+
if (typeof expected === 'string') {
message = expected;
expected = null;
}
-
+
try {
block();
} catch (e) {
actual = e;
}
-
+
if (actual) {
// we don't want to validate thrown error
if (!expected) {
ok = true;
- // expected is a regexp
+ // expected is a regexp
} else if (QUnit.objectType(expected) === "regexp") {
ok = expected.test(actual);
- // expected is a constructor
+ // expected is a constructor
} else if (actual instanceof expected) {
ok = true;
- // expected is a validation function which returns true is validation passed
+ // expected is a validation function which returns true is validation passed
} else if (expected.call({}, actual) === true) {
ok = true;
}
}
-
+
QUnit.ok(ok, message);
},
@@ -388,6 +400,9 @@ var QUnit = {
// A slight delay, to avoid any current callbacks
if ( defined.setTimeout ) {
window.setTimeout(function() {
+ if (config.semaphore > 0) {
+ return;
+ }
if ( config.timeout ) {
clearTimeout(config.timeout);
}
@@ -400,7 +415,7 @@ var QUnit = {
process();
}
},
-
+
stop: function(timeout) {
config.semaphore++;
config.blocking = true;
@@ -413,9 +428,17 @@ var QUnit = {
}, timeout);
}
}
-
};
+//We want access to the constructor's prototype
+(function() {
+ function F(){};
+ F.prototype = QUnit;
+ QUnit = new F();
+ //Make F QUnit's constructor so that we can add to the prototype later
+ QUnit.constructor = F;
+})();
+
// Backwards compatibility, deprecated
QUnit.equals = QUnit.equal;
QUnit.same = QUnit.deepEqual;
@@ -426,33 +449,52 @@ var config = {
queue: [],
// block until document ready
- blocking: true
+ 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,
+
+ // by default, modify document.title when suite is done
+ altertitle: true,
+
+ urlConfig: ['noglobals', 'notrycatch'],
+
+ //logging callback queues
+ begin: [],
+ done: [],
+ log: [],
+ testStart: [],
+ testDone: [],
+ moduleStart: [],
+ moduleDone: []
};
// Load paramaters
(function() {
var location = window.location || { search: "", protocol: "file:" },
- GETParams = location.search.slice(1).split('&');
-
- for ( var i = 0; i < GETParams.length; i++ ) {
- GETParams[i] = decodeURIComponent( GETParams[i] );
- if ( GETParams[i] === "noglobals" ) {
- GETParams.splice( i, 1 );
- i--;
- config.noglobals = true;
- } else if ( GETParams[i] === "notrycatch" ) {
- GETParams.splice( i, 1 );
- i--;
- config.notrycatch = true;
- } else if ( GETParams[i].search('=') > -1 ) {
- GETParams.splice( i, 1 );
- i--;
+ params = location.search.slice( 1 ).split( "&" ),
+ length = params.length,
+ urlParams = {},
+ current;
+
+ if ( params[ 0 ] ) {
+ for ( var i = 0; i < length; i++ ) {
+ current = params[ i ].split( "=" );
+ current[ 0 ] = decodeURIComponent( current[ 0 ] );
+ // allow just a key to turn on a flag, e.g., test.html?noglobals
+ current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true;
+ urlParams[ current[ 0 ] ] = current[ 1 ];
}
}
-
- // restrict modules/tests by get parameters
- config.filters = GETParams;
-
+
+ QUnit.urlParams = urlParams;
+ config.filter = urlParams.filter;
+
// Figure out if we're running the tests from a server or not
QUnit.isLocal = !!(location.protocol === 'file:');
})();
@@ -481,14 +523,14 @@ extend(QUnit, {
blocking: false,
autostart: true,
autorun: false,
- filters: [],
+ filter: "",
queue: [],
semaphore: 0
});
- var tests = id("qunit-tests"),
- banner = id("qunit-banner"),
- result = id("qunit-testresult");
+ var tests = id( "qunit-tests" ),
+ banner = id( "qunit-banner" ),
+ result = id( "qunit-testresult" );
if ( tests ) {
tests.innerHTML = "";
@@ -501,24 +543,32 @@ extend(QUnit, {
if ( result ) {
result.parentNode.removeChild( result );
}
+
+ if ( tests ) {
+ result = document.createElement( "p" );
+ result.id = "qunit-testresult";
+ result.className = "result";
+ tests.parentNode.insertBefore( result, tests );
+ result.innerHTML = 'Running...
';
+ }
},
-
+
/**
* Resets the test setup. Useful for tests that modify the DOM.
- *
+ *
* If jQuery is available, uses jQuery's html(), otherwise just innerHTML.
*/
reset: function() {
if ( window.jQuery ) {
- jQuery( "#main, #qunit-fixture" ).html( config.fixture );
+ jQuery( "#qunit-fixture" ).html( config.fixture );
} else {
- var main = id( 'main' ) || id( 'qunit-fixture' );
+ var main = id( 'qunit-fixture' );
if ( main ) {
main.innerHTML = config.fixture;
}
}
},
-
+
/**
* Trigger an event on an element.
*
@@ -538,12 +588,12 @@ extend(QUnit, {
elem.fireEvent("on"+type);
}
},
-
+
// Safe object type checking
is: function( type, obj ) {
return QUnit.objectType( obj ) == type;
},
-
+
objectType: function( obj ) {
if (typeof obj === "undefined") {
return "undefined";
@@ -577,7 +627,7 @@ extend(QUnit, {
}
return undefined;
},
-
+
push: function(result, actual, expected, message) {
var details = {
result: result,
@@ -585,7 +635,7 @@ extend(QUnit, {
actual: actual,
expected: expected
};
-
+
message = escapeHtml(message) || (result ? "okay" : "failed");
message = ' ";
expected = escapeHtml(QUnit.jsDump.parse(expected));
@@ -599,43 +649,63 @@ extend(QUnit, {
var source = sourceFromStacktrace();
if (source) {
details.source = source;
- output += '
' + source +'
' + escapeHtml(source) + '