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