fix: bad JSON state leaving events disabled (#7501)

* fix: broken JSON state stopping event firing

* chore: add unit test for events not breaking
This commit is contained in:
Beka Westberg
2023-09-19 05:17:51 -07:00
committed by GitHub
parent f8a134caef
commit 32c9daf885
2 changed files with 25 additions and 2 deletions

View File

@@ -23,6 +23,25 @@ suite('JSO Deserialization', function () {
});
suite('Events', function () {
test('bad JSON does not leave events disabled', function () {
const state = {
'blocks': {
'blocks': [
{
'type': 'undefined_block',
},
],
},
};
chai.assert.throws(() => {
Blockly.serialization.workspaces.load(state, this.workspace);
});
chai.assert.isTrue(
Blockly.Events.isEnabled(),
'Expected events to be enabled',
);
});
suite('Finished loading', function () {
test('Just var', function () {
const state = {