From 4911c066b336d99b8fd259998b70bb00ca52513b Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Fri, 10 Jun 2022 15:31:57 +0100 Subject: [PATCH] feat(tests): Support an additionalScripts option This is a list of scripts to load (in order) once the required modules have been bootstrapped. We do this using goog.addDependency to make the first script depend on the required modules, then each subsequent script depend on the previous one, and then finally goog.bootstrapping the last such script. --- tests/bootstrap.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tests/bootstrap.js b/tests/bootstrap.js index fb185e1e2..4ccf7eb63 100644 --- a/tests/bootstrap.js +++ b/tests/bootstrap.js @@ -80,6 +80,11 @@ 'php_compressed.js', 'python_compressed.js', ], + + // Additional scripts to be loaded after Blockly is loaded, + // whether Blockly is loaded from compressed or uncompressed. + additionalScripts: [ + ], }; if (typeof window.BLOCKLY_BOOTSTRAP_OPTIONS === 'object') { Object.assign(options, window.BLOCKLY_BOOTSTRAP_OPTIONS); @@ -125,11 +130,21 @@ ' window.BlocklyMsg = window.Blockly.Msg;\n' + ' delete window.Blockly;\n' + '\n'); - const allRequires = options.requires.map(quote).join(); + const requiresString = options.requires.map(quote).join(); + const scriptsString = options.additionalScripts.map(quote).join(); document.write( '');