Add missing cleanup for block types. (#3890)

* Add missing cleanup for block types.

* Add missing dispose and remove unecessary delete.
This commit is contained in:
Monica Kozbial
2020-05-06 17:49:22 -07:00
committed by GitHub
parent 888e348c69
commit abd6a53ac2
3 changed files with 7 additions and 21 deletions

View File

@@ -321,8 +321,8 @@ suite('ASTNode', function() {
delete this.blocks.dummyInput;
delete this.blocks.dummyInputValue;
delete this.blocks.fieldWithOutput2;
delete Blockly.Blocks['output_next'];
delete Blockly.Blocks['fields_and_input2'];
delete Blockly.Blocks['two_fields'];
delete Blockly.Blocks['fields_and_input'];

View File

@@ -44,6 +44,7 @@ suite('Blocks', function() {
});
teardown(function() {
this.workspace.dispose();
delete Blockly.Blocks['empty_block'];
delete Blockly.Blocks['stack_block'];
delete Blockly.Blocks['row_block'];
delete Blockly.Blocks['statement_block'];
@@ -324,21 +325,10 @@ suite('Blocks', function() {
}
]
},
{
"type": "statement_block",
"message0": "%1",
"args0": [
{
"type": "input_statement",
"name": "STATEMENT"
}
]
},
]);
});
teardown(function() {
delete Blockly.Blocks['value_block'];
delete Blockly.Blocks['statement_block'];
});
suite('Value', function() {
@@ -1030,17 +1020,9 @@ suite('Blocks', function() {
});
suite('Comments', function() {
setup(function() {
Blockly.defineBlocksWithJsonArray([
{
"type": "empty_block",
"message0": "",
"args0": []
},
]);
this.eventSpy = sinon.spy(Blockly.Events, 'fire');
});
teardown(function() {
delete Blockly.Blocks['empty_block'];
this.eventSpy.restore();
});
suite('Set/Get Text', function() {

View File

@@ -367,6 +367,10 @@ suite('Navigation', function() {
}
};
});
teardown(function() {
delete Blockly.Blocks['basic_block'];
this.workspace.dispose();
});
test('Action does not exist', function() {
var block = this.workspace.getTopBlocks()[0];
var field = block.inputList[0].fieldRow[0];
@@ -432,7 +436,6 @@ suite('Navigation', function() {
chai.assert.isTrue(Blockly.navigation.focusWorkspace_.calledOnce);
chai.assert.isTrue(Blockly.getMainWorkspace().keyboardAccessibilityMode);
Blockly.navigation.focusWorkspace_.restore();
this.workspace.dispose();
});
suite('Test key press in read only mode', function() {
@@ -630,6 +633,7 @@ suite('Navigation', function() {
});
teardown(function() {
delete Blockly.Blocks['inline_block'];
delete Blockly.Blocks['basic_block'];
this.workspace.dispose();
});