mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Add tests for cloning symbol properties.
This commit is contained in:
29
test/test.js
29
test/test.js
@@ -2361,7 +2361,23 @@
|
|||||||
assert.strictEqual(actual.lastIndex, 3);
|
assert.strictEqual(actual.lastIndex, 3);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('`_.' + methodName + '` should clone symbols', function(assert) {
|
QUnit.test('`_.' + methodName + '` should clone symbol properties', function(assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
if (Symbol) {
|
||||||
|
var values = [[], Object(false), new Date, {}, Object(0), /a/, Object('a')];
|
||||||
|
|
||||||
|
assert.ok(lodashStable.every(values, function(value) {
|
||||||
|
value[symbol] = {};
|
||||||
|
return func(value)[symbol] === value[symbol];
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
skipTest(assert);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
QUnit.test('`_.' + methodName + '` should clone symbol objects', function(assert) {
|
||||||
assert.expect(4);
|
assert.expect(4);
|
||||||
|
|
||||||
if (Symbol) {
|
if (Symbol) {
|
||||||
@@ -2379,6 +2395,17 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test('`_.' + methodName + '` should not clone symbol primitives', function(assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
if (Symbol) {
|
||||||
|
assert.strictEqual(func(symbol), symbol);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
skipTest(assert);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
QUnit.test('`_.' + methodName + '` should not error on DOM elements', function(assert) {
|
QUnit.test('`_.' + methodName + '` should not error on DOM elements', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user