Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd8ddc1a

Browse files
committed
Add test for indirectly mergingObject properties.
1 parente5f9af5 commitd8ddc1a

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

‎test/test.js‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7555,16 +7555,34 @@
75557555
}
75567556
});
75577557

7558-
QUnit.test('should not merge `Object.prototype` properties', function(assert) {
7559-
assert.expect(1);
7558+
QUnit.test('should not indirectly merge builtin prototype properties', function(assert) {
7559+
assert.expect(2);
7560+
7561+
_.merge({}, { 'toString': { 'constructor': { 'prototype': { 'a': 1 } } } });
7562+
7563+
var actual = 'a' in funcProto;
7564+
delete funcProto.a;
7565+
7566+
assert.notOk(actual);
75607567

75617568
_.merge({}, { 'constructor': { 'prototype': { 'a': 1 } } });
75627569

7563-
varactual = 'a' in objectProto;
7570+
actual = 'a' in objectProto;
75647571
delete objectProto.a;
75657572

75667573
assert.notOk(actual);
75677574
});
7575+
7576+
QUnit.test('should not indirectly merge `Object` properties', function(assert) {
7577+
assert.expect(1);
7578+
7579+
_.merge({}, { 'constructor': { 'a': 1 } });
7580+
7581+
var actual = 'a' in Object;
7582+
delete Object.a;
7583+
7584+
assert.notOk(actual);
7585+
});
75687586
}());
75697587

75707588
/*--------------------------------------------------------------------------*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp