mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Cleanup unit tests.
Former-commit-id: 460ffc3bd38c98dd86fc8c74d4720eed5d50433d
This commit is contained in:
@@ -15,9 +15,9 @@
|
||||
// assign `QUnit.config` properties
|
||||
QUnit.config.lodashFilename = (function() {
|
||||
switch (build) {
|
||||
case 'prod': return 'lodash.min';
|
||||
case 'custom': return 'lodash.custom.min';
|
||||
case 'custom-debug': return 'lodash.custom';
|
||||
case 'prod': return 'lodash.min';
|
||||
}
|
||||
return 'lodash';
|
||||
}());
|
||||
@@ -52,13 +52,13 @@
|
||||
|
||||
dropdown.selectedIndex = (function() {
|
||||
switch (build) {
|
||||
case 'custom': return 3;
|
||||
case 'custom-debug': return 2;
|
||||
case 'prod': return 1;
|
||||
case 'custom': return 2;
|
||||
case 'custom-debug': return 3;
|
||||
}
|
||||
return 0;
|
||||
}());
|
||||
|
||||
|
||||
checkbox.checked = norequire;
|
||||
addEvent(checkbox, 'click', eventHandler);
|
||||
addEvent(dropdown, 'change', eventHandler);
|
||||
@@ -77,8 +77,8 @@
|
||||
'<select name="build">' +
|
||||
'<option value="dev">developement</option>' +
|
||||
'<option value="prod">production</option>' +
|
||||
'<option value="custom-debug">custom (debug)</option>' +
|
||||
'<option value="custom">custom</option>' +
|
||||
'<option value="custom-debug">custom (debug)</option>' +
|
||||
'</select>build';
|
||||
|
||||
var checkbox = label1.firstChild,
|
||||
|
||||
39
test/test.js
39
test/test.js
@@ -24,9 +24,6 @@
|
||||
/** Shortcut used to convert array-like objects to arrays */
|
||||
var slice = [].slice;
|
||||
|
||||
/** Used to resolve a value's internal [[Class]] */
|
||||
var toString = {}.toString;
|
||||
|
||||
/** Used to check problem JScript properties (a.k.a. the [[DontEnum]] bug) */
|
||||
var shadowed = {
|
||||
'constructor': 1,
|
||||
@@ -638,9 +635,9 @@
|
||||
});
|
||||
|
||||
test('should allow a falsey `object` argument', function() {
|
||||
var fn = _.size;
|
||||
var func = _.size;
|
||||
try {
|
||||
var actual = [fn(), fn(undefined), fn(null), fn(false), fn(0)];
|
||||
var actual = [func(), func(undefined), func(null), func(false), func(0)];
|
||||
} catch(e) { }
|
||||
|
||||
deepEqual(actual, [0, 0, 0, 0, 0]);
|
||||
@@ -907,15 +904,15 @@
|
||||
'zip',
|
||||
'zipObject'
|
||||
], function(methodName) {
|
||||
var fn = _[methodName],
|
||||
var func = _[methodName],
|
||||
pass = true;
|
||||
|
||||
try {
|
||||
fn();
|
||||
fn(undefined);
|
||||
fn(null);
|
||||
fn(false);
|
||||
fn(0);
|
||||
func();
|
||||
func(undefined);
|
||||
func(null);
|
||||
func(false);
|
||||
func(0);
|
||||
} catch(e) {
|
||||
pass = false;
|
||||
}
|
||||
@@ -945,23 +942,23 @@
|
||||
'some',
|
||||
'toArray'
|
||||
], function(methodName) {
|
||||
var fn = _[methodName],
|
||||
var func = _[methodName],
|
||||
identity = _.identity,
|
||||
pass = true;
|
||||
|
||||
try {
|
||||
if (/^(?:contains|toArray)$/.test(methodName)) {
|
||||
fn();
|
||||
fn(undefined);
|
||||
fn(null);
|
||||
fn(false);
|
||||
fn(0);
|
||||
func();
|
||||
func(undefined);
|
||||
func(null);
|
||||
func(false);
|
||||
func(0);
|
||||
}
|
||||
else {
|
||||
fn(undefined, identity);
|
||||
fn(null, identity);
|
||||
fn(false, identity);
|
||||
fn(0, identity);
|
||||
func(undefined, identity);
|
||||
func(null, identity);
|
||||
func(false, identity);
|
||||
func(0, identity);
|
||||
}
|
||||
} catch(e) {
|
||||
pass = false;
|
||||
|
||||
Reference in New Issue
Block a user