/** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: Apache-2.0 */ /** * @fileoverview Test blocks toolbox has a category menu and an auto-closing flyout. * The blocks in this toolbox reflect block configurations not used by * the standard predefined blocks, and so test alternative block rendering * code paths. * @author aschmiedt@google.com (Abby Schmiedt) */ var alignCategory = { "kind": "CATEGORY", "name": "Align", "contents": [ { "kind": "BLOCK", "type": "test_align_dummy_right", }, { "kind": "BLOCK", "type": "test_align_all", }, { "kind": "BLOCK", "type": "test_align_with_external_input", } ], }; var basicCategory = { "kind": "CATEGORY", "name": "Basic", "contents": [ { "kind": "BLOCK", "type": "test_basic_empty", }, { "kind": "BLOCK", "type": "test_basic_empty_with_mutator", }, { "kind": "BLOCK", "type": "test_basic_dummy", }, { "kind": "BLOCK", "type": "test_basic_multiple_dummy", }, { "kind": "BLOCK", "type": "test_basic_stack", }, { "kind": "BLOCK", "type": "test_basic_row", }, { "kind": "BLOCK", "type": "test_basic_value_to_stack", }, { "kind": "BLOCK", "type": "test_basic_value_to_statement", }, { "kind": "BLOCK", "type": "test_basic_limit_instances", }, { "kind": "BLOCK", "type": "test_basic_tooltips" }, { "kind": "BLOCK", "type": "test_basic_javascript", } ], }; var rowCategory = { "kind": "CATEGORY", "name": "Row", "contents": [ { "kind": "LABEL", "text": "blocks have" }, { "kind": "SEP", "gap": "-1" }, { "kind": "LABEL", "text": "tooltips" }, { "kind": "BUTTON", "text": "insert", "callbackkey": "insertConnectionRows" }, { "kind": "SEP", "gap": "7" }, { "kind": "BLOCK", "type": "test_connections_row_input", }, { "kind": "SEP", "gap": "7" }, { "kind": "BLOCK", "type": "test_connections_row_blue", }, { "kind": "SEP", "gap": "7" }, { "kind": "BLOCK", "type": "test_connections_row_yellow", }, { "kind": "SEP", "gap": "7" }, { "kind": "BLOCK", "type": "test_connections_row_red", }, { "kind": "SEP", "gap": "7" }, { "kind": "BLOCK", "type": "test_connections_row_output", }, { "kind": "BLOCK", "blockxml": "", }, { "kind": "SEP", "gap": "7" }, { "kind": "BLOCK", "type": "test_connections_multivalue_1valid", }, { "kind": "SEP", "gap": "7" }, { "kind": "BLOCK", "type": "test_connections_multivalue_2valid", } ], }; var stackCategory = { "kind": "CATEGORY", "name": "Stack", "contents": [ { "kind": "LABEL", "text": "blocks have" }, { "kind": "SEP", "gap": "-1" }, { "kind": "LABEL", "text": "tooltips" }, { "kind": "BUTTON", "text": "insert", "callbackkey": "insertConnectionStacks" }, { "kind": "SEP", "gap": "7" }, { "kind": "BLOCK", "type": "test_connections_stack_next", }, { "kind": "SEP", "gap": "7" }, { "kind": "BLOCK", "type": "test_connections_stack_blue", }, { "kind": "SEP", "gap": "7" }, { "kind": "BLOCK", "type": "test_connections_stack_yellow", }, { "kind": "SEP", "gap": "7" }, { "kind": "BLOCK", "type": "test_connections_stack_red", }, { "kind": "SEP", "gap": "7" }, { "kind": "BLOCK", "type": "test_connections_stack_prev", }, { "kind": "BLOCK", "blockxml": "", } ], }; var statementCategory = { "kind": "CATEGORY", "name": "Statement", "contents": [ { "kind": "LABEL", "text": "blocks have" }, { "kind": "SEP", "gap": "-1" }, { "kind": "LABEL", "text": "tooltips" }, { "kind": "BUTTON", "text": "insert", "callbackkey": "insertConnectionStatements" }, { "kind": "SEP", "gap": "7" }, { "kind": "BLOCK", "type": "test_connections_statement_blue", }, { "kind": "SEP", "gap": "7" }, { "kind": "BLOCK", "type": "test_connections_statement_yellow", }, { "kind": "SEP", "gap": "7" }, { "kind": "BLOCK", "type": "test_connections_statement_red", }, { "kind": "BLOCK", "type": "test_connections_statement_nonext", }, { "kind": "SEP", "gap": "7" }, { "kind": "BLOCK", "type": "test_connections_multistatement_1valid", }, { "kind": "SEP", "gap": "7" }, { "kind": "BLOCK", "type": "test_connections_multistatement_2valid", } ], }; var dragCategory = { "kind": "CATEGORY", "name": "Drag", "contents": [ { "kind": "LABEL", "text": "Drag each to the workspace" }, { "kind": "BLOCK", "blockxml": "Drag me by this child", }, { "kind": "BLOCK", "blockxml": "Drag me by this shadow", }, { "kind": "BLOCK", "blockxml": "Shadow valueShadow statement", }, { "kind": "LABEL", "text": "Multiple Variable Refs" }, { "kind": "BLOCK", "blockxml": "itemitem", }, { "kind": "LABEL", "text": "Procedure Definitions" }, { "kind": "BLOCK", "blockxml": "without argumentsNo argument reference.", }, { "kind": "BLOCK", "blockxml": "with one argumentExpected an argument reference here.fnArgument", } ], }; var fieldDefaults = { "kind": "CATEGORY", "name": "Defaults", "contents": [ { "kind": "BUTTON", "text": "add blocks to workspace", "callbackkey": "addAllBlocksToWorkspace" }, { "kind": "SEP", "gap": "8" }, { "kind": "BUTTON", "text": "set random style", "callbackkey": "setRandomStyle" }, { "kind": "SEP", "gap": "8" }, { "kind": "BUTTON", "text": "toggle enabled", "callbackkey": "toggleEnabled" }, { "kind": "SEP", "gap": "8" }, { "kind": "BUTTON", "text": "toggle shadow", "callbackkey": "toggleShadow" }, { "kind": "SEP", "gap": "8" }, { "kind": "BUTTON", "text": "toggle collapsed", "callbackkey": "toggleCollapsed" }, { "kind": "BLOCK", "type": "test_fields_angle", }, { "kind": "BLOCK", "type": "test_fields_checkbox", }, { "kind": "BLOCK", "type": "test_fields_colour", }, { "kind": "BLOCK", "type": "test_fields_colour_options", }, { "kind": "BLOCK", "type": "test_fields_text_input", }, { "kind": "BLOCK", "type": "test_fields_only_text_input", }, { "kind": "BLOCK", "type": "test_fields_multilinetext", }, { "kind": "BLOCK", "type": "test_fields_variable", }, { "kind": "BUTTON", "text": "randomize label text", "callbackkey": "randomizeLabelText" }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_fields_label_serializable", }, { "kind": "BUTTON", "text": "change image", "callbackkey": "changeImage" }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_fields_image", } ], }; var fieldNumbers = { "kind": "CATEGORY", "name": "Numbers", "contents": [ { "kind": "BLOCK", "blockxml": "123.456", }, { "kind": "BLOCK", "blockxml": "123.456", }, { "kind": "BLOCK", "blockxml": "123.456", }, { "kind": "BLOCK", "blockxml": "123.456", }, { "kind": "BLOCK", "blockxml": "123.456", }, { "kind": "BLOCK", "blockxml": "60", } ], }; var fieldAngles = { "kind": "CATEGORY", "name": "Angles", "contents": [ { "kind": "BLOCK", "type": "test_angles_clockwise", }, { "kind": "BLOCK", "type": "test_angles_offset", }, { "kind": "BLOCK", "type": "test_angles_wrap", }, { "kind": "BLOCK", "type": "test_angles_round_30", }, { "kind": "BLOCK", "type": "test_angles_round_0", }, { "kind": "BLOCK", "type": "test_angles_protractor", }, { "kind": "BLOCK", "type": "test_angles_compass", } ], }; var fieldDropDowns = { "kind": "CATEGORY", "name": "Drop-downs", "contents": [ { "kind": "LABEL", "text": "Dynamic" }, { "kind": "BLOCK", "type": "test_dropdowns_dynamic", }, { "kind": "BUTTON", "text": "Add option", "callbackkey": "addDynamicOption" }, { "kind": "BUTTON", "text": "Remove option", "callbackkey": "removeDynamicOption" }, { "kind": "BLOCK", "type": "test_dropdowns_dynamic_random", }, { "kind": "LABEL", "text": "Other" }, { "kind": "BLOCK", "type": "test_dropdowns_long", }, { "kind": "BLOCK", "type": "test_dropdowns_images", }, { "kind": "BLOCK", "type": "test_dropdowns_images_and_text", } ], }; var fieldImages = { "kind": "CATEGORY", "name": "Images", "contents": [ { "kind": "BLOCK", "type": "test_images_datauri", }, { "kind": "BLOCK", "type": "test_images_small", }, { "kind": "BLOCK", "type": "test_images_large", }, { "kind": "BLOCK", "type": "test_images_fliprtl", }, { "kind": "BLOCK", "type": "test_images_missing", }, { "kind": "BLOCK", "type": "test_images_many_icons", }, { "kind": "BLOCK", "type": "test_images_clickhandler", } ], }; var fieldEmoji = { "kind": "CATEGORY", "name": "Emoji! o((*^ᴗ^*))o", "contents": [ { "kind": "LABEL", "text": "Unicode & Emojis" }, { "kind": "BLOCK", "type": "test_style_emoji", }, { "kind": "BLOCK", "blockxml": "Robot face in text field:🤖", }, { "kind": "BLOCK", "blockxml": "Zalgo in text field:B̛̻̦̬̘̰͎̥̈̔͊͞ͅl̡͖̫̺̬̖̣̳̃̀́͑͑̕͟͠͝o̢̹͙̮̫͔͋̉̊̑̿̽̚c̸̹̹̜͙̹̠͋̒͑̊̇͝k̡͉̫͇̖̳͖̊͒́̆̄̎̂̔̕͜͞l̰̙̞̳̩̠͖̯̀̆̈́̿̈̓͗y̨̡̟͇̮͈̬̙̲̏̅̀͘͠", } ] }; var fieldValidators = { "kind": "CATEGORY", "name": "Validators", "contents": [ { "kind": "BUTTON", "text": "add blocks to workspace", "callbackkey": "addAllBlocksToWorkspace" }, { "kind": "SEP", "gap": "8" }, { "kind": "BUTTON", "text": "set input", "callbackkey": "setInput" }, { "kind": "LABEL", "text": "Dispose block" }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_dispose_block", }, { "kind": "LABEL", "text": "Angles" }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_angle_null", }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_angle_mult30_force", }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_angle_mult30_null", }, { "kind": "LABEL", "text": "Checkboxes" }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_checkbox_null", }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_checkbox_match", }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_checkbox_not_match_null", }, { "kind": "LABEL", "text": "Colours" }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_colour_null", }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_colour_force_red", }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_colour_red_null", }, { "kind": "LABEL", "text": "Dropdowns" }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_dropdown_null", }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_dropdown_force_1s", }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_dropdown_1s_null", }, { "kind": "LABEL", "text": "Numbers" }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_number_null", }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_number_mult10_force", }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_number_mult10_null", }, { "kind": "LABEL", "text": "Text" }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_text_null", }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_text_A", }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_text_B", }, { "kind": "LABEL", "text": "Variables" }, { "kind": "SEP", "gap": "8" }, { "kind": "BUTTON", "text": "add test variables", "callbackkey": "addVariables", "web-class": "modifiesWorkspace" }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_variable_null", }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_variable_force_1s", }, { "kind": "SEP", "gap": "12" }, { "kind": "BLOCK", "type": "test_validators_variable_1s_null", } ], }; var mutators = { "kind": "CATEGORY", "name": "Mutators", "contents": [ { "kind": "LABEL", "text": "logic_compare" }, { "kind": "BLOCK", "blockxml": "1010", }, { "kind": "BLOCK", "blockxml": "1010", }, { "kind": "BLOCK", "type": "test_mutators_noflyout", }, ], }; var style = { "kind": "CATEGORY", "name": "Style", "contents": [ { "kind": "LABEL", "text": "Hats" }, { "kind": "BLOCK", "type": "test_style_hat", }, { "kind": "LABEL", "text": "Colour" }, { "kind": "BLOCK", "type": "test_style_hex1", }, { "kind": "BLOCK", "type": "test_style_hex2", }, { "kind": "BLOCK", "type": "test_style_hex3", }, { "kind": "BLOCK", "type": "test_style_no_colour", }, { "kind": "BLOCK", "type": "test_style_hex4", }, { "kind": "BLOCK", "type": "test_style_hex5", "gap": "40", }, { "kind": "BLOCK", "type": "test_style_hex5", "disabled": "true", }, ], }; /* exported testBlocksToolbox */ var testBlocksToolbox = [ alignCategory, basicCategory, { "kind": "CATEGORY", "name": "Connections", "expanded": "true", "contents": [ rowCategory, stackCategory, statementCategory ], }, dragCategory, { "kind": "CATEGORY", "name": "Fields", "expanded": "true", "contents": [ fieldDefaults, fieldNumbers, fieldAngles, fieldDropDowns, fieldImages, fieldEmoji, fieldValidators ], }, mutators, style ];