scratch-blocks 1.1.206 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.husky/commit-msg +0 -3
- package/CHANGELOG.md +111 -833
- package/TODO.md +16 -0
- package/blockly-rc/.eslintignore +28 -0
- package/blockly-rc/.eslintrc.js +187 -0
- package/blockly-rc/.gitattributes +1 -0
- package/blockly-rc/.github/CODEOWNERS +1 -0
- package/blockly-rc/.github/CONTRIBUTING.md +46 -0
- package/blockly-rc/.github/ISSUE_TEMPLATE/bug_report.yaml +58 -0
- package/blockly-rc/.github/ISSUE_TEMPLATE/config.yml +7 -0
- package/blockly-rc/.github/ISSUE_TEMPLATE/documentation.yaml +38 -0
- package/blockly-rc/.github/ISSUE_TEMPLATE/feature_request.yaml +39 -0
- package/blockly-rc/.github/PULL_REQUEST_TEMPLATE.md +42 -0
- package/blockly-rc/.github/dependabot.yml +27 -0
- package/blockly-rc/.github/release.yml +32 -0
- package/blockly-rc/.github/workflows/appengine_deploy.yml +54 -0
- package/blockly-rc/.github/workflows/assign_reviewers.yml +41 -0
- package/blockly-rc/.github/workflows/browser_test.yml +55 -0
- package/blockly-rc/.github/workflows/build.yml +86 -0
- package/blockly-rc/.github/workflows/conventional-label.yml +17 -0
- package/blockly-rc/.github/workflows/develop_freeze.yml +26 -0
- package/blockly-rc/.github/workflows/tag_module_cleanup.yml +37 -0
- package/blockly-rc/.github/workflows/welcome_new_contributors.yml +36 -0
- package/blockly-rc/.prettierignore +30 -0
- package/blockly-rc/.prettierrc.js +13 -0
- package/blockly-rc/CHANGELOG.md +77 -0
- package/blockly-rc/LICENSE +202 -0
- package/blockly-rc/README.md +80 -0
- package/blockly-rc/_config.yml +1 -0
- package/blockly-rc/api-extractor.json +385 -0
- package/blockly-rc/appengine/.gcloudignore +20 -0
- package/blockly-rc/appengine/README.txt +42 -0
- package/blockly-rc/appengine/add_timestamps.py +69 -0
- package/blockly-rc/appengine/app.yaml +104 -0
- package/blockly-rc/appengine/apple-touch-icon.png +0 -0
- package/blockly-rc/appengine/blockly_compressed.js +11 -0
- package/blockly-rc/appengine/expiration.py +52 -0
- package/blockly-rc/appengine/favicon.ico +0 -0
- package/blockly-rc/appengine/index.yaml +11 -0
- package/blockly-rc/appengine/main.py +39 -0
- package/blockly-rc/appengine/redirect.html +107 -0
- package/blockly-rc/appengine/requirements.txt +1 -0
- package/blockly-rc/appengine/robots.txt +2 -0
- package/blockly-rc/appengine/storage.js +190 -0
- package/blockly-rc/appengine/storage.py +125 -0
- package/blockly-rc/blocks/blocks.ts +44 -0
- package/blockly-rc/blocks/lists.ts +1085 -0
- package/blockly-rc/blocks/logic.ts +712 -0
- package/blockly-rc/blocks/loops.ts +408 -0
- package/blockly-rc/blocks/math.ts +591 -0
- package/blockly-rc/blocks/procedures.ts +1364 -0
- package/blockly-rc/blocks/text.ts +1007 -0
- package/blockly-rc/blocks/variables.ts +183 -0
- package/blockly-rc/blocks/variables_dynamic.ts +194 -0
- package/blockly-rc/core/any_aliases.ts +8 -0
- package/blockly-rc/core/block.ts +2523 -0
- package/blockly-rc/core/block_animations.ts +225 -0
- package/blockly-rc/core/block_flyout_inflater.ts +262 -0
- package/blockly-rc/core/block_svg.ts +1768 -0
- package/blockly-rc/core/blockly.ts +605 -0
- package/blockly-rc/core/blockly_options.ts +71 -0
- package/blockly-rc/core/blocks.ts +18 -0
- package/blockly-rc/core/browser_events.ts +244 -0
- package/blockly-rc/core/bubbles/bubble.ts +658 -0
- package/blockly-rc/core/bubbles/mini_workspace_bubble.ts +280 -0
- package/blockly-rc/core/bubbles/text_bubble.ts +103 -0
- package/blockly-rc/core/bubbles/textinput_bubble.ts +344 -0
- package/blockly-rc/core/bubbles.ts +12 -0
- package/blockly-rc/core/bump_objects.ts +192 -0
- package/blockly-rc/core/button_flyout_inflater.ts +63 -0
- package/blockly-rc/core/clipboard/block_paster.ts +142 -0
- package/blockly-rc/core/clipboard/registry.ts +31 -0
- package/blockly-rc/core/clipboard/workspace_comment_paster.ts +94 -0
- package/blockly-rc/core/clipboard.ts +113 -0
- package/blockly-rc/core/comments/comment_view.ts +899 -0
- package/blockly-rc/core/comments/rendered_workspace_comment.ts +297 -0
- package/blockly-rc/core/comments/workspace_comment.ts +237 -0
- package/blockly-rc/core/comments.ts +9 -0
- package/blockly-rc/core/common.ts +305 -0
- package/blockly-rc/core/component_manager.ts +235 -0
- package/blockly-rc/core/config.ts +65 -0
- package/blockly-rc/core/connection.ts +793 -0
- package/blockly-rc/core/connection_checker.ts +348 -0
- package/blockly-rc/core/connection_db.ts +297 -0
- package/blockly-rc/core/connection_type.ts +21 -0
- package/blockly-rc/core/constants.ts +23 -0
- package/blockly-rc/core/contextmenu.ts +268 -0
- package/blockly-rc/core/contextmenu_items.ts +700 -0
- package/blockly-rc/core/contextmenu_registry.ts +194 -0
- package/blockly-rc/core/css.ts +481 -0
- package/blockly-rc/core/delete_area.ts +77 -0
- package/blockly-rc/core/dialog.ts +121 -0
- package/blockly-rc/core/drag_target.ts +97 -0
- package/blockly-rc/core/dragging/block_drag_strategy.ts +454 -0
- package/blockly-rc/core/dragging/bubble_drag_strategy.ts +52 -0
- package/blockly-rc/core/dragging/comment_drag_strategy.ts +91 -0
- package/blockly-rc/core/dragging/dragger.ts +163 -0
- package/blockly-rc/core/dragging.ts +12 -0
- package/blockly-rc/core/dropdowndiv.ts +768 -0
- package/blockly-rc/core/events/events.ts +163 -0
- package/blockly-rc/core/events/events_abstract.ts +130 -0
- package/blockly-rc/core/events/events_block_base.ts +88 -0
- package/blockly-rc/core/events/events_block_change.ts +259 -0
- package/blockly-rc/core/events/events_block_create.ts +185 -0
- package/blockly-rc/core/events/events_block_delete.ts +182 -0
- package/blockly-rc/core/events/events_block_drag.ts +116 -0
- package/blockly-rc/core/events/events_block_field_intermediate_change.ts +167 -0
- package/blockly-rc/core/events/events_block_move.ts +307 -0
- package/blockly-rc/core/events/events_bubble_open.ts +120 -0
- package/blockly-rc/core/events/events_click.ts +110 -0
- package/blockly-rc/core/events/events_comment_base.ts +126 -0
- package/blockly-rc/core/events/events_comment_change.ts +161 -0
- package/blockly-rc/core/events/events_comment_collapse.ts +103 -0
- package/blockly-rc/core/events/events_comment_create.ts +118 -0
- package/blockly-rc/core/events/events_comment_delete.ts +117 -0
- package/blockly-rc/core/events/events_comment_drag.ts +99 -0
- package/blockly-rc/core/events/events_comment_move.ts +207 -0
- package/blockly-rc/core/events/events_comment_resize.ts +174 -0
- package/blockly-rc/core/events/events_marker_move.ts +134 -0
- package/blockly-rc/core/events/events_selected.ts +98 -0
- package/blockly-rc/core/events/events_theme_change.ts +84 -0
- package/blockly-rc/core/events/events_toolbox_item_select.ts +96 -0
- package/blockly-rc/core/events/events_trashcan_open.ts +88 -0
- package/blockly-rc/core/events/events_ui_base.ts +47 -0
- package/blockly-rc/core/events/events_var_base.ts +89 -0
- package/blockly-rc/core/events/events_var_create.ts +129 -0
- package/blockly-rc/core/events/events_var_delete.ts +124 -0
- package/blockly-rc/core/events/events_var_rename.ts +133 -0
- package/blockly-rc/core/events/events_var_type_change.ts +122 -0
- package/blockly-rc/core/events/events_viewport.ts +149 -0
- package/blockly-rc/core/events/utils.ts +595 -0
- package/blockly-rc/core/events/workspace_events.ts +46 -0
- package/blockly-rc/core/extensions.ts +491 -0
- package/blockly-rc/core/field.ts +1471 -0
- package/blockly-rc/core/field_checkbox.ts +271 -0
- package/blockly-rc/core/field_dropdown.ts +857 -0
- package/blockly-rc/core/field_image.ts +297 -0
- package/blockly-rc/core/field_input.ts +755 -0
- package/blockly-rc/core/field_label.ts +150 -0
- package/blockly-rc/core/field_label_serializable.ts +73 -0
- package/blockly-rc/core/field_number.ts +381 -0
- package/blockly-rc/core/field_registry.ts +115 -0
- package/blockly-rc/core/field_textinput.ts +117 -0
- package/blockly-rc/core/field_variable.ts +651 -0
- package/blockly-rc/core/flyout_base.ts +968 -0
- package/blockly-rc/core/flyout_button.ts +416 -0
- package/blockly-rc/core/flyout_horizontal.ts +374 -0
- package/blockly-rc/core/flyout_metrics_manager.ts +90 -0
- package/blockly-rc/core/flyout_separator.ts +61 -0
- package/blockly-rc/core/flyout_vertical.ts +353 -0
- package/blockly-rc/core/generator.ts +611 -0
- package/blockly-rc/core/gesture.ts +1191 -0
- package/blockly-rc/core/grid.ts +252 -0
- package/blockly-rc/core/icons/comment_icon.ts +435 -0
- package/blockly-rc/core/icons/exceptions.ts +23 -0
- package/blockly-rc/core/icons/icon.ts +147 -0
- package/blockly-rc/core/icons/icon_types.ts +32 -0
- package/blockly-rc/core/icons/mutator_icon.ts +354 -0
- package/blockly-rc/core/icons/registry.ts +33 -0
- package/blockly-rc/core/icons/warning_icon.ts +219 -0
- package/blockly-rc/core/icons.ts +24 -0
- package/blockly-rc/core/inject.ts +428 -0
- package/blockly-rc/core/inputs/align.ts +14 -0
- package/blockly-rc/core/inputs/dummy_input.ts +26 -0
- package/blockly-rc/core/inputs/end_row_input.ts +31 -0
- package/blockly-rc/core/inputs/input.ts +318 -0
- package/blockly-rc/core/inputs/input_types.ts +27 -0
- package/blockly-rc/core/inputs/statement_input.ts +34 -0
- package/blockly-rc/core/inputs/value_input.ts +30 -0
- package/blockly-rc/core/inputs.ts +23 -0
- package/blockly-rc/core/insertion_marker_manager.ts +742 -0
- package/blockly-rc/core/insertion_marker_previewer.ts +254 -0
- package/blockly-rc/core/interfaces/i_ast_node_location.ts +12 -0
- package/blockly-rc/core/interfaces/i_ast_node_location_svg.ts +28 -0
- package/blockly-rc/core/interfaces/i_ast_node_location_with_block.ts +22 -0
- package/blockly-rc/core/interfaces/i_autohideable.ts +22 -0
- package/blockly-rc/core/interfaces/i_bounded_element.ts +30 -0
- package/blockly-rc/core/interfaces/i_bubble.ts +63 -0
- package/blockly-rc/core/interfaces/i_collapsible_toolbox_item.ts +33 -0
- package/blockly-rc/core/interfaces/i_comment_icon.ts +47 -0
- package/blockly-rc/core/interfaces/i_component.ts +19 -0
- package/blockly-rc/core/interfaces/i_connection_checker.ts +100 -0
- package/blockly-rc/core/interfaces/i_connection_previewer.ts +50 -0
- package/blockly-rc/core/interfaces/i_contextmenu.ts +16 -0
- package/blockly-rc/core/interfaces/i_copyable.ts +31 -0
- package/blockly-rc/core/interfaces/i_deletable.ts +34 -0
- package/blockly-rc/core/interfaces/i_delete_area.ts +28 -0
- package/blockly-rc/core/interfaces/i_drag_target.ts +69 -0
- package/blockly-rc/core/interfaces/i_draggable.ts +72 -0
- package/blockly-rc/core/interfaces/i_dragger.ts +35 -0
- package/blockly-rc/core/interfaces/i_flyout.ts +189 -0
- package/blockly-rc/core/interfaces/i_flyout_inflater.ts +41 -0
- package/blockly-rc/core/interfaces/i_has_bubble.ts +20 -0
- package/blockly-rc/core/interfaces/i_icon.ts +114 -0
- package/blockly-rc/core/interfaces/i_keyboard_accessible.ts +21 -0
- package/blockly-rc/core/interfaces/i_legacy_procedure_blocks.ts +50 -0
- package/blockly-rc/core/interfaces/i_metrics_manager.ts +149 -0
- package/blockly-rc/core/interfaces/i_movable.ts +19 -0
- package/blockly-rc/core/interfaces/i_observable.ts +24 -0
- package/blockly-rc/core/interfaces/i_parameter_model.ts +51 -0
- package/blockly-rc/core/interfaces/i_paster.ts +25 -0
- package/blockly-rc/core/interfaces/i_positionable.ts +33 -0
- package/blockly-rc/core/interfaces/i_procedure_block.ts +27 -0
- package/blockly-rc/core/interfaces/i_procedure_map.ts +18 -0
- package/blockly-rc/core/interfaces/i_procedure_model.ts +71 -0
- package/blockly-rc/core/interfaces/i_registrable.ts +12 -0
- package/blockly-rc/core/interfaces/i_rendered_element.ts +22 -0
- package/blockly-rc/core/interfaces/i_selectable.ts +34 -0
- package/blockly-rc/core/interfaces/i_selectable_toolbox_item.ts +63 -0
- package/blockly-rc/core/interfaces/i_serializable.ts +28 -0
- package/blockly-rc/core/interfaces/i_serializer.ts +55 -0
- package/blockly-rc/core/interfaces/i_styleable.ts +26 -0
- package/blockly-rc/core/interfaces/i_toolbox.ts +112 -0
- package/blockly-rc/core/interfaces/i_toolbox_item.ts +81 -0
- package/blockly-rc/core/interfaces/i_variable_backed_parameter_model.ts +23 -0
- package/blockly-rc/core/interfaces/i_variable_map.ts +65 -0
- package/blockly-rc/core/interfaces/i_variable_model.ts +57 -0
- package/blockly-rc/core/internal_constants.ts +47 -0
- package/blockly-rc/core/keyboard_nav/ast_node.ts +884 -0
- package/blockly-rc/core/keyboard_nav/basic_cursor.ts +223 -0
- package/blockly-rc/core/keyboard_nav/cursor.ts +138 -0
- package/blockly-rc/core/keyboard_nav/marker.ts +113 -0
- package/blockly-rc/core/keyboard_nav/tab_navigate_cursor.ts +46 -0
- package/blockly-rc/core/label_flyout_inflater.ts +59 -0
- package/blockly-rc/core/layer_manager.ts +186 -0
- package/blockly-rc/core/layers.ts +17 -0
- package/blockly-rc/core/main.ts +31 -0
- package/blockly-rc/core/marker_manager.ts +189 -0
- package/blockly-rc/core/menu.ts +463 -0
- package/blockly-rc/core/menuitem.ts +221 -0
- package/blockly-rc/core/metrics_manager.ts +486 -0
- package/blockly-rc/core/msg.ts +27 -0
- package/blockly-rc/core/names.ts +275 -0
- package/blockly-rc/core/observable_procedure_map.ts +66 -0
- package/blockly-rc/core/options.ts +377 -0
- package/blockly-rc/core/positionable_helpers.ts +186 -0
- package/blockly-rc/core/procedures.ts +510 -0
- package/blockly-rc/core/registry.ts +400 -0
- package/blockly-rc/core/render_management.ts +193 -0
- package/blockly-rc/core/rendered_connection.ts +571 -0
- package/blockly-rc/core/renderers/common/block_rendering.ts +120 -0
- package/blockly-rc/core/renderers/common/constants.ts +1198 -0
- package/blockly-rc/core/renderers/common/drawer.ts +518 -0
- package/blockly-rc/core/renderers/common/i_path_object.ts +137 -0
- package/blockly-rc/core/renderers/common/info.ts +767 -0
- package/blockly-rc/core/renderers/common/marker_svg.ts +765 -0
- package/blockly-rc/core/renderers/common/path_object.ts +324 -0
- package/blockly-rc/core/renderers/common/renderer.ts +281 -0
- package/blockly-rc/core/renderers/geras/constants.ts +46 -0
- package/blockly-rc/core/renderers/geras/drawer.ts +167 -0
- package/blockly-rc/core/renderers/geras/geras.ts +31 -0
- package/blockly-rc/core/renderers/geras/highlight_constants.ts +342 -0
- package/blockly-rc/core/renderers/geras/highlighter.ts +313 -0
- package/blockly-rc/core/renderers/geras/info.ts +478 -0
- package/blockly-rc/core/renderers/geras/measurables/inline_input.ts +37 -0
- package/blockly-rc/core/renderers/geras/measurables/statement_input.ts +36 -0
- package/blockly-rc/core/renderers/geras/path_object.ts +135 -0
- package/blockly-rc/core/renderers/geras/renderer.ts +124 -0
- package/blockly-rc/core/renderers/measurables/base.ts +41 -0
- package/blockly-rc/core/renderers/measurables/bottom_row.ts +104 -0
- package/blockly-rc/core/renderers/measurables/connection.ts +43 -0
- package/blockly-rc/core/renderers/measurables/external_value_input.ts +53 -0
- package/blockly-rc/core/renderers/measurables/field.ts +50 -0
- package/blockly-rc/core/renderers/measurables/hat.ts +33 -0
- package/blockly-rc/core/renderers/measurables/icon.ts +42 -0
- package/blockly-rc/core/renderers/measurables/in_row_spacer.ts +29 -0
- package/blockly-rc/core/renderers/measurables/inline_input.ts +63 -0
- package/blockly-rc/core/renderers/measurables/input_connection.ts +57 -0
- package/blockly-rc/core/renderers/measurables/input_row.ts +67 -0
- package/blockly-rc/core/renderers/measurables/jagged_edge.ts +28 -0
- package/blockly-rc/core/renderers/measurables/next_connection.ts +34 -0
- package/blockly-rc/core/renderers/measurables/output_connection.ts +43 -0
- package/blockly-rc/core/renderers/measurables/previous_connection.ts +34 -0
- package/blockly-rc/core/renderers/measurables/round_corner.ts +34 -0
- package/blockly-rc/core/renderers/measurables/row.ts +191 -0
- package/blockly-rc/core/renderers/measurables/spacer_row.ts +44 -0
- package/blockly-rc/core/renderers/measurables/square_corner.ts +32 -0
- package/blockly-rc/core/renderers/measurables/statement_input.ts +41 -0
- package/blockly-rc/core/renderers/measurables/top_row.ts +110 -0
- package/blockly-rc/core/renderers/measurables/types.ts +319 -0
- package/blockly-rc/core/renderers/thrasos/info.ts +328 -0
- package/blockly-rc/core/renderers/thrasos/renderer.ts +40 -0
- package/blockly-rc/core/renderers/thrasos/thrasos.ts +14 -0
- package/blockly-rc/core/renderers/zelos/constants.ts +877 -0
- package/blockly-rc/core/renderers/zelos/drawer.ts +274 -0
- package/blockly-rc/core/renderers/zelos/info.ts +652 -0
- package/blockly-rc/core/renderers/zelos/marker_svg.ts +145 -0
- package/blockly-rc/core/renderers/zelos/measurables/bottom_row.ts +44 -0
- package/blockly-rc/core/renderers/zelos/measurables/inputs.ts +41 -0
- package/blockly-rc/core/renderers/zelos/measurables/row_elements.ts +29 -0
- package/blockly-rc/core/renderers/zelos/measurables/top_row.ts +50 -0
- package/blockly-rc/core/renderers/zelos/path_object.ts +209 -0
- package/blockly-rc/core/renderers/zelos/renderer.ts +143 -0
- package/blockly-rc/core/renderers/zelos/zelos.ts +33 -0
- package/blockly-rc/core/scrollbar.ts +898 -0
- package/blockly-rc/core/scrollbar_pair.ts +349 -0
- package/blockly-rc/core/separator_flyout_inflater.ts +69 -0
- package/blockly-rc/core/serialization/blocks.ts +868 -0
- package/blockly-rc/core/serialization/exceptions.ts +112 -0
- package/blockly-rc/core/serialization/priorities.ts +25 -0
- package/blockly-rc/core/serialization/procedures.ts +158 -0
- package/blockly-rc/core/serialization/registry.ts +30 -0
- package/blockly-rc/core/serialization/variables.ts +68 -0
- package/blockly-rc/core/serialization/workspace_comments.ts +143 -0
- package/blockly-rc/core/serialization/workspaces.ts +94 -0
- package/blockly-rc/core/serialization.ts +32 -0
- package/blockly-rc/core/shortcut_items.ts +338 -0
- package/blockly-rc/core/shortcut_registry.ts +368 -0
- package/blockly-rc/core/sprites.ts +15 -0
- package/blockly-rc/core/theme/classic.ts +40 -0
- package/blockly-rc/core/theme/themes.ts +12 -0
- package/blockly-rc/core/theme/zelos.ts +80 -0
- package/blockly-rc/core/theme.ts +232 -0
- package/blockly-rc/core/theme_manager.ts +192 -0
- package/blockly-rc/core/toolbox/category.ts +739 -0
- package/blockly-rc/core/toolbox/collapsible_category.ts +288 -0
- package/blockly-rc/core/toolbox/separator.ts +105 -0
- package/blockly-rc/core/toolbox/toolbox.ts +1134 -0
- package/blockly-rc/core/toolbox/toolbox_item.ts +152 -0
- package/blockly-rc/core/tooltip.ts +466 -0
- package/blockly-rc/core/touch.ts +155 -0
- package/blockly-rc/core/trashcan.ts +748 -0
- package/blockly-rc/core/utils/aria.ts +144 -0
- package/blockly-rc/core/utils/array.ts +24 -0
- package/blockly-rc/core/utils/colour.ts +265 -0
- package/blockly-rc/core/utils/coordinate.ts +129 -0
- package/blockly-rc/core/utils/deprecation.ts +47 -0
- package/blockly-rc/core/utils/dom.ts +356 -0
- package/blockly-rc/core/utils/idgenerator.ts +70 -0
- package/blockly-rc/core/utils/keycodes.ts +154 -0
- package/blockly-rc/core/utils/math.ts +50 -0
- package/blockly-rc/core/utils/metrics.ts +86 -0
- package/blockly-rc/core/utils/object.ts +28 -0
- package/blockly-rc/core/utils/parsing.ts +287 -0
- package/blockly-rc/core/utils/rect.ts +69 -0
- package/blockly-rc/core/utils/size.ts +62 -0
- package/blockly-rc/core/utils/string.ts +289 -0
- package/blockly-rc/core/utils/style.ts +219 -0
- package/blockly-rc/core/utils/svg.ts +84 -0
- package/blockly-rc/core/utils/svg_math.ts +208 -0
- package/blockly-rc/core/utils/svg_paths.ts +133 -0
- package/blockly-rc/core/utils/toolbox.ts +419 -0
- package/blockly-rc/core/utils/useragent.ts +86 -0
- package/blockly-rc/core/utils/xml.ts +165 -0
- package/blockly-rc/core/utils.ts +59 -0
- package/blockly-rc/core/variable_map.ts +437 -0
- package/blockly-rc/core/variable_model.ts +149 -0
- package/blockly-rc/core/variables.ts +773 -0
- package/blockly-rc/core/variables_dynamic.ts +142 -0
- package/blockly-rc/core/widgetdiv.ts +319 -0
- package/blockly-rc/core/workspace.ts +957 -0
- package/blockly-rc/core/workspace_audio.ts +171 -0
- package/blockly-rc/core/workspace_dragger.ts +97 -0
- package/blockly-rc/core/workspace_svg.ts +2519 -0
- package/blockly-rc/core/xml.ts +1133 -0
- package/blockly-rc/core/zoom_controls.ts +492 -0
- package/blockly-rc/demos/blockfactory/analytics.js +195 -0
- package/blockly-rc/demos/blockfactory/app_controller.js +726 -0
- package/blockly-rc/demos/blockfactory/block_definition_extractor.js +742 -0
- package/blockly-rc/demos/blockfactory/block_exporter_controller.js +311 -0
- package/blockly-rc/demos/blockfactory/block_exporter_tools.js +212 -0
- package/blockly-rc/demos/blockfactory/block_exporter_view.js +101 -0
- package/blockly-rc/demos/blockfactory/block_library_controller.js +325 -0
- package/blockly-rc/demos/blockfactory/block_library_storage.js +149 -0
- package/blockly-rc/demos/blockfactory/block_library_view.js +178 -0
- package/blockly-rc/demos/blockfactory/block_option.js +151 -0
- package/blockly-rc/demos/blockfactory/blocks.js +916 -0
- package/blockly-rc/demos/blockfactory/cp.css +46 -0
- package/blockly-rc/demos/blockfactory/cp.js +179 -0
- package/blockly-rc/demos/blockfactory/factory.css +586 -0
- package/blockly-rc/demos/blockfactory/factory.js +337 -0
- package/blockly-rc/demos/blockfactory/factory_utils.js +1036 -0
- package/blockly-rc/demos/blockfactory/icon.png +0 -0
- package/blockly-rc/demos/blockfactory/index.html +767 -0
- package/blockly-rc/demos/blockfactory/link.png +0 -0
- package/blockly-rc/demos/blockfactory/standard_categories.js +384 -0
- package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_controller.js +1332 -0
- package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_generator.js +224 -0
- package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_init.js +541 -0
- package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_model.js +548 -0
- package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_view.js +424 -0
- package/blockly-rc/demos/code/code.js +626 -0
- package/blockly-rc/demos/code/icon.png +0 -0
- package/blockly-rc/demos/code/icons.png +0 -0
- package/blockly-rc/demos/code/index.html +359 -0
- package/blockly-rc/demos/code/msg/ar.js +24 -0
- package/blockly-rc/demos/code/msg/be-tarask.js +24 -0
- package/blockly-rc/demos/code/msg/br.js +24 -0
- package/blockly-rc/demos/code/msg/ca.js +24 -0
- package/blockly-rc/demos/code/msg/cs.js +24 -0
- package/blockly-rc/demos/code/msg/da.js +24 -0
- package/blockly-rc/demos/code/msg/de.js +24 -0
- package/blockly-rc/demos/code/msg/el.js +24 -0
- package/blockly-rc/demos/code/msg/en.js +24 -0
- package/blockly-rc/demos/code/msg/es.js +24 -0
- package/blockly-rc/demos/code/msg/et.js +24 -0
- package/blockly-rc/demos/code/msg/fa.js +24 -0
- package/blockly-rc/demos/code/msg/fr.js +24 -0
- package/blockly-rc/demos/code/msg/he.js +24 -0
- package/blockly-rc/demos/code/msg/hr.js +24 -0
- package/blockly-rc/demos/code/msg/hrx.js +24 -0
- package/blockly-rc/demos/code/msg/hu.js +24 -0
- package/blockly-rc/demos/code/msg/ia.js +24 -0
- package/blockly-rc/demos/code/msg/is.js +24 -0
- package/blockly-rc/demos/code/msg/it.js +24 -0
- package/blockly-rc/demos/code/msg/ja.js +24 -0
- package/blockly-rc/demos/code/msg/kab.js +24 -0
- package/blockly-rc/demos/code/msg/ko.js +24 -0
- package/blockly-rc/demos/code/msg/mk.js +24 -0
- package/blockly-rc/demos/code/msg/ms.js +24 -0
- package/blockly-rc/demos/code/msg/nb.js +24 -0
- package/blockly-rc/demos/code/msg/nl.js +24 -0
- package/blockly-rc/demos/code/msg/oc.js +24 -0
- package/blockly-rc/demos/code/msg/pl.js +24 -0
- package/blockly-rc/demos/code/msg/pms.js +24 -0
- package/blockly-rc/demos/code/msg/pt-br.js +24 -0
- package/blockly-rc/demos/code/msg/ro.js +24 -0
- package/blockly-rc/demos/code/msg/ru.js +24 -0
- package/blockly-rc/demos/code/msg/sc.js +24 -0
- package/blockly-rc/demos/code/msg/sk.js +24 -0
- package/blockly-rc/demos/code/msg/sr.js +24 -0
- package/blockly-rc/demos/code/msg/sv.js +24 -0
- package/blockly-rc/demos/code/msg/ta.js +24 -0
- package/blockly-rc/demos/code/msg/th.js +24 -0
- package/blockly-rc/demos/code/msg/tlh.js +24 -0
- package/blockly-rc/demos/code/msg/tr.js +24 -0
- package/blockly-rc/demos/code/msg/uk.js +24 -0
- package/blockly-rc/demos/code/msg/vi.js +24 -0
- package/blockly-rc/demos/code/msg/zh-hans.js +24 -0
- package/blockly-rc/demos/code/msg/zh-hant.js +24 -0
- package/blockly-rc/demos/code/style.css +184 -0
- package/blockly-rc/demos/index.html +68 -0
- package/blockly-rc/demos/minimap/icon.png +0 -0
- package/blockly-rc/demos/minimap/index.html +91 -0
- package/blockly-rc/demos/minimap/minimap.js +302 -0
- package/blockly-rc/demos/mobile/README.md +53 -0
- package/blockly-rc/demos/mobile/android/README.md +45 -0
- package/blockly-rc/demos/mobile/android/app/build.gradle +64 -0
- package/blockly-rc/demos/mobile/android/app/proguard-rules.pro +21 -0
- package/blockly-rc/demos/mobile/android/app/src/androidTest/java/com/example/blocklywebview/ExampleInstrumentedTest.java +26 -0
- package/blockly-rc/demos/mobile/android/app/src/main/AndroidManifest.xml +21 -0
- package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/BlocklyWebViewFragment.java +40 -0
- package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/JsDialogHelper.java +150 -0
- package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/WebChromeClient.java +32 -0
- package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/demo/MainActivity.java +18 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/drawable/ic_launcher_background.xml +74 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +34 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/layout/activity_main.xml +17 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/layout/js_prompt.xml +37 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/values/colors.xml +6 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/values/js_dialog_helper.xml +7 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/values/strings.xml +3 -0
- package/blockly-rc/demos/mobile/android/app/src/main/res/values/styles.xml +11 -0
- package/blockly-rc/demos/mobile/android/app/src/test/java/com/example/blocklywebview/ExampleUnitTest.java +17 -0
- package/blockly-rc/demos/mobile/android/build.gradle +27 -0
- package/blockly-rc/demos/mobile/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/blockly-rc/demos/mobile/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/blockly-rc/demos/mobile/android/gradle.properties +13 -0
- package/blockly-rc/demos/mobile/android/gradlew +172 -0
- package/blockly-rc/demos/mobile/android/gradlew.bat +84 -0
- package/blockly-rc/demos/mobile/android/settings.gradle +1 -0
- package/blockly-rc/demos/mobile/html/index.html +31 -0
- package/blockly-rc/demos/mobile/html/ln_resources.sh +22 -0
- package/blockly-rc/demos/mobile/html/toolbox_standard.js +333 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/AppDelegate.swift +46 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/Assets.xcassets/AppIcon.appiconset/Contents.json +98 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/Assets.xcassets/Contents.json +6 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/Base.lproj/LaunchScreen.storyboard +25 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/Base.lproj/Main.storyboard +44 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/Info.plist +45 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView/ViewController.swift +110 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView.xcodeproj/project.pbxproj +390 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/blockly-rc/demos/mobile/ios/Blockly WebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/blockly-rc/demos/mobile/ios/cp_resources.sh +21 -0
- package/blockly-rc/demos/storage/icon.png +0 -0
- package/blockly-rc/demos/storage/index.html +104 -0
- package/blockly-rc/generators/dart/dart_generator.ts +321 -0
- package/blockly-rc/generators/dart/lists.ts +525 -0
- package/blockly-rc/generators/dart/logic.ts +155 -0
- package/blockly-rc/generators/dart/loops.ts +217 -0
- package/blockly-rc/generators/dart/math.ts +559 -0
- package/blockly-rc/generators/dart/procedures.ts +138 -0
- package/blockly-rc/generators/dart/text.ts +405 -0
- package/blockly-rc/generators/dart/variables.ts +32 -0
- package/blockly-rc/generators/dart/variables_dynamic.ts +17 -0
- package/blockly-rc/generators/dart.ts +50 -0
- package/blockly-rc/generators/javascript/javascript_generator.ts +346 -0
- package/blockly-rc/generators/javascript/lists.ts +465 -0
- package/blockly-rc/generators/javascript/logic.ts +153 -0
- package/blockly-rc/generators/javascript/loops.ts +245 -0
- package/blockly-rc/generators/javascript/math.ts +450 -0
- package/blockly-rc/generators/javascript/procedures.ts +142 -0
- package/blockly-rc/generators/javascript/text.ts +418 -0
- package/blockly-rc/generators/javascript/variables.ts +32 -0
- package/blockly-rc/generators/javascript/variables_dynamic.ts +17 -0
- package/blockly-rc/generators/javascript.ts +46 -0
- package/blockly-rc/generators/lua/lists.ts +445 -0
- package/blockly-rc/generators/lua/logic.ts +142 -0
- package/blockly-rc/generators/lua/loops.ts +192 -0
- package/blockly-rc/generators/lua/lua_generator.ts +225 -0
- package/blockly-rc/generators/lua/math.ts +473 -0
- package/blockly-rc/generators/lua/procedures.ts +144 -0
- package/blockly-rc/generators/lua/text.ts +380 -0
- package/blockly-rc/generators/lua/variables.ts +31 -0
- package/blockly-rc/generators/lua/variables_dynamic.ts +17 -0
- package/blockly-rc/generators/lua.ts +44 -0
- package/blockly-rc/generators/php/lists.ts +585 -0
- package/blockly-rc/generators/php/logic.ts +155 -0
- package/blockly-rc/generators/php/loops.ts +218 -0
- package/blockly-rc/generators/php/math.ts +408 -0
- package/blockly-rc/generators/php/php_generator.ts +320 -0
- package/blockly-rc/generators/php/procedures.ts +159 -0
- package/blockly-rc/generators/php/text.ts +315 -0
- package/blockly-rc/generators/php/variables.ts +32 -0
- package/blockly-rc/generators/php/variables_dynamic.ts +17 -0
- package/blockly-rc/generators/php.ts +46 -0
- package/blockly-rc/generators/python/lists.ts +398 -0
- package/blockly-rc/generators/python/logic.ts +148 -0
- package/blockly-rc/generators/python/loops.ts +251 -0
- package/blockly-rc/generators/python/math.ts +434 -0
- package/blockly-rc/generators/python/procedures.ts +159 -0
- package/blockly-rc/generators/python/python_generator.ts +355 -0
- package/blockly-rc/generators/python/text.ts +338 -0
- package/blockly-rc/generators/python/variables.ts +31 -0
- package/blockly-rc/generators/python/variables_dynamic.ts +17 -0
- package/blockly-rc/generators/python.ts +51 -0
- package/blockly-rc/gulpfile.js +54 -0
- package/blockly-rc/jsconfig.json +7 -0
- package/blockly-rc/media/1x1.gif +0 -0
- package/blockly-rc/media/click.mp3 +0 -0
- package/blockly-rc/media/click.ogg +0 -0
- package/blockly-rc/media/click.wav +0 -0
- package/blockly-rc/media/delete-icon.svg +1 -0
- package/blockly-rc/media/delete.mp3 +0 -0
- package/blockly-rc/media/delete.ogg +0 -0
- package/blockly-rc/media/delete.wav +0 -0
- package/blockly-rc/media/disconnect.mp3 +0 -0
- package/blockly-rc/media/disconnect.ogg +0 -0
- package/blockly-rc/media/disconnect.wav +0 -0
- package/blockly-rc/media/dropdown-arrow.svg +1 -0
- package/blockly-rc/media/foldout-icon.svg +1 -0
- package/blockly-rc/media/handclosed.cur +0 -0
- package/blockly-rc/media/handdelete.cur +0 -0
- package/blockly-rc/media/handopen.cur +0 -0
- package/blockly-rc/media/pilcrow.png +0 -0
- package/blockly-rc/media/quote0.png +0 -0
- package/blockly-rc/media/quote1.png +0 -0
- package/blockly-rc/media/resize-handle.svg +3 -0
- package/blockly-rc/media/sprites.png +0 -0
- package/blockly-rc/media/sprites.svg +74 -0
- package/blockly-rc/msg/json/README.md +33 -0
- package/blockly-rc/msg/json/ab.json +222 -0
- package/blockly-rc/msg/json/ace.json +7 -0
- package/blockly-rc/msg/json/af.json +34 -0
- package/blockly-rc/msg/json/am.json +30 -0
- package/blockly-rc/msg/json/ar.json +355 -0
- package/blockly-rc/msg/json/ast.json +10 -0
- package/blockly-rc/msg/json/az.json +332 -0
- package/blockly-rc/msg/json/ba.json +211 -0
- package/blockly-rc/msg/json/bcc.json +290 -0
- package/blockly-rc/msg/json/be-tarask.json +334 -0
- package/blockly-rc/msg/json/be.json +324 -0
- package/blockly-rc/msg/json/bg.json +345 -0
- package/blockly-rc/msg/json/bn.json +189 -0
- package/blockly-rc/msg/json/br.json +334 -0
- package/blockly-rc/msg/json/bs.json +166 -0
- package/blockly-rc/msg/json/ca.json +341 -0
- package/blockly-rc/msg/json/cdo.json +6 -0
- package/blockly-rc/msg/json/ce.json +326 -0
- package/blockly-rc/msg/json/constants.json +12 -0
- package/blockly-rc/msg/json/cs.json +343 -0
- package/blockly-rc/msg/json/da.json +346 -0
- package/blockly-rc/msg/json/de.json +369 -0
- package/blockly-rc/msg/json/diq.json +258 -0
- package/blockly-rc/msg/json/dtp.json +198 -0
- package/blockly-rc/msg/json/dty.json +97 -0
- package/blockly-rc/msg/json/ee.json +160 -0
- package/blockly-rc/msg/json/el.json +356 -0
- package/blockly-rc/msg/json/en-gb.json +199 -0
- package/blockly-rc/msg/json/en.json +400 -0
- package/blockly-rc/msg/json/eo.json +337 -0
- package/blockly-rc/msg/json/es.json +358 -0
- package/blockly-rc/msg/json/et.json +326 -0
- package/blockly-rc/msg/json/eu.json +219 -0
- package/blockly-rc/msg/json/fa.json +341 -0
- package/blockly-rc/msg/json/fi.json +350 -0
- package/blockly-rc/msg/json/fo.json +46 -0
- package/blockly-rc/msg/json/fr.json +373 -0
- package/blockly-rc/msg/json/frr.json +6 -0
- package/blockly-rc/msg/json/gl.json +338 -0
- package/blockly-rc/msg/json/gn.json +54 -0
- package/blockly-rc/msg/json/gor.json +87 -0
- package/blockly-rc/msg/json/ha.json +313 -0
- package/blockly-rc/msg/json/hak.json +17 -0
- package/blockly-rc/msg/json/he.json +354 -0
- package/blockly-rc/msg/json/hi.json +318 -0
- package/blockly-rc/msg/json/hr.json +327 -0
- package/blockly-rc/msg/json/hrx.json +287 -0
- package/blockly-rc/msg/json/hsb.json +128 -0
- package/blockly-rc/msg/json/hu.json +349 -0
- package/blockly-rc/msg/json/hy.json +337 -0
- package/blockly-rc/msg/json/ia.json +337 -0
- package/blockly-rc/msg/json/id.json +335 -0
- package/blockly-rc/msg/json/ig.json +323 -0
- package/blockly-rc/msg/json/inh.json +80 -0
- package/blockly-rc/msg/json/is.json +331 -0
- package/blockly-rc/msg/json/it.json +346 -0
- package/blockly-rc/msg/json/ja.json +361 -0
- package/blockly-rc/msg/json/ka.json +14 -0
- package/blockly-rc/msg/json/kab.json +323 -0
- package/blockly-rc/msg/json/kbd-cyrl.json +84 -0
- package/blockly-rc/msg/json/km.json +29 -0
- package/blockly-rc/msg/json/kn.json +332 -0
- package/blockly-rc/msg/json/ko.json +372 -0
- package/blockly-rc/msg/json/ksh.json +43 -0
- package/blockly-rc/msg/json/ku-latn.json +41 -0
- package/blockly-rc/msg/json/ky.json +71 -0
- package/blockly-rc/msg/json/la.json +6 -0
- package/blockly-rc/msg/json/lb.json +156 -0
- package/blockly-rc/msg/json/lki.json +282 -0
- package/blockly-rc/msg/json/lo.json +92 -0
- package/blockly-rc/msg/json/lrc.json +123 -0
- package/blockly-rc/msg/json/lt.json +321 -0
- package/blockly-rc/msg/json/lv.json +324 -0
- package/blockly-rc/msg/json/mg.json +58 -0
- package/blockly-rc/msg/json/mk.json +178 -0
- package/blockly-rc/msg/json/ml.json +35 -0
- package/blockly-rc/msg/json/mnw.json +90 -0
- package/blockly-rc/msg/json/ms.json +300 -0
- package/blockly-rc/msg/json/my.json +57 -0
- package/blockly-rc/msg/json/mzn.json +6 -0
- package/blockly-rc/msg/json/nb.json +330 -0
- package/blockly-rc/msg/json/ne.json +247 -0
- package/blockly-rc/msg/json/nl.json +357 -0
- package/blockly-rc/msg/json/oc.json +194 -0
- package/blockly-rc/msg/json/olo.json +37 -0
- package/blockly-rc/msg/json/pa.json +69 -0
- package/blockly-rc/msg/json/pl.json +357 -0
- package/blockly-rc/msg/json/pms.json +324 -0
- package/blockly-rc/msg/json/ps.json +50 -0
- package/blockly-rc/msg/json/pt-br.json +369 -0
- package/blockly-rc/msg/json/pt.json +358 -0
- package/blockly-rc/msg/json/qqq.json +406 -0
- package/blockly-rc/msg/json/ro.json +333 -0
- package/blockly-rc/msg/json/ru.json +363 -0
- package/blockly-rc/msg/json/sc.json +283 -0
- package/blockly-rc/msg/json/sco.json +11 -0
- package/blockly-rc/msg/json/sd.json +158 -0
- package/blockly-rc/msg/json/shn.json +109 -0
- package/blockly-rc/msg/json/si.json +16 -0
- package/blockly-rc/msg/json/sk.json +332 -0
- package/blockly-rc/msg/json/skr-arab.json +117 -0
- package/blockly-rc/msg/json/sl.json +355 -0
- package/blockly-rc/msg/json/smn.json +133 -0
- package/blockly-rc/msg/json/sq.json +343 -0
- package/blockly-rc/msg/json/sr-latn.json +324 -0
- package/blockly-rc/msg/json/sr.json +348 -0
- package/blockly-rc/msg/json/sv.json +347 -0
- package/blockly-rc/msg/json/sw.json +12 -0
- package/blockly-rc/msg/json/synonyms.json +22 -0
- package/blockly-rc/msg/json/ta.json +306 -0
- package/blockly-rc/msg/json/tcy.json +316 -0
- package/blockly-rc/msg/json/tdd.json +109 -0
- package/blockly-rc/msg/json/te.json +101 -0
- package/blockly-rc/msg/json/th.json +333 -0
- package/blockly-rc/msg/json/ti.json +50 -0
- package/blockly-rc/msg/json/tl.json +129 -0
- package/blockly-rc/msg/json/tlh.json +179 -0
- package/blockly-rc/msg/json/tr.json +369 -0
- package/blockly-rc/msg/json/ug-arab.json +132 -0
- package/blockly-rc/msg/json/uk.json +345 -0
- package/blockly-rc/msg/json/ur.json +117 -0
- package/blockly-rc/msg/json/uz.json +36 -0
- package/blockly-rc/msg/json/vi.json +345 -0
- package/blockly-rc/msg/json/xmf.json +96 -0
- package/blockly-rc/msg/json/yo.json +316 -0
- package/blockly-rc/msg/json/zgh.json +83 -0
- package/blockly-rc/msg/json/zh-hans.json +372 -0
- package/blockly-rc/msg/json/zh-hant.json +362 -0
- package/blockly-rc/msg/messages.js +1616 -0
- package/blockly-rc/package-lock.json +12324 -0
- package/blockly-rc/package.json +149 -0
- package/blockly-rc/patches/@microsoft+api-documenter+7.22.4.patch +81 -0
- package/blockly-rc/scripts/goog_module/convert-file.sh +406 -0
- package/blockly-rc/scripts/gulpfiles/appengine_tasks.js +195 -0
- package/blockly-rc/scripts/gulpfiles/build_tasks.js +752 -0
- package/blockly-rc/scripts/gulpfiles/config.js +41 -0
- package/blockly-rc/scripts/gulpfiles/docs_tasks.js +147 -0
- package/blockly-rc/scripts/gulpfiles/git_tasks.js +181 -0
- package/blockly-rc/scripts/gulpfiles/helper_tasks.js +19 -0
- package/blockly-rc/scripts/gulpfiles/package_tasks.js +262 -0
- package/blockly-rc/scripts/gulpfiles/release_tasks.js +183 -0
- package/blockly-rc/scripts/gulpfiles/test_tasks.js +405 -0
- package/blockly-rc/scripts/helpers.js +74 -0
- package/blockly-rc/scripts/i18n/common.py +233 -0
- package/blockly-rc/scripts/i18n/create_messages.py +167 -0
- package/blockly-rc/scripts/i18n/dedup_json.py +72 -0
- package/blockly-rc/scripts/i18n/js_to_json.py +135 -0
- package/blockly-rc/scripts/i18n/tests.py +46 -0
- package/blockly-rc/scripts/migration/cjs2esm +162 -0
- package/blockly-rc/scripts/migration/js2ts +168 -0
- package/blockly-rc/scripts/migration/renamings.json5 +1599 -0
- package/blockly-rc/scripts/package/README.md +93 -0
- package/blockly-rc/scripts/package/core-node.js +31 -0
- package/blockly-rc/scripts/package/index.js +23 -0
- package/blockly-rc/scripts/package/templates/umd-msg.template +16 -0
- package/blockly-rc/scripts/package/templates/umd.template +13 -0
- package/blockly-rc/scripts/themes/blockStyles_example.json +11 -0
- package/blockly-rc/scripts/themes/create_blockStyles.py +181 -0
- package/blockly-rc/scripts/tsick.js +86 -0
- package/blockly-rc/tests/.eslintrc.json +10 -0
- package/blockly-rc/tests/browser/.eslintrc.json +29 -0
- package/blockly-rc/tests/browser/.mocharc.js +6 -0
- package/blockly-rc/tests/browser/test/basic_block_factory_test.mjs +44 -0
- package/blockly-rc/tests/browser/test/basic_block_test.mjs +39 -0
- package/blockly-rc/tests/browser/test/basic_playground_test.mjs +198 -0
- package/blockly-rc/tests/browser/test/block_undo_test.mjs +50 -0
- package/blockly-rc/tests/browser/test/delete_blocks_test.mjs +211 -0
- package/blockly-rc/tests/browser/test/extensive_test.mjs +195 -0
- package/blockly-rc/tests/browser/test/field_edits_test.mjs +61 -0
- package/blockly-rc/tests/browser/test/hooks.mjs +23 -0
- package/blockly-rc/tests/browser/test/mutator_test.mjs +88 -0
- package/blockly-rc/tests/browser/test/procedure_test.mjs +109 -0
- package/blockly-rc/tests/browser/test/test_setup.mjs +589 -0
- package/blockly-rc/tests/browser/test/toolbox_drag_test.mjs +207 -0
- package/blockly-rc/tests/browser/test/workspace_comment_test.mjs +224 -0
- package/blockly-rc/tests/compile/index.html +43 -0
- package/blockly-rc/tests/compile/main.js +53 -0
- package/blockly-rc/tests/compile/test_blocks.js +47 -0
- package/blockly-rc/tests/compile/webdriver.js +81 -0
- package/blockly-rc/tests/generators/functions.xml +561 -0
- package/blockly-rc/tests/generators/golden/generated.dart +1604 -0
- package/blockly-rc/tests/generators/golden/generated.js +1552 -0
- package/blockly-rc/tests/generators/golden/generated.lua +1828 -0
- package/blockly-rc/tests/generators/golden/generated.php +1611 -0
- package/blockly-rc/tests/generators/golden/generated.py +1407 -0
- package/blockly-rc/tests/generators/index.html +405 -0
- package/blockly-rc/tests/generators/lists.xml +8675 -0
- package/blockly-rc/tests/generators/logic.xml +1019 -0
- package/blockly-rc/tests/generators/loops1.xml +345 -0
- package/blockly-rc/tests/generators/loops2.xml +891 -0
- package/blockly-rc/tests/generators/loops3.xml +735 -0
- package/blockly-rc/tests/generators/math.xml +2077 -0
- package/blockly-rc/tests/generators/text.xml +4651 -0
- package/blockly-rc/tests/generators/unittest.js +103 -0
- package/blockly-rc/tests/generators/unittest_dart.js +163 -0
- package/blockly-rc/tests/generators/unittest_javascript.js +167 -0
- package/blockly-rc/tests/generators/unittest_lua.js +165 -0
- package/blockly-rc/tests/generators/unittest_php.js +154 -0
- package/blockly-rc/tests/generators/unittest_python.js +138 -0
- package/blockly-rc/tests/generators/variables.xml +68 -0
- package/blockly-rc/tests/generators/webdriver.js +123 -0
- package/blockly-rc/tests/media/200px.png +0 -0
- package/blockly-rc/tests/media/30px.png +0 -0
- package/blockly-rc/tests/media/50px.png +0 -0
- package/blockly-rc/tests/media/a.png +0 -0
- package/blockly-rc/tests/media/arrow.png +0 -0
- package/blockly-rc/tests/media/b.png +0 -0
- package/blockly-rc/tests/media/c.png +0 -0
- package/blockly-rc/tests/media/d.png +0 -0
- package/blockly-rc/tests/media/e.png +0 -0
- package/blockly-rc/tests/media/f.png +0 -0
- package/blockly-rc/tests/media/g.png +0 -0
- package/blockly-rc/tests/media/h.png +0 -0
- package/blockly-rc/tests/media/i.png +0 -0
- package/blockly-rc/tests/media/j.png +0 -0
- package/blockly-rc/tests/media/k.png +0 -0
- package/blockly-rc/tests/media/l.png +0 -0
- package/blockly-rc/tests/media/m.png +0 -0
- package/blockly-rc/tests/migration/renamings.schema.json +59 -0
- package/blockly-rc/tests/migration/validate-renamings.mjs +60 -0
- package/blockly-rc/tests/mocha/.eslintrc.json +21 -0
- package/blockly-rc/tests/mocha/.mocharc.js +6 -0
- package/blockly-rc/tests/mocha/astnode_test.js +850 -0
- package/blockly-rc/tests/mocha/block_json_test.js +777 -0
- package/blockly-rc/tests/mocha/block_test.js +2743 -0
- package/blockly-rc/tests/mocha/blocks/lists_test.js +196 -0
- package/blockly-rc/tests/mocha/blocks/logic_ternary_test.js +320 -0
- package/blockly-rc/tests/mocha/blocks/loops_test.js +56 -0
- package/blockly-rc/tests/mocha/blocks/procedures_test.js +2495 -0
- package/blockly-rc/tests/mocha/blocks/variables_test.js +311 -0
- package/blockly-rc/tests/mocha/clipboard_test.js +136 -0
- package/blockly-rc/tests/mocha/comment_deserialization_test.js +122 -0
- package/blockly-rc/tests/mocha/comment_test.js +170 -0
- package/blockly-rc/tests/mocha/comment_view_test.js +188 -0
- package/blockly-rc/tests/mocha/connection_checker_test.js +666 -0
- package/blockly-rc/tests/mocha/connection_db_test.js +362 -0
- package/blockly-rc/tests/mocha/connection_test.js +3738 -0
- package/blockly-rc/tests/mocha/contextmenu_items_test.js +488 -0
- package/blockly-rc/tests/mocha/contextmenu_test.js +71 -0
- package/blockly-rc/tests/mocha/cursor_test.js +134 -0
- package/blockly-rc/tests/mocha/dropdowndiv_test.js +116 -0
- package/blockly-rc/tests/mocha/event_block_change_test.js +126 -0
- package/blockly-rc/tests/mocha/event_block_create_test.js +109 -0
- package/blockly-rc/tests/mocha/event_block_delete_test.js +55 -0
- package/blockly-rc/tests/mocha/event_block_drag_test.js +36 -0
- package/blockly-rc/tests/mocha/event_block_field_intermediate_change_test.js +67 -0
- package/blockly-rc/tests/mocha/event_block_move_test.js +39 -0
- package/blockly-rc/tests/mocha/event_bubble_open_test.js +42 -0
- package/blockly-rc/tests/mocha/event_click_test.js +40 -0
- package/blockly-rc/tests/mocha/event_comment_change_test.js +39 -0
- package/blockly-rc/tests/mocha/event_comment_collapse_test.js +34 -0
- package/blockly-rc/tests/mocha/event_comment_create_test.js +38 -0
- package/blockly-rc/tests/mocha/event_comment_delete_test.js +38 -0
- package/blockly-rc/tests/mocha/event_comment_drag_test.js +35 -0
- package/blockly-rc/tests/mocha/event_comment_move_test.js +40 -0
- package/blockly-rc/tests/mocha/event_comment_resize_test.js +38 -0
- package/blockly-rc/tests/mocha/event_marker_move_test.js +44 -0
- package/blockly-rc/tests/mocha/event_selected_test.js +41 -0
- package/blockly-rc/tests/mocha/event_test.js +1578 -0
- package/blockly-rc/tests/mocha/event_theme_change_test.js +36 -0
- package/blockly-rc/tests/mocha/event_toolbox_item_select_test.js +64 -0
- package/blockly-rc/tests/mocha/event_trashcan_open_test.js +36 -0
- package/blockly-rc/tests/mocha/event_var_create_test.js +54 -0
- package/blockly-rc/tests/mocha/event_var_delete_test.js +54 -0
- package/blockly-rc/tests/mocha/event_var_rename_test.js +39 -0
- package/blockly-rc/tests/mocha/event_var_type_change_test.js +43 -0
- package/blockly-rc/tests/mocha/event_viewport_test.js +39 -0
- package/blockly-rc/tests/mocha/extensions_test.js +613 -0
- package/blockly-rc/tests/mocha/field_checkbox_test.js +299 -0
- package/blockly-rc/tests/mocha/field_colour_test.js +395 -0
- package/blockly-rc/tests/mocha/field_dropdown_test.js +282 -0
- package/blockly-rc/tests/mocha/field_image_test.js +241 -0
- package/blockly-rc/tests/mocha/field_label_serializable_test.js +252 -0
- package/blockly-rc/tests/mocha/field_label_test.js +226 -0
- package/blockly-rc/tests/mocha/field_number_test.js +505 -0
- package/blockly-rc/tests/mocha/field_registry_test.js +116 -0
- package/blockly-rc/tests/mocha/field_test.js +822 -0
- package/blockly-rc/tests/mocha/field_textinput_test.js +297 -0
- package/blockly-rc/tests/mocha/field_variable_test.js +611 -0
- package/blockly-rc/tests/mocha/flyout_test.js +638 -0
- package/blockly-rc/tests/mocha/generator_test.js +233 -0
- package/blockly-rc/tests/mocha/gesture_test.js +97 -0
- package/blockly-rc/tests/mocha/icon_test.js +369 -0
- package/blockly-rc/tests/mocha/index.html +229 -0
- package/blockly-rc/tests/mocha/input_test.js +296 -0
- package/blockly-rc/tests/mocha/insertion_marker_manager_test.js +443 -0
- package/blockly-rc/tests/mocha/insertion_marker_test.js +432 -0
- package/blockly-rc/tests/mocha/jso_deserialization_test.js +849 -0
- package/blockly-rc/tests/mocha/jso_serialization_test.js +1067 -0
- package/blockly-rc/tests/mocha/json_test.js +315 -0
- package/blockly-rc/tests/mocha/keydown_test.js +364 -0
- package/blockly-rc/tests/mocha/layering_test.js +95 -0
- package/blockly-rc/tests/mocha/metrics_test.js +671 -0
- package/blockly-rc/tests/mocha/mutator_test.js +87 -0
- package/blockly-rc/tests/mocha/names_test.js +97 -0
- package/blockly-rc/tests/mocha/old_workspace_comment_test.js +256 -0
- package/blockly-rc/tests/mocha/procedure_map_test.js +57 -0
- package/blockly-rc/tests/mocha/registry_test.js +281 -0
- package/blockly-rc/tests/mocha/render_management_test.js +127 -0
- package/blockly-rc/tests/mocha/serializer_test.js +2104 -0
- package/blockly-rc/tests/mocha/shortcut_registry_test.js +450 -0
- package/blockly-rc/tests/mocha/test_helpers/block_definitions.js +204 -0
- package/blockly-rc/tests/mocha/test_helpers/code_generation.js +115 -0
- package/blockly-rc/tests/mocha/test_helpers/common.js +106 -0
- package/blockly-rc/tests/mocha/test_helpers/events.js +290 -0
- package/blockly-rc/tests/mocha/test_helpers/fields.js +310 -0
- package/blockly-rc/tests/mocha/test_helpers/icon_mocks.js +81 -0
- package/blockly-rc/tests/mocha/test_helpers/procedures.js +302 -0
- package/blockly-rc/tests/mocha/test_helpers/serialization.js +124 -0
- package/blockly-rc/tests/mocha/test_helpers/setup_teardown.js +209 -0
- package/blockly-rc/tests/mocha/test_helpers/toolbox_definitions.js +271 -0
- package/blockly-rc/tests/mocha/test_helpers/user_input.js +62 -0
- package/blockly-rc/tests/mocha/test_helpers/variables.js +23 -0
- package/blockly-rc/tests/mocha/test_helpers/warnings.js +83 -0
- package/blockly-rc/tests/mocha/test_helpers/workspace.js +1691 -0
- package/blockly-rc/tests/mocha/theme_test.js +307 -0
- package/blockly-rc/tests/mocha/toolbox_test.js +761 -0
- package/blockly-rc/tests/mocha/tooltip_test.js +276 -0
- package/blockly-rc/tests/mocha/touch_test.js +109 -0
- package/blockly-rc/tests/mocha/trashcan_test.js +375 -0
- package/blockly-rc/tests/mocha/utils_test.js +536 -0
- package/blockly-rc/tests/mocha/variable_map_test.js +509 -0
- package/blockly-rc/tests/mocha/variable_model_test.js +85 -0
- package/blockly-rc/tests/mocha/webdriver.js +96 -0
- package/blockly-rc/tests/mocha/widget_div_test.js +272 -0
- package/blockly-rc/tests/mocha/workspace_comment_test.js +171 -0
- package/blockly-rc/tests/mocha/workspace_svg_test.js +414 -0
- package/blockly-rc/tests/mocha/workspace_test.js +27 -0
- package/blockly-rc/tests/mocha/xml_test.js +951 -0
- package/blockly-rc/tests/mocha/zoom_controls_test.js +81 -0
- package/blockly-rc/tests/multi_playground.html +482 -0
- package/blockly-rc/tests/node/.eslintrc.json +12 -0
- package/blockly-rc/tests/node/.mocharc.js +6 -0
- package/blockly-rc/tests/node/run_node_test.mjs +72 -0
- package/blockly-rc/tests/playground.html +1280 -0
- package/blockly-rc/tests/playgrounds/advanced_playground.html +158 -0
- package/blockly-rc/tests/playgrounds/iframe.html +40 -0
- package/blockly-rc/tests/playgrounds/screenshot.js +123 -0
- package/blockly-rc/tests/scripts/check_metadata.sh +166 -0
- package/blockly-rc/tests/scripts/compile_typings.sh +32 -0
- package/blockly-rc/tests/scripts/load.mjs +140 -0
- package/blockly-rc/tests/scripts/setup_linux_env.sh +7 -0
- package/blockly-rc/tests/scripts/update_metadata.sh +46 -0
- package/blockly-rc/tests/themes/test_themes.js +62 -0
- package/blockly-rc/tests/typescript/README.md +4 -0
- package/blockly-rc/tests/typescript/src/field/different_user_input.ts +81 -0
- package/blockly-rc/tests/typescript/src/generators/dart.ts +24 -0
- package/blockly-rc/tests/typescript/src/generators/javascript.ts +28 -0
- package/blockly-rc/tests/typescript/src/generators/lua.ts +24 -0
- package/blockly-rc/tests/typescript/src/generators/php.ts +24 -0
- package/blockly-rc/tests/typescript/src/generators/python.ts +24 -0
- package/blockly-rc/tests/typescript/src/generators.ts +31 -0
- package/blockly-rc/tests/typescript/src/msg.ts +20 -0
- package/blockly-rc/tests/typescript/tsconfig.json +20 -0
- package/blockly-rc/tests/xml/README.txt +11 -0
- package/blockly-rc/tests/xml/blockly.xsd +178 -0
- package/blockly-rc/tests/xml/invalid.xml +6 -0
- package/blockly-rc/tests/xml/toolbox.xml +311 -0
- package/blockly-rc/tests/xml/workspace.xml +114 -0
- package/blockly-rc/tsconfig.json +37 -0
- package/blockly-rc/tsdoc.json +35 -0
- package/blockly-rc/typings/README.md +5 -0
- package/blockly-rc/typings/blocks.d.ts +17 -0
- package/blockly-rc/typings/core.d.ts +7 -0
- package/blockly-rc/typings/dart.d.ts +7 -0
- package/blockly-rc/typings/index.d.ts +10 -0
- package/blockly-rc/typings/javascript.d.ts +7 -0
- package/blockly-rc/typings/lua.d.ts +7 -0
- package/blockly-rc/typings/msg/ab.d.ts +8 -0
- package/blockly-rc/typings/msg/ace.d.ts +8 -0
- package/blockly-rc/typings/msg/af.d.ts +8 -0
- package/blockly-rc/typings/msg/am.d.ts +8 -0
- package/blockly-rc/typings/msg/ar.d.ts +8 -0
- package/blockly-rc/typings/msg/ast.d.ts +8 -0
- package/blockly-rc/typings/msg/az.d.ts +8 -0
- package/blockly-rc/typings/msg/ba.d.ts +8 -0
- package/blockly-rc/typings/msg/bcc.d.ts +8 -0
- package/blockly-rc/typings/msg/be-tarask.d.ts +8 -0
- package/blockly-rc/typings/msg/be.d.ts +8 -0
- package/blockly-rc/typings/msg/bg.d.ts +8 -0
- package/blockly-rc/typings/msg/bn.d.ts +8 -0
- package/blockly-rc/typings/msg/br.d.ts +8 -0
- package/blockly-rc/typings/msg/bs.d.ts +8 -0
- package/blockly-rc/typings/msg/ca.d.ts +8 -0
- package/blockly-rc/typings/msg/cdo.d.ts +8 -0
- package/blockly-rc/typings/msg/ce.d.ts +8 -0
- package/blockly-rc/typings/msg/cs.d.ts +8 -0
- package/blockly-rc/typings/msg/da.d.ts +8 -0
- package/blockly-rc/typings/msg/de.d.ts +8 -0
- package/blockly-rc/typings/msg/diq.d.ts +8 -0
- package/blockly-rc/typings/msg/dtp.d.ts +8 -0
- package/blockly-rc/typings/msg/dty.d.ts +8 -0
- package/blockly-rc/typings/msg/ee.d.ts +8 -0
- package/blockly-rc/typings/msg/el.d.ts +8 -0
- package/blockly-rc/typings/msg/en-gb.d.ts +8 -0
- package/blockly-rc/typings/msg/en.d.ts +8 -0
- package/blockly-rc/typings/msg/eo.d.ts +8 -0
- package/blockly-rc/typings/msg/es.d.ts +8 -0
- package/blockly-rc/typings/msg/et.d.ts +8 -0
- package/blockly-rc/typings/msg/eu.d.ts +8 -0
- package/blockly-rc/typings/msg/fa.d.ts +8 -0
- package/blockly-rc/typings/msg/fi.d.ts +8 -0
- package/blockly-rc/typings/msg/fo.d.ts +8 -0
- package/blockly-rc/typings/msg/fr.d.ts +8 -0
- package/blockly-rc/typings/msg/frr.d.ts +8 -0
- package/blockly-rc/typings/msg/gl.d.ts +8 -0
- package/blockly-rc/typings/msg/gn.d.ts +8 -0
- package/blockly-rc/typings/msg/gor.d.ts +8 -0
- package/blockly-rc/typings/msg/ha.d.ts +8 -0
- package/blockly-rc/typings/msg/hak.d.ts +8 -0
- package/blockly-rc/typings/msg/he.d.ts +8 -0
- package/blockly-rc/typings/msg/hi.d.ts +8 -0
- package/blockly-rc/typings/msg/hr.d.ts +8 -0
- package/blockly-rc/typings/msg/hrx.d.ts +8 -0
- package/blockly-rc/typings/msg/hsb.d.ts +8 -0
- package/blockly-rc/typings/msg/hu.d.ts +8 -0
- package/blockly-rc/typings/msg/hy.d.ts +8 -0
- package/blockly-rc/typings/msg/ia.d.ts +8 -0
- package/blockly-rc/typings/msg/id.d.ts +8 -0
- package/blockly-rc/typings/msg/ig.d.ts +8 -0
- package/blockly-rc/typings/msg/inh.d.ts +8 -0
- package/blockly-rc/typings/msg/is.d.ts +8 -0
- package/blockly-rc/typings/msg/it.d.ts +8 -0
- package/blockly-rc/typings/msg/ja.d.ts +8 -0
- package/blockly-rc/typings/msg/ka.d.ts +8 -0
- package/blockly-rc/typings/msg/kab.d.ts +8 -0
- package/blockly-rc/typings/msg/kbd-cyrl.d.ts +8 -0
- package/blockly-rc/typings/msg/km.d.ts +8 -0
- package/blockly-rc/typings/msg/kn.d.ts +8 -0
- package/blockly-rc/typings/msg/ko.d.ts +8 -0
- package/blockly-rc/typings/msg/ksh.d.ts +8 -0
- package/blockly-rc/typings/msg/ku-latn.d.ts +8 -0
- package/blockly-rc/typings/msg/ky.d.ts +8 -0
- package/blockly-rc/typings/msg/la.d.ts +8 -0
- package/blockly-rc/typings/msg/lb.d.ts +8 -0
- package/blockly-rc/typings/msg/lki.d.ts +8 -0
- package/blockly-rc/typings/msg/lo.d.ts +8 -0
- package/blockly-rc/typings/msg/lrc.d.ts +8 -0
- package/blockly-rc/typings/msg/lt.d.ts +8 -0
- package/blockly-rc/typings/msg/lv.d.ts +8 -0
- package/blockly-rc/typings/msg/mg.d.ts +8 -0
- package/blockly-rc/typings/msg/mk.d.ts +8 -0
- package/blockly-rc/typings/msg/ml.d.ts +8 -0
- package/blockly-rc/typings/msg/mnw.d.ts +8 -0
- package/blockly-rc/typings/msg/ms.d.ts +8 -0
- package/blockly-rc/typings/msg/msg.d.ts +440 -0
- package/blockly-rc/typings/msg/my.d.ts +8 -0
- package/blockly-rc/typings/msg/mzn.d.ts +8 -0
- package/blockly-rc/typings/msg/nb.d.ts +8 -0
- package/blockly-rc/typings/msg/ne.d.ts +8 -0
- package/blockly-rc/typings/msg/nl.d.ts +8 -0
- package/blockly-rc/typings/msg/oc.d.ts +8 -0
- package/blockly-rc/typings/msg/olo.d.ts +8 -0
- package/blockly-rc/typings/msg/pa.d.ts +8 -0
- package/blockly-rc/typings/msg/pl.d.ts +8 -0
- package/blockly-rc/typings/msg/pms.d.ts +8 -0
- package/blockly-rc/typings/msg/ps.d.ts +8 -0
- package/blockly-rc/typings/msg/pt-br.d.ts +8 -0
- package/blockly-rc/typings/msg/pt.d.ts +8 -0
- package/blockly-rc/typings/msg/ro.d.ts +8 -0
- package/blockly-rc/typings/msg/ru.d.ts +8 -0
- package/blockly-rc/typings/msg/sc.d.ts +8 -0
- package/blockly-rc/typings/msg/sco.d.ts +8 -0
- package/blockly-rc/typings/msg/sd.d.ts +8 -0
- package/blockly-rc/typings/msg/shn.d.ts +8 -0
- package/blockly-rc/typings/msg/si.d.ts +8 -0
- package/blockly-rc/typings/msg/sk.d.ts +8 -0
- package/blockly-rc/typings/msg/skr-arab.d.ts +8 -0
- package/blockly-rc/typings/msg/sl.d.ts +8 -0
- package/blockly-rc/typings/msg/smn.d.ts +8 -0
- package/blockly-rc/typings/msg/sq.d.ts +8 -0
- package/blockly-rc/typings/msg/sr-latn.d.ts +8 -0
- package/blockly-rc/typings/msg/sr.d.ts +8 -0
- package/blockly-rc/typings/msg/sv.d.ts +8 -0
- package/blockly-rc/typings/msg/sw.d.ts +8 -0
- package/blockly-rc/typings/msg/ta.d.ts +8 -0
- package/blockly-rc/typings/msg/tcy.d.ts +8 -0
- package/blockly-rc/typings/msg/tdd.d.ts +8 -0
- package/blockly-rc/typings/msg/te.d.ts +8 -0
- package/blockly-rc/typings/msg/th.d.ts +8 -0
- package/blockly-rc/typings/msg/ti.d.ts +8 -0
- package/blockly-rc/typings/msg/tl.d.ts +8 -0
- package/blockly-rc/typings/msg/tlh.d.ts +8 -0
- package/blockly-rc/typings/msg/tr.d.ts +8 -0
- package/blockly-rc/typings/msg/ug-arab.d.ts +8 -0
- package/blockly-rc/typings/msg/uk.d.ts +8 -0
- package/blockly-rc/typings/msg/ur.d.ts +8 -0
- package/blockly-rc/typings/msg/uz.d.ts +8 -0
- package/blockly-rc/typings/msg/vi.d.ts +8 -0
- package/blockly-rc/typings/msg/xmf.d.ts +8 -0
- package/blockly-rc/typings/msg/yo.d.ts +8 -0
- package/blockly-rc/typings/msg/zgh.d.ts +8 -0
- package/blockly-rc/typings/msg/zh-hans.d.ts +8 -0
- package/blockly-rc/typings/msg/zh-hant.d.ts +8 -0
- package/blockly-rc/typings/php.d.ts +7 -0
- package/blockly-rc/typings/python.d.ts +7 -0
- package/blockly-rc/typings/templates/blockly-header.template +11 -0
- package/blockly-rc/typings/templates/blockly-interfaces.template +83 -0
- package/blockly-rc/typings/templates/msg.template +15 -0
- package/blockly-rc/typings/tsconfig.json +23 -0
- package/continuous-toolbox.d.ts +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.LICENSE.txt +163 -0
- package/media/delete-icon.svg +10 -0
- package/media/resize-handle.svg +3 -0
- package/msg/scratch_msgs.js +184 -164
- package/package.json +25 -40
- package/release.config.js +8 -0
- package/src/block_reporting.js +31 -0
- package/src/blocks/colour.js +56 -0
- package/src/blocks/control.js +492 -0
- package/src/blocks/data.js +690 -0
- package/src/blocks/event.js +305 -0
- package/src/blocks/looks.js +537 -0
- package/src/blocks/math.js +137 -0
- package/src/blocks/matrix.js +47 -0
- package/src/blocks/motion.js +513 -0
- package/src/blocks/note.js +48 -0
- package/src/blocks/operators.js +463 -0
- package/src/blocks/procedures.js +1009 -0
- package/src/blocks/sensing.js +441 -0
- package/src/blocks/sound.js +205 -0
- package/src/blocks/text.js +45 -0
- package/src/blocks/vertical_extensions.js +309 -0
- package/src/categories.js +15 -0
- package/src/checkable_continuous_flyout.js +138 -0
- package/src/checkbox_bubble.js +282 -0
- package/src/colours.js +77 -0
- package/src/constants.js +63 -0
- package/src/context_menu_items.js +150 -0
- package/src/css.js +1197 -0
- package/src/data_category.js +556 -0
- package/src/events/events_block_comment_base.js +35 -0
- package/src/events/events_block_comment_change.js +43 -0
- package/src/events/events_block_comment_collapse.js +43 -0
- package/src/events/events_block_comment_create.js +52 -0
- package/src/events/events_block_comment_delete.js +27 -0
- package/src/events/events_block_comment_move.js +54 -0
- package/src/events/events_block_comment_resize.js +52 -0
- package/src/events/events_block_drag_end.js +33 -0
- package/src/events/events_block_drag_outside.js +30 -0
- package/src/events/events_scratch_variable_create.js +67 -0
- package/src/fields/field_angle.js +433 -0
- package/src/fields/field_colour_slider.js +388 -0
- package/src/fields/field_dropdown.js +42 -0
- package/src/fields/field_matrix.js +634 -0
- package/src/fields/field_note.js +937 -0
- package/src/fields/field_number.js +380 -0
- package/src/fields/field_textinput_removable.js +107 -0
- package/src/fields/field_variable.js +171 -0
- package/src/fields/field_variable_getter.js +109 -0
- package/src/fields/field_vertical_separator.js +139 -0
- package/src/flyout_checkbox_icon.js +88 -0
- package/src/glows.js +98 -0
- package/src/index.ts +137 -0
- package/src/procedures.js +425 -0
- package/src/recyclable_block_flyout_inflater.js +194 -0
- package/src/renderer/bowler_hat.js +17 -0
- package/src/renderer/constants.js +45 -0
- package/src/renderer/drawer.js +51 -0
- package/src/renderer/path_object.js +35 -0
- package/src/renderer/render_info.js +98 -0
- package/src/renderer/renderer.js +74 -0
- package/src/scratch_block_paster.js +46 -0
- package/src/scratch_blocks_utils.js +148 -0
- package/src/scratch_comment_bubble.js +169 -0
- package/src/scratch_comment_icon.js +195 -0
- package/src/scratch_connection_checker.js +29 -0
- package/src/scratch_continuous_category.js +80 -0
- package/src/scratch_continuous_toolbox.js +78 -0
- package/src/scratch_dragger.js +142 -0
- package/src/scratch_variable_map.js +25 -0
- package/src/scratch_variable_model.js +24 -0
- package/src/shadows.js +61 -0
- package/src/status_indicator_label.js +186 -0
- package/src/status_indicator_label_flyout_inflater.js +42 -0
- package/src/variables.js +355 -0
- package/temp-use-blockly-v12-rc.sh +26 -0
- package/tsconfig.json +13 -0
- package/blockly_compressed_horizontal.js +0 -2255
- package/blockly_compressed_vertical.js +0 -2283
- package/blockly_uncompressed_horizontal.js +0 -1210
- package/blockly_uncompressed_vertical.js +0 -1210
- package/blocks_common/colour.js +0 -61
- package/blocks_common/math.js +0 -159
- package/blocks_common/matrix.js +0 -54
- package/blocks_common/note.js +0 -58
- package/blocks_common/text.js +0 -57
- package/blocks_compressed.js +0 -36
- package/blocks_compressed_horizontal.js +0 -67
- package/blocks_compressed_vertical.js +0 -208
- package/blocks_horizontal/control.js +0 -212
- package/blocks_horizontal/default_toolbox.js +0 -139
- package/blocks_horizontal/event.js +0 -190
- package/blocks_horizontal/wedo.js +0 -325
- package/blocks_vertical/control.js +0 -532
- package/blocks_vertical/data.js +0 -666
- package/blocks_vertical/default_toolbox.js +0 -564
- package/blocks_vertical/event.js +0 -329
- package/blocks_vertical/extensions.js +0 -294
- package/blocks_vertical/looks.js +0 -591
- package/blocks_vertical/motion.js +0 -587
- package/blocks_vertical/operators.js +0 -470
- package/blocks_vertical/procedures.js +0 -973
- package/blocks_vertical/sensing.js +0 -539
- package/blocks_vertical/sound.js +0 -246
- package/blocks_vertical/vertical_extensions.js +0 -266
- package/build/gen_blocks.js +0 -1
- package/build/test_expect.js +0 -1
- package/build/test_input.js +0 -1
- package/build.py +0 -636
- package/cleanup.sh +0 -101
- package/core/block.js +0 -1837
- package/core/block_animations.js +0 -107
- package/core/block_drag_surface.js +0 -299
- package/core/block_dragger.js +0 -421
- package/core/block_events.js +0 -531
- package/core/block_render_svg_horizontal.js +0 -890
- package/core/block_render_svg_vertical.js +0 -1732
- package/core/block_svg.js +0 -1316
- package/core/blockly.js +0 -622
- package/core/blocks.js +0 -37
- package/core/bubble.js +0 -664
- package/core/bubble_dragger.js +0 -285
- package/core/colours.js +0 -160
- package/core/comment.js +0 -293
- package/core/comment_events.js +0 -539
- package/core/connection.js +0 -766
- package/core/connection_db.js +0 -300
- package/core/constants.js +0 -387
- package/core/contextmenu.js +0 -519
- package/core/css.js +0 -1351
- package/core/data_category.js +0 -490
- package/core/dragged_connection_manager.js +0 -260
- package/core/dropdowndiv.js +0 -408
- package/core/events.js +0 -429
- package/core/events_abstract.js +0 -113
- package/core/extensions.js +0 -450
- package/core/field.js +0 -807
- package/core/field_angle.js +0 -398
- package/core/field_checkbox.js +0 -133
- package/core/field_colour.js +0 -253
- package/core/field_colour_slider.js +0 -387
- package/core/field_date.js +0 -353
- package/core/field_dropdown.js +0 -483
- package/core/field_iconmenu.js +0 -309
- package/core/field_image.js +0 -193
- package/core/field_label.js +0 -136
- package/core/field_label_serializable.js +0 -125
- package/core/field_matrix.js +0 -566
- package/core/field_note.js +0 -850
- package/core/field_number.js +0 -366
- package/core/field_numberdropdown.js +0 -77
- package/core/field_textdropdown.js +0 -164
- package/core/field_textinput.js +0 -675
- package/core/field_textinput_removable.js +0 -105
- package/core/field_variable.js +0 -385
- package/core/field_variable_getter.js +0 -185
- package/core/field_vertical_separator.js +0 -161
- package/core/flyout_base.js +0 -923
- package/core/flyout_button.js +0 -322
- package/core/flyout_dragger.js +0 -83
- package/core/flyout_extension_category_header.js +0 -159
- package/core/flyout_horizontal.js +0 -475
- package/core/flyout_vertical.js +0 -770
- package/core/generator.js +0 -426
- package/core/gesture.js +0 -1011
- package/core/grid.js +0 -227
- package/core/icon.js +0 -205
- package/core/inject.js +0 -491
- package/core/input.js +0 -285
- package/core/insertion_marker_manager.js +0 -678
- package/core/msg.js +0 -62
- package/core/mutator.js +0 -426
- package/core/names.js +0 -198
- package/core/options.js +0 -244
- package/core/procedures.js +0 -577
- package/core/rendered_connection.js +0 -417
- package/core/scratch_block_comment.js +0 -653
- package/core/scratch_blocks_utils.js +0 -244
- package/core/scratch_bubble.js +0 -696
- package/core/scratch_events.js +0 -131
- package/core/scratch_msgs.js +0 -85
- package/core/scrollbar.js +0 -875
- package/core/toolbox.js +0 -801
- package/core/tooltip.js +0 -337
- package/core/touch.js +0 -226
- package/core/trashcan.js +0 -343
- package/core/ui_events.js +0 -91
- package/core/ui_menu_utils.js +0 -68
- package/core/utils.js +0 -948
- package/core/variable_events.js +0 -259
- package/core/variable_map.js +0 -415
- package/core/variable_model.js +0 -116
- package/core/variables.js +0 -674
- package/core/warning.js +0 -199
- package/core/widgetdiv.js +0 -344
- package/core/workspace.js +0 -673
- package/core/workspace_audio.js +0 -170
- package/core/workspace_comment.js +0 -432
- package/core/workspace_comment_render_svg.js +0 -723
- package/core/workspace_comment_svg.js +0 -611
- package/core/workspace_drag_surface_svg.js +0 -195
- package/core/workspace_dragger.js +0 -132
- package/core/workspace_svg.js +0 -2267
- package/core/xml.js +0 -919
- package/core/zoom_controls.js +0 -301
- package/dist/horizontal.js +0 -222
- package/dist/vertical.js +0 -222
- package/dist/web/horizontal.js +0 -232
- package/dist/web/vertical.js +0 -232
- package/local_build.sh +0 -70
- package/pack/scratch-blocks-1.1.206.tgz +0 -0
- package/pull_from_blockly.sh +0 -151
- package/shim/blockly_compressed_horizontal-blocks_compressed.js +0 -1
- package/shim/blockly_compressed_horizontal.Blockly.js +0 -1
- package/shim/blockly_compressed_horizontal.goog.js +0 -1
- package/shim/blockly_compressed_horizontal.js +0 -1
- package/shim/blockly_compressed_vertical-blocks_compressed.js +0 -1
- package/shim/blockly_compressed_vertical.Blockly.js +0 -1
- package/shim/blockly_compressed_vertical.goog.js +0 -1
- package/shim/blockly_compressed_vertical.js +0 -1
- package/shim/blocks_compressed_horizontal-blockly_compressed_horizontal-messages.js +0 -1
- package/shim/blocks_compressed_horizontal.js +0 -1
- package/shim/blocks_compressed_vertical-blockly_compressed_vertical-messages.js +0 -1
- package/shim/blocks_compressed_vertical.js +0 -1
- package/shim/gh-pages.js +0 -1
- package/shim/horizontal.js +0 -1
- package/shim/index.js +0 -17
- package/shim/vertical.js +0 -1
- /package/media/{comment-arrow-down.svg → foldout-icon.svg} +0 -0
|
@@ -0,0 +1,1691 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {assert} from '../../../node_modules/chai/chai.js';
|
|
8
|
+
import {assertVariableValues} from './variables.js';
|
|
9
|
+
import {assertWarnings} from './warnings.js';
|
|
10
|
+
import * as eventUtils from '../../../build/src/core/events/utils.js';
|
|
11
|
+
import {workspaceTeardown} from './setup_teardown.js';
|
|
12
|
+
|
|
13
|
+
export function testAWorkspace() {
|
|
14
|
+
setup(function () {
|
|
15
|
+
Blockly.defineBlocksWithJsonArray([
|
|
16
|
+
{
|
|
17
|
+
'type': 'get_var_block',
|
|
18
|
+
'message0': '%1',
|
|
19
|
+
'args0': [
|
|
20
|
+
{
|
|
21
|
+
'type': 'field_variable',
|
|
22
|
+
'name': 'VAR',
|
|
23
|
+
'variableTypes': ['', 'type1', 'type2'],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
]);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
teardown(function () {
|
|
31
|
+
// Clear Blockly.Event state.
|
|
32
|
+
eventUtils.setGroup(false);
|
|
33
|
+
while (!eventUtils.isEnabled()) {
|
|
34
|
+
eventUtils.enable();
|
|
35
|
+
}
|
|
36
|
+
sinon.restore();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
function assertBlockVarModelName(workspace, blockIndex, name) {
|
|
40
|
+
const block = workspace.getTopBlocks(false)[blockIndex];
|
|
41
|
+
assert.exists(block, 'Block at topBlocks[' + blockIndex + ']');
|
|
42
|
+
const varModel = block.getVarModels()[0];
|
|
43
|
+
assert.exists(
|
|
44
|
+
varModel,
|
|
45
|
+
'VariableModel for block at topBlocks[' + blockIndex + ']',
|
|
46
|
+
);
|
|
47
|
+
const blockVarName = varModel.name;
|
|
48
|
+
assert.equal(
|
|
49
|
+
blockVarName,
|
|
50
|
+
name,
|
|
51
|
+
'VariableModel name for block at topBlocks[' + blockIndex + ']',
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function createVarBlocksNoEvents(workspace, ids) {
|
|
56
|
+
const blocks = [];
|
|
57
|
+
// Turn off events to avoid testing XML at the same time.
|
|
58
|
+
eventUtils.disable();
|
|
59
|
+
for (let i = 0, id; (id = ids[i]); i++) {
|
|
60
|
+
const block = new Blockly.Block(workspace, 'get_var_block');
|
|
61
|
+
block.inputList[0].fieldRow[0].setValue(id);
|
|
62
|
+
blocks.push(block);
|
|
63
|
+
}
|
|
64
|
+
eventUtils.enable();
|
|
65
|
+
return blocks;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
suite('clear', function () {
|
|
69
|
+
test('Trivial', function () {
|
|
70
|
+
sinon.stub(eventUtils.TEST_ONLY, 'setGroupInternal').returns(null);
|
|
71
|
+
this.workspace.createVariable('name1', 'type1', 'id1');
|
|
72
|
+
this.workspace.createVariable('name2', 'type2', 'id2');
|
|
73
|
+
this.workspace.newBlock('');
|
|
74
|
+
|
|
75
|
+
this.workspace.clear();
|
|
76
|
+
assert.equal(this.workspace.getTopBlocks(false).length, 0);
|
|
77
|
+
const varMapLength = this.workspace.getVariableMap().variableMap.size;
|
|
78
|
+
assert.equal(varMapLength, 0);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test('No variables', function () {
|
|
82
|
+
sinon.stub(eventUtils.TEST_ONLY, 'setGroupInternal').returns(null);
|
|
83
|
+
this.workspace.newBlock('');
|
|
84
|
+
|
|
85
|
+
this.workspace.clear();
|
|
86
|
+
assert.equal(this.workspace.getTopBlocks(false).length, 0);
|
|
87
|
+
const varMapLength = this.workspace.getVariableMap().variableMap.size;
|
|
88
|
+
assert.equal(varMapLength, 0);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
suite('deleteVariable', function () {
|
|
93
|
+
setup(function () {
|
|
94
|
+
// Create two variables of different types.
|
|
95
|
+
this.var1 = this.workspace.createVariable('name1', 'type1', 'id1');
|
|
96
|
+
this.var2 = this.workspace.createVariable('name2', 'type2', 'id2');
|
|
97
|
+
// Create blocks to refer to both of them.
|
|
98
|
+
createVarBlocksNoEvents(this.workspace, ['id1', 'id1', 'id2']);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test('deleteVariableById(id2) one usage', function () {
|
|
102
|
+
// Deleting variable one usage should not trigger confirm dialog.
|
|
103
|
+
const stub = sinon
|
|
104
|
+
.stub(Blockly.dialog.TEST_ONLY, 'confirmInternal')
|
|
105
|
+
.callsArgWith(1, true);
|
|
106
|
+
this.workspace.deleteVariableById('id2');
|
|
107
|
+
|
|
108
|
+
sinon.assert.notCalled(stub);
|
|
109
|
+
const variable = this.workspace.getVariableById('id2');
|
|
110
|
+
assert.isNull(variable);
|
|
111
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
112
|
+
assertBlockVarModelName(this.workspace, 0, 'name1');
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test('deleteVariableById(id1) multiple usages confirm', function () {
|
|
116
|
+
// Deleting variable with multiple usages triggers confirm dialog.
|
|
117
|
+
const stub = sinon
|
|
118
|
+
.stub(Blockly.dialog.TEST_ONLY, 'confirmInternal')
|
|
119
|
+
.callsArgWith(1, true);
|
|
120
|
+
this.workspace.deleteVariableById('id1');
|
|
121
|
+
|
|
122
|
+
sinon.assert.calledOnce(stub);
|
|
123
|
+
const variable = this.workspace.getVariableById('id1');
|
|
124
|
+
assert.isNull(variable);
|
|
125
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
126
|
+
assertBlockVarModelName(this.workspace, 0, 'name2');
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
test('deleteVariableById(id1) multiple usages cancel', function () {
|
|
130
|
+
// Deleting variable with multiple usages triggers confirm dialog.
|
|
131
|
+
const stub = sinon
|
|
132
|
+
.stub(Blockly.dialog.TEST_ONLY, 'confirmInternal')
|
|
133
|
+
.callsArgWith(1, false);
|
|
134
|
+
this.workspace.deleteVariableById('id1');
|
|
135
|
+
|
|
136
|
+
sinon.assert.calledOnce(stub);
|
|
137
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
138
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
139
|
+
assertBlockVarModelName(this.workspace, 0, 'name1');
|
|
140
|
+
assertBlockVarModelName(this.workspace, 1, 'name1');
|
|
141
|
+
assertBlockVarModelName(this.workspace, 2, 'name2');
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
suite('renameVariableById', function () {
|
|
146
|
+
setup(function () {
|
|
147
|
+
this.workspace.createVariable('name1', 'type1', 'id1');
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
test('No references rename to name2', function () {
|
|
151
|
+
this.workspace.renameVariableById('id1', 'name2');
|
|
152
|
+
assertVariableValues(this.workspace, 'name2', 'type1', 'id1');
|
|
153
|
+
// Renaming should not have created a new variable.
|
|
154
|
+
assert.equal(this.workspace.getAllVariables().length, 1);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test('Reference exists rename to name2', function () {
|
|
158
|
+
createVarBlocksNoEvents(this.workspace, ['id1']);
|
|
159
|
+
|
|
160
|
+
this.workspace.renameVariableById('id1', 'name2');
|
|
161
|
+
assertVariableValues(this.workspace, 'name2', 'type1', 'id1');
|
|
162
|
+
// Renaming should not have created a new variable.
|
|
163
|
+
assert.equal(this.workspace.getAllVariables().length, 1);
|
|
164
|
+
assertBlockVarModelName(this.workspace, 0, 'name2');
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
test('Reference exists different capitalization rename to Name1', function () {
|
|
168
|
+
createVarBlocksNoEvents(this.workspace, ['id1']);
|
|
169
|
+
|
|
170
|
+
this.workspace.renameVariableById('id1', 'Name1');
|
|
171
|
+
assertVariableValues(this.workspace, 'Name1', 'type1', 'id1');
|
|
172
|
+
// Renaming should not have created a new variable.
|
|
173
|
+
assert.equal(this.workspace.getAllVariables().length, 1);
|
|
174
|
+
assertBlockVarModelName(this.workspace, 0, 'Name1');
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
suite('Two variables rename overlap', function () {
|
|
178
|
+
test('Same type rename variable with id1 to name2', function () {
|
|
179
|
+
this.workspace.createVariable('name2', 'type1', 'id2');
|
|
180
|
+
createVarBlocksNoEvents(this.workspace, ['id1', 'id2']);
|
|
181
|
+
|
|
182
|
+
this.workspace.renameVariableById('id1', 'name2');
|
|
183
|
+
|
|
184
|
+
// The second variable should remain unchanged.
|
|
185
|
+
assertVariableValues(this.workspace, 'name2', 'type1', 'id2');
|
|
186
|
+
// The first variable should have been deleted.
|
|
187
|
+
const variable = this.workspace.getVariableById('id1');
|
|
188
|
+
assert.isNull(variable);
|
|
189
|
+
// There should only be one variable left.
|
|
190
|
+
assert.equal(this.workspace.getAllVariables().length, 1);
|
|
191
|
+
|
|
192
|
+
// Both blocks should now reference variable with name2.
|
|
193
|
+
assertBlockVarModelName(this.workspace, 0, 'name2');
|
|
194
|
+
assertBlockVarModelName(this.workspace, 1, 'name2');
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
test('Different type rename variable with id1 to name2', function () {
|
|
198
|
+
this.workspace.createVariable('name2', 'type2', 'id2');
|
|
199
|
+
createVarBlocksNoEvents(this.workspace, ['id1', 'id2']);
|
|
200
|
+
|
|
201
|
+
this.workspace.renameVariableById('id1', 'name2');
|
|
202
|
+
|
|
203
|
+
// Variables with different type are allowed to have the same name.
|
|
204
|
+
assertVariableValues(this.workspace, 'name2', 'type1', 'id1');
|
|
205
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
206
|
+
|
|
207
|
+
// Both blocks should now reference variable with name2.
|
|
208
|
+
assertBlockVarModelName(this.workspace, 0, 'name2');
|
|
209
|
+
assertBlockVarModelName(this.workspace, 1, 'name2');
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
test('Same type different capitalization rename variable with id1 to Name2', function () {
|
|
213
|
+
this.workspace.createVariable('name2', 'type1', 'id2');
|
|
214
|
+
createVarBlocksNoEvents(this.workspace, ['id1', 'id2']);
|
|
215
|
+
|
|
216
|
+
this.workspace.renameVariableById('id1', 'Name2');
|
|
217
|
+
|
|
218
|
+
// The second variable should be updated.
|
|
219
|
+
assertVariableValues(this.workspace, 'Name2', 'type1', 'id2');
|
|
220
|
+
// The first variable should have been deleted.
|
|
221
|
+
const variable = this.workspace.getVariableById('id1');
|
|
222
|
+
assert.isNull(variable);
|
|
223
|
+
// There should only be one variable left.
|
|
224
|
+
assert.equal(this.workspace.getAllVariables().length, 1);
|
|
225
|
+
|
|
226
|
+
// Both blocks should now reference variable with Name2.
|
|
227
|
+
assertBlockVarModelName(this.workspace, 0, 'Name2');
|
|
228
|
+
assertBlockVarModelName(this.workspace, 1, 'Name2');
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
test('Different type different capitalization rename variable with id1 to Name2', function () {
|
|
232
|
+
this.workspace.createVariable('name2', 'type2', 'id2');
|
|
233
|
+
createVarBlocksNoEvents(this.workspace, ['id1', 'id2']);
|
|
234
|
+
|
|
235
|
+
this.workspace.renameVariableById('id1', 'Name2');
|
|
236
|
+
|
|
237
|
+
// Variables with different type are allowed to have the same name.
|
|
238
|
+
assertVariableValues(this.workspace, 'Name2', 'type1', 'id1');
|
|
239
|
+
// Second variable should remain unchanged.
|
|
240
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
241
|
+
|
|
242
|
+
// Only first block should use new capitalization.
|
|
243
|
+
assertBlockVarModelName(this.workspace, 0, 'Name2');
|
|
244
|
+
assertBlockVarModelName(this.workspace, 1, 'name2');
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
suite('getTopBlocks(ordered=true)', function () {
|
|
250
|
+
test('Empty workspace', function () {
|
|
251
|
+
assert.equal(this.workspace.getTopBlocks(true).length, 0);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
test('Flat workspace one block', function () {
|
|
255
|
+
this.workspace.newBlock('');
|
|
256
|
+
assert.equal(this.workspace.getTopBlocks(true).length, 1);
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
test('Flat workspace one block after dispose', function () {
|
|
260
|
+
const blockA = this.workspace.newBlock('');
|
|
261
|
+
this.workspace.newBlock('');
|
|
262
|
+
blockA.dispose();
|
|
263
|
+
assert.equal(this.workspace.getTopBlocks(true).length, 1);
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
test('Flat workspace two blocks', function () {
|
|
267
|
+
this.workspace.newBlock('');
|
|
268
|
+
this.workspace.newBlock('');
|
|
269
|
+
assert.equal(this.workspace.getTopBlocks(true).length, 2);
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
test('Clear', function () {
|
|
273
|
+
this.workspace.clear();
|
|
274
|
+
assert.equal(
|
|
275
|
+
this.workspace.getTopBlocks(true).length,
|
|
276
|
+
0,
|
|
277
|
+
'Clear empty workspace',
|
|
278
|
+
);
|
|
279
|
+
this.workspace.newBlock('');
|
|
280
|
+
this.workspace.newBlock('');
|
|
281
|
+
this.workspace.clear();
|
|
282
|
+
assert.equal(this.workspace.getTopBlocks(true).length, 0);
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
suite('getTopBlocks(ordered=false)', function () {
|
|
287
|
+
test('Empty workspace', function () {
|
|
288
|
+
assert.equal(this.workspace.getTopBlocks(false).length, 0);
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
test('Flat workspace one block', function () {
|
|
292
|
+
this.workspace.newBlock('');
|
|
293
|
+
assert.equal(this.workspace.getTopBlocks(false).length, 1);
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
test('Flat workspace one block after dispose', function () {
|
|
297
|
+
const blockA = this.workspace.newBlock('');
|
|
298
|
+
this.workspace.newBlock('');
|
|
299
|
+
blockA.dispose();
|
|
300
|
+
assert.equal(this.workspace.getTopBlocks(false).length, 1);
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
test('Flat workspace two blocks', function () {
|
|
304
|
+
this.workspace.newBlock('');
|
|
305
|
+
this.workspace.newBlock('');
|
|
306
|
+
assert.equal(this.workspace.getTopBlocks(false).length, 2);
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
test('Clear empty workspace', function () {
|
|
310
|
+
this.workspace.clear();
|
|
311
|
+
assert.equal(this.workspace.getTopBlocks(false).length, 0);
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
test('Clear non-empty workspace', function () {
|
|
315
|
+
this.workspace.newBlock('');
|
|
316
|
+
this.workspace.newBlock('');
|
|
317
|
+
this.workspace.clear();
|
|
318
|
+
assert.equal(this.workspace.getTopBlocks(false).length, 0);
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
suite('getAllBlocks', function () {
|
|
323
|
+
test('Empty workspace', function () {
|
|
324
|
+
assert.equal(this.workspace.getAllBlocks(true).length, 0);
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
test('Flat workspace one block', function () {
|
|
328
|
+
this.workspace.newBlock('');
|
|
329
|
+
assert.equal(this.workspace.getAllBlocks(true).length, 1);
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
test('Flat workspace one block after dispose', function () {
|
|
333
|
+
const blockA = this.workspace.newBlock('');
|
|
334
|
+
this.workspace.newBlock('');
|
|
335
|
+
blockA.dispose();
|
|
336
|
+
assert.equal(this.workspace.getAllBlocks(true).length, 1);
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
test('Flat workspace two blocks', function () {
|
|
340
|
+
this.workspace.newBlock('');
|
|
341
|
+
this.workspace.newBlock('');
|
|
342
|
+
assert.equal(this.workspace.getAllBlocks(true).length, 2);
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
test('Clear', function () {
|
|
346
|
+
this.workspace.clear();
|
|
347
|
+
assert.equal(
|
|
348
|
+
this.workspace.getAllBlocks(true).length,
|
|
349
|
+
0,
|
|
350
|
+
'Clear empty workspace',
|
|
351
|
+
);
|
|
352
|
+
this.workspace.newBlock('');
|
|
353
|
+
this.workspace.newBlock('');
|
|
354
|
+
this.workspace.clear();
|
|
355
|
+
assert.equal(this.workspace.getAllBlocks(true).length, 0);
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
suite('remainingCapacity', function () {
|
|
360
|
+
setup(function () {
|
|
361
|
+
this.workspace.newBlock('');
|
|
362
|
+
this.workspace.newBlock('');
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
test('No block limit', function () {
|
|
366
|
+
assert.equal(this.workspace.remainingCapacity(), Infinity);
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
test('Under block limit', function () {
|
|
370
|
+
this.workspace.options.maxBlocks = 3;
|
|
371
|
+
assert.equal(this.workspace.remainingCapacity(), 1);
|
|
372
|
+
this.workspace.options.maxBlocks = 4;
|
|
373
|
+
assert.equal(this.workspace.remainingCapacity(), 2);
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
test('At block limit', function () {
|
|
377
|
+
this.workspace.options.maxBlocks = 2;
|
|
378
|
+
assert.equal(this.workspace.remainingCapacity(), 0);
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
test('At block limit of 0 after clear', function () {
|
|
382
|
+
this.workspace.options.maxBlocks = 0;
|
|
383
|
+
this.workspace.clear();
|
|
384
|
+
assert.equal(this.workspace.remainingCapacity(), 0);
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
test('Over block limit', function () {
|
|
388
|
+
this.workspace.options.maxBlocks = 1;
|
|
389
|
+
assert.equal(this.workspace.remainingCapacity(), -1);
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
test('Over block limit of 0', function () {
|
|
393
|
+
this.workspace.options.maxBlocks = 0;
|
|
394
|
+
assert.equal(this.workspace.remainingCapacity(), -2);
|
|
395
|
+
});
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
suite('remainingCapacityOfType', function () {
|
|
399
|
+
setup(function () {
|
|
400
|
+
this.workspace.newBlock('get_var_block');
|
|
401
|
+
this.workspace.newBlock('get_var_block');
|
|
402
|
+
this.workspace.options.maxInstances = {};
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
test('No instance limit', function () {
|
|
406
|
+
assert.equal(
|
|
407
|
+
this.workspace.remainingCapacityOfType('get_var_block'),
|
|
408
|
+
Infinity,
|
|
409
|
+
);
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
test('Under instance limit', function () {
|
|
413
|
+
this.workspace.options.maxInstances['get_var_block'] = 3;
|
|
414
|
+
assert.equal(
|
|
415
|
+
this.workspace.remainingCapacityOfType('get_var_block'),
|
|
416
|
+
1,
|
|
417
|
+
'With maxInstances limit 3',
|
|
418
|
+
);
|
|
419
|
+
this.workspace.options.maxInstances['get_var_block'] = 4;
|
|
420
|
+
assert.equal(
|
|
421
|
+
this.workspace.remainingCapacityOfType('get_var_block'),
|
|
422
|
+
2,
|
|
423
|
+
'With maxInstances limit 4',
|
|
424
|
+
);
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
test('Under instance limit with multiple block types', function () {
|
|
428
|
+
this.workspace.newBlock('');
|
|
429
|
+
this.workspace.newBlock('');
|
|
430
|
+
this.workspace.newBlock('');
|
|
431
|
+
this.workspace.options.maxInstances['get_var_block'] = 3;
|
|
432
|
+
assert.equal(
|
|
433
|
+
this.workspace.remainingCapacityOfType('get_var_block'),
|
|
434
|
+
1,
|
|
435
|
+
'With maxInstances limit 3',
|
|
436
|
+
);
|
|
437
|
+
this.workspace.options.maxInstances['get_var_block'] = 4;
|
|
438
|
+
assert.equal(
|
|
439
|
+
this.workspace.remainingCapacityOfType('get_var_block'),
|
|
440
|
+
2,
|
|
441
|
+
'With maxInstances limit 4',
|
|
442
|
+
);
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
test('At instance limit', function () {
|
|
446
|
+
this.workspace.options.maxInstances['get_var_block'] = 2;
|
|
447
|
+
assert.equal(
|
|
448
|
+
this.workspace.remainingCapacityOfType('get_var_block'),
|
|
449
|
+
0,
|
|
450
|
+
'With maxInstances limit 2',
|
|
451
|
+
);
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
test('At instance limit of 0 after clear', function () {
|
|
455
|
+
this.workspace.clear();
|
|
456
|
+
this.workspace.options.maxInstances['get_var_block'] = 0;
|
|
457
|
+
assert.equal(this.workspace.remainingCapacityOfType('get_var_block'), 0);
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
test('At instance limit with multiple block types', function () {
|
|
461
|
+
this.workspace.newBlock('');
|
|
462
|
+
this.workspace.newBlock('');
|
|
463
|
+
this.workspace.newBlock('');
|
|
464
|
+
this.workspace.options.maxInstances['get_var_block'] = 2;
|
|
465
|
+
assert.equal(
|
|
466
|
+
this.workspace.remainingCapacityOfType('get_var_block'),
|
|
467
|
+
0,
|
|
468
|
+
'With maxInstances limit 2',
|
|
469
|
+
);
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
test('At instance limit of 0 with multiple block types', function () {
|
|
473
|
+
this.workspace.newBlock('');
|
|
474
|
+
this.workspace.newBlock('');
|
|
475
|
+
this.workspace.newBlock('');
|
|
476
|
+
this.workspace.options.maxInstances['get_var_block'] = 0;
|
|
477
|
+
this.workspace.clear();
|
|
478
|
+
assert.equal(this.workspace.remainingCapacityOfType('get_var_block'), 0);
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
test('Over instance limit', function () {
|
|
482
|
+
this.workspace.options.maxInstances['get_var_block'] = 1;
|
|
483
|
+
assert.equal(
|
|
484
|
+
this.workspace.remainingCapacityOfType('get_var_block'),
|
|
485
|
+
-1,
|
|
486
|
+
'With maxInstances limit 1',
|
|
487
|
+
);
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
test('Over instance limit of 0', function () {
|
|
491
|
+
this.workspace.options.maxInstances['get_var_block'] = 0;
|
|
492
|
+
assert.equal(
|
|
493
|
+
this.workspace.remainingCapacityOfType('get_var_block'),
|
|
494
|
+
-2,
|
|
495
|
+
'With maxInstances limit 0',
|
|
496
|
+
);
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
test('Over instance limit with multiple block types', function () {
|
|
500
|
+
this.workspace.newBlock('');
|
|
501
|
+
this.workspace.newBlock('');
|
|
502
|
+
this.workspace.newBlock('');
|
|
503
|
+
this.workspace.options.maxInstances['get_var_block'] = 1;
|
|
504
|
+
assert.equal(
|
|
505
|
+
this.workspace.remainingCapacityOfType('get_var_block'),
|
|
506
|
+
-1,
|
|
507
|
+
'With maxInstances limit 1',
|
|
508
|
+
);
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
test('Over instance limit of 0 with multiple block types', function () {
|
|
512
|
+
this.workspace.newBlock('');
|
|
513
|
+
this.workspace.newBlock('');
|
|
514
|
+
this.workspace.newBlock('');
|
|
515
|
+
this.workspace.options.maxInstances['get_var_block'] = 0;
|
|
516
|
+
assert.equal(
|
|
517
|
+
this.workspace.remainingCapacityOfType('get_var_block'),
|
|
518
|
+
-2,
|
|
519
|
+
'With maxInstances limit 0',
|
|
520
|
+
);
|
|
521
|
+
});
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
suite('isCapacityAvailable', function () {
|
|
525
|
+
setup(function () {
|
|
526
|
+
this.workspace.newBlock('get_var_block');
|
|
527
|
+
this.workspace.newBlock('get_var_block');
|
|
528
|
+
this.workspace.options.maxInstances = {};
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
test('Under block limit and no instance limit', function () {
|
|
532
|
+
this.workspace.options.maxBlocks = 3;
|
|
533
|
+
const typeCountsMap = {'get_var_block': 1};
|
|
534
|
+
assert.isTrue(this.workspace.isCapacityAvailable(typeCountsMap));
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
test('At block limit and no instance limit', function () {
|
|
538
|
+
this.workspace.options.maxBlocks = 2;
|
|
539
|
+
const typeCountsMap = {'get_var_block': 1};
|
|
540
|
+
assert.isFalse(this.workspace.isCapacityAvailable(typeCountsMap));
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
test('Over block limit of 0 and no instance limit', function () {
|
|
544
|
+
this.workspace.options.maxBlocks = 0;
|
|
545
|
+
const typeCountsMap = {'get_var_block': 1};
|
|
546
|
+
assert.isFalse(this.workspace.isCapacityAvailable(typeCountsMap));
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
test('Over block limit but under instance limit', function () {
|
|
550
|
+
this.workspace.options.maxBlocks = 1;
|
|
551
|
+
this.workspace.options.maxInstances['get_var_block'] = 3;
|
|
552
|
+
const typeCountsMap = {'get_var_block': 1};
|
|
553
|
+
assert.isFalse(
|
|
554
|
+
this.workspace.isCapacityAvailable(typeCountsMap),
|
|
555
|
+
'With maxBlocks limit 1 and maxInstances limit 3',
|
|
556
|
+
);
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
test('Over block limit of 0 but under instance limit', function () {
|
|
560
|
+
this.workspace.options.maxBlocks = 0;
|
|
561
|
+
this.workspace.options.maxInstances['get_var_block'] = 3;
|
|
562
|
+
const typeCountsMap = {'get_var_block': 1};
|
|
563
|
+
assert.isFalse(
|
|
564
|
+
this.workspace.isCapacityAvailable(typeCountsMap),
|
|
565
|
+
'With maxBlocks limit 0 and maxInstances limit 3',
|
|
566
|
+
);
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
test('Over block limit but at instance limit', function () {
|
|
570
|
+
this.workspace.options.maxBlocks = 1;
|
|
571
|
+
this.workspace.options.maxInstances['get_var_block'] = 2;
|
|
572
|
+
const typeCountsMap = {'get_var_block': 1};
|
|
573
|
+
assert.isFalse(
|
|
574
|
+
this.workspace.isCapacityAvailable(typeCountsMap),
|
|
575
|
+
'With maxBlocks limit 1 and maxInstances limit 2',
|
|
576
|
+
);
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
test('Over block limit and over instance limit', function () {
|
|
580
|
+
this.workspace.options.maxBlocks = 1;
|
|
581
|
+
this.workspace.options.maxInstances['get_var_block'] = 1;
|
|
582
|
+
const typeCountsMap = {'get_var_block': 1};
|
|
583
|
+
assert.isFalse(
|
|
584
|
+
this.workspace.isCapacityAvailable(typeCountsMap),
|
|
585
|
+
'With maxBlocks limit 1 and maxInstances limit 1',
|
|
586
|
+
);
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
test('Over block limit of 0 and over instance limit', function () {
|
|
590
|
+
this.workspace.options.maxBlocks = 0;
|
|
591
|
+
this.workspace.options.maxInstances['get_var_block'] = 1;
|
|
592
|
+
const typeCountsMap = {'get_var_block': 1};
|
|
593
|
+
assert.isFalse(
|
|
594
|
+
this.workspace.isCapacityAvailable(typeCountsMap),
|
|
595
|
+
'With maxBlocks limit 0 and maxInstances limit 1',
|
|
596
|
+
);
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
test('Over block limit and over instance limit of 0', function () {
|
|
600
|
+
this.workspace.options.maxBlocks = 1;
|
|
601
|
+
this.workspace.options.maxInstances['get_var_block'] = 0;
|
|
602
|
+
const typeCountsMap = {'get_var_block': 1};
|
|
603
|
+
assert.isFalse(
|
|
604
|
+
this.workspace.isCapacityAvailable(typeCountsMap),
|
|
605
|
+
'With maxBlocks limit 1 and maxInstances limit 0',
|
|
606
|
+
);
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
test('Over block limit of 0 and over instance limit of 0', function () {
|
|
610
|
+
this.workspace.options.maxBlocks = 0;
|
|
611
|
+
this.workspace.options.maxInstances['get_var_block'] = 0;
|
|
612
|
+
const typeCountsMap = {'get_var_block': 1};
|
|
613
|
+
assert.isFalse(this.workspace.isCapacityAvailable(typeCountsMap));
|
|
614
|
+
});
|
|
615
|
+
});
|
|
616
|
+
|
|
617
|
+
suite('getById', function () {
|
|
618
|
+
setup(function () {
|
|
619
|
+
this.workspaceB = this.workspace.rendered
|
|
620
|
+
? new Blockly.WorkspaceSvg(new Blockly.Options({}))
|
|
621
|
+
: new Blockly.Workspace();
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
teardown(function () {
|
|
625
|
+
workspaceTeardown.call(this, this.workspaceB);
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
test('Trivial', function () {
|
|
629
|
+
assert.equal(
|
|
630
|
+
Blockly.Workspace.getById(this.workspace.id),
|
|
631
|
+
this.workspace,
|
|
632
|
+
'Find workspace',
|
|
633
|
+
);
|
|
634
|
+
assert.equal(
|
|
635
|
+
Blockly.Workspace.getById(this.workspaceB.id),
|
|
636
|
+
this.workspaceB,
|
|
637
|
+
'Find workspaceB',
|
|
638
|
+
);
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
test('Null id', function () {
|
|
642
|
+
assert.isNull(Blockly.Workspace.getById(null));
|
|
643
|
+
});
|
|
644
|
+
|
|
645
|
+
test('Non-existent id', function () {
|
|
646
|
+
assert.isNull(Blockly.Workspace.getById('badId'));
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
test('After dispose', function () {
|
|
650
|
+
this.workspaceB.dispose();
|
|
651
|
+
assert.isNull(Blockly.Workspace.getById(this.workspaceB.id));
|
|
652
|
+
});
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
suite('getBlockById', function () {
|
|
656
|
+
setup(function () {
|
|
657
|
+
this.blockA = this.workspace.newBlock('');
|
|
658
|
+
this.blockB = this.workspace.newBlock('');
|
|
659
|
+
this.workspaceB = this.workspace.rendered
|
|
660
|
+
? new Blockly.WorkspaceSvg(new Blockly.Options({}))
|
|
661
|
+
: new Blockly.Workspace();
|
|
662
|
+
});
|
|
663
|
+
|
|
664
|
+
teardown(function () {
|
|
665
|
+
workspaceTeardown.call(this, this.workspaceB);
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
test('Trivial', function () {
|
|
669
|
+
assert.equal(this.workspace.getBlockById(this.blockA.id), this.blockA);
|
|
670
|
+
assert.equal(this.workspace.getBlockById(this.blockB.id), this.blockB);
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
test('Null id', function () {
|
|
674
|
+
assert.isNull(this.workspace.getBlockById(null));
|
|
675
|
+
});
|
|
676
|
+
|
|
677
|
+
test('Non-existent id', function () {
|
|
678
|
+
assert.isNull(this.workspace.getBlockById('badId'));
|
|
679
|
+
});
|
|
680
|
+
|
|
681
|
+
test('After dispose', function () {
|
|
682
|
+
this.blockA.dispose();
|
|
683
|
+
assert.isNull(this.workspace.getBlockById(this.blockA.id));
|
|
684
|
+
assert.equal(this.workspace.getBlockById(this.blockB.id), this.blockB);
|
|
685
|
+
});
|
|
686
|
+
|
|
687
|
+
test('After clear', function () {
|
|
688
|
+
this.workspace.clear();
|
|
689
|
+
assert.isNull(this.workspace.getBlockById(this.blockA.id));
|
|
690
|
+
assert.isNull(this.workspace.getBlockById(this.blockB.id));
|
|
691
|
+
});
|
|
692
|
+
});
|
|
693
|
+
|
|
694
|
+
suite('Undo/Redo', function () {
|
|
695
|
+
/**
|
|
696
|
+
* Assert that two nodes are equal.
|
|
697
|
+
* @param {!Element} actual the actual node.
|
|
698
|
+
* @param {!Element} expected the expected node.
|
|
699
|
+
*/
|
|
700
|
+
function assertNodesEqual(actual, expected) {
|
|
701
|
+
const actualString = '\n' + Blockly.Xml.domToPrettyText(actual) + '\n';
|
|
702
|
+
const expectedString =
|
|
703
|
+
'\n' + Blockly.Xml.domToPrettyText(expected) + '\n';
|
|
704
|
+
|
|
705
|
+
assert.equal(actual.tagName, expected.tagName);
|
|
706
|
+
for (let i = 0, attr; (attr = expected.attributes[i]); i++) {
|
|
707
|
+
assert.equal(
|
|
708
|
+
actual.getAttribute(attr.name),
|
|
709
|
+
attr.value,
|
|
710
|
+
`expected attribute ${attr.name} on ${actualString} to match ` +
|
|
711
|
+
`${expectedString}`,
|
|
712
|
+
);
|
|
713
|
+
}
|
|
714
|
+
assert.equal(
|
|
715
|
+
actual.childElementCount,
|
|
716
|
+
expected.childElementCount,
|
|
717
|
+
`expected node ${actualString} to have the same children as node ` +
|
|
718
|
+
`${expectedString}`,
|
|
719
|
+
);
|
|
720
|
+
for (let i = 0; i < expected.childElementCount; i++) {
|
|
721
|
+
assertNodesEqual(actual.children[i], expected.children[i]);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
suite('Undo Delete', function () {
|
|
726
|
+
setup(function () {
|
|
727
|
+
Blockly.defineBlocksWithJsonArray([
|
|
728
|
+
{
|
|
729
|
+
'type': 'stack_block',
|
|
730
|
+
'message0': '',
|
|
731
|
+
'previousStatement': null,
|
|
732
|
+
'nextStatement': null,
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
'type': 'row_block',
|
|
736
|
+
'message0': '%1',
|
|
737
|
+
'args0': [
|
|
738
|
+
{
|
|
739
|
+
'type': 'input_value',
|
|
740
|
+
'name': 'INPUT',
|
|
741
|
+
},
|
|
742
|
+
],
|
|
743
|
+
'output': null,
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
'type': 'statement_block',
|
|
747
|
+
'message0': '%1',
|
|
748
|
+
'args0': [
|
|
749
|
+
{
|
|
750
|
+
'type': 'input_statement',
|
|
751
|
+
'name': 'STATEMENT',
|
|
752
|
+
},
|
|
753
|
+
],
|
|
754
|
+
'previousStatement': null,
|
|
755
|
+
'nextStatement': null,
|
|
756
|
+
},
|
|
757
|
+
]);
|
|
758
|
+
});
|
|
759
|
+
|
|
760
|
+
teardown(function () {
|
|
761
|
+
delete Blockly.Blocks['stack_block'];
|
|
762
|
+
delete Blockly.Blocks['row_block'];
|
|
763
|
+
delete Blockly.Blocks['statement_block'];
|
|
764
|
+
});
|
|
765
|
+
|
|
766
|
+
function testUndoDelete(xmlText) {
|
|
767
|
+
const xml = Blockly.utils.xml.textToDom(xmlText);
|
|
768
|
+
Blockly.Xml.domToBlock(xml, this.workspace);
|
|
769
|
+
this.workspace.getTopBlocks()[0].dispose(false);
|
|
770
|
+
this.clock.runAll();
|
|
771
|
+
this.workspace.undo();
|
|
772
|
+
this.clock.runAll();
|
|
773
|
+
const newXml = Blockly.Xml.workspaceToDom(this.workspace);
|
|
774
|
+
assertNodesEqual(newXml.firstChild, xml);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
test('Stack', function () {
|
|
778
|
+
testUndoDelete.call(this, '<block type="stack_block" id="1"/>');
|
|
779
|
+
});
|
|
780
|
+
|
|
781
|
+
test('Row', function () {
|
|
782
|
+
testUndoDelete.call(this, '<block type="row_block" id="1"/>');
|
|
783
|
+
});
|
|
784
|
+
|
|
785
|
+
test('Statement', function () {
|
|
786
|
+
testUndoDelete.call(this, '<block type="statement_block" id="1"/>');
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
test('Stack w/ child', function () {
|
|
790
|
+
testUndoDelete.call(
|
|
791
|
+
this,
|
|
792
|
+
'<block type="stack_block" id="1">' +
|
|
793
|
+
' <next>' +
|
|
794
|
+
' <block type="stack_block" id="2"></block>' +
|
|
795
|
+
' </next>' +
|
|
796
|
+
'</block>',
|
|
797
|
+
);
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
test('Row w/ child', function () {
|
|
801
|
+
testUndoDelete.call(
|
|
802
|
+
this,
|
|
803
|
+
'<block type="row_block" id="1">' +
|
|
804
|
+
' <value name="INPUT">' +
|
|
805
|
+
' <block type="row_block" id="2"></block>' +
|
|
806
|
+
' </value>' +
|
|
807
|
+
'</block>',
|
|
808
|
+
);
|
|
809
|
+
});
|
|
810
|
+
|
|
811
|
+
test('Statement w/ child', function () {
|
|
812
|
+
testUndoDelete.call(
|
|
813
|
+
this,
|
|
814
|
+
'<block type="statement_block" id="1">' +
|
|
815
|
+
' <statement name="STATEMENT">' +
|
|
816
|
+
' <block type="stack_block" id="2"></block>' +
|
|
817
|
+
' </statement>' +
|
|
818
|
+
'</block>',
|
|
819
|
+
);
|
|
820
|
+
});
|
|
821
|
+
|
|
822
|
+
test('Stack w/ shadow', function () {
|
|
823
|
+
testUndoDelete.call(
|
|
824
|
+
this,
|
|
825
|
+
'<block type="stack_block" id="1">' +
|
|
826
|
+
' <next>' +
|
|
827
|
+
' <shadow type="stack_block" id="2"></shadow>' +
|
|
828
|
+
' </next>' +
|
|
829
|
+
'</block>',
|
|
830
|
+
);
|
|
831
|
+
});
|
|
832
|
+
|
|
833
|
+
test('Row w/ shadow', function () {
|
|
834
|
+
testUndoDelete.call(
|
|
835
|
+
this,
|
|
836
|
+
'<block type="row_block" id="1">' +
|
|
837
|
+
' <value name="INPUT">' +
|
|
838
|
+
' <shadow type="row_block" id="2"></shadow>' +
|
|
839
|
+
' </value>' +
|
|
840
|
+
'</block>',
|
|
841
|
+
);
|
|
842
|
+
});
|
|
843
|
+
|
|
844
|
+
test('Statement w/ shadow', function () {
|
|
845
|
+
testUndoDelete.call(
|
|
846
|
+
this,
|
|
847
|
+
'<block type="statement_block" id="1">' +
|
|
848
|
+
' <statement name="STATEMENT">' +
|
|
849
|
+
' <shadow type="stack_block" id="2"></shadow>' +
|
|
850
|
+
' </statement>' +
|
|
851
|
+
'</block>',
|
|
852
|
+
);
|
|
853
|
+
});
|
|
854
|
+
});
|
|
855
|
+
|
|
856
|
+
suite('Undo Connect', function () {
|
|
857
|
+
setup(function () {
|
|
858
|
+
Blockly.defineBlocksWithJsonArray([
|
|
859
|
+
{
|
|
860
|
+
'type': 'stack_block',
|
|
861
|
+
'message0': '',
|
|
862
|
+
'previousStatement': null,
|
|
863
|
+
'nextStatement': null,
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
'type': 'row_block',
|
|
867
|
+
'message0': '%1',
|
|
868
|
+
'args0': [
|
|
869
|
+
{
|
|
870
|
+
'type': 'input_value',
|
|
871
|
+
'name': 'INPUT',
|
|
872
|
+
},
|
|
873
|
+
],
|
|
874
|
+
'output': null,
|
|
875
|
+
},
|
|
876
|
+
{
|
|
877
|
+
'type': 'statement_block',
|
|
878
|
+
'message0': '%1',
|
|
879
|
+
'args0': [
|
|
880
|
+
{
|
|
881
|
+
'type': 'input_statement',
|
|
882
|
+
'name': 'STATEMENT',
|
|
883
|
+
},
|
|
884
|
+
],
|
|
885
|
+
'previousStatement': null,
|
|
886
|
+
'nextStatement': null,
|
|
887
|
+
},
|
|
888
|
+
]);
|
|
889
|
+
});
|
|
890
|
+
|
|
891
|
+
teardown(function () {
|
|
892
|
+
delete Blockly.Blocks['stack_block'];
|
|
893
|
+
delete Blockly.Blocks['row_block'];
|
|
894
|
+
delete Blockly.Blocks['statement_block'];
|
|
895
|
+
});
|
|
896
|
+
|
|
897
|
+
function testUndoConnect(xmlText, parentId, childId, func) {
|
|
898
|
+
const xml = Blockly.utils.xml.textToDom(xmlText);
|
|
899
|
+
Blockly.Xml.domToWorkspace(xml, this.workspace);
|
|
900
|
+
this.clock.runAll();
|
|
901
|
+
|
|
902
|
+
const parent = this.workspace.getBlockById(parentId);
|
|
903
|
+
const child = this.workspace.getBlockById(childId);
|
|
904
|
+
func.call(this, parent, child);
|
|
905
|
+
this.clock.runAll();
|
|
906
|
+
this.workspace.undo();
|
|
907
|
+
this.clock.runAll();
|
|
908
|
+
|
|
909
|
+
const newXml = Blockly.Xml.workspaceToDom(this.workspace);
|
|
910
|
+
assertNodesEqual(newXml, xml);
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
test('Stack', function () {
|
|
914
|
+
const xml =
|
|
915
|
+
'<xml>' +
|
|
916
|
+
' <block type="stack_block" id="1" x="10" y="10"></block>' +
|
|
917
|
+
' <block type="stack_block" id="2" x="50" y="50"></block>' +
|
|
918
|
+
'</xml>';
|
|
919
|
+
|
|
920
|
+
testUndoConnect.call(this, xml, '1', '2', (parent, child) => {
|
|
921
|
+
parent.nextConnection.connect(child.previousConnection);
|
|
922
|
+
});
|
|
923
|
+
});
|
|
924
|
+
|
|
925
|
+
test('Row', function () {
|
|
926
|
+
const xml =
|
|
927
|
+
'<xml>' +
|
|
928
|
+
' <block type="row_block" id="1" x="10" y="10"></block>' +
|
|
929
|
+
' <block type="row_block" id="2" x="50" y="50"></block>' +
|
|
930
|
+
'</xml>';
|
|
931
|
+
|
|
932
|
+
testUndoConnect.call(this, xml, '1', '2', (parent, child) => {
|
|
933
|
+
parent.getInput('INPUT').connection.connect(child.outputConnection);
|
|
934
|
+
});
|
|
935
|
+
});
|
|
936
|
+
|
|
937
|
+
test('Statement', function () {
|
|
938
|
+
const xml =
|
|
939
|
+
'<xml>' +
|
|
940
|
+
' <block type="statement_block" id="1" x="10" y="10"></block>' +
|
|
941
|
+
' <block type="stack_block" id="2" x="50" y="50"></block>' +
|
|
942
|
+
'</xml>';
|
|
943
|
+
|
|
944
|
+
testUndoConnect.call(this, xml, '1', '2', (parent, child) => {
|
|
945
|
+
parent
|
|
946
|
+
.getInput('STATEMENT')
|
|
947
|
+
.connection.connect(child.previousConnection);
|
|
948
|
+
});
|
|
949
|
+
});
|
|
950
|
+
|
|
951
|
+
test('Stack w/ child', function () {
|
|
952
|
+
const xml =
|
|
953
|
+
'<xml>' +
|
|
954
|
+
' <block type="stack_block" id="1" x="10" y="10">' +
|
|
955
|
+
' <next>' +
|
|
956
|
+
' <block type="stack_block" id="3"></block>' +
|
|
957
|
+
' </next>' +
|
|
958
|
+
' </block>' +
|
|
959
|
+
' <block type="stack_block" id="2" x="50" y="50"></block>' +
|
|
960
|
+
'</xml>';
|
|
961
|
+
|
|
962
|
+
testUndoConnect.call(this, xml, '1', '2', (parent, child) => {
|
|
963
|
+
parent.nextConnection.connect(child.previousConnection);
|
|
964
|
+
});
|
|
965
|
+
});
|
|
966
|
+
|
|
967
|
+
test('Row w/ child', function () {
|
|
968
|
+
const xml =
|
|
969
|
+
'<xml>' +
|
|
970
|
+
' <block type="row_block" id="1" x="10" y="10">' +
|
|
971
|
+
' <value name="INPUT">' +
|
|
972
|
+
' <block type="row_block" id="3"></block>' +
|
|
973
|
+
' </value>' +
|
|
974
|
+
' </block>' +
|
|
975
|
+
' <block type="row_block" id="2" x="50" y="50"></block>' +
|
|
976
|
+
'</xml>';
|
|
977
|
+
|
|
978
|
+
testUndoConnect.call(this, xml, '1', '2', (parent, child) => {
|
|
979
|
+
parent.getInput('INPUT').connection.connect(child.outputConnection);
|
|
980
|
+
});
|
|
981
|
+
});
|
|
982
|
+
|
|
983
|
+
test('Statement w/ child', function () {
|
|
984
|
+
const xml =
|
|
985
|
+
'<xml>' +
|
|
986
|
+
' <block type="statement_block" id="1" x="10" y="10">' +
|
|
987
|
+
' <statement name="STATEMENT">' +
|
|
988
|
+
' <block type="stack_block" id="3"></block>' +
|
|
989
|
+
' </statement>' +
|
|
990
|
+
' </block>' +
|
|
991
|
+
' <block type="stack_block" id="2" x="100" y="100"></block>' +
|
|
992
|
+
'</xml>';
|
|
993
|
+
|
|
994
|
+
testUndoConnect.call(this, xml, '1', '2', (parent, child) => {
|
|
995
|
+
parent
|
|
996
|
+
.getInput('STATEMENT')
|
|
997
|
+
.connection.connect(child.previousConnection);
|
|
998
|
+
});
|
|
999
|
+
});
|
|
1000
|
+
|
|
1001
|
+
test('Stack w/ shadow', function () {
|
|
1002
|
+
const xml =
|
|
1003
|
+
'<xml>' +
|
|
1004
|
+
' <block type="stack_block" id="1" x="10" y="10">' +
|
|
1005
|
+
' <next>' +
|
|
1006
|
+
' <shadow type="stack_block" id="3"></shadow>' +
|
|
1007
|
+
' </next>' +
|
|
1008
|
+
' </block>' +
|
|
1009
|
+
' <block type="stack_block" id="2" x="50" y="50"></block>' +
|
|
1010
|
+
'</xml>';
|
|
1011
|
+
|
|
1012
|
+
testUndoConnect.call(this, xml, '1', '2', (parent, child) => {
|
|
1013
|
+
parent.nextConnection.connect(child.previousConnection);
|
|
1014
|
+
});
|
|
1015
|
+
});
|
|
1016
|
+
|
|
1017
|
+
test('Row w/ shadow', function () {
|
|
1018
|
+
const xml =
|
|
1019
|
+
'<xml>' +
|
|
1020
|
+
' <block type="row_block" id="1" x="10" y="10">' +
|
|
1021
|
+
' <value name="INPUT">' +
|
|
1022
|
+
' <shadow type="row_block" id="3"></shadow>' +
|
|
1023
|
+
' </value>' +
|
|
1024
|
+
' </block>' +
|
|
1025
|
+
' <block type="row_block" id="2" x="50" y="50"></block>' +
|
|
1026
|
+
'</xml>';
|
|
1027
|
+
|
|
1028
|
+
testUndoConnect.call(this, xml, '1', '2', (parent, child) => {
|
|
1029
|
+
parent.getInput('INPUT').connection.connect(child.outputConnection);
|
|
1030
|
+
});
|
|
1031
|
+
});
|
|
1032
|
+
|
|
1033
|
+
test('Statement w/ shadow', function () {
|
|
1034
|
+
const xml =
|
|
1035
|
+
'<xml>' +
|
|
1036
|
+
' <block type="statement_block" id="1" x="10" y="10">' +
|
|
1037
|
+
' <statement name="STATEMENT">' +
|
|
1038
|
+
' <shadow type="stack_block" id="3"></shadow>' +
|
|
1039
|
+
' </statement>' +
|
|
1040
|
+
' </block>' +
|
|
1041
|
+
' <block type="stack_block" id="2" x="100" y="100"></block>' +
|
|
1042
|
+
'</xml>';
|
|
1043
|
+
|
|
1044
|
+
testUndoConnect.call(this, xml, '1', '2', (parent, child) => {
|
|
1045
|
+
parent
|
|
1046
|
+
.getInput('STATEMENT')
|
|
1047
|
+
.connection.connect(child.previousConnection);
|
|
1048
|
+
});
|
|
1049
|
+
});
|
|
1050
|
+
});
|
|
1051
|
+
|
|
1052
|
+
suite('Undo Disconnect', function () {
|
|
1053
|
+
setup(function () {
|
|
1054
|
+
Blockly.defineBlocksWithJsonArray([
|
|
1055
|
+
{
|
|
1056
|
+
'type': 'stack_block',
|
|
1057
|
+
'message0': '',
|
|
1058
|
+
'previousStatement': null,
|
|
1059
|
+
'nextStatement': null,
|
|
1060
|
+
},
|
|
1061
|
+
{
|
|
1062
|
+
'type': 'row_block',
|
|
1063
|
+
'message0': '%1',
|
|
1064
|
+
'args0': [
|
|
1065
|
+
{
|
|
1066
|
+
'type': 'input_value',
|
|
1067
|
+
'name': 'INPUT',
|
|
1068
|
+
},
|
|
1069
|
+
],
|
|
1070
|
+
'output': null,
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
'type': 'statement_block',
|
|
1074
|
+
'message0': '%1',
|
|
1075
|
+
'args0': [
|
|
1076
|
+
{
|
|
1077
|
+
'type': 'input_statement',
|
|
1078
|
+
'name': 'STATEMENT',
|
|
1079
|
+
},
|
|
1080
|
+
],
|
|
1081
|
+
'previousStatement': null,
|
|
1082
|
+
'nextStatement': null,
|
|
1083
|
+
},
|
|
1084
|
+
]);
|
|
1085
|
+
});
|
|
1086
|
+
|
|
1087
|
+
teardown(function () {
|
|
1088
|
+
delete Blockly.Blocks['stack_block'];
|
|
1089
|
+
delete Blockly.Blocks['row_block'];
|
|
1090
|
+
delete Blockly.Blocks['statement_block'];
|
|
1091
|
+
});
|
|
1092
|
+
|
|
1093
|
+
function testUndoDisconnect(xmlText, childId) {
|
|
1094
|
+
const xml = Blockly.utils.xml.textToDom(xmlText);
|
|
1095
|
+
Blockly.Xml.domToWorkspace(xml, this.workspace);
|
|
1096
|
+
this.clock.runAll();
|
|
1097
|
+
|
|
1098
|
+
const child = this.workspace.getBlockById(childId);
|
|
1099
|
+
if (child.outputConnection) {
|
|
1100
|
+
child.outputConnection.disconnect();
|
|
1101
|
+
} else {
|
|
1102
|
+
child.previousConnection.disconnect();
|
|
1103
|
+
}
|
|
1104
|
+
this.clock.runAll();
|
|
1105
|
+
this.workspace.undo();
|
|
1106
|
+
this.clock.runAll();
|
|
1107
|
+
|
|
1108
|
+
const newXml = Blockly.Xml.workspaceToDom(this.workspace);
|
|
1109
|
+
assertNodesEqual(newXml, xml);
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
test('Stack', function () {
|
|
1113
|
+
const xml =
|
|
1114
|
+
'<xml>' +
|
|
1115
|
+
' <block type="stack_block" id="1">' +
|
|
1116
|
+
' <next>' +
|
|
1117
|
+
' <block type="stack_block" id="2"></block>' +
|
|
1118
|
+
' </next>' +
|
|
1119
|
+
' </block>' +
|
|
1120
|
+
'</xml>';
|
|
1121
|
+
testUndoDisconnect.call(this, xml, '2');
|
|
1122
|
+
});
|
|
1123
|
+
|
|
1124
|
+
test('Row', function () {
|
|
1125
|
+
const xml =
|
|
1126
|
+
'<xml>' +
|
|
1127
|
+
' <block type="row_block" id="1">' +
|
|
1128
|
+
' <value name="INPUT">' +
|
|
1129
|
+
' <block type="row_block" id="2"></block>' +
|
|
1130
|
+
' </value>' +
|
|
1131
|
+
' </block>' +
|
|
1132
|
+
'</xml>';
|
|
1133
|
+
testUndoDisconnect.call(this, xml, '2');
|
|
1134
|
+
});
|
|
1135
|
+
|
|
1136
|
+
test('Statement', function () {
|
|
1137
|
+
const xml =
|
|
1138
|
+
'<xml>' +
|
|
1139
|
+
' <block type="statement_block" id="1">' +
|
|
1140
|
+
' <statement name="STATEMENT">' +
|
|
1141
|
+
' <block type="stack_block" id="2"></block>' +
|
|
1142
|
+
' </statement>' +
|
|
1143
|
+
' </block>' +
|
|
1144
|
+
'</xml>';
|
|
1145
|
+
testUndoDisconnect.call(this, xml, '2');
|
|
1146
|
+
});
|
|
1147
|
+
|
|
1148
|
+
test('Stack w/ child', function () {
|
|
1149
|
+
const xml =
|
|
1150
|
+
'<xml>' +
|
|
1151
|
+
' <block type="stack_block" id="1">' +
|
|
1152
|
+
' <next>' +
|
|
1153
|
+
' <block type="stack_block" id="2">' +
|
|
1154
|
+
' <next>' +
|
|
1155
|
+
' <block type="stack_block" id="3"></block>' +
|
|
1156
|
+
' </next>' +
|
|
1157
|
+
' </block>' +
|
|
1158
|
+
' </next>' +
|
|
1159
|
+
' </block>' +
|
|
1160
|
+
'</xml>';
|
|
1161
|
+
testUndoDisconnect.call(this, xml, '2');
|
|
1162
|
+
});
|
|
1163
|
+
|
|
1164
|
+
test('Row w/ child', function () {
|
|
1165
|
+
const xml =
|
|
1166
|
+
'<xml>' +
|
|
1167
|
+
' <block type="row_block" id="1">' +
|
|
1168
|
+
' <value name="INPUT">' +
|
|
1169
|
+
' <block type="row_block" id="2">' +
|
|
1170
|
+
' <value name="INPUT">' +
|
|
1171
|
+
' <block type="row_block" id="3"></block>' +
|
|
1172
|
+
' </value>' +
|
|
1173
|
+
' </block>' +
|
|
1174
|
+
' </value>' +
|
|
1175
|
+
' </block>' +
|
|
1176
|
+
'</xml>';
|
|
1177
|
+
testUndoDisconnect.call(this, xml, '2');
|
|
1178
|
+
});
|
|
1179
|
+
|
|
1180
|
+
test('Statement w/ child', function () {
|
|
1181
|
+
const xml =
|
|
1182
|
+
'<xml>' +
|
|
1183
|
+
' <block type="statement_block" id="1">' +
|
|
1184
|
+
' <statement name="STATEMENT">' +
|
|
1185
|
+
' <block type="statement_block" id="2">' +
|
|
1186
|
+
' <statement name="STATEMENT">' +
|
|
1187
|
+
' <block type="stack_block" id="3"></block>' +
|
|
1188
|
+
' </statement>' +
|
|
1189
|
+
' </block>' +
|
|
1190
|
+
' </statement>' +
|
|
1191
|
+
' </block>' +
|
|
1192
|
+
'</xml>';
|
|
1193
|
+
testUndoDisconnect.call(this, xml, '2');
|
|
1194
|
+
});
|
|
1195
|
+
|
|
1196
|
+
test('Stack w/ shadow', function () {
|
|
1197
|
+
// TODO: For some reason on next connections shadows are
|
|
1198
|
+
// serialized second.
|
|
1199
|
+
const xml =
|
|
1200
|
+
'<xml>' +
|
|
1201
|
+
' <block type="stack_block" id="1">' +
|
|
1202
|
+
' <next>' +
|
|
1203
|
+
' <block type="stack_block" id="2"></block>' +
|
|
1204
|
+
' <shadow type="stack_block" id="3"></shadow>' +
|
|
1205
|
+
' </next>' +
|
|
1206
|
+
' </block>' +
|
|
1207
|
+
'</xml>';
|
|
1208
|
+
testUndoDisconnect.call(this, xml, '2');
|
|
1209
|
+
assert.equal(
|
|
1210
|
+
this.workspace.getAllBlocks().length,
|
|
1211
|
+
2,
|
|
1212
|
+
'expected there to only be 2 blocks on the workspace ' +
|
|
1213
|
+
'(check for shadows)',
|
|
1214
|
+
);
|
|
1215
|
+
});
|
|
1216
|
+
|
|
1217
|
+
test('Row w/ shadow', function () {
|
|
1218
|
+
const xml =
|
|
1219
|
+
'<xml>' +
|
|
1220
|
+
' <block type="row_block" id="1">' +
|
|
1221
|
+
' <value name="INPUT">' +
|
|
1222
|
+
' <shadow type="row_block" id="3"></shadow>' +
|
|
1223
|
+
' <block type="row_block" id="2"></block>' +
|
|
1224
|
+
' </value>' +
|
|
1225
|
+
' </block>' +
|
|
1226
|
+
'</xml>';
|
|
1227
|
+
testUndoDisconnect.call(this, xml, '2');
|
|
1228
|
+
assert.equal(
|
|
1229
|
+
this.workspace.getAllBlocks().length,
|
|
1230
|
+
2,
|
|
1231
|
+
'expected there to only be 2 blocks on the workspace ' +
|
|
1232
|
+
'(check for shadows)',
|
|
1233
|
+
);
|
|
1234
|
+
});
|
|
1235
|
+
|
|
1236
|
+
test('Statement w/ shadow', function () {
|
|
1237
|
+
const xml =
|
|
1238
|
+
'<xml>' +
|
|
1239
|
+
' <block type="statement_block" id="1">' +
|
|
1240
|
+
' <statement name="STATEMENT">' +
|
|
1241
|
+
' <shadow type="stack_block" id="3"></shadow>' +
|
|
1242
|
+
' <block type="stack_block" id="2"></block>' +
|
|
1243
|
+
' </statement>' +
|
|
1244
|
+
' </block>' +
|
|
1245
|
+
'</xml>';
|
|
1246
|
+
testUndoDisconnect.call(this, xml, '2');
|
|
1247
|
+
});
|
|
1248
|
+
});
|
|
1249
|
+
|
|
1250
|
+
suite('Variables', function () {
|
|
1251
|
+
function createTwoVarsDifferentTypes(workspace) {
|
|
1252
|
+
workspace.createVariable('name1', 'type1', 'id1');
|
|
1253
|
+
workspace.createVariable('name2', 'type2', 'id2');
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
suite('createVariable', function () {
|
|
1257
|
+
test('Undo only', function () {
|
|
1258
|
+
createTwoVarsDifferentTypes(this.workspace);
|
|
1259
|
+
this.clock.runAll();
|
|
1260
|
+
|
|
1261
|
+
this.workspace.undo();
|
|
1262
|
+
this.clock.runAll();
|
|
1263
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1264
|
+
assert.isNull(this.workspace.getVariableById('id2'));
|
|
1265
|
+
|
|
1266
|
+
this.workspace.undo();
|
|
1267
|
+
assert.isNull(this.workspace.getVariableById('id1'));
|
|
1268
|
+
assert.isNull(this.workspace.getVariableById('id2'));
|
|
1269
|
+
});
|
|
1270
|
+
|
|
1271
|
+
test('Undo and redo', function () {
|
|
1272
|
+
createTwoVarsDifferentTypes(this.workspace);
|
|
1273
|
+
this.clock.runAll();
|
|
1274
|
+
|
|
1275
|
+
this.workspace.undo();
|
|
1276
|
+
this.clock.runAll();
|
|
1277
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1278
|
+
assert.isNull(this.workspace.getVariableById('id2'));
|
|
1279
|
+
|
|
1280
|
+
this.workspace.undo(true);
|
|
1281
|
+
|
|
1282
|
+
// Expect that variable 'id2' is recreated
|
|
1283
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1284
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1285
|
+
|
|
1286
|
+
this.workspace.undo();
|
|
1287
|
+
this.workspace.undo();
|
|
1288
|
+
assert.isNull(this.workspace.getVariableById('id1'));
|
|
1289
|
+
assert.isNull(this.workspace.getVariableById('id2'));
|
|
1290
|
+
this.workspace.undo(true);
|
|
1291
|
+
|
|
1292
|
+
// Expect that variable 'id1' is recreated
|
|
1293
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1294
|
+
assert.isNull(this.workspace.getVariableById('id2'));
|
|
1295
|
+
});
|
|
1296
|
+
});
|
|
1297
|
+
|
|
1298
|
+
suite('deleteVariableById', function () {
|
|
1299
|
+
test('Undo only no usages', function () {
|
|
1300
|
+
createTwoVarsDifferentTypes(this.workspace);
|
|
1301
|
+
this.clock.runAll();
|
|
1302
|
+
this.workspace.deleteVariableById('id1');
|
|
1303
|
+
this.workspace.deleteVariableById('id2');
|
|
1304
|
+
this.clock.runAll();
|
|
1305
|
+
|
|
1306
|
+
this.workspace.undo();
|
|
1307
|
+
this.clock.runAll();
|
|
1308
|
+
assert.isNull(this.workspace.getVariableById('id1'));
|
|
1309
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1310
|
+
|
|
1311
|
+
this.workspace.undo();
|
|
1312
|
+
this.clock.runAll();
|
|
1313
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1314
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1315
|
+
});
|
|
1316
|
+
|
|
1317
|
+
test('Undo only with usages', function () {
|
|
1318
|
+
createTwoVarsDifferentTypes(this.workspace);
|
|
1319
|
+
// Create blocks to refer to both of them.
|
|
1320
|
+
createVarBlocksNoEvents(this.workspace, ['id1', 'id2']);
|
|
1321
|
+
this.clock.runAll();
|
|
1322
|
+
this.workspace.deleteVariableById('id1');
|
|
1323
|
+
this.workspace.deleteVariableById('id2');
|
|
1324
|
+
this.clock.runAll();
|
|
1325
|
+
|
|
1326
|
+
this.workspace.undo();
|
|
1327
|
+
this.clock.runAll();
|
|
1328
|
+
assertBlockVarModelName(this.workspace, 0, 'name2');
|
|
1329
|
+
assert.isNull(this.workspace.getVariableById('id1'));
|
|
1330
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1331
|
+
|
|
1332
|
+
this.workspace.undo();
|
|
1333
|
+
this.clock.runAll();
|
|
1334
|
+
assertBlockVarModelName(this.workspace, 0, 'name2');
|
|
1335
|
+
assertBlockVarModelName(this.workspace, 1, 'name1');
|
|
1336
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1337
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1338
|
+
});
|
|
1339
|
+
|
|
1340
|
+
test('Reference exists no usages', function () {
|
|
1341
|
+
createTwoVarsDifferentTypes(this.workspace);
|
|
1342
|
+
this.clock.runAll();
|
|
1343
|
+
this.workspace.deleteVariableById('id1');
|
|
1344
|
+
this.workspace.deleteVariableById('id2');
|
|
1345
|
+
this.clock.runAll();
|
|
1346
|
+
|
|
1347
|
+
this.workspace.undo();
|
|
1348
|
+
this.clock.runAll();
|
|
1349
|
+
assert.isNull(this.workspace.getVariableById('id1'));
|
|
1350
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1351
|
+
|
|
1352
|
+
this.workspace.undo(true);
|
|
1353
|
+
this.clock.runAll();
|
|
1354
|
+
// Expect that both variables are deleted
|
|
1355
|
+
assert.isNull(this.workspace.getVariableById('id1'));
|
|
1356
|
+
assert.isNull(this.workspace.getVariableById('id2'));
|
|
1357
|
+
|
|
1358
|
+
this.workspace.undo();
|
|
1359
|
+
this.clock.runAll();
|
|
1360
|
+
this.workspace.undo();
|
|
1361
|
+
this.clock.runAll();
|
|
1362
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1363
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1364
|
+
|
|
1365
|
+
this.workspace.undo(true);
|
|
1366
|
+
this.clock.runAll();
|
|
1367
|
+
// Expect that variable 'id2' is recreated
|
|
1368
|
+
assert.isNull(this.workspace.getVariableById('id1'));
|
|
1369
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1370
|
+
});
|
|
1371
|
+
|
|
1372
|
+
test('Reference exists with usages', function () {
|
|
1373
|
+
createTwoVarsDifferentTypes(this.workspace);
|
|
1374
|
+
// Create blocks to refer to both of them.
|
|
1375
|
+
createVarBlocksNoEvents(this.workspace, ['id1', 'id2']);
|
|
1376
|
+
this.clock.runAll();
|
|
1377
|
+
this.workspace.deleteVariableById('id1');
|
|
1378
|
+
this.workspace.deleteVariableById('id2');
|
|
1379
|
+
this.clock.runAll();
|
|
1380
|
+
|
|
1381
|
+
this.workspace.undo();
|
|
1382
|
+
this.clock.runAll();
|
|
1383
|
+
assertBlockVarModelName(this.workspace, 0, 'name2');
|
|
1384
|
+
assert.isNull(this.workspace.getVariableById('id1'));
|
|
1385
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1386
|
+
|
|
1387
|
+
this.workspace.undo(true);
|
|
1388
|
+
this.clock.runAll();
|
|
1389
|
+
// Expect that both variables are deleted
|
|
1390
|
+
assert.equal(this.workspace.getTopBlocks(false).length, 0);
|
|
1391
|
+
assert.isNull(this.workspace.getVariableById('id1'));
|
|
1392
|
+
assert.isNull(this.workspace.getVariableById('id2'));
|
|
1393
|
+
|
|
1394
|
+
this.workspace.undo();
|
|
1395
|
+
this.clock.runAll();
|
|
1396
|
+
this.workspace.undo();
|
|
1397
|
+
this.clock.runAll();
|
|
1398
|
+
assertBlockVarModelName(this.workspace, 0, 'name2');
|
|
1399
|
+
assertBlockVarModelName(this.workspace, 1, 'name1');
|
|
1400
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1401
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1402
|
+
|
|
1403
|
+
this.workspace.undo(true);
|
|
1404
|
+
this.clock.runAll();
|
|
1405
|
+
// Expect that variable 'id2' is recreated
|
|
1406
|
+
assertBlockVarModelName(this.workspace, 0, 'name2');
|
|
1407
|
+
assert.isNull(this.workspace.getVariableById('id1'));
|
|
1408
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1409
|
+
});
|
|
1410
|
+
|
|
1411
|
+
test('Delete same variable twice no usages', function () {
|
|
1412
|
+
this.workspace.createVariable('name1', 'type1', 'id1');
|
|
1413
|
+
this.workspace.deleteVariableById('id1');
|
|
1414
|
+
this.clock.runAll();
|
|
1415
|
+
const workspace = this.workspace;
|
|
1416
|
+
assertWarnings(() => {
|
|
1417
|
+
workspace.deleteVariableById('id1');
|
|
1418
|
+
}, /Can't delete/);
|
|
1419
|
+
|
|
1420
|
+
// Check the undoStack only recorded one delete event.
|
|
1421
|
+
const undoStack = this.workspace.undoStack_;
|
|
1422
|
+
assert.equal(undoStack[undoStack.length - 1].type, 'var_delete');
|
|
1423
|
+
assert.notEqual(undoStack[undoStack.length - 2].type, 'var_delete');
|
|
1424
|
+
|
|
1425
|
+
// Undo delete
|
|
1426
|
+
this.workspace.undo();
|
|
1427
|
+
this.clock.runAll();
|
|
1428
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1429
|
+
|
|
1430
|
+
// Redo delete
|
|
1431
|
+
this.workspace.undo(true);
|
|
1432
|
+
this.clock.runAll();
|
|
1433
|
+
assert.isNull(this.workspace.getVariableById('id1'));
|
|
1434
|
+
|
|
1435
|
+
// Redo delete, nothing should happen
|
|
1436
|
+
this.workspace.undo(true);
|
|
1437
|
+
this.clock.runAll();
|
|
1438
|
+
assert.isNull(this.workspace.getVariableById('id1'));
|
|
1439
|
+
});
|
|
1440
|
+
|
|
1441
|
+
test('Delete same variable twice with usages', function () {
|
|
1442
|
+
this.workspace.createVariable('name1', 'type1', 'id1');
|
|
1443
|
+
createVarBlocksNoEvents(this.workspace, ['id1']);
|
|
1444
|
+
this.clock.runAll();
|
|
1445
|
+
this.workspace.deleteVariableById('id1');
|
|
1446
|
+
this.clock.runAll();
|
|
1447
|
+
const workspace = this.workspace;
|
|
1448
|
+
assertWarnings(() => {
|
|
1449
|
+
workspace.deleteVariableById('id1');
|
|
1450
|
+
}, /Can't delete/);
|
|
1451
|
+
|
|
1452
|
+
// Check the undoStack only recorded one delete event.
|
|
1453
|
+
const undoStack = this.workspace.undoStack_;
|
|
1454
|
+
assert.equal(undoStack[undoStack.length - 1].type, 'var_delete');
|
|
1455
|
+
assert.equal(undoStack[undoStack.length - 2].type, 'delete');
|
|
1456
|
+
assert.notEqual(undoStack[undoStack.length - 3].type, 'var_delete');
|
|
1457
|
+
|
|
1458
|
+
// Undo delete
|
|
1459
|
+
this.workspace.undo();
|
|
1460
|
+
this.clock.runAll();
|
|
1461
|
+
assertBlockVarModelName(this.workspace, 0, 'name1');
|
|
1462
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1463
|
+
|
|
1464
|
+
// Redo delete
|
|
1465
|
+
this.workspace.undo(true);
|
|
1466
|
+
this.clock.runAll();
|
|
1467
|
+
assert.equal(this.workspace.getTopBlocks(false).length, 0);
|
|
1468
|
+
assert.isNull(this.workspace.getVariableById('id1'));
|
|
1469
|
+
|
|
1470
|
+
// Redo delete, nothing should happen
|
|
1471
|
+
this.workspace.undo(true);
|
|
1472
|
+
this.clock.runAll();
|
|
1473
|
+
assert.equal(this.workspace.getTopBlocks(false).length, 0);
|
|
1474
|
+
assert.isNull(this.workspace.getVariableById('id1'));
|
|
1475
|
+
});
|
|
1476
|
+
});
|
|
1477
|
+
|
|
1478
|
+
suite('renameVariableById', function () {
|
|
1479
|
+
setup(function () {
|
|
1480
|
+
this.workspace.createVariable('name1', 'type1', 'id1');
|
|
1481
|
+
});
|
|
1482
|
+
|
|
1483
|
+
test('Reference exists no usages rename to name2', function () {
|
|
1484
|
+
this.workspace.renameVariableById('id1', 'name2');
|
|
1485
|
+
this.clock.runAll();
|
|
1486
|
+
|
|
1487
|
+
this.workspace.undo();
|
|
1488
|
+
this.clock.runAll();
|
|
1489
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1490
|
+
|
|
1491
|
+
this.workspace.undo(true);
|
|
1492
|
+
this.clock.runAll();
|
|
1493
|
+
assertVariableValues(this.workspace, 'name2', 'type1', 'id1');
|
|
1494
|
+
});
|
|
1495
|
+
|
|
1496
|
+
test('Reference exists with usages rename to name2', function () {
|
|
1497
|
+
createVarBlocksNoEvents(this.workspace, ['id1']);
|
|
1498
|
+
this.workspace.renameVariableById('id1', 'name2');
|
|
1499
|
+
this.clock.runAll();
|
|
1500
|
+
|
|
1501
|
+
this.workspace.undo();
|
|
1502
|
+
this.clock.runAll();
|
|
1503
|
+
assertBlockVarModelName(this.workspace, 0, 'name1');
|
|
1504
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1505
|
+
|
|
1506
|
+
this.workspace.undo(true);
|
|
1507
|
+
this.clock.runAll();
|
|
1508
|
+
assertBlockVarModelName(this.workspace, 0, 'name2');
|
|
1509
|
+
assertVariableValues(this.workspace, 'name2', 'type1', 'id1');
|
|
1510
|
+
});
|
|
1511
|
+
|
|
1512
|
+
test('Reference exists different capitalization no usages rename to Name1', function () {
|
|
1513
|
+
this.workspace.renameVariableById('id1', 'Name1');
|
|
1514
|
+
this.clock.runAll();
|
|
1515
|
+
|
|
1516
|
+
this.workspace.undo();
|
|
1517
|
+
this.clock.runAll();
|
|
1518
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1519
|
+
|
|
1520
|
+
this.workspace.undo(true);
|
|
1521
|
+
this.clock.runAll();
|
|
1522
|
+
assertVariableValues(this.workspace, 'Name1', 'type1', 'id1');
|
|
1523
|
+
});
|
|
1524
|
+
|
|
1525
|
+
test('Reference exists different capitalization with usages rename to Name1', function () {
|
|
1526
|
+
createVarBlocksNoEvents(this.workspace, ['id1']);
|
|
1527
|
+
this.workspace.renameVariableById('id1', 'Name1');
|
|
1528
|
+
this.clock.runAll();
|
|
1529
|
+
|
|
1530
|
+
this.workspace.undo();
|
|
1531
|
+
this.clock.runAll();
|
|
1532
|
+
assertBlockVarModelName(this.workspace, 0, 'name1');
|
|
1533
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1534
|
+
|
|
1535
|
+
this.workspace.undo(true);
|
|
1536
|
+
this.clock.runAll();
|
|
1537
|
+
assertBlockVarModelName(this.workspace, 0, 'Name1');
|
|
1538
|
+
assertVariableValues(this.workspace, 'Name1', 'type1', 'id1');
|
|
1539
|
+
});
|
|
1540
|
+
|
|
1541
|
+
suite('Two variables rename overlap', function () {
|
|
1542
|
+
test('Same type no usages rename variable with id1 to name2', function () {
|
|
1543
|
+
this.workspace.createVariable('name2', 'type1', 'id2');
|
|
1544
|
+
this.workspace.renameVariableById('id1', 'name2');
|
|
1545
|
+
this.clock.runAll();
|
|
1546
|
+
|
|
1547
|
+
this.workspace.undo();
|
|
1548
|
+
this.clock.runAll();
|
|
1549
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1550
|
+
assertVariableValues(this.workspace, 'name2', 'type1', 'id2');
|
|
1551
|
+
|
|
1552
|
+
this.workspace.undo(true);
|
|
1553
|
+
this.clock.runAll();
|
|
1554
|
+
assertVariableValues(this.workspace, 'name2', 'type1', 'id2');
|
|
1555
|
+
assert.isNull(this.workspace.getVariableById('id1'));
|
|
1556
|
+
});
|
|
1557
|
+
|
|
1558
|
+
test('Same type with usages rename variable with id1 to name2', function () {
|
|
1559
|
+
this.workspace.createVariable('name2', 'type1', 'id2');
|
|
1560
|
+
createVarBlocksNoEvents(this.workspace, ['id1', 'id2']);
|
|
1561
|
+
this.workspace.renameVariableById('id1', 'name2');
|
|
1562
|
+
this.clock.runAll();
|
|
1563
|
+
|
|
1564
|
+
this.workspace.undo();
|
|
1565
|
+
this.clock.runAll();
|
|
1566
|
+
assertBlockVarModelName(this.workspace, 0, 'name1');
|
|
1567
|
+
assertBlockVarModelName(this.workspace, 1, 'name2');
|
|
1568
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1569
|
+
assertVariableValues(this.workspace, 'name2', 'type1', 'id2');
|
|
1570
|
+
|
|
1571
|
+
this.workspace.undo(true);
|
|
1572
|
+
this.clock.runAll();
|
|
1573
|
+
assertVariableValues(this.workspace, 'name2', 'type1', 'id2');
|
|
1574
|
+
assert.isNull(this.workspace.getVariableById('id1'));
|
|
1575
|
+
});
|
|
1576
|
+
|
|
1577
|
+
test('Same type different capitalization no usages rename variable with id1 to Name2', function () {
|
|
1578
|
+
this.workspace.createVariable('name2', 'type1', 'id2');
|
|
1579
|
+
this.workspace.renameVariableById('id1', 'Name2');
|
|
1580
|
+
this.clock.runAll();
|
|
1581
|
+
|
|
1582
|
+
this.workspace.undo();
|
|
1583
|
+
this.clock.runAll();
|
|
1584
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1585
|
+
assertVariableValues(this.workspace, 'name2', 'type1', 'id2');
|
|
1586
|
+
|
|
1587
|
+
this.workspace.undo(true);
|
|
1588
|
+
this.clock.runAll();
|
|
1589
|
+
assertVariableValues(this.workspace, 'Name2', 'type1', 'id2');
|
|
1590
|
+
assert.isNull(this.workspace.getVariable('name1'));
|
|
1591
|
+
});
|
|
1592
|
+
|
|
1593
|
+
test('Same type different capitalization with usages rename variable with id1 to Name2', function () {
|
|
1594
|
+
this.workspace.createVariable('name2', 'type1', 'id2');
|
|
1595
|
+
createVarBlocksNoEvents(this.workspace, ['id1', 'id2']);
|
|
1596
|
+
this.workspace.renameVariableById('id1', 'Name2');
|
|
1597
|
+
this.clock.runAll();
|
|
1598
|
+
|
|
1599
|
+
this.workspace.undo();
|
|
1600
|
+
this.clock.runAll();
|
|
1601
|
+
assertBlockVarModelName(this.workspace, 0, 'name1');
|
|
1602
|
+
assertBlockVarModelName(this.workspace, 1, 'name2');
|
|
1603
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1604
|
+
assertVariableValues(this.workspace, 'name2', 'type1', 'id2');
|
|
1605
|
+
|
|
1606
|
+
this.workspace.undo(true);
|
|
1607
|
+
this.clock.runAll();
|
|
1608
|
+
assertVariableValues(this.workspace, 'Name2', 'type1', 'id2');
|
|
1609
|
+
assert.isNull(this.workspace.getVariableById('id1'));
|
|
1610
|
+
assertBlockVarModelName(this.workspace, 0, 'Name2');
|
|
1611
|
+
assertBlockVarModelName(this.workspace, 1, 'Name2');
|
|
1612
|
+
});
|
|
1613
|
+
|
|
1614
|
+
test('Different type no usages rename variable with id1 to name2', function () {
|
|
1615
|
+
this.workspace.createVariable('name2', 'type2', 'id2');
|
|
1616
|
+
this.workspace.renameVariableById('id1', 'name2');
|
|
1617
|
+
this.clock.runAll();
|
|
1618
|
+
|
|
1619
|
+
this.workspace.undo();
|
|
1620
|
+
this.clock.runAll();
|
|
1621
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1622
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1623
|
+
|
|
1624
|
+
this.workspace.undo(true);
|
|
1625
|
+
this.clock.runAll();
|
|
1626
|
+
assertVariableValues(this.workspace, 'name2', 'type1', 'id1');
|
|
1627
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1628
|
+
});
|
|
1629
|
+
|
|
1630
|
+
test('Different type with usages rename variable with id1 to name2', function () {
|
|
1631
|
+
this.workspace.createVariable('name2', 'type2', 'id2');
|
|
1632
|
+
createVarBlocksNoEvents(this.workspace, ['id1', 'id2']);
|
|
1633
|
+
this.workspace.renameVariableById('id1', 'name2');
|
|
1634
|
+
this.clock.runAll();
|
|
1635
|
+
|
|
1636
|
+
this.workspace.undo();
|
|
1637
|
+
this.clock.runAll();
|
|
1638
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1639
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1640
|
+
assertBlockVarModelName(this.workspace, 0, 'name1');
|
|
1641
|
+
assertBlockVarModelName(this.workspace, 1, 'name2');
|
|
1642
|
+
|
|
1643
|
+
this.workspace.undo(true);
|
|
1644
|
+
this.clock.runAll();
|
|
1645
|
+
assertVariableValues(this.workspace, 'name2', 'type1', 'id1');
|
|
1646
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1647
|
+
assertBlockVarModelName(this.workspace, 0, 'name2');
|
|
1648
|
+
assertBlockVarModelName(this.workspace, 1, 'name2');
|
|
1649
|
+
});
|
|
1650
|
+
|
|
1651
|
+
test('Different type different capitalization no usages rename variable with id1 to Name2', function () {
|
|
1652
|
+
this.workspace.createVariable('name2', 'type2', 'id2');
|
|
1653
|
+
this.workspace.renameVariableById('id1', 'Name2');
|
|
1654
|
+
this.clock.runAll();
|
|
1655
|
+
|
|
1656
|
+
this.workspace.undo();
|
|
1657
|
+
this.clock.runAll();
|
|
1658
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1659
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1660
|
+
|
|
1661
|
+
this.workspace.undo(true);
|
|
1662
|
+
this.clock.runAll();
|
|
1663
|
+
assertVariableValues(this.workspace, 'Name2', 'type1', 'id1');
|
|
1664
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1665
|
+
});
|
|
1666
|
+
|
|
1667
|
+
test('Different type different capitalization with usages rename variable with id1 to Name2', function () {
|
|
1668
|
+
this.workspace.createVariable('name2', 'type2', 'id2');
|
|
1669
|
+
createVarBlocksNoEvents(this.workspace, ['id1', 'id2']);
|
|
1670
|
+
this.workspace.renameVariableById('id1', 'Name2');
|
|
1671
|
+
this.clock.runAll();
|
|
1672
|
+
|
|
1673
|
+
this.workspace.undo();
|
|
1674
|
+
this.clock.runAll();
|
|
1675
|
+
assertVariableValues(this.workspace, 'name1', 'type1', 'id1');
|
|
1676
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1677
|
+
assertBlockVarModelName(this.workspace, 0, 'name1');
|
|
1678
|
+
assertBlockVarModelName(this.workspace, 1, 'name2');
|
|
1679
|
+
|
|
1680
|
+
this.workspace.undo(true);
|
|
1681
|
+
this.clock.runAll();
|
|
1682
|
+
assertVariableValues(this.workspace, 'Name2', 'type1', 'id1');
|
|
1683
|
+
assertVariableValues(this.workspace, 'name2', 'type2', 'id2');
|
|
1684
|
+
assertBlockVarModelName(this.workspace, 0, 'Name2');
|
|
1685
|
+
assertBlockVarModelName(this.workspace, 1, 'name2');
|
|
1686
|
+
});
|
|
1687
|
+
});
|
|
1688
|
+
});
|
|
1689
|
+
});
|
|
1690
|
+
});
|
|
1691
|
+
}
|