mirror of
https://github.com/google/blockly.git
synced 2026-01-08 09:30:06 +01:00
fix!: deepMerge for arrays, shortcut keycodes returned as array (#9047)
This commit is contained in:
@@ -533,4 +533,25 @@ suite('Utils', function () {
|
||||
assert.equal(Blockly.utils.math.toDegrees(5 * quarter), 360 + 90, '450');
|
||||
});
|
||||
});
|
||||
|
||||
suite('deepMerge', function () {
|
||||
test('Merges two objects', function () {
|
||||
const target = {a: 1, b: '2', shared: 'this should be overwritten'};
|
||||
const source = {c: {deeplyNested: true}, shared: 'I overwrote it'};
|
||||
|
||||
const expected = {...target, ...source};
|
||||
const actual = Blockly.utils.object.deepMerge(target, source);
|
||||
|
||||
assert.deepEqual(expected, actual);
|
||||
});
|
||||
test('Merges objects with arrays', function () {
|
||||
const target = {a: 1};
|
||||
const source = {b: ['orange', 'lime']};
|
||||
|
||||
const expected = {...target, ...source};
|
||||
const actual = Blockly.utils.object.deepMerge(target, source);
|
||||
|
||||
assert.deepEqual(expected, actual);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user