From 1eaa112f7d674f2cd77715ee27c52596f47a321f Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 24 Dec 2015 15:16:17 -0600 Subject: [PATCH] Add tests for cloning symbol properties. --- test/test.js | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/test/test.js b/test/test.js index 64154cd69..7a2d51bdb 100644 --- a/test/test.js +++ b/test/test.js @@ -2361,7 +2361,23 @@ 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); 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) { assert.expect(1);