Skip to content

Commit 9202eac

Browse files
committed
[fixup]: domEqual is a real assertion
1 parent 9e9bef0 commit 9202eac

File tree

7 files changed

+197
-198
lines changed

7 files changed

+197
-198
lines changed

external/qunit/qunit.js

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

1212
(function( window ) {
@@ -189,14 +189,17 @@ config.modules.push( config.currentModule );
189189
if ( urlParams.testId ) {
190190

191191
// Ensure that urlParams.testId is an array
192-
urlParams.testId = [].concat( urlParams.testId );
192+
urlParams.testId = decodeURIComponent( urlParams.testId ).split( "," );
193193
for ( i = 0; i < urlParams.testId.length; i++ ) {
194194
config.testId.push( urlParams.testId[ i ] );
195195
}
196196
}
197197

198198
// Figure out if we're running the tests from a server or not
199199
QUnit.isLocal = location.protocol === "file:";
200+
201+
// Expose the current QUnit version
202+
QUnit.version = "1.17.2-pre";
200203
}());
201204

202205
// Root QUnit object.
@@ -1123,7 +1126,7 @@ Test.prototype = {
11231126

11241127
valid: function() {
11251128
var include,
1126-
filter = config.filter,
1129+
filter = config.filter && config.filter.toLowerCase(),
11271130
module = QUnit.urlParams.module && QUnit.urlParams.module.toLowerCase(),
11281131
fullName = ( this.module.name + ": " + this.testName ).toLowerCase();
11291132

@@ -1146,7 +1149,7 @@ Test.prototype = {
11461149

11471150
include = filter.charAt( 0 ) !== "!";
11481151
if ( !include ) {
1149-
filter = filter.toLowerCase().slice( 1 );
1152+
filter = filter.slice( 1 );
11501153
}
11511154

11521155
// If the filter matches, we need to honour include
@@ -1284,109 +1287,75 @@ QUnit.assert = Assert.prototype = {
12841287
return assert.test.push.apply( assert.test, arguments );
12851288
},
12861289

1287-
/**
1288-
* Asserts rough true-ish result.
1289-
* @name ok
1290-
* @function
1291-
* @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
1292-
*/
12931290
ok: function( result, message ) {
12941291
message = message || ( result ? "okay" : "failed, expected argument to be truthy, was: " +
12951292
QUnit.dump.parse( result ) );
12961293
this.push( !!result, result, true, message );
12971294
},
12981295

1299-
/**
1300-
* Assert that the first two arguments are equal, with an optional message.
1301-
* Prints out both actual and expected values.
1302-
* @name equal
1303-
* @function
1304-
* @example equal( format( "{0} bytes.", 2), "2 bytes.", "replaces {0} with next argument" );
1305-
*/
1296+
notOk: function( result, message ) {
1297+
message = message || ( !result ? "okay" : "failed, expected argument to be falsy, was: " +
1298+
QUnit.dump.parse( result ) );
1299+
this.push( !result, result, false, message );
1300+
},
1301+
13061302
equal: function( actual, expected, message ) {
13071303
/*jshint eqeqeq:false */
13081304
this.push( expected == actual, actual, expected, message );
13091305
},
13101306

1311-
/**
1312-
* @name notEqual
1313-
* @function
1314-
*/
13151307
notEqual: function( actual, expected, message ) {
13161308
/*jshint eqeqeq:false */
13171309
this.push( expected != actual, actual, expected, message );
13181310
},
13191311

1320-
/**
1321-
* @name propEqual
1322-
* @function
1323-
*/
13241312
propEqual: function( actual, expected, message ) {
13251313
actual = objectValues( actual );
13261314
expected = objectValues( expected );
13271315
this.push( QUnit.equiv( actual, expected ), actual, expected, message );
13281316
},
13291317

1330-
/**
1331-
* @name notPropEqual
1332-
* @function
1333-
*/
13341318
notPropEqual: function( actual, expected, message ) {
13351319
actual = objectValues( actual );
13361320
expected = objectValues( expected );
13371321
this.push( !QUnit.equiv( actual, expected ), actual, expected, message );
13381322
},
13391323

1340-
/**
1341-
* @name deepEqual
1342-
* @function
1343-
*/
13441324
deepEqual: function( actual, expected, message ) {
13451325
this.push( QUnit.equiv( actual, expected ), actual, expected, message );
13461326
},
13471327

1348-
/**
1349-
* @name notDeepEqual
1350-
* @function
1351-
*/
13521328
notDeepEqual: function( actual, expected, message ) {
13531329
this.push( !QUnit.equiv( actual, expected ), actual, expected, message );
13541330
},
13551331

1356-
/**
1357-
* @name strictEqual
1358-
* @function
1359-
*/
13601332
strictEqual: function( actual, expected, message ) {
13611333
this.push( expected === actual, actual, expected, message );
13621334
},
13631335

1364-
/**
1365-
* @name notStrictEqual
1366-
* @function
1367-
*/
13681336
notStrictEqual: function( actual, expected, message ) {
13691337
this.push( expected !== actual, actual, expected, message );
13701338
},
13711339

13721340
"throws": function( block, expected, message ) {
13731341
var actual, expectedType,
13741342
expectedOutput = expected,
1375-
ok = false;
1343+
ok = false,
1344+
currentTest = ( this instanceof Assert && this.test ) || QUnit.config.current;
13761345

13771346
// 'expected' is optional unless doing string comparison
13781347
if ( message == null && typeof expected === "string" ) {
13791348
message = expected;
13801349
expected = null;
13811350
}
13821351

1383-
this.test.ignoreGlobalErrors = true;
1352+
currentTest.ignoreGlobalErrors = true;
13841353
try {
1385-
block.call( this.test.testEnvironment );
1354+
block.call( currentTest.testEnvironment );
13861355
} catch (e) {
13871356
actual = e;
13881357
}
1389-
this.test.ignoreGlobalErrors = false;
1358+
currentTest.ignoreGlobalErrors = false;
13901359

13911360
if ( actual ) {
13921361
expectedType = QUnit.objectType( expected );
@@ -1419,11 +1388,9 @@ QUnit.assert = Assert.prototype = {
14191388
expectedOutput = null;
14201389
ok = true;
14211390
}
1422-
1423-
this.push( ok, actual, expectedOutput, message );
1424-
} else {
1425-
this.test.pushFailure( message, null, "No exception was thrown." );
14261391
}
1392+
1393+
currentTest.assert.push( ok, actual, expectedOutput, message );
14271394
}
14281395
};
14291396

@@ -1830,7 +1797,7 @@ QUnit.dump = (function() {
18301797
nonEnumerableProperties = [ "message", "name" ];
18311798
for ( i in nonEnumerableProperties ) {
18321799
key = nonEnumerableProperties[ i ];
1833-
if ( key in map && !( key in keys ) ) {
1800+
if ( key in map && inArray( key, keys ) < 0 ) {
18341801
keys.push( key );
18351802
}
18361803
}
@@ -1949,6 +1916,7 @@ if ( typeof window !== "undefined" ) {
19491916
"start",
19501917
"stop",
19511918
"ok",
1919+
"notOk",
19521920
"equal",
19531921
"notEqual",
19541922
"propEqual",
@@ -1981,6 +1949,13 @@ if ( typeof exports !== "undefined" && exports ) {
19811949
exports.QUnit = QUnit;
19821950
}
19831951

1952+
if ( typeof define === "function" && define.amd ) {
1953+
define( [], function() {
1954+
return QUnit;
1955+
} );
1956+
QUnit.config.autostart = false;
1957+
}
1958+
19841959
// Get a reference to the global object, like window in browsers
19851960
}( (function() {
19861961
return this;
@@ -2256,7 +2231,14 @@ function addEvent( elem, type, fn ) {
22562231
} else if ( elem.attachEvent ) {
22572232

22582233
// support: IE <9
2259-
elem.attachEvent( "on" + type, fn );
2234+
elem.attachEvent( "on" + type, function() {
2235+
var event = window.event;
2236+
if ( !event.target ) {
2237+
event.target = event.srcElement || document;
2238+
}
2239+
2240+
fn.call( elem, event );
2241+
});
22602242
}
22612243
}
22622244

@@ -2427,12 +2409,16 @@ function setUrl( params ) {
24272409
}
24282410

24292411
function applyUrlParams() {
2430-
var selectBox = id( "qunit-modulefilter" ),
2431-
selection = decodeURIComponent( selectBox.options[ selectBox.selectedIndex ].value ),
2412+
var selectedModule,
2413+
modulesList = id( "qunit-modulefilter" ),
24322414
filter = id( "qunit-filter-input" ).value;
24332415

2416+
selectedModule = modulesList ?
2417+
decodeURIComponent( modulesList.options[ modulesList.selectedIndex ].value ) :
2418+
undefined;
2419+
24342420
window.location = setUrl({
2435-
module: ( selection === "" ) ? undefined : selection,
2421+
module: ( selectedModule === "" ) ? undefined : selectedModule,
24362422
filter: ( filter === "" ) ? undefined : filter,
24372423

24382424
// Remove testId filter
@@ -2588,9 +2574,14 @@ function storeFixture() {
25882574

25892575
function appendUserAgent() {
25902576
var userAgent = id( "qunit-userAgent" );
2577+
25912578
if ( userAgent ) {
25922579
userAgent.innerHTML = "";
2593-
userAgent.appendChild( document.createTextNode( navigator.userAgent ) );
2580+
userAgent.appendChild(
2581+
document.createTextNode(
2582+
"QUnit " + QUnit.version + "; " + navigator.userAgent
2583+
)
2584+
);
25942585
}
25952586
}
25962587

@@ -2733,7 +2724,7 @@ function getNameHtml( name, module ) {
27332724
}
27342725

27352726
QUnit.testStart(function( details ) {
2736-
var running, testBlock;
2727+
var running, testBlock, bad;
27372728

27382729
testBlock = id( "qunit-test-output-" + details.testId );
27392730
if ( testBlock ) {
@@ -2746,7 +2737,13 @@ QUnit.testStart(function( details ) {
27462737

27472738
running = id( "qunit-testresult" );
27482739
if ( running ) {
2749-
running.innerHTML = "Running: <br />" + getNameHtml( details.name, details.module );
2740+
bad = QUnit.config.reorder && defined.sessionStorage &&
2741+
+sessionStorage.getItem( "qunit-test-" + details.module + "-" + details.name );
2742+
2743+
running.innerHTML = ( bad ?
2744+
"Rerunning previously failed test: <br />" :
2745+
"Running: <br />" ) +
2746+
getNameHtml( details.name, details.module );
27502747
}
27512748

27522749
});
@@ -2865,10 +2862,6 @@ QUnit.testDone(function( details ) {
28652862

28662863
if ( defined.document ) {
28672864
if ( document.readyState === "complete" ) {
2868-
if ( window.define && window.define.amd ) {
2869-
QUnit.config.autostart = false;
2870-
}
2871-
28722865
QUnit.load();
28732866
} else {
28742867
addEvent( window, "load", QUnit.load );

tests/unit/testsuite-require.js renamed to tests/lib/bootstrap.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ window.requirejs = {
66
"jquery": jqueryUrl(),
77
"jquery.simulate": "../../../external/jquery-simulate/jquery.simulate",
88
"jshint": "../../../external/jshint/jshint",
9-
"qunit": "../qunit",
109
"qunit-assert-classes": "../../../external/qunit-assert-classes/qunit-assert-classes",
11-
"qunit-core": "../../../external/qunit/qunit",
10+
"qunit": "../../../external/qunit/qunit",
1211
"ui": "../../../ui"
1312
},
1413
shim: {
1514
"jquery.simulate": [ "jquery" ],
16-
"qunit-assert-classes": [ "qunit-core" ]
15+
"qunit-assert-classes": [ "qunit" ]
1716
}
1817
};
1918

@@ -38,11 +37,13 @@ function requireModules( dependencies, callback, modules ) {
3837

3938
window.requireTests = function( dependencies, callback ) {
4039
dependencies = [
41-
"qunit",
42-
"jquery"
40+
"../../lib/qunit",
41+
"jquery",
42+
"qunit-assert-classes",
43+
"../../lib/qunit-assert-domequal"
4344
].concat( dependencies );
4445

45-
requireModules( dependencies, function() {
46+
requireModules( dependencies, function( QUnit ) {
4647
swarmInject();
4748
QUnit.start();
4849
} );
@@ -67,10 +68,10 @@ function jqueryUrl() {
6768
var version = parseUrl().jquery;
6869
var url;
6970

70-
if ( version === "git" ) {
71-
url = "http://code.jquery.com/jquery-git.js";
71+
if ( version === "git" || version === "git1" ) {
72+
url = "http://code.jquery.com/jquery-" + version + ".js";
7273
} else {
73-
url = "../../../external/jquery-" + ( version || "1.10.2" ) + "/jquery";
74+
url = "../../../external/jquery-" + ( version || "1.11.2" ) + "/jquery";
7475
}
7576

7677
return url;

0 commit comments

Comments
 (0)