Update vendor folder.

Former-commit-id: 363508c8d79afa1ec8c1aba48b5be58a8a572367
This commit is contained in:
John-David Dalton
2012-07-12 13:32:48 -04:00
parent 4293515b3d
commit 9530efb4d4
5 changed files with 157 additions and 86 deletions

View File

@@ -740,7 +740,7 @@
}); });
test('should raise an error if a template, compiled with errors, is executed', function() { test('should raise an error if a template, compiled with errors, is executed', function() {
raises(_.template('<% if x %>')); throws(_.template('<% if x %>'));
}); });
test('should work with complex "interpolate" delimiters', function() { test('should work with complex "interpolate" delimiters', function() {

View File

@@ -5,6 +5,7 @@
* Available under MIT license <http://mths.be/mit> * Available under MIT license <http://mths.be/mit>
*/ */
;(function(global) { ;(function(global) {
'use strict';
/** Add `console.log()` support for Narwhal, Rhino, and RingoJS */ /** Add `console.log()` support for Narwhal, Rhino, and RingoJS */
global.console || (global.console = { 'log': global.print }); global.console || (global.console = { 'log': global.print });
@@ -24,7 +25,8 @@
var toString = {}.toString; var toString = {}.toString;
/** Used by timer methods */ /** Used by timer methods */
var timer, var doneCalled,
timer,
counter = 0, counter = 0,
ids = {}; ids = {};
@@ -149,26 +151,26 @@
* `runtime`, and `total`. * `runtime`, and `total`.
*/ */
function done(details) { function done(details) {
// stop `asyncTest()` from erroneously calling `done()` twice in environments w/o timeouts // stop `asyncTest()` from erroneously calling `done()` twice in
if (!QUnit.doneCalled) { // environments w/o timeouts
console.log(hr); if (doneCalled) {
console.log(' PASS: ' + details.passed + ' FAIL: ' + details.failed + ' TOTAL: ' + details.total); return;
console.log(' Finished in ' + details.runtime + ' milliseconds.');
console.log(hr);
// exit out of Rhino
try {
quit();
} catch(e) { }
// exit out of Node.js
try {
process.exit();
} catch(e) { }
// prevent multiple calls to `done()`
QUnit.doneCalled = true;
} }
doneCalled = true;
console.log(hr);
console.log(' PASS: ' + details.passed + ' FAIL: ' + details.failed + ' TOTAL: ' + details.total);
console.log(' Finished in ' + details.runtime + ' milliseconds.');
console.log(hr);
// exit out of Rhino
try {
quit();
} catch(e) { }
// exit out of Node.js
try {
process.exit();
} catch(e) { }
} }
/** /**
@@ -181,12 +183,13 @@
function log(details) { function log(details) {
var expected = details.expected, var expected = details.expected,
result = details.result, result = details.result,
type = typeof expected != 'undefined' ? 'EQ' : 'OK', type = typeof expected != 'undefined' ? 'EQ' : 'OK';
assertion = [
result ? 'PASS' : 'FAIL', var assertion = [
type, result ? 'PASS' : 'FAIL',
details.message || 'ok' type,
]; details.message || 'ok'
];
if (!result && type == 'EQ') { if (!result && type == 'EQ') {
assertion.push('Expected: ' + expected + ', Actual: ' + details.actual); assertion.push('Expected: ' + expected + ', Actual: ' + details.actual);
@@ -215,7 +218,7 @@
* @returns {String} The result string. * @returns {String} The result string.
*/ */
var parseObject = (function() { var parseObject = (function() {
var _parseObject = QUnit.jsDump.parsers.object; var func = QUnit.jsDump.parsers.object;
return function(object) { return function(object) {
// fork to support Rhino's error objects // fork to support Rhino's error objects
if (typeof object.rhinoException == 'object') { if (typeof object.rhinoException == 'object') {
@@ -224,7 +227,7 @@
'", fileName: "' + object.fileName + '", fileName: "' + object.fileName +
'", lineNumber: ' + object.lineNumber + ' }'; '", lineNumber: ' + object.lineNumber + ' }';
} }
return _parseObject(object); return func(object);
}; };
}()); }());
@@ -237,16 +240,16 @@
*/ */
function testDone(details) { function testDone(details) {
var assertions = QUnit.config.testStats.assertions, var assertions = QUnit.config.testStats.assertions,
name = details.name; testName = details.name;
if (details.failed > 0) { if (details.failed > 0) {
console.log(' FAIL - '+ name); console.log(' FAIL - '+ testName);
each(assertions, function(value) { each(assertions, function(value) {
console.log(' ' + value); console.log(' ' + value);
}); });
} }
else { else {
console.log(' PASS - ' + name); console.log(' PASS - ' + testName);
} }
assertions.length = 0; assertions.length = 0;
} }
@@ -274,8 +277,11 @@
// exclude `module` because some environments have it as a built-in object // exclude `module` because some environments have it as a built-in object
each(['asyncTest', 'deepEqual', 'equal', 'equals', 'expect', 'notDeepEqual', each(['asyncTest', 'deepEqual', 'equal', 'equals', 'expect', 'notDeepEqual',
'notEqual', 'notStrictEqual', 'ok', 'raises', 'same', 'start', 'stop', 'notEqual', 'notStrictEqual', 'ok', 'raises', 'same', 'start', 'stop',
'strictEqual', 'test'], function(name) { 'strictEqual', 'test', 'throws'], function(funcName) {
global[name] = QUnit[name]; var func = QUnit[funcName];
if (func) {
global[funcName] = func;
}
}); });
// expose timer methods to global // expose timer methods to global
@@ -301,11 +307,11 @@
QUnit.moduleStart(moduleStart); QUnit.moduleStart(moduleStart);
QUnit.testDone(testDone); QUnit.testDone(testDone);
// wrap `parseObject` // add wrapped function
QUnit.jsDump.parsers.object = parseObject; QUnit.jsDump.parsers.object = parseObject;
// must call `QUnit.start()` in the test file if using QUnit < 1.3.0 with Node.js // must call `QUnit.start()` in the test file if using QUnit < 1.3.0 with
// or any version of QUnit with Narwhal, Rhino, or RingoJS // Node.js or any version of QUnit with Narwhal, Rhino, or RingoJS
QUnit.init(); QUnit.init();
}(typeof global == 'object' && global || this)); }(typeof global == 'object' && global || this));

View File

@@ -41,8 +41,9 @@ Releases
-------- --------
Install git-extras and run `git changelog` to update History.md. Install git-extras and run `git changelog` to update History.md.
Update qunit/qunit.js|css to the release version, commit and tag, update them Update qunit/qunit.js|css and package.json to the release version, commit and
again to the next version, commit and push commits and tags. tag, update them again to the next version, commit and push commits and tags
(`git push --tags origin master`).
Put the 'v' in front of the tag (unlike the 1.1.0 release). Clean up the changelog, Put the 'v' in front of the tag, e.g. `v1.8.0`. Clean up the changelog, removing merge commits
removing merge commits or whitespace cleanups. or whitespace cleanups.

View File

@@ -1,5 +1,5 @@
/** /**
* QUnit v1.8.0 - A JavaScript Unit Testing Framework * QUnit v1.9.0 - A JavaScript Unit Testing Framework
* *
* http://docs.jquery.com/QUnit * http://docs.jquery.com/QUnit
* *
@@ -38,10 +38,10 @@
line-height: 1em; line-height: 1em;
font-weight: normal; font-weight: normal;
border-radius: 15px 15px 0 0; border-radius: 5px 5px 0 0;
-moz-border-radius: 15px 15px 0 0; -moz-border-radius: 5px 5px 0 0;
-webkit-border-top-right-radius: 15px; -webkit-border-top-right-radius: 5px;
-webkit-border-top-left-radius: 15px; -webkit-border-top-left-radius: 5px;
} }
#qunit-header a { #qunit-header a {
@@ -54,9 +54,9 @@
color: #fff; color: #fff;
} }
#qunit-header label { #qunit-testrunner-toolbar label {
display: inline-block; display: inline-block;
padding-left: 0.5em; padding: 0 .5em 0 .1em;
} }
#qunit-banner { #qunit-banner {
@@ -113,13 +113,9 @@
background-color: #fff; background-color: #fff;
border-radius: 15px; border-radius: 5px;
-moz-border-radius: 15px; -moz-border-radius: 5px;
-webkit-border-radius: 15px; -webkit-border-radius: 5px;
box-shadow: inset 0px 2px 13px #999;
-moz-box-shadow: inset 0px 2px 13px #999;
-webkit-box-shadow: inset 0px 2px 13px #999;
} }
#qunit-tests table { #qunit-tests table {
@@ -162,8 +158,7 @@
#qunit-tests b.failed { color: #710909; } #qunit-tests b.failed { color: #710909; }
#qunit-tests li li { #qunit-tests li li {
margin: 0.5em; padding: 5px;
padding: 0.4em 0.5em 0.4em 0.5em;
background-color: #fff; background-color: #fff;
border-bottom: none; border-bottom: none;
list-style-position: inside; list-style-position: inside;
@@ -172,9 +167,9 @@
/*** Passing Styles */ /*** Passing Styles */
#qunit-tests li li.pass { #qunit-tests li li.pass {
color: #5E740B; color: #3c510c;
background-color: #fff; background-color: #fff;
border-left: 26px solid #C6E746; border-left: 10px solid #C6E746;
} }
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; } #qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
@@ -190,15 +185,15 @@
#qunit-tests li li.fail { #qunit-tests li li.fail {
color: #710909; color: #710909;
background-color: #fff; background-color: #fff;
border-left: 26px solid #EE5757; border-left: 10px solid #EE5757;
white-space: pre; white-space: pre;
} }
#qunit-tests > li:last-child { #qunit-tests > li:last-child {
border-radius: 0 0 15px 15px; border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 15px 15px; -moz-border-radius: 0 0 5px 5px;
-webkit-border-bottom-right-radius: 15px; -webkit-border-bottom-right-radius: 5px;
-webkit-border-bottom-left-radius: 15px; -webkit-border-bottom-left-radius: 5px;
} }
#qunit-tests .fail { color: #000000; background-color: #EE5757; } #qunit-tests .fail { color: #000000; background-color: #EE5757; }

View File

@@ -1,5 +1,5 @@
/** /**
* QUnit v1.8.0 - A JavaScript Unit Testing Framework * QUnit v1.9.0 - A JavaScript Unit Testing Framework
* *
* http://docs.jquery.com/QUnit * http://docs.jquery.com/QUnit
* *
@@ -403,6 +403,8 @@ QUnit = {
QUnit.assert = { QUnit.assert = {
/** /**
* Asserts rough true-ish result. * Asserts rough true-ish result.
* @name ok
* @function
* @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
*/ */
ok: function( result, msg ) { ok: function( result, msg ) {
@@ -437,36 +439,59 @@ QUnit.assert = {
/** /**
* Assert that the first two arguments are equal, with an optional message. * Assert that the first two arguments are equal, with an optional message.
* Prints out both actual and expected values. * Prints out both actual and expected values.
* @name equal
* @function
* @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" ); * @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" );
*/ */
equal: function( actual, expected, message ) { equal: function( actual, expected, message ) {
QUnit.push( expected == actual, actual, expected, message ); QUnit.push( expected == actual, actual, expected, message );
}, },
/**
* @name notEqual
* @function
*/
notEqual: function( actual, expected, message ) { notEqual: function( actual, expected, message ) {
QUnit.push( expected != actual, actual, expected, message ); QUnit.push( expected != actual, actual, expected, message );
}, },
/**
* @name deepEqual
* @function
*/
deepEqual: function( actual, expected, message ) { deepEqual: function( actual, expected, message ) {
QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
}, },
/**
* @name notDeepEqual
* @function
*/
notDeepEqual: function( actual, expected, message ) { notDeepEqual: function( actual, expected, message ) {
QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message );
}, },
/**
* @name strictEqual
* @function
*/
strictEqual: function( actual, expected, message ) { strictEqual: function( actual, expected, message ) {
QUnit.push( expected === actual, actual, expected, message ); QUnit.push( expected === actual, actual, expected, message );
}, },
/**
* @name notStrictEqual
* @function
*/
notStrictEqual: function( actual, expected, message ) { notStrictEqual: function( actual, expected, message ) {
QUnit.push( expected !== actual, actual, expected, message ); QUnit.push( expected !== actual, actual, expected, message );
}, },
raises: function( block, expected, message ) { throws: function( block, expected, message ) {
var actual, var actual,
ok = false; ok = false;
// 'expected' is optional
if ( typeof expected === "string" ) { if ( typeof expected === "string" ) {
message = expected; message = expected;
expected = null; expected = null;
@@ -494,18 +519,29 @@ QUnit.assert = {
} else if ( expected.call( {}, actual ) === true ) { } else if ( expected.call( {}, actual ) === true ) {
ok = true; ok = true;
} }
}
QUnit.push( ok, actual, null, message ); QUnit.push( ok, actual, null, message );
} else {
QUnit.pushFailure( message, null, 'No exception was thrown.' );
}
} }
}; };
// @deprecated: Kept assertion helpers in root for backwards compatibility /**
* @deprecate since 1.8.0
* Kept assertion helpers in root for backwards compatibility
*/
extend( QUnit, QUnit.assert ); extend( QUnit, QUnit.assert );
/** /**
* @deprecated: Kept for backwards compatibility * @deprecated since 1.9.0
* next step: remove entirely * Kept global "raises()" for backwards compatibility
*/
QUnit.raises = QUnit.assert.throws;
/**
* @deprecated since 1.0.0, replaced with error pushes since 1.3.0
* Kept to avoid TypeErrors for undefined methods.
*/ */
QUnit.equals = function() { QUnit.equals = function() {
QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" ); QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" );
@@ -549,7 +585,20 @@ config = {
// when enabled, all tests must call expect() // when enabled, all tests must call expect()
requireExpects: false, requireExpects: false,
urlConfig: [ "noglobals", "notrycatch" ], // add checkboxes that are persisted in the query-string
// when enabled, the id is set to `true` as a `QUnit.config` property
urlConfig: [
{
id: "noglobals",
label: "Check for Globals",
tooltip: "Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings."
},
{
id: "notrycatch",
label: "No try-catch",
tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings."
}
],
// logging callback queues // logging callback queues
begin: [], begin: [],
@@ -770,7 +819,7 @@ extend( QUnit, {
}); });
}, },
pushFailure: function( message, source ) { pushFailure: function( message, source, actual ) {
if ( !config.current ) { if ( !config.current ) {
throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) ); throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) );
} }
@@ -781,15 +830,23 @@ extend( QUnit, {
message: message message: message
}; };
message = escapeInnerText(message ) || "error"; message = escapeInnerText( message ) || "error";
message = "<span class='test-message'>" + message + "</span>"; message = "<span class='test-message'>" + message + "</span>";
output = message; output = message;
output += "<table>";
if ( actual ) {
output += "<tr class='test-actual'><th>Result: </th><td><pre>" + escapeInnerText( actual ) + "</pre></td></tr>";
}
if ( source ) { if ( source ) {
details.source = source; details.source = source;
output += "<table><tr class='test-source'><th>Source: </th><td><pre>" + escapeInnerText( source ) + "</pre></td></tr></table>"; output += "<tr class='test-source'><th>Source: </th><td><pre>" + escapeInnerText( source ) + "</pre></td></tr>";
} }
output += "</table>";
runLoggingCallbacks( "log", QUnit, details ); runLoggingCallbacks( "log", QUnit, details );
config.current.assertions.push({ config.current.assertions.push({
@@ -859,7 +916,7 @@ QUnit.load = function() {
runLoggingCallbacks( "begin", QUnit, {} ); runLoggingCallbacks( "begin", QUnit, {} );
// Initialize the config, saving the execution queue // Initialize the config, saving the execution queue
var banner, filter, i, label, len, main, ol, toolbar, userAgent, val, var banner, filter, i, label, len, main, ol, toolbar, userAgent, val, urlConfigCheckboxes,
urlConfigHtml = "", urlConfigHtml = "",
oldconfig = extend( {}, config ); oldconfig = extend( {}, config );
@@ -872,8 +929,15 @@ QUnit.load = function() {
for ( i = 0; i < len; i++ ) { for ( i = 0; i < len; i++ ) {
val = config.urlConfig[i]; val = config.urlConfig[i];
config[val] = QUnit.urlParams[val]; if ( typeof val === "string" ) {
urlConfigHtml += "<label><input name='" + val + "' type='checkbox'" + ( config[val] ? " checked='checked'" : "" ) + ">" + val + "</label>"; val = {
id: val,
label: val,
tooltip: "[no tooltip available]"
};
}
config[ val.id ] = QUnit.urlParams[ val.id ];
urlConfigHtml += "<input id='qunit-urlconfig-" + val.id + "' name='" + val.id + "' type='checkbox'" + ( config[ val.id ] ? " checked='checked'" : "" ) + " title='" + val.tooltip + "'><label for='qunit-urlconfig-" + val.id + "' title='" + val.tooltip + "'>" + val.label + "</label>";
} }
// `userAgent` initialized at top of scope // `userAgent` initialized at top of scope
@@ -885,12 +949,7 @@ QUnit.load = function() {
// `banner` initialized at top of scope // `banner` initialized at top of scope
banner = id( "qunit-header" ); banner = id( "qunit-header" );
if ( banner ) { if ( banner ) {
banner.innerHTML = "<a href='" + QUnit.url({ filter: undefined }) + "'>" + banner.innerHTML + "</a> " + urlConfigHtml; banner.innerHTML = "<a href='" + QUnit.url({ filter: undefined, module: undefined, testNumber: undefined }) + "'>" + banner.innerHTML + "</a> ";
addEvent( banner, "change", function( event ) {
var params = {};
params[ event.target.name ] = event.target.checked ? true : undefined;
window.location = QUnit.url( params );
});
} }
// `toolbar` initialized at top of scope // `toolbar` initialized at top of scope
@@ -931,8 +990,18 @@ QUnit.load = function() {
// `label` initialized at top of scope // `label` initialized at top of scope
label = document.createElement( "label" ); label = document.createElement( "label" );
label.setAttribute( "for", "qunit-filter-pass" ); label.setAttribute( "for", "qunit-filter-pass" );
label.setAttribute( "title", "Only show tests and assertons that fail. Stored in sessionStorage." );
label.innerHTML = "Hide passed tests"; label.innerHTML = "Hide passed tests";
toolbar.appendChild( label ); toolbar.appendChild( label );
urlConfigCheckboxes = document.createElement( 'span' );
urlConfigCheckboxes.innerHTML = urlConfigHtml;
addEvent( urlConfigCheckboxes, "change", function( event ) {
var params = {};
params[ event.target.name ] = event.target.checked ? true : undefined;
window.location = QUnit.url( params );
});
toolbar.appendChild( urlConfigCheckboxes );
} }
// `main` initialized at top of scope // `main` initialized at top of scope
@@ -1051,14 +1120,14 @@ function done() {
function validTest( test ) { function validTest( test ) {
var include, var include,
filter = config.filter && config.filter.toLowerCase(), filter = config.filter && config.filter.toLowerCase(),
module = config.module, module = config.module && config.module.toLowerCase(),
fullName = (test.module + ": " + test.testName).toLowerCase(); fullName = (test.module + ": " + test.testName).toLowerCase();
if ( config.testNumber ) { if ( config.testNumber ) {
return test.testNumber === config.testNumber; return test.testNumber === config.testNumber;
} }
if ( module && test.module !== module ) { if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) {
return false; return false;
} }