|
14830 | 14830 | }());
|
14831 | 14831 |
|
14832 | 14832 | /*--------------------------------------------------------------------------*/
|
14833 |
| -// sina |
| 14833 | + |
14834 | 14834 | QUnit.module('lodash.merge');
|
14835 | 14835 |
|
14836 | 14836 | (function() {
|
@@ -14914,34 +14914,36 @@
|
14914 | 14914 | QUnit.test('should merge first source object properties to function', function(assert) {
|
14915 | 14915 | assert.expect(1);
|
14916 | 14916 |
|
14917 |
| - const Foo = function () {}; |
14918 |
| - var object = { prop: {} }, |
14919 |
| - actual = _.merge({prop: Foo}, object); |
| 14917 | + var fn = function() {}, |
| 14918 | + object = { 'prop': {} }, |
| 14919 | + actual = _.merge({ 'prop': fn }, object); |
14920 | 14920 |
|
14921 | 14921 | assert.deepEqual(actual, object);
|
14922 | 14922 | });
|
14923 | 14923 |
|
14924 | 14924 | QUnit.test('should merge first and second source object properties to function', function(assert) {
|
14925 | 14925 | assert.expect(1);
|
14926 | 14926 |
|
14927 |
| - const fn = function () {}; |
14928 |
| - var object = { prop: {} }, |
14929 |
| - actual = _.merge({prop: fn}, {prop: fn}, object); |
| 14927 | + var fn = function() {}, |
| 14928 | + object = { 'prop': {} }, |
| 14929 | + actual = _.merge({ 'prop': fn }, { 'prop': fn }, object); |
14930 | 14930 |
|
14931 | 14931 | assert.deepEqual(actual, object);
|
14932 | 14932 | });
|
14933 | 14933 |
|
14934 | 14934 | QUnit.test('should not merge onto function values of sources', function(assert) {
|
14935 |
| - assert.expect(2); |
| 14935 | + assert.expect(3); |
14936 | 14936 |
|
14937 | 14937 | var source1 = { 'a': function() {} },
|
14938 | 14938 | source2 = { 'a': { 'b': 2 } },
|
| 14939 | + expected = { 'a': { 'b': 2 } }, |
14939 | 14940 | actual = _.merge({}, source1, source2);
|
14940 | 14941 |
|
14941 |
| - assert.deepEqual(actual, { 'a': { 'b': 2 } }); |
| 14942 | + assert.deepEqual(actual, expected); |
| 14943 | + assert.notOk('b' in source1.a); |
14942 | 14944 |
|
14943 | 14945 | actual = _.merge(source1, source2);
|
14944 |
| - assert.strictEqual(actual.a.b, 2); |
| 14946 | + assert.deepEqual(actual, expected); |
14945 | 14947 | });
|
14946 | 14948 |
|
14947 | 14949 | QUnit.test('should merge onto non-plain `object` values', function(assert) {
|
|
0 commit comments