mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Add _.isEqual test for arguments objects and tweak phantom detection.
This commit is contained in:
39
test/test.js
39
test/test.js
@@ -81,8 +81,8 @@
|
|||||||
/** Detect if testing `npm` modules */
|
/** Detect if testing `npm` modules */
|
||||||
var isNpm = isModularize && /\bnpm\b/.test([ui.buildPath, ui.urlParams.build]);
|
var isNpm = isModularize && /\bnpm\b/.test([ui.buildPath, ui.urlParams.build]);
|
||||||
|
|
||||||
/** Detects if running in a PhantomJS web page */
|
/** Detects if running in PhantomJS */
|
||||||
var isPhantomPage = typeof callPhantom == 'function';
|
var isPhantom = phantom || typeof callPhantom == 'function';
|
||||||
|
|
||||||
/** Detect if running in Rhino */
|
/** Detect if running in Rhino */
|
||||||
var isRhino = isJava && typeof global == 'function' && global().Array === root.Array;
|
var isRhino = isJava && typeof global == 'function' && global().Array === root.Array;
|
||||||
@@ -1932,7 +1932,7 @@
|
|||||||
|
|
||||||
test('should support a `maxWait` option', 2, function() {
|
test('should support a `maxWait` option', 2, function() {
|
||||||
if (!(isRhino && isModularize)) {
|
if (!(isRhino && isModularize)) {
|
||||||
var limit = (argv || isPhantomPage) ? 1000 : 256,
|
var limit = (argv || isPhantom) ? 1000 : 256,
|
||||||
withCount = 0,
|
withCount = 0,
|
||||||
withoutCount = 0;
|
withoutCount = 0;
|
||||||
|
|
||||||
@@ -3974,11 +3974,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should work with `arguments` objects (test in IE < 9)', 1, function() {
|
test('should work with `arguments` objects (test in IE < 9)', 1, function() {
|
||||||
if (!isPhantomPage) {
|
strictEqual(_.isEmpty(args), false);
|
||||||
strictEqual(_.isEmpty(args), false);
|
|
||||||
} else {
|
|
||||||
skipTest();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should work with jQuery/MooTools DOM query collections', 1, function() {
|
test('should work with jQuery/MooTools DOM query collections', 1, function() {
|
||||||
@@ -4260,7 +4256,7 @@
|
|||||||
|
|
||||||
strictEqual(_.isEqual(args1, args2), true);
|
strictEqual(_.isEqual(args1, args2), true);
|
||||||
|
|
||||||
if (!isPhantomPage) {
|
if (!isPhantom) {
|
||||||
strictEqual(_.isEqual(args1, args3), false);
|
strictEqual(_.isEqual(args1, args3), false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -4268,6 +4264,23 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should treat `arguments` objects like `Object` objects', 2, function() {
|
||||||
|
var args = (function() { return arguments; }(1, 2, 3)),
|
||||||
|
object = { '0': 1, '1': 2, '2': 3, 'length': 3 };
|
||||||
|
|
||||||
|
function Foo() {}
|
||||||
|
Foo.prototype = object;
|
||||||
|
|
||||||
|
strictEqual(_.isEqual(args, object), true);
|
||||||
|
|
||||||
|
if (!isPhantom) {
|
||||||
|
strictEqual(_.isEqual(args, new Foo), false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
skipTest();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', 1, function() {
|
test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', 1, function() {
|
||||||
strictEqual(_.isEqual(shadowedObject, {}), false);
|
strictEqual(_.isEqual(shadowedObject, {}), false);
|
||||||
});
|
});
|
||||||
@@ -5081,7 +5094,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should work with `arguments` objects (test in IE < 9)', 1, function() {
|
test('should work with `arguments` objects (test in IE < 9)', 1, function() {
|
||||||
if (!isPhantomPage) {
|
if (!isPhantom) {
|
||||||
deepEqual(_.keys(args), ['0', '1', '2']);
|
deepEqual(_.keys(args), ['0', '1', '2']);
|
||||||
} else {
|
} else {
|
||||||
skipTest();
|
skipTest();
|
||||||
@@ -7438,11 +7451,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should work with `arguments` objects (test in IE < 9)', 1, function() {
|
test('should work with `arguments` objects (test in IE < 9)', 1, function() {
|
||||||
if (!isPhantomPage) {
|
equal(_.size(args), 3);
|
||||||
equal(_.size(args), 3);
|
|
||||||
} else {
|
|
||||||
skipTest();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should work with jQuery/MooTools DOM query collections', 1, function() {
|
test('should work with jQuery/MooTools DOM query collections', 1, function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user