From 615a08e9b86b5634804ce532c9a91e9a0d9e746a Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Wed, 11 Sep 2024 10:26:31 +0100 Subject: [PATCH] chore(field-*): Remove unneeded uninstallBlocks test helpers --- .../field-colour/test/blocks_test.mocha.js | 30 ------------------- plugins/field-colour/test/index.ts | 26 ---------------- .../test/block_test.mocha.js | 20 ------------- plugins/field-multilineinput/test/index.ts | 14 --------- 4 files changed, 90 deletions(-) diff --git a/plugins/field-colour/test/blocks_test.mocha.js b/plugins/field-colour/test/blocks_test.mocha.js index 3d0f4f4999..710a50f573 100644 --- a/plugins/field-colour/test/blocks_test.mocha.js +++ b/plugins/field-colour/test/blocks_test.mocha.js @@ -169,32 +169,6 @@ const blockJson = { }, }; -/** - * Uninstall old blocks and generators, since they come pre-installed - * with Blockly. - * TODO(#2194): Delete this function and calls to it. - */ -function uninstallBlocks() { - delete Blockly.Blocks['colour_blend']; - delete Blockly.Blocks['colour_rgb']; - delete Blockly.Blocks['colour_random']; - delete Blockly.Blocks['colour_picker']; - - const blockNames = [ - 'colour_blend', - 'colour_rgb', - 'colour_random', - 'colour_picker', - ]; - blockNames.forEach((name) => { - delete javascriptGenerator.forBlock[name]; - delete dartGenerator.forBlock[name]; - delete luaGenerator.forBlock[name]; - delete pythonGenerator.forBlock[name]; - delete phpGenerator.forBlock[name]; - }); -} - /** * Assert that the generated code matches the golden code for the specified * language. @@ -212,7 +186,6 @@ function checkResult(suffix, generated) { suite('Colour Block Generators', function () { suiteSetup(function () { - uninstallBlocks(); installAllBlocks({ javascript: javascriptGenerator, dart: dartGenerator, @@ -248,7 +221,4 @@ suite('Colour Block Generators', function () { teardown(function () { this.workspace.dispose(); }); - suiteTeardown(function () { - uninstallBlocks(); - }); }); diff --git a/plugins/field-colour/test/index.ts b/plugins/field-colour/test/index.ts index c72be864fb..722d0629ea 100644 --- a/plugins/field-colour/test/index.ts +++ b/plugins/field-colour/test/index.ts @@ -240,31 +240,6 @@ const jsonToolbox = { ], }; -/** - * Uninstall the base colour blocks and their associated generators. - * TODO(#2194): remove this when those blocks are removed from the core library. - */ -function uninstallBlocks() { - delete Blockly.Blocks['colour_blend']; - delete Blockly.Blocks['colour_rgb']; - delete Blockly.Blocks['colour_random']; - delete Blockly.Blocks['colour_picker']; - - const blockNames = [ - 'colour_blend', - 'colour_rgb', - 'colour_random', - 'colour_picker', - ]; - blockNames.forEach((name) => { - delete javascriptGenerator.forBlock[name]; - delete dartGenerator.forBlock[name]; - delete luaGenerator.forBlock[name]; - delete pythonGenerator.forBlock[name]; - delete phpGenerator.forBlock[name]; - }); -} - /** * Create a workspace. * @@ -281,7 +256,6 @@ function createWorkspace( } document.addEventListener('DOMContentLoaded', function () { - uninstallBlocks(); installColourBlocks({ javascript: javascriptGenerator, dart: dartGenerator, diff --git a/plugins/field-multilineinput/test/block_test.mocha.js b/plugins/field-multilineinput/test/block_test.mocha.js index 368b4cccb7..d60fd2cf15 100644 --- a/plugins/field-multilineinput/test/block_test.mocha.js +++ b/plugins/field-multilineinput/test/block_test.mocha.js @@ -15,7 +15,6 @@ import {phpGenerator} from 'blockly/php'; import {pythonGenerator} from 'blockly/python'; import {luaGenerator} from 'blockly/lua'; import {installAllBlocks} from '../src/index'; -import {BLOCK_NAME} from '../src/blocks/textMultiline'; import {assert} from 'chai'; const blockJson = { @@ -39,21 +38,6 @@ const blockJson = { }, }; -/** - * Uninstall old blocks and generators, since they come pre-installed - * with Blockly. - * TODO(#2194): Delete this function and calls to it. - */ -function uninstallBlocks() { - delete Blockly.Blocks[BLOCK_NAME]; - - delete javascriptGenerator.forBlock[BLOCK_NAME]; - delete dartGenerator.forBlock[BLOCK_NAME]; - delete luaGenerator.forBlock[BLOCK_NAME]; - delete pythonGenerator.forBlock[BLOCK_NAME]; - delete phpGenerator.forBlock[BLOCK_NAME]; -} - /** * Assert that the generated code matches the golden code for the specified * language. @@ -72,7 +56,6 @@ function checkResult(suffix, generated) { suite('Multiline Text Block Generators', function () { suiteSetup(function () { Blockly.setLocale(en); - uninstallBlocks(); installAllBlocks({ javascript: javascriptGenerator, dart: dartGenerator, @@ -108,7 +91,4 @@ suite('Multiline Text Block Generators', function () { teardown(function () { this.workspace.dispose(); }); - suiteTeardown(function () { - uninstallBlocks(); - }); }); diff --git a/plugins/field-multilineinput/test/index.ts b/plugins/field-multilineinput/test/index.ts index 135ac63f39..521ca502d4 100644 --- a/plugins/field-multilineinput/test/index.ts +++ b/plugins/field-multilineinput/test/index.ts @@ -191,19 +191,6 @@ const jsonToolbox = { ], }; -/** - * Uninstall the base multiline text block and its associated generators. - * TODO(#2194): remove this when those blocks are removed from the core library. - */ -function uninstallBlock() { - delete Blockly.Blocks['text_multiline']; - delete javascriptGenerator.forBlock['text_multiline']; - delete dartGenerator.forBlock['text_multiline']; - delete luaGenerator.forBlock['text_multiline']; - delete pythonGenerator.forBlock['text_multiline']; - delete phpGenerator.forBlock['text_multiline']; -} - /** * Create a workspace. * @@ -215,7 +202,6 @@ function createWorkspace( blocklyDiv: HTMLElement, options: Blockly.BlocklyOptions, ): Blockly.WorkspaceSvg { - uninstallBlock(); textMultiline.installBlock({ javascript: javascriptGenerator, dart: dartGenerator,