fix!: deepMerge for arrays, shortcut keycodes returned as array (#9047)

This commit is contained in:
Maribeth Moffatt
2025-05-14 12:23:12 -07:00
committed by GitHub
parent 523dca92bd
commit 205ef6c7d7
3 changed files with 32 additions and 2 deletions

View File

@@ -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);
});
});
});