mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-02 08:33:56 -04:00
Fix typo uncovered by loading lonely variable reporters
This commit is contained in:
parent
be65b615a2
commit
809d2de9f2
2 changed files with 8 additions and 3 deletions
|
@ -802,7 +802,7 @@ const deserializeBlocks = function (blocks) {
|
|||
// this is one of the primitives
|
||||
// delete the old entry in object.blocks and replace it w/the
|
||||
// deserialized object
|
||||
delete block[blockId];
|
||||
delete blocks[blockId];
|
||||
deserializeInputDesc(block, null, false, blocks);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -243,10 +243,15 @@ test('(#1608) serializeBlocks maintains top level variable reporters', t => {
|
|||
vm.loadProject(readFileToBuffer(variableReporterSB2ProjectPath))
|
||||
.then(() => {
|
||||
const blocks = vm.runtime.targets[0].blocks._blocks;
|
||||
const result = sb3.serialize(vm.runtime).targets[0].blocks;
|
||||
const result = sb3.serialize(vm.runtime);
|
||||
// Project should have 1 block, a top-level variable reporter
|
||||
t.equal(Object.keys(blocks).length, 1);
|
||||
t.equal(Object.keys(result).length, 1);
|
||||
t.equal(Object.keys(result.targets[0].blocks).length, 1);
|
||||
|
||||
// Make sure deserializing these blocks works
|
||||
t.doesNotThrow(() => {
|
||||
sb3.deserialize(JSON.parse(JSON.stringify(result)), vm.runtime);
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue