Skip to content

Commit

Permalink
Common prefix for test blocks
Browse files Browse the repository at this point in the history
Fixes #2103.

This will break any saved XML involving the playground’s test blocks.  I don’t think any such XML exists on this planet.
  • Loading branch information
NeilFraser committed Apr 5, 2019
1 parent 5056e23 commit 9561ecf
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 59 deletions.
58 changes: 29 additions & 29 deletions tests/blocks/test_blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ goog.provide('Blockly.TestBlocks');

Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
{
"type": "empty_block",
"type": "test_basic_empty",
"message0": "",
"args0": []
},
{
"type": "value_to_stack",
"type": "test_basic_value_to_stack",
"message0": "value to stack",
"nextStatement": null,
"output": null,
"style": "math_blocks"
},
{
"type": "value_to_statement",
"type": "test_basic_value_to_statement",
"message0": "value to statement %1",
"args0": [
{
Expand All @@ -47,7 +47,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
"style": "math_blocks"
},
{
"type": "limit_instances",
"type": "test_basic_limit_instances",
"message0": "limit 3 instances %1 %2",
"args0": [
{
Expand All @@ -63,7 +63,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
"style": "math_blocks",
},
{
"type": "example_dropdown_long",
"type": "test_fields_dropdown_long",
"message0": "long: %1",
"args0": [
{
Expand Down Expand Up @@ -107,7 +107,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
]
},
{
"type": "example_dropdown_images",
"type": "test_fields_dropdown_images",
"message0": "%1",
"args0": [
{
Expand All @@ -133,7 +133,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
]
},
{
"type": "example_dropdown_images_and_text",
"type": "test_fields_dropdown_images_and_text",
"message0": "%1",
"args0": [
{
Expand All @@ -160,7 +160,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
]
},
{
"type": "example_angle",
"type": "test_fields_angle",
"message0": "angle: %1",
"args0": [
{
Expand All @@ -177,7 +177,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
"colour": "230"
},
{
"type": "example_date",
"type": "test_fields_date",
"message0": "date: %1",
"args0": [
{
Expand All @@ -193,7 +193,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
]
},
{
"type": "test_number",
"type": "test_fields_number",
"message0": "float %1",
"args0": [
{
Expand All @@ -207,7 +207,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
"tooltip": "A number."
},
{
"type": "test_integer",
"type": "test_fields_integer",
"message0": "integer %1",
"args0": [
{
Expand All @@ -222,7 +222,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
"tooltip": "An integer."
},
{
"type": "test_number_hundredths",
"type": "test_fields_number_hundredths",
"message0": "$ %1",
"args0": [
{
Expand All @@ -237,7 +237,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
"tooltip": "A dollar amount."
},
{
"type": "test_integer_bounded",
"type": "test_fields_integer_bounded",
"message0": "midi note %1",
"args0": [
{
Expand All @@ -254,7 +254,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
"tooltip": "A midi note."
},
{
"type": "image_datauri",
"type": "test_images_datauri",
"message0": "Image data: URI %1",
"args0": [
{
Expand All @@ -268,7 +268,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
"style": "text_blocks"
},
{
"type": "image_small",
"type": "test_images_small",
"message0": "Image too small %1",
"args0": [
{
Expand All @@ -282,7 +282,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
"style": "text_blocks"
},
{
"type": "image_large",
"type": "test_images_large",
"message0": "Image too large %1",
"args0": [
{
Expand All @@ -296,7 +296,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
"style": "text_blocks"
},
{
"type": "image_fliprtl",
"type": "test_images_fliprtl",
"message0": "Image flipped RTL %1",
"args0": [
{
Expand All @@ -311,7 +311,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
"colour": 160
},
{
"type": "image_missing",
"type": "test_images_missing",
"message0": "Image missing %1",
"args0": [
{
Expand All @@ -325,7 +325,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
"style": "text_blocks"
},
{
"type": "test_with_lots_of_network_icons",
"type": "test_images_many_icons",
"message0": "Lots of network icons: %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16 %17 %18",
"args0": [
{
Expand Down Expand Up @@ -450,13 +450,13 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
"style": "text_blocks"
},
{
"type": "styled_event_cap",
"type": "test_style_hat",
"message0": "Hat block (event)",
"nextStatement": null,
"style": "hat_blocks"
},
{
"type": "block_colour_hex1",
"type": "test_style_hex1",
"message0": "Block color: Bright purple %1 %2 %3 %4",
"args0": [
{
Expand Down Expand Up @@ -487,7 +487,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
"colour": "#992aff"
},
{
"type": "block_colour_hex2",
"type": "test_style_hex2",
"message0": "Block color: White %1 %2 %3 %4",
"args0": [
{
Expand Down Expand Up @@ -518,7 +518,7 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
"colour": "#fefefe"
},
{
"type": "block_colour_hex3",
"type": "test_style_hex3",
"message0": "Block color: Black %1 %2 %3 %4",
"args0": [
{
Expand Down Expand Up @@ -549,33 +549,33 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
"colour": "#010101"
},
{
"type": "block_no_colour",
"type": "test_style_no_colour",
"message0": "Block color: unset"
},
{
"type": "block_colour_hex4",
"type": "test_style_hex4",
"message0": "Block color: #RRGGBBAA (invalid)",
"colour": "#992aff99"
},
{
"type": "block_colour_hex5",
"type": "test_style_hex5",
"message0": "Block color: #RRGGBB (invalid)",
"colour": "#NotHex"
},
{
"type": "emoji_label_robot_face",
"type": "test_style_emoji",
"message0": "Robot Face: \uD83E\uDD16",
"colour": "#AAAAAA"
}
]); // END JSON EXTRACT (Do not delete this comment.)

Blockly.Blocks['empty_block_with_mutator'] = {
Blockly.Blocks['test_basic_empty_with_mutator'] = {
init: function() {
this.setMutator(new Blockly.Mutator(['math_number']));
}
};

Blockly.Blocks['test_dropdown_dynamic'] = {
Blockly.Blocks['test_fields_dropdown_dynamic'] = {
init: function() {
var dropdown = new Blockly.FieldDropdown(this.dynamicOptions);
this.appendDummyInput()
Expand Down
60 changes: 30 additions & 30 deletions tests/playground.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
},
horizontalLayout: side == 'top' || side == 'bottom',
maxBlocks: Infinity,
maxInstances: {'limit_instances': 3},
maxInstances: {'test_basic_limit_instances': 3},
media: '../media/',
oneBasedIndex: true,
readOnly: false,
Expand Down Expand Up @@ -1105,11 +1105,11 @@ <h1>Blockly Playground</h1>
code paths. -->
<xml id="toolbox-test-blocks" style="display: none">
<category name="Basic">
<block type="empty_block"></block>
<block type="empty_block_with_mutator"></block>
<block type="value_to_stack"></block>
<block type="value_to_statement"></block>
<block type="limit_instances"></block>
<block type="test_basic_empty"></block>
<block type="test_basic_empty_with_mutator"></block>
<block type="test_basic_value_to_stack"></block>
<block type="test_basic_value_to_statement"></block>
<block type="test_basic_limit_instances"></block>
</category>
<category name="Drag">
<label text="Drag each to the workspace"></label>
Expand Down Expand Up @@ -1194,29 +1194,29 @@ <h1>Blockly Playground</h1>
</category>
<category name="Fields">
<label text="Numbers"></label>
<block type="test_number">
<block type="test_fields_number">
<field name="NUM">123.456</field>
</block>
<block type="test_integer">
<block type="test_fields_integer">
<field name="NUM">123.456</field>
</block>
<block type="test_number_hundredths">
<block type="test_fields_number_hundredths">
<field name="NUM">123.456</field>
</block>
<block type="test_integer_bounded">
<block type="test_fields_integer_bounded">
<field name="NOTE">60</field>
</block>
<label text="Drop-downs"></label>
<block type="example_dropdown_long"></block>
<block type="example_dropdown_images"></block>
<block type="example_dropdown_images_and_text"></block>
<block type="test_fields_dropdown_long"></block>
<block type="test_fields_dropdown_images"></block>
<block type="test_fields_dropdown_images_and_text"></block>
<label text="Dynamic Drop-downs"></label>
<block type="test_dropdown_dynamic"></block>
<block type="test_fields_dropdown_dynamic"></block>
<button text="Add option" callbackKey="addDynamicOption"></button>
<button text="Remove option" callbackKey="removeDynamicOption"></button>
<label text="Others"></label>
<block type="example_angle"></block>
<block type="example_date"></block>
<block type="test_fields_angle"></block>
<block type="test_fields_date"></block>
</category>
<category name="Mutators">
<label text="logic_compare"></label>
Expand Down Expand Up @@ -1247,24 +1247,24 @@ <h1>Blockly Playground</h1>
</category>
<category name="Style">
<label text="Hats"></label>
<block type="styled_event_cap"></block>
<block type="test_style_hat"></block>
<label text="Colour"></label>
<block type="block_colour_hex1"></block>
<block type="block_colour_hex2"></block>
<block type="block_colour_hex3"></block>
<block type="block_no_colour"></block>
<block type="block_colour_hex4"></block>
<block type="block_colour_hex5"></block>
<block type="test_style_hex1"></block>
<block type="test_style_hex2"></block>
<block type="test_style_hex3"></block>
<block type="test_style_no_colour"></block>
<block type="test_style_hex4"></block>
<block type="test_style_hex5"></block>
</category>
<category name="Images">
<block type="image_datauri"></block>
<block type="image_small"></block>
<block type="image_large"></block>
<block type="image_fliprtl"></block>
<block type="image_missing"></block>
<block type="test_with_lots_of_network_icons"></block>
<block type="test_images_datauri"></block>
<block type="test_images_small"></block>
<block type="test_images_large"></block>
<block type="test_images_fliprtl"></block>
<block type="test_images_missing"></block>
<block type="test_images_many_icons"></block>
<label text="Unicode & Emojis"></label>
<block type="emoji_label_robot_face"></block>
<block type="test_style_emoji"></block>
<block type="text">
<field name="TEXT">Robot face in text field: &#x1f916;</field>
</block>
Expand Down

0 comments on commit 9561ecf

Please sign in to comment.