diff --git a/tests/blocks/test_blocks.js b/tests/blocks/test_blocks.js
index d599c316c..3c1aa3992 100644
--- a/tests/blocks/test_blocks.js
+++ b/tests/blocks/test_blocks.js
@@ -1731,7 +1731,7 @@ Blockly.Blocks['test_dropdowns_dynamic'] = {
/**
* An array of options for the dynamic dropdown.
* @type {!Array}
- * @package
+ * @private
*/
Blockly.TestBlocks.dynamicDropdownOptions_ = [];
@@ -1740,7 +1740,7 @@ Blockly.TestBlocks.dynamicDropdownOptions_ = [];
* the user for an option to add.
* @package
*/
-Blockly.TestBlocks.addDynamicDropdownOption_ = function() {
+Blockly.TestBlocks.addDynamicDropdownOption = function() {
Blockly.prompt('Add an option?',
'option ' + Blockly.TestBlocks.dynamicDropdownOptions_.length,
function(text) {
@@ -1761,7 +1761,7 @@ Blockly.TestBlocks.addDynamicDropdownOption_ = function() {
* same name.
* @package
*/
-Blockly.TestBlocks.removeDynamicDropdownOption_ = function() {
+Blockly.TestBlocks.removeDynamicDropdownOption = function() {
var defaultText = Blockly.TestBlocks.dynamicDropdownOptions_[0] ?
Blockly.TestBlocks.dynamicDropdownOptions_[0][0] : '';
Blockly.prompt('Remove an option?', defaultText, function(text) {
@@ -1796,3 +1796,97 @@ Blockly.Blocks['test_dropdowns_dynamic_random'] = {
return options;
}
};
+
+/**
+ * Handles "insert" button in the connection row test category. This will insert
+ * a group of test blocks connected in a row.
+ * @package
+ */
+Blockly.TestBlocks.insertConnectionRows = function(button) {
+ var workspace = button.getTargetWorkspace();
+ Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(
+ '\n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ''
+ ), workspace)
+};
+
+/**
+ * Handles "insert" button in the connection stack test category. This will
+ * insert a group of test blocks connected in a stack.
+ * @package
+ */
+Blockly.TestBlocks.insertConnectionStacks = function(button) {
+ var workspace = button.getTargetWorkspace();
+ Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(
+ '\n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ''
+ ), workspace);
+};
+
+/**
+ * Handles "insert" button in the connection statement test category. This will
+ * insert a group of test blocks connected as statements.
+ * @package
+ */
+Blockly.TestBlocks.insertConnectionStatements = function(button) {
+ var workspace = button.getTargetWorkspace();
+ Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(
+ '\n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ' \n' +
+ ''
+ ), workspace);
+};
diff --git a/tests/playground.html b/tests/playground.html
index f3a306dc8..3523caa67 100644
--- a/tests/playground.html
+++ b/tests/playground.html
@@ -249,91 +249,15 @@ function addToolboxButtonCallbacks() {
workspace.createVariable('2b', '', '2B');
workspace.createVariable('2c', '', '2C');
};
- var insertConnectionRows = function(button) {
- var workspace = button.getTargetWorkspace();
- Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(
- '\n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ''
- ), workspace)
- };
- var insertConnectionStacks = function(button) {
- var workspace = button.getTargetWorkspace();
- Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(
- '\n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ''
- ), workspace);
- };
- var insertConnectionStatements = function(button) {
- var workspace = button.getTargetWorkspace();
- Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(
- '\n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ' \n' +
- ''
- ), workspace);
- };
workspace.registerButtonCallback(
- 'addVariables', addVariables);
+ 'addVariables', addVariables);
workspace.registerButtonCallback(
- 'changeImage', changeImage);
+ 'changeImage', changeImage);
workspace.registerButtonCallback(
- 'addAllBlocksToWorkspace', addAllBlocksToWorkspace);
+ 'addAllBlocksToWorkspace', addAllBlocksToWorkspace);
workspace.registerButtonCallback(
- 'setInput', setInput);
+ 'setInput', setInput);
workspace.registerButtonCallback(
'setRandomStyle', setRandomStyle);
workspace.registerButtonCallback(
@@ -345,15 +269,16 @@ function addToolboxButtonCallbacks() {
workspace.registerButtonCallback(
'randomizeLabelText', randomizeLabelText);
workspace.registerButtonCallback(
- 'addDynamicOption', Blockly.TestBlocks.addDynamicDropdownOption_);
+ 'addDynamicOption', Blockly.TestBlocks.addDynamicDropdownOption);
workspace.registerButtonCallback(
- 'removeDynamicOption', Blockly.TestBlocks.removeDynamicDropdownOption_);
+ 'removeDynamicOption', Blockly.TestBlocks.removeDynamicDropdownOption);
workspace.registerButtonCallback(
- 'insertConnectionRows', insertConnectionRows);
+ 'insertConnectionRows', Blockly.TestBlocks.insertConnectionRows);
workspace.registerButtonCallback(
- 'insertConnectionStacks', insertConnectionStacks);
+ 'insertConnectionStacks', Blockly.TestBlocks.insertConnectionStacks);
workspace.registerButtonCallback(
- 'insertConnectionStatements', insertConnectionStatements);
+ 'insertConnectionStatements',
+ Blockly.TestBlocks.insertConnectionStatements);
}
function setRenderDebugOptionCheckboxState(overrideOptions) {