scratch-blocks 2.0.0-beta.1 → 2.0.0-spork.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.
Files changed (1065) hide show
  1. package/CHANGELOG.md +16 -16
  2. package/package.json +1 -1
  3. package/release.config.js +4 -0
  4. package/blockly-rc/.eslintignore +0 -28
  5. package/blockly-rc/.eslintrc.js +0 -187
  6. package/blockly-rc/.gitattributes +0 -1
  7. package/blockly-rc/.github/CODEOWNERS +0 -1
  8. package/blockly-rc/.github/CONTRIBUTING.md +0 -46
  9. package/blockly-rc/.github/ISSUE_TEMPLATE/bug_report.yaml +0 -58
  10. package/blockly-rc/.github/ISSUE_TEMPLATE/config.yml +0 -7
  11. package/blockly-rc/.github/ISSUE_TEMPLATE/documentation.yaml +0 -38
  12. package/blockly-rc/.github/ISSUE_TEMPLATE/feature_request.yaml +0 -39
  13. package/blockly-rc/.github/PULL_REQUEST_TEMPLATE.md +0 -42
  14. package/blockly-rc/.github/dependabot.yml +0 -27
  15. package/blockly-rc/.github/release.yml +0 -32
  16. package/blockly-rc/.github/workflows/appengine_deploy.yml +0 -54
  17. package/blockly-rc/.github/workflows/assign_reviewers.yml +0 -41
  18. package/blockly-rc/.github/workflows/browser_test.yml +0 -55
  19. package/blockly-rc/.github/workflows/build.yml +0 -86
  20. package/blockly-rc/.github/workflows/conventional-label.yml +0 -17
  21. package/blockly-rc/.github/workflows/develop_freeze.yml +0 -26
  22. package/blockly-rc/.github/workflows/tag_module_cleanup.yml +0 -37
  23. package/blockly-rc/.github/workflows/welcome_new_contributors.yml +0 -36
  24. package/blockly-rc/.prettierignore +0 -30
  25. package/blockly-rc/.prettierrc.js +0 -13
  26. package/blockly-rc/CHANGELOG.md +0 -77
  27. package/blockly-rc/LICENSE +0 -202
  28. package/blockly-rc/README.md +0 -80
  29. package/blockly-rc/_config.yml +0 -1
  30. package/blockly-rc/api-extractor.json +0 -385
  31. package/blockly-rc/appengine/.gcloudignore +0 -20
  32. package/blockly-rc/appengine/README.txt +0 -42
  33. package/blockly-rc/appengine/add_timestamps.py +0 -69
  34. package/blockly-rc/appengine/app.yaml +0 -104
  35. package/blockly-rc/appengine/apple-touch-icon.png +0 -0
  36. package/blockly-rc/appengine/blockly_compressed.js +0 -11
  37. package/blockly-rc/appengine/expiration.py +0 -52
  38. package/blockly-rc/appengine/favicon.ico +0 -0
  39. package/blockly-rc/appengine/index.yaml +0 -11
  40. package/blockly-rc/appengine/main.py +0 -39
  41. package/blockly-rc/appengine/redirect.html +0 -107
  42. package/blockly-rc/appengine/requirements.txt +0 -1
  43. package/blockly-rc/appengine/robots.txt +0 -2
  44. package/blockly-rc/appengine/storage.js +0 -190
  45. package/blockly-rc/appengine/storage.py +0 -125
  46. package/blockly-rc/blocks/blocks.ts +0 -44
  47. package/blockly-rc/blocks/lists.ts +0 -1085
  48. package/blockly-rc/blocks/logic.ts +0 -712
  49. package/blockly-rc/blocks/loops.ts +0 -408
  50. package/blockly-rc/blocks/math.ts +0 -591
  51. package/blockly-rc/blocks/procedures.ts +0 -1364
  52. package/blockly-rc/blocks/text.ts +0 -1007
  53. package/blockly-rc/blocks/variables.ts +0 -183
  54. package/blockly-rc/blocks/variables_dynamic.ts +0 -194
  55. package/blockly-rc/core/any_aliases.ts +0 -8
  56. package/blockly-rc/core/block.ts +0 -2523
  57. package/blockly-rc/core/block_animations.ts +0 -225
  58. package/blockly-rc/core/block_flyout_inflater.ts +0 -262
  59. package/blockly-rc/core/block_svg.ts +0 -1768
  60. package/blockly-rc/core/blockly.ts +0 -605
  61. package/blockly-rc/core/blockly_options.ts +0 -71
  62. package/blockly-rc/core/blocks.ts +0 -18
  63. package/blockly-rc/core/browser_events.ts +0 -244
  64. package/blockly-rc/core/bubbles/bubble.ts +0 -658
  65. package/blockly-rc/core/bubbles/mini_workspace_bubble.ts +0 -280
  66. package/blockly-rc/core/bubbles/text_bubble.ts +0 -103
  67. package/blockly-rc/core/bubbles/textinput_bubble.ts +0 -344
  68. package/blockly-rc/core/bubbles.ts +0 -12
  69. package/blockly-rc/core/bump_objects.ts +0 -192
  70. package/blockly-rc/core/button_flyout_inflater.ts +0 -63
  71. package/blockly-rc/core/clipboard/block_paster.ts +0 -142
  72. package/blockly-rc/core/clipboard/registry.ts +0 -31
  73. package/blockly-rc/core/clipboard/workspace_comment_paster.ts +0 -94
  74. package/blockly-rc/core/clipboard.ts +0 -113
  75. package/blockly-rc/core/comments/comment_view.ts +0 -899
  76. package/blockly-rc/core/comments/rendered_workspace_comment.ts +0 -297
  77. package/blockly-rc/core/comments/workspace_comment.ts +0 -237
  78. package/blockly-rc/core/comments.ts +0 -9
  79. package/blockly-rc/core/common.ts +0 -305
  80. package/blockly-rc/core/component_manager.ts +0 -235
  81. package/blockly-rc/core/config.ts +0 -65
  82. package/blockly-rc/core/connection.ts +0 -793
  83. package/blockly-rc/core/connection_checker.ts +0 -348
  84. package/blockly-rc/core/connection_db.ts +0 -297
  85. package/blockly-rc/core/connection_type.ts +0 -21
  86. package/blockly-rc/core/constants.ts +0 -23
  87. package/blockly-rc/core/contextmenu.ts +0 -268
  88. package/blockly-rc/core/contextmenu_items.ts +0 -700
  89. package/blockly-rc/core/contextmenu_registry.ts +0 -194
  90. package/blockly-rc/core/css.ts +0 -481
  91. package/blockly-rc/core/delete_area.ts +0 -77
  92. package/blockly-rc/core/dialog.ts +0 -121
  93. package/blockly-rc/core/drag_target.ts +0 -97
  94. package/blockly-rc/core/dragging/block_drag_strategy.ts +0 -454
  95. package/blockly-rc/core/dragging/bubble_drag_strategy.ts +0 -52
  96. package/blockly-rc/core/dragging/comment_drag_strategy.ts +0 -91
  97. package/blockly-rc/core/dragging/dragger.ts +0 -163
  98. package/blockly-rc/core/dragging.ts +0 -12
  99. package/blockly-rc/core/dropdowndiv.ts +0 -768
  100. package/blockly-rc/core/events/events.ts +0 -163
  101. package/blockly-rc/core/events/events_abstract.ts +0 -130
  102. package/blockly-rc/core/events/events_block_base.ts +0 -88
  103. package/blockly-rc/core/events/events_block_change.ts +0 -259
  104. package/blockly-rc/core/events/events_block_create.ts +0 -185
  105. package/blockly-rc/core/events/events_block_delete.ts +0 -182
  106. package/blockly-rc/core/events/events_block_drag.ts +0 -116
  107. package/blockly-rc/core/events/events_block_field_intermediate_change.ts +0 -167
  108. package/blockly-rc/core/events/events_block_move.ts +0 -307
  109. package/blockly-rc/core/events/events_bubble_open.ts +0 -120
  110. package/blockly-rc/core/events/events_click.ts +0 -110
  111. package/blockly-rc/core/events/events_comment_base.ts +0 -126
  112. package/blockly-rc/core/events/events_comment_change.ts +0 -161
  113. package/blockly-rc/core/events/events_comment_collapse.ts +0 -103
  114. package/blockly-rc/core/events/events_comment_create.ts +0 -118
  115. package/blockly-rc/core/events/events_comment_delete.ts +0 -117
  116. package/blockly-rc/core/events/events_comment_drag.ts +0 -99
  117. package/blockly-rc/core/events/events_comment_move.ts +0 -207
  118. package/blockly-rc/core/events/events_comment_resize.ts +0 -174
  119. package/blockly-rc/core/events/events_marker_move.ts +0 -134
  120. package/blockly-rc/core/events/events_selected.ts +0 -98
  121. package/blockly-rc/core/events/events_theme_change.ts +0 -84
  122. package/blockly-rc/core/events/events_toolbox_item_select.ts +0 -96
  123. package/blockly-rc/core/events/events_trashcan_open.ts +0 -88
  124. package/blockly-rc/core/events/events_ui_base.ts +0 -47
  125. package/blockly-rc/core/events/events_var_base.ts +0 -89
  126. package/blockly-rc/core/events/events_var_create.ts +0 -129
  127. package/blockly-rc/core/events/events_var_delete.ts +0 -124
  128. package/blockly-rc/core/events/events_var_rename.ts +0 -133
  129. package/blockly-rc/core/events/events_var_type_change.ts +0 -122
  130. package/blockly-rc/core/events/events_viewport.ts +0 -149
  131. package/blockly-rc/core/events/utils.ts +0 -595
  132. package/blockly-rc/core/events/workspace_events.ts +0 -46
  133. package/blockly-rc/core/extensions.ts +0 -491
  134. package/blockly-rc/core/field.ts +0 -1471
  135. package/blockly-rc/core/field_checkbox.ts +0 -271
  136. package/blockly-rc/core/field_dropdown.ts +0 -857
  137. package/blockly-rc/core/field_image.ts +0 -297
  138. package/blockly-rc/core/field_input.ts +0 -755
  139. package/blockly-rc/core/field_label.ts +0 -150
  140. package/blockly-rc/core/field_label_serializable.ts +0 -73
  141. package/blockly-rc/core/field_number.ts +0 -381
  142. package/blockly-rc/core/field_registry.ts +0 -115
  143. package/blockly-rc/core/field_textinput.ts +0 -117
  144. package/blockly-rc/core/field_variable.ts +0 -651
  145. package/blockly-rc/core/flyout_base.ts +0 -968
  146. package/blockly-rc/core/flyout_button.ts +0 -416
  147. package/blockly-rc/core/flyout_horizontal.ts +0 -374
  148. package/blockly-rc/core/flyout_metrics_manager.ts +0 -90
  149. package/blockly-rc/core/flyout_separator.ts +0 -61
  150. package/blockly-rc/core/flyout_vertical.ts +0 -353
  151. package/blockly-rc/core/generator.ts +0 -611
  152. package/blockly-rc/core/gesture.ts +0 -1191
  153. package/blockly-rc/core/grid.ts +0 -252
  154. package/blockly-rc/core/icons/comment_icon.ts +0 -435
  155. package/blockly-rc/core/icons/exceptions.ts +0 -23
  156. package/blockly-rc/core/icons/icon.ts +0 -147
  157. package/blockly-rc/core/icons/icon_types.ts +0 -32
  158. package/blockly-rc/core/icons/mutator_icon.ts +0 -354
  159. package/blockly-rc/core/icons/registry.ts +0 -33
  160. package/blockly-rc/core/icons/warning_icon.ts +0 -219
  161. package/blockly-rc/core/icons.ts +0 -24
  162. package/blockly-rc/core/inject.ts +0 -428
  163. package/blockly-rc/core/inputs/align.ts +0 -14
  164. package/blockly-rc/core/inputs/dummy_input.ts +0 -26
  165. package/blockly-rc/core/inputs/end_row_input.ts +0 -31
  166. package/blockly-rc/core/inputs/input.ts +0 -318
  167. package/blockly-rc/core/inputs/input_types.ts +0 -27
  168. package/blockly-rc/core/inputs/statement_input.ts +0 -34
  169. package/blockly-rc/core/inputs/value_input.ts +0 -30
  170. package/blockly-rc/core/inputs.ts +0 -23
  171. package/blockly-rc/core/insertion_marker_manager.ts +0 -742
  172. package/blockly-rc/core/insertion_marker_previewer.ts +0 -254
  173. package/blockly-rc/core/interfaces/i_ast_node_location.ts +0 -12
  174. package/blockly-rc/core/interfaces/i_ast_node_location_svg.ts +0 -28
  175. package/blockly-rc/core/interfaces/i_ast_node_location_with_block.ts +0 -22
  176. package/blockly-rc/core/interfaces/i_autohideable.ts +0 -22
  177. package/blockly-rc/core/interfaces/i_bounded_element.ts +0 -30
  178. package/blockly-rc/core/interfaces/i_bubble.ts +0 -63
  179. package/blockly-rc/core/interfaces/i_collapsible_toolbox_item.ts +0 -33
  180. package/blockly-rc/core/interfaces/i_comment_icon.ts +0 -47
  181. package/blockly-rc/core/interfaces/i_component.ts +0 -19
  182. package/blockly-rc/core/interfaces/i_connection_checker.ts +0 -100
  183. package/blockly-rc/core/interfaces/i_connection_previewer.ts +0 -50
  184. package/blockly-rc/core/interfaces/i_contextmenu.ts +0 -16
  185. package/blockly-rc/core/interfaces/i_copyable.ts +0 -31
  186. package/blockly-rc/core/interfaces/i_deletable.ts +0 -34
  187. package/blockly-rc/core/interfaces/i_delete_area.ts +0 -28
  188. package/blockly-rc/core/interfaces/i_drag_target.ts +0 -69
  189. package/blockly-rc/core/interfaces/i_draggable.ts +0 -72
  190. package/blockly-rc/core/interfaces/i_dragger.ts +0 -35
  191. package/blockly-rc/core/interfaces/i_flyout.ts +0 -189
  192. package/blockly-rc/core/interfaces/i_flyout_inflater.ts +0 -41
  193. package/blockly-rc/core/interfaces/i_has_bubble.ts +0 -20
  194. package/blockly-rc/core/interfaces/i_icon.ts +0 -114
  195. package/blockly-rc/core/interfaces/i_keyboard_accessible.ts +0 -21
  196. package/blockly-rc/core/interfaces/i_legacy_procedure_blocks.ts +0 -50
  197. package/blockly-rc/core/interfaces/i_metrics_manager.ts +0 -149
  198. package/blockly-rc/core/interfaces/i_movable.ts +0 -19
  199. package/blockly-rc/core/interfaces/i_observable.ts +0 -24
  200. package/blockly-rc/core/interfaces/i_parameter_model.ts +0 -51
  201. package/blockly-rc/core/interfaces/i_paster.ts +0 -25
  202. package/blockly-rc/core/interfaces/i_positionable.ts +0 -33
  203. package/blockly-rc/core/interfaces/i_procedure_block.ts +0 -27
  204. package/blockly-rc/core/interfaces/i_procedure_map.ts +0 -18
  205. package/blockly-rc/core/interfaces/i_procedure_model.ts +0 -71
  206. package/blockly-rc/core/interfaces/i_registrable.ts +0 -12
  207. package/blockly-rc/core/interfaces/i_rendered_element.ts +0 -22
  208. package/blockly-rc/core/interfaces/i_selectable.ts +0 -34
  209. package/blockly-rc/core/interfaces/i_selectable_toolbox_item.ts +0 -63
  210. package/blockly-rc/core/interfaces/i_serializable.ts +0 -28
  211. package/blockly-rc/core/interfaces/i_serializer.ts +0 -55
  212. package/blockly-rc/core/interfaces/i_styleable.ts +0 -26
  213. package/blockly-rc/core/interfaces/i_toolbox.ts +0 -112
  214. package/blockly-rc/core/interfaces/i_toolbox_item.ts +0 -81
  215. package/blockly-rc/core/interfaces/i_variable_backed_parameter_model.ts +0 -23
  216. package/blockly-rc/core/interfaces/i_variable_map.ts +0 -65
  217. package/blockly-rc/core/interfaces/i_variable_model.ts +0 -57
  218. package/blockly-rc/core/internal_constants.ts +0 -47
  219. package/blockly-rc/core/keyboard_nav/ast_node.ts +0 -884
  220. package/blockly-rc/core/keyboard_nav/basic_cursor.ts +0 -223
  221. package/blockly-rc/core/keyboard_nav/cursor.ts +0 -138
  222. package/blockly-rc/core/keyboard_nav/marker.ts +0 -113
  223. package/blockly-rc/core/keyboard_nav/tab_navigate_cursor.ts +0 -46
  224. package/blockly-rc/core/label_flyout_inflater.ts +0 -59
  225. package/blockly-rc/core/layer_manager.ts +0 -186
  226. package/blockly-rc/core/layers.ts +0 -17
  227. package/blockly-rc/core/main.ts +0 -31
  228. package/blockly-rc/core/marker_manager.ts +0 -189
  229. package/blockly-rc/core/menu.ts +0 -463
  230. package/blockly-rc/core/menuitem.ts +0 -221
  231. package/blockly-rc/core/metrics_manager.ts +0 -486
  232. package/blockly-rc/core/msg.ts +0 -27
  233. package/blockly-rc/core/names.ts +0 -275
  234. package/blockly-rc/core/observable_procedure_map.ts +0 -66
  235. package/blockly-rc/core/options.ts +0 -377
  236. package/blockly-rc/core/positionable_helpers.ts +0 -186
  237. package/blockly-rc/core/procedures.ts +0 -510
  238. package/blockly-rc/core/registry.ts +0 -400
  239. package/blockly-rc/core/render_management.ts +0 -193
  240. package/blockly-rc/core/rendered_connection.ts +0 -571
  241. package/blockly-rc/core/renderers/common/block_rendering.ts +0 -120
  242. package/blockly-rc/core/renderers/common/constants.ts +0 -1198
  243. package/blockly-rc/core/renderers/common/drawer.ts +0 -518
  244. package/blockly-rc/core/renderers/common/i_path_object.ts +0 -137
  245. package/blockly-rc/core/renderers/common/info.ts +0 -767
  246. package/blockly-rc/core/renderers/common/marker_svg.ts +0 -765
  247. package/blockly-rc/core/renderers/common/path_object.ts +0 -324
  248. package/blockly-rc/core/renderers/common/renderer.ts +0 -281
  249. package/blockly-rc/core/renderers/geras/constants.ts +0 -46
  250. package/blockly-rc/core/renderers/geras/drawer.ts +0 -167
  251. package/blockly-rc/core/renderers/geras/geras.ts +0 -31
  252. package/blockly-rc/core/renderers/geras/highlight_constants.ts +0 -342
  253. package/blockly-rc/core/renderers/geras/highlighter.ts +0 -313
  254. package/blockly-rc/core/renderers/geras/info.ts +0 -478
  255. package/blockly-rc/core/renderers/geras/measurables/inline_input.ts +0 -37
  256. package/blockly-rc/core/renderers/geras/measurables/statement_input.ts +0 -36
  257. package/blockly-rc/core/renderers/geras/path_object.ts +0 -135
  258. package/blockly-rc/core/renderers/geras/renderer.ts +0 -124
  259. package/blockly-rc/core/renderers/measurables/base.ts +0 -41
  260. package/blockly-rc/core/renderers/measurables/bottom_row.ts +0 -104
  261. package/blockly-rc/core/renderers/measurables/connection.ts +0 -43
  262. package/blockly-rc/core/renderers/measurables/external_value_input.ts +0 -53
  263. package/blockly-rc/core/renderers/measurables/field.ts +0 -50
  264. package/blockly-rc/core/renderers/measurables/hat.ts +0 -33
  265. package/blockly-rc/core/renderers/measurables/icon.ts +0 -42
  266. package/blockly-rc/core/renderers/measurables/in_row_spacer.ts +0 -29
  267. package/blockly-rc/core/renderers/measurables/inline_input.ts +0 -63
  268. package/blockly-rc/core/renderers/measurables/input_connection.ts +0 -57
  269. package/blockly-rc/core/renderers/measurables/input_row.ts +0 -67
  270. package/blockly-rc/core/renderers/measurables/jagged_edge.ts +0 -28
  271. package/blockly-rc/core/renderers/measurables/next_connection.ts +0 -34
  272. package/blockly-rc/core/renderers/measurables/output_connection.ts +0 -43
  273. package/blockly-rc/core/renderers/measurables/previous_connection.ts +0 -34
  274. package/blockly-rc/core/renderers/measurables/round_corner.ts +0 -34
  275. package/blockly-rc/core/renderers/measurables/row.ts +0 -191
  276. package/blockly-rc/core/renderers/measurables/spacer_row.ts +0 -44
  277. package/blockly-rc/core/renderers/measurables/square_corner.ts +0 -32
  278. package/blockly-rc/core/renderers/measurables/statement_input.ts +0 -41
  279. package/blockly-rc/core/renderers/measurables/top_row.ts +0 -110
  280. package/blockly-rc/core/renderers/measurables/types.ts +0 -319
  281. package/blockly-rc/core/renderers/thrasos/info.ts +0 -328
  282. package/blockly-rc/core/renderers/thrasos/renderer.ts +0 -40
  283. package/blockly-rc/core/renderers/thrasos/thrasos.ts +0 -14
  284. package/blockly-rc/core/renderers/zelos/constants.ts +0 -877
  285. package/blockly-rc/core/renderers/zelos/drawer.ts +0 -274
  286. package/blockly-rc/core/renderers/zelos/info.ts +0 -652
  287. package/blockly-rc/core/renderers/zelos/marker_svg.ts +0 -145
  288. package/blockly-rc/core/renderers/zelos/measurables/bottom_row.ts +0 -44
  289. package/blockly-rc/core/renderers/zelos/measurables/inputs.ts +0 -41
  290. package/blockly-rc/core/renderers/zelos/measurables/row_elements.ts +0 -29
  291. package/blockly-rc/core/renderers/zelos/measurables/top_row.ts +0 -50
  292. package/blockly-rc/core/renderers/zelos/path_object.ts +0 -209
  293. package/blockly-rc/core/renderers/zelos/renderer.ts +0 -143
  294. package/blockly-rc/core/renderers/zelos/zelos.ts +0 -33
  295. package/blockly-rc/core/scrollbar.ts +0 -898
  296. package/blockly-rc/core/scrollbar_pair.ts +0 -349
  297. package/blockly-rc/core/separator_flyout_inflater.ts +0 -69
  298. package/blockly-rc/core/serialization/blocks.ts +0 -868
  299. package/blockly-rc/core/serialization/exceptions.ts +0 -112
  300. package/blockly-rc/core/serialization/priorities.ts +0 -25
  301. package/blockly-rc/core/serialization/procedures.ts +0 -158
  302. package/blockly-rc/core/serialization/registry.ts +0 -30
  303. package/blockly-rc/core/serialization/variables.ts +0 -68
  304. package/blockly-rc/core/serialization/workspace_comments.ts +0 -143
  305. package/blockly-rc/core/serialization/workspaces.ts +0 -94
  306. package/blockly-rc/core/serialization.ts +0 -32
  307. package/blockly-rc/core/shortcut_items.ts +0 -338
  308. package/blockly-rc/core/shortcut_registry.ts +0 -368
  309. package/blockly-rc/core/sprites.ts +0 -15
  310. package/blockly-rc/core/theme/classic.ts +0 -40
  311. package/blockly-rc/core/theme/themes.ts +0 -12
  312. package/blockly-rc/core/theme/zelos.ts +0 -80
  313. package/blockly-rc/core/theme.ts +0 -232
  314. package/blockly-rc/core/theme_manager.ts +0 -192
  315. package/blockly-rc/core/toolbox/category.ts +0 -739
  316. package/blockly-rc/core/toolbox/collapsible_category.ts +0 -288
  317. package/blockly-rc/core/toolbox/separator.ts +0 -105
  318. package/blockly-rc/core/toolbox/toolbox.ts +0 -1134
  319. package/blockly-rc/core/toolbox/toolbox_item.ts +0 -152
  320. package/blockly-rc/core/tooltip.ts +0 -466
  321. package/blockly-rc/core/touch.ts +0 -155
  322. package/blockly-rc/core/trashcan.ts +0 -748
  323. package/blockly-rc/core/utils/aria.ts +0 -144
  324. package/blockly-rc/core/utils/array.ts +0 -24
  325. package/blockly-rc/core/utils/colour.ts +0 -265
  326. package/blockly-rc/core/utils/coordinate.ts +0 -129
  327. package/blockly-rc/core/utils/deprecation.ts +0 -47
  328. package/blockly-rc/core/utils/dom.ts +0 -356
  329. package/blockly-rc/core/utils/idgenerator.ts +0 -70
  330. package/blockly-rc/core/utils/keycodes.ts +0 -154
  331. package/blockly-rc/core/utils/math.ts +0 -50
  332. package/blockly-rc/core/utils/metrics.ts +0 -86
  333. package/blockly-rc/core/utils/object.ts +0 -28
  334. package/blockly-rc/core/utils/parsing.ts +0 -287
  335. package/blockly-rc/core/utils/rect.ts +0 -69
  336. package/blockly-rc/core/utils/size.ts +0 -62
  337. package/blockly-rc/core/utils/string.ts +0 -289
  338. package/blockly-rc/core/utils/style.ts +0 -219
  339. package/blockly-rc/core/utils/svg.ts +0 -84
  340. package/blockly-rc/core/utils/svg_math.ts +0 -208
  341. package/blockly-rc/core/utils/svg_paths.ts +0 -133
  342. package/blockly-rc/core/utils/toolbox.ts +0 -419
  343. package/blockly-rc/core/utils/useragent.ts +0 -86
  344. package/blockly-rc/core/utils/xml.ts +0 -165
  345. package/blockly-rc/core/utils.ts +0 -59
  346. package/blockly-rc/core/variable_map.ts +0 -437
  347. package/blockly-rc/core/variable_model.ts +0 -149
  348. package/blockly-rc/core/variables.ts +0 -773
  349. package/blockly-rc/core/variables_dynamic.ts +0 -142
  350. package/blockly-rc/core/widgetdiv.ts +0 -319
  351. package/blockly-rc/core/workspace.ts +0 -957
  352. package/blockly-rc/core/workspace_audio.ts +0 -171
  353. package/blockly-rc/core/workspace_dragger.ts +0 -97
  354. package/blockly-rc/core/workspace_svg.ts +0 -2519
  355. package/blockly-rc/core/xml.ts +0 -1133
  356. package/blockly-rc/core/zoom_controls.ts +0 -492
  357. package/blockly-rc/demos/blockfactory/analytics.js +0 -195
  358. package/blockly-rc/demos/blockfactory/app_controller.js +0 -726
  359. package/blockly-rc/demos/blockfactory/block_definition_extractor.js +0 -742
  360. package/blockly-rc/demos/blockfactory/block_exporter_controller.js +0 -311
  361. package/blockly-rc/demos/blockfactory/block_exporter_tools.js +0 -212
  362. package/blockly-rc/demos/blockfactory/block_exporter_view.js +0 -101
  363. package/blockly-rc/demos/blockfactory/block_library_controller.js +0 -325
  364. package/blockly-rc/demos/blockfactory/block_library_storage.js +0 -149
  365. package/blockly-rc/demos/blockfactory/block_library_view.js +0 -178
  366. package/blockly-rc/demos/blockfactory/block_option.js +0 -151
  367. package/blockly-rc/demos/blockfactory/blocks.js +0 -916
  368. package/blockly-rc/demos/blockfactory/cp.css +0 -46
  369. package/blockly-rc/demos/blockfactory/cp.js +0 -179
  370. package/blockly-rc/demos/blockfactory/factory.css +0 -586
  371. package/blockly-rc/demos/blockfactory/factory.js +0 -337
  372. package/blockly-rc/demos/blockfactory/factory_utils.js +0 -1036
  373. package/blockly-rc/demos/blockfactory/icon.png +0 -0
  374. package/blockly-rc/demos/blockfactory/index.html +0 -767
  375. package/blockly-rc/demos/blockfactory/link.png +0 -0
  376. package/blockly-rc/demos/blockfactory/standard_categories.js +0 -384
  377. package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_controller.js +0 -1332
  378. package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_generator.js +0 -224
  379. package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_init.js +0 -541
  380. package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_model.js +0 -548
  381. package/blockly-rc/demos/blockfactory/workspacefactory/wfactory_view.js +0 -424
  382. package/blockly-rc/demos/code/code.js +0 -626
  383. package/blockly-rc/demos/code/icon.png +0 -0
  384. package/blockly-rc/demos/code/icons.png +0 -0
  385. package/blockly-rc/demos/code/index.html +0 -359
  386. package/blockly-rc/demos/code/msg/ar.js +0 -24
  387. package/blockly-rc/demos/code/msg/be-tarask.js +0 -24
  388. package/blockly-rc/demos/code/msg/br.js +0 -24
  389. package/blockly-rc/demos/code/msg/ca.js +0 -24
  390. package/blockly-rc/demos/code/msg/cs.js +0 -24
  391. package/blockly-rc/demos/code/msg/da.js +0 -24
  392. package/blockly-rc/demos/code/msg/de.js +0 -24
  393. package/blockly-rc/demos/code/msg/el.js +0 -24
  394. package/blockly-rc/demos/code/msg/en.js +0 -24
  395. package/blockly-rc/demos/code/msg/es.js +0 -24
  396. package/blockly-rc/demos/code/msg/et.js +0 -24
  397. package/blockly-rc/demos/code/msg/fa.js +0 -24
  398. package/blockly-rc/demos/code/msg/fr.js +0 -24
  399. package/blockly-rc/demos/code/msg/he.js +0 -24
  400. package/blockly-rc/demos/code/msg/hr.js +0 -24
  401. package/blockly-rc/demos/code/msg/hrx.js +0 -24
  402. package/blockly-rc/demos/code/msg/hu.js +0 -24
  403. package/blockly-rc/demos/code/msg/ia.js +0 -24
  404. package/blockly-rc/demos/code/msg/is.js +0 -24
  405. package/blockly-rc/demos/code/msg/it.js +0 -24
  406. package/blockly-rc/demos/code/msg/ja.js +0 -24
  407. package/blockly-rc/demos/code/msg/kab.js +0 -24
  408. package/blockly-rc/demos/code/msg/ko.js +0 -24
  409. package/blockly-rc/demos/code/msg/mk.js +0 -24
  410. package/blockly-rc/demos/code/msg/ms.js +0 -24
  411. package/blockly-rc/demos/code/msg/nb.js +0 -24
  412. package/blockly-rc/demos/code/msg/nl.js +0 -24
  413. package/blockly-rc/demos/code/msg/oc.js +0 -24
  414. package/blockly-rc/demos/code/msg/pl.js +0 -24
  415. package/blockly-rc/demos/code/msg/pms.js +0 -24
  416. package/blockly-rc/demos/code/msg/pt-br.js +0 -24
  417. package/blockly-rc/demos/code/msg/ro.js +0 -24
  418. package/blockly-rc/demos/code/msg/ru.js +0 -24
  419. package/blockly-rc/demos/code/msg/sc.js +0 -24
  420. package/blockly-rc/demos/code/msg/sk.js +0 -24
  421. package/blockly-rc/demos/code/msg/sr.js +0 -24
  422. package/blockly-rc/demos/code/msg/sv.js +0 -24
  423. package/blockly-rc/demos/code/msg/ta.js +0 -24
  424. package/blockly-rc/demos/code/msg/th.js +0 -24
  425. package/blockly-rc/demos/code/msg/tlh.js +0 -24
  426. package/blockly-rc/demos/code/msg/tr.js +0 -24
  427. package/blockly-rc/demos/code/msg/uk.js +0 -24
  428. package/blockly-rc/demos/code/msg/vi.js +0 -24
  429. package/blockly-rc/demos/code/msg/zh-hans.js +0 -24
  430. package/blockly-rc/demos/code/msg/zh-hant.js +0 -24
  431. package/blockly-rc/demos/code/style.css +0 -184
  432. package/blockly-rc/demos/index.html +0 -68
  433. package/blockly-rc/demos/minimap/icon.png +0 -0
  434. package/blockly-rc/demos/minimap/index.html +0 -91
  435. package/blockly-rc/demos/minimap/minimap.js +0 -302
  436. package/blockly-rc/demos/mobile/README.md +0 -53
  437. package/blockly-rc/demos/mobile/android/README.md +0 -45
  438. package/blockly-rc/demos/mobile/android/app/build.gradle +0 -64
  439. package/blockly-rc/demos/mobile/android/app/proguard-rules.pro +0 -21
  440. package/blockly-rc/demos/mobile/android/app/src/androidTest/java/com/example/blocklywebview/ExampleInstrumentedTest.java +0 -26
  441. package/blockly-rc/demos/mobile/android/app/src/main/AndroidManifest.xml +0 -21
  442. package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/BlocklyWebViewFragment.java +0 -40
  443. package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/JsDialogHelper.java +0 -150
  444. package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/WebChromeClient.java +0 -32
  445. package/blockly-rc/demos/mobile/android/app/src/main/java/com/google/blockly/android/webview/demo/MainActivity.java +0 -18
  446. package/blockly-rc/demos/mobile/android/app/src/main/res/drawable/ic_launcher_background.xml +0 -74
  447. package/blockly-rc/demos/mobile/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +0 -34
  448. package/blockly-rc/demos/mobile/android/app/src/main/res/layout/activity_main.xml +0 -17
  449. package/blockly-rc/demos/mobile/android/app/src/main/res/layout/js_prompt.xml +0 -37
  450. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +0 -5
  451. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +0 -5
  452. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  453. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  454. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  455. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  456. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  457. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  458. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  459. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  460. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  461. package/blockly-rc/demos/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  462. package/blockly-rc/demos/mobile/android/app/src/main/res/values/colors.xml +0 -6
  463. package/blockly-rc/demos/mobile/android/app/src/main/res/values/js_dialog_helper.xml +0 -7
  464. package/blockly-rc/demos/mobile/android/app/src/main/res/values/strings.xml +0 -3
  465. package/blockly-rc/demos/mobile/android/app/src/main/res/values/styles.xml +0 -11
  466. package/blockly-rc/demos/mobile/android/app/src/test/java/com/example/blocklywebview/ExampleUnitTest.java +0 -17
  467. package/blockly-rc/demos/mobile/android/build.gradle +0 -27
  468. package/blockly-rc/demos/mobile/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  469. package/blockly-rc/demos/mobile/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  470. package/blockly-rc/demos/mobile/android/gradle.properties +0 -13
  471. package/blockly-rc/demos/mobile/android/gradlew +0 -172
  472. package/blockly-rc/demos/mobile/android/gradlew.bat +0 -84
  473. package/blockly-rc/demos/mobile/android/settings.gradle +0 -1
  474. package/blockly-rc/demos/mobile/html/index.html +0 -31
  475. package/blockly-rc/demos/mobile/html/ln_resources.sh +0 -22
  476. package/blockly-rc/demos/mobile/html/toolbox_standard.js +0 -333
  477. package/blockly-rc/demos/mobile/ios/Blockly WebView/AppDelegate.swift +0 -46
  478. package/blockly-rc/demos/mobile/ios/Blockly WebView/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -98
  479. package/blockly-rc/demos/mobile/ios/Blockly WebView/Assets.xcassets/Contents.json +0 -6
  480. package/blockly-rc/demos/mobile/ios/Blockly WebView/Base.lproj/LaunchScreen.storyboard +0 -25
  481. package/blockly-rc/demos/mobile/ios/Blockly WebView/Base.lproj/Main.storyboard +0 -44
  482. package/blockly-rc/demos/mobile/ios/Blockly WebView/Info.plist +0 -45
  483. package/blockly-rc/demos/mobile/ios/Blockly WebView/ViewController.swift +0 -110
  484. package/blockly-rc/demos/mobile/ios/Blockly WebView.xcodeproj/project.pbxproj +0 -390
  485. package/blockly-rc/demos/mobile/ios/Blockly WebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  486. package/blockly-rc/demos/mobile/ios/Blockly WebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  487. package/blockly-rc/demos/mobile/ios/cp_resources.sh +0 -21
  488. package/blockly-rc/demos/storage/icon.png +0 -0
  489. package/blockly-rc/demos/storage/index.html +0 -104
  490. package/blockly-rc/generators/dart/dart_generator.ts +0 -321
  491. package/blockly-rc/generators/dart/lists.ts +0 -525
  492. package/blockly-rc/generators/dart/logic.ts +0 -155
  493. package/blockly-rc/generators/dart/loops.ts +0 -217
  494. package/blockly-rc/generators/dart/math.ts +0 -559
  495. package/blockly-rc/generators/dart/procedures.ts +0 -138
  496. package/blockly-rc/generators/dart/text.ts +0 -405
  497. package/blockly-rc/generators/dart/variables.ts +0 -32
  498. package/blockly-rc/generators/dart/variables_dynamic.ts +0 -17
  499. package/blockly-rc/generators/dart.ts +0 -50
  500. package/blockly-rc/generators/javascript/javascript_generator.ts +0 -346
  501. package/blockly-rc/generators/javascript/lists.ts +0 -465
  502. package/blockly-rc/generators/javascript/logic.ts +0 -153
  503. package/blockly-rc/generators/javascript/loops.ts +0 -245
  504. package/blockly-rc/generators/javascript/math.ts +0 -450
  505. package/blockly-rc/generators/javascript/procedures.ts +0 -142
  506. package/blockly-rc/generators/javascript/text.ts +0 -418
  507. package/blockly-rc/generators/javascript/variables.ts +0 -32
  508. package/blockly-rc/generators/javascript/variables_dynamic.ts +0 -17
  509. package/blockly-rc/generators/javascript.ts +0 -46
  510. package/blockly-rc/generators/lua/lists.ts +0 -445
  511. package/blockly-rc/generators/lua/logic.ts +0 -142
  512. package/blockly-rc/generators/lua/loops.ts +0 -192
  513. package/blockly-rc/generators/lua/lua_generator.ts +0 -225
  514. package/blockly-rc/generators/lua/math.ts +0 -473
  515. package/blockly-rc/generators/lua/procedures.ts +0 -144
  516. package/blockly-rc/generators/lua/text.ts +0 -380
  517. package/blockly-rc/generators/lua/variables.ts +0 -31
  518. package/blockly-rc/generators/lua/variables_dynamic.ts +0 -17
  519. package/blockly-rc/generators/lua.ts +0 -44
  520. package/blockly-rc/generators/php/lists.ts +0 -585
  521. package/blockly-rc/generators/php/logic.ts +0 -155
  522. package/blockly-rc/generators/php/loops.ts +0 -218
  523. package/blockly-rc/generators/php/math.ts +0 -408
  524. package/blockly-rc/generators/php/php_generator.ts +0 -320
  525. package/blockly-rc/generators/php/procedures.ts +0 -159
  526. package/blockly-rc/generators/php/text.ts +0 -315
  527. package/blockly-rc/generators/php/variables.ts +0 -32
  528. package/blockly-rc/generators/php/variables_dynamic.ts +0 -17
  529. package/blockly-rc/generators/php.ts +0 -46
  530. package/blockly-rc/generators/python/lists.ts +0 -398
  531. package/blockly-rc/generators/python/logic.ts +0 -148
  532. package/blockly-rc/generators/python/loops.ts +0 -251
  533. package/blockly-rc/generators/python/math.ts +0 -434
  534. package/blockly-rc/generators/python/procedures.ts +0 -159
  535. package/blockly-rc/generators/python/python_generator.ts +0 -355
  536. package/blockly-rc/generators/python/text.ts +0 -338
  537. package/blockly-rc/generators/python/variables.ts +0 -31
  538. package/blockly-rc/generators/python/variables_dynamic.ts +0 -17
  539. package/blockly-rc/generators/python.ts +0 -51
  540. package/blockly-rc/gulpfile.js +0 -54
  541. package/blockly-rc/jsconfig.json +0 -7
  542. package/blockly-rc/media/1x1.gif +0 -0
  543. package/blockly-rc/media/click.mp3 +0 -0
  544. package/blockly-rc/media/click.ogg +0 -0
  545. package/blockly-rc/media/click.wav +0 -0
  546. package/blockly-rc/media/delete-icon.svg +0 -1
  547. package/blockly-rc/media/delete.mp3 +0 -0
  548. package/blockly-rc/media/delete.ogg +0 -0
  549. package/blockly-rc/media/delete.wav +0 -0
  550. package/blockly-rc/media/disconnect.mp3 +0 -0
  551. package/blockly-rc/media/disconnect.ogg +0 -0
  552. package/blockly-rc/media/disconnect.wav +0 -0
  553. package/blockly-rc/media/dropdown-arrow.svg +0 -1
  554. package/blockly-rc/media/foldout-icon.svg +0 -1
  555. package/blockly-rc/media/handclosed.cur +0 -0
  556. package/blockly-rc/media/handdelete.cur +0 -0
  557. package/blockly-rc/media/handopen.cur +0 -0
  558. package/blockly-rc/media/pilcrow.png +0 -0
  559. package/blockly-rc/media/quote0.png +0 -0
  560. package/blockly-rc/media/quote1.png +0 -0
  561. package/blockly-rc/media/resize-handle.svg +0 -3
  562. package/blockly-rc/media/sprites.png +0 -0
  563. package/blockly-rc/media/sprites.svg +0 -74
  564. package/blockly-rc/msg/json/README.md +0 -33
  565. package/blockly-rc/msg/json/ab.json +0 -222
  566. package/blockly-rc/msg/json/ace.json +0 -7
  567. package/blockly-rc/msg/json/af.json +0 -34
  568. package/blockly-rc/msg/json/am.json +0 -30
  569. package/blockly-rc/msg/json/ar.json +0 -355
  570. package/blockly-rc/msg/json/ast.json +0 -10
  571. package/blockly-rc/msg/json/az.json +0 -332
  572. package/blockly-rc/msg/json/ba.json +0 -211
  573. package/blockly-rc/msg/json/bcc.json +0 -290
  574. package/blockly-rc/msg/json/be-tarask.json +0 -334
  575. package/blockly-rc/msg/json/be.json +0 -324
  576. package/blockly-rc/msg/json/bg.json +0 -345
  577. package/blockly-rc/msg/json/bn.json +0 -189
  578. package/blockly-rc/msg/json/br.json +0 -334
  579. package/blockly-rc/msg/json/bs.json +0 -166
  580. package/blockly-rc/msg/json/ca.json +0 -341
  581. package/blockly-rc/msg/json/cdo.json +0 -6
  582. package/blockly-rc/msg/json/ce.json +0 -326
  583. package/blockly-rc/msg/json/constants.json +0 -12
  584. package/blockly-rc/msg/json/cs.json +0 -343
  585. package/blockly-rc/msg/json/da.json +0 -346
  586. package/blockly-rc/msg/json/de.json +0 -369
  587. package/blockly-rc/msg/json/diq.json +0 -258
  588. package/blockly-rc/msg/json/dtp.json +0 -198
  589. package/blockly-rc/msg/json/dty.json +0 -97
  590. package/blockly-rc/msg/json/ee.json +0 -160
  591. package/blockly-rc/msg/json/el.json +0 -356
  592. package/blockly-rc/msg/json/en-gb.json +0 -199
  593. package/blockly-rc/msg/json/en.json +0 -400
  594. package/blockly-rc/msg/json/eo.json +0 -337
  595. package/blockly-rc/msg/json/es.json +0 -358
  596. package/blockly-rc/msg/json/et.json +0 -326
  597. package/blockly-rc/msg/json/eu.json +0 -219
  598. package/blockly-rc/msg/json/fa.json +0 -341
  599. package/blockly-rc/msg/json/fi.json +0 -350
  600. package/blockly-rc/msg/json/fo.json +0 -46
  601. package/blockly-rc/msg/json/fr.json +0 -373
  602. package/blockly-rc/msg/json/frr.json +0 -6
  603. package/blockly-rc/msg/json/gl.json +0 -338
  604. package/blockly-rc/msg/json/gn.json +0 -54
  605. package/blockly-rc/msg/json/gor.json +0 -87
  606. package/blockly-rc/msg/json/ha.json +0 -313
  607. package/blockly-rc/msg/json/hak.json +0 -17
  608. package/blockly-rc/msg/json/he.json +0 -354
  609. package/blockly-rc/msg/json/hi.json +0 -318
  610. package/blockly-rc/msg/json/hr.json +0 -327
  611. package/blockly-rc/msg/json/hrx.json +0 -287
  612. package/blockly-rc/msg/json/hsb.json +0 -128
  613. package/blockly-rc/msg/json/hu.json +0 -349
  614. package/blockly-rc/msg/json/hy.json +0 -337
  615. package/blockly-rc/msg/json/ia.json +0 -337
  616. package/blockly-rc/msg/json/id.json +0 -335
  617. package/blockly-rc/msg/json/ig.json +0 -323
  618. package/blockly-rc/msg/json/inh.json +0 -80
  619. package/blockly-rc/msg/json/is.json +0 -331
  620. package/blockly-rc/msg/json/it.json +0 -346
  621. package/blockly-rc/msg/json/ja.json +0 -361
  622. package/blockly-rc/msg/json/ka.json +0 -14
  623. package/blockly-rc/msg/json/kab.json +0 -323
  624. package/blockly-rc/msg/json/kbd-cyrl.json +0 -84
  625. package/blockly-rc/msg/json/km.json +0 -29
  626. package/blockly-rc/msg/json/kn.json +0 -332
  627. package/blockly-rc/msg/json/ko.json +0 -372
  628. package/blockly-rc/msg/json/ksh.json +0 -43
  629. package/blockly-rc/msg/json/ku-latn.json +0 -41
  630. package/blockly-rc/msg/json/ky.json +0 -71
  631. package/blockly-rc/msg/json/la.json +0 -6
  632. package/blockly-rc/msg/json/lb.json +0 -156
  633. package/blockly-rc/msg/json/lki.json +0 -282
  634. package/blockly-rc/msg/json/lo.json +0 -92
  635. package/blockly-rc/msg/json/lrc.json +0 -123
  636. package/blockly-rc/msg/json/lt.json +0 -321
  637. package/blockly-rc/msg/json/lv.json +0 -324
  638. package/blockly-rc/msg/json/mg.json +0 -58
  639. package/blockly-rc/msg/json/mk.json +0 -178
  640. package/blockly-rc/msg/json/ml.json +0 -35
  641. package/blockly-rc/msg/json/mnw.json +0 -90
  642. package/blockly-rc/msg/json/ms.json +0 -300
  643. package/blockly-rc/msg/json/my.json +0 -57
  644. package/blockly-rc/msg/json/mzn.json +0 -6
  645. package/blockly-rc/msg/json/nb.json +0 -330
  646. package/blockly-rc/msg/json/ne.json +0 -247
  647. package/blockly-rc/msg/json/nl.json +0 -357
  648. package/blockly-rc/msg/json/oc.json +0 -194
  649. package/blockly-rc/msg/json/olo.json +0 -37
  650. package/blockly-rc/msg/json/pa.json +0 -69
  651. package/blockly-rc/msg/json/pl.json +0 -357
  652. package/blockly-rc/msg/json/pms.json +0 -324
  653. package/blockly-rc/msg/json/ps.json +0 -50
  654. package/blockly-rc/msg/json/pt-br.json +0 -369
  655. package/blockly-rc/msg/json/pt.json +0 -358
  656. package/blockly-rc/msg/json/qqq.json +0 -406
  657. package/blockly-rc/msg/json/ro.json +0 -333
  658. package/blockly-rc/msg/json/ru.json +0 -363
  659. package/blockly-rc/msg/json/sc.json +0 -283
  660. package/blockly-rc/msg/json/sco.json +0 -11
  661. package/blockly-rc/msg/json/sd.json +0 -158
  662. package/blockly-rc/msg/json/shn.json +0 -109
  663. package/blockly-rc/msg/json/si.json +0 -16
  664. package/blockly-rc/msg/json/sk.json +0 -332
  665. package/blockly-rc/msg/json/skr-arab.json +0 -117
  666. package/blockly-rc/msg/json/sl.json +0 -355
  667. package/blockly-rc/msg/json/smn.json +0 -133
  668. package/blockly-rc/msg/json/sq.json +0 -343
  669. package/blockly-rc/msg/json/sr-latn.json +0 -324
  670. package/blockly-rc/msg/json/sr.json +0 -348
  671. package/blockly-rc/msg/json/sv.json +0 -347
  672. package/blockly-rc/msg/json/sw.json +0 -12
  673. package/blockly-rc/msg/json/synonyms.json +0 -22
  674. package/blockly-rc/msg/json/ta.json +0 -306
  675. package/blockly-rc/msg/json/tcy.json +0 -316
  676. package/blockly-rc/msg/json/tdd.json +0 -109
  677. package/blockly-rc/msg/json/te.json +0 -101
  678. package/blockly-rc/msg/json/th.json +0 -333
  679. package/blockly-rc/msg/json/ti.json +0 -50
  680. package/blockly-rc/msg/json/tl.json +0 -129
  681. package/blockly-rc/msg/json/tlh.json +0 -179
  682. package/blockly-rc/msg/json/tr.json +0 -369
  683. package/blockly-rc/msg/json/ug-arab.json +0 -132
  684. package/blockly-rc/msg/json/uk.json +0 -345
  685. package/blockly-rc/msg/json/ur.json +0 -117
  686. package/blockly-rc/msg/json/uz.json +0 -36
  687. package/blockly-rc/msg/json/vi.json +0 -345
  688. package/blockly-rc/msg/json/xmf.json +0 -96
  689. package/blockly-rc/msg/json/yo.json +0 -316
  690. package/blockly-rc/msg/json/zgh.json +0 -83
  691. package/blockly-rc/msg/json/zh-hans.json +0 -372
  692. package/blockly-rc/msg/json/zh-hant.json +0 -362
  693. package/blockly-rc/msg/messages.js +0 -1616
  694. package/blockly-rc/package-lock.json +0 -12324
  695. package/blockly-rc/package.json +0 -149
  696. package/blockly-rc/patches/@microsoft+api-documenter+7.22.4.patch +0 -81
  697. package/blockly-rc/scripts/goog_module/convert-file.sh +0 -406
  698. package/blockly-rc/scripts/gulpfiles/appengine_tasks.js +0 -195
  699. package/blockly-rc/scripts/gulpfiles/build_tasks.js +0 -752
  700. package/blockly-rc/scripts/gulpfiles/config.js +0 -41
  701. package/blockly-rc/scripts/gulpfiles/docs_tasks.js +0 -147
  702. package/blockly-rc/scripts/gulpfiles/git_tasks.js +0 -181
  703. package/blockly-rc/scripts/gulpfiles/helper_tasks.js +0 -19
  704. package/blockly-rc/scripts/gulpfiles/package_tasks.js +0 -262
  705. package/blockly-rc/scripts/gulpfiles/release_tasks.js +0 -183
  706. package/blockly-rc/scripts/gulpfiles/test_tasks.js +0 -405
  707. package/blockly-rc/scripts/helpers.js +0 -74
  708. package/blockly-rc/scripts/i18n/common.py +0 -233
  709. package/blockly-rc/scripts/i18n/create_messages.py +0 -167
  710. package/blockly-rc/scripts/i18n/dedup_json.py +0 -72
  711. package/blockly-rc/scripts/i18n/js_to_json.py +0 -135
  712. package/blockly-rc/scripts/i18n/tests.py +0 -46
  713. package/blockly-rc/scripts/migration/cjs2esm +0 -162
  714. package/blockly-rc/scripts/migration/js2ts +0 -168
  715. package/blockly-rc/scripts/migration/renamings.json5 +0 -1599
  716. package/blockly-rc/scripts/package/README.md +0 -93
  717. package/blockly-rc/scripts/package/core-node.js +0 -31
  718. package/blockly-rc/scripts/package/index.js +0 -23
  719. package/blockly-rc/scripts/package/templates/umd-msg.template +0 -16
  720. package/blockly-rc/scripts/package/templates/umd.template +0 -13
  721. package/blockly-rc/scripts/themes/blockStyles_example.json +0 -11
  722. package/blockly-rc/scripts/themes/create_blockStyles.py +0 -181
  723. package/blockly-rc/scripts/tsick.js +0 -86
  724. package/blockly-rc/tests/.eslintrc.json +0 -10
  725. package/blockly-rc/tests/browser/.eslintrc.json +0 -29
  726. package/blockly-rc/tests/browser/.mocharc.js +0 -6
  727. package/blockly-rc/tests/browser/test/basic_block_factory_test.mjs +0 -44
  728. package/blockly-rc/tests/browser/test/basic_block_test.mjs +0 -39
  729. package/blockly-rc/tests/browser/test/basic_playground_test.mjs +0 -198
  730. package/blockly-rc/tests/browser/test/block_undo_test.mjs +0 -50
  731. package/blockly-rc/tests/browser/test/delete_blocks_test.mjs +0 -211
  732. package/blockly-rc/tests/browser/test/extensive_test.mjs +0 -195
  733. package/blockly-rc/tests/browser/test/field_edits_test.mjs +0 -61
  734. package/blockly-rc/tests/browser/test/hooks.mjs +0 -23
  735. package/blockly-rc/tests/browser/test/mutator_test.mjs +0 -88
  736. package/blockly-rc/tests/browser/test/procedure_test.mjs +0 -109
  737. package/blockly-rc/tests/browser/test/test_setup.mjs +0 -589
  738. package/blockly-rc/tests/browser/test/toolbox_drag_test.mjs +0 -207
  739. package/blockly-rc/tests/browser/test/workspace_comment_test.mjs +0 -224
  740. package/blockly-rc/tests/compile/index.html +0 -43
  741. package/blockly-rc/tests/compile/main.js +0 -53
  742. package/blockly-rc/tests/compile/test_blocks.js +0 -47
  743. package/blockly-rc/tests/compile/webdriver.js +0 -81
  744. package/blockly-rc/tests/generators/functions.xml +0 -561
  745. package/blockly-rc/tests/generators/golden/generated.dart +0 -1604
  746. package/blockly-rc/tests/generators/golden/generated.js +0 -1552
  747. package/blockly-rc/tests/generators/golden/generated.lua +0 -1828
  748. package/blockly-rc/tests/generators/golden/generated.php +0 -1611
  749. package/blockly-rc/tests/generators/golden/generated.py +0 -1407
  750. package/blockly-rc/tests/generators/index.html +0 -405
  751. package/blockly-rc/tests/generators/lists.xml +0 -8675
  752. package/blockly-rc/tests/generators/logic.xml +0 -1019
  753. package/blockly-rc/tests/generators/loops1.xml +0 -345
  754. package/blockly-rc/tests/generators/loops2.xml +0 -891
  755. package/blockly-rc/tests/generators/loops3.xml +0 -735
  756. package/blockly-rc/tests/generators/math.xml +0 -2077
  757. package/blockly-rc/tests/generators/text.xml +0 -4651
  758. package/blockly-rc/tests/generators/unittest.js +0 -103
  759. package/blockly-rc/tests/generators/unittest_dart.js +0 -163
  760. package/blockly-rc/tests/generators/unittest_javascript.js +0 -167
  761. package/blockly-rc/tests/generators/unittest_lua.js +0 -165
  762. package/blockly-rc/tests/generators/unittest_php.js +0 -154
  763. package/blockly-rc/tests/generators/unittest_python.js +0 -138
  764. package/blockly-rc/tests/generators/variables.xml +0 -68
  765. package/blockly-rc/tests/generators/webdriver.js +0 -123
  766. package/blockly-rc/tests/media/200px.png +0 -0
  767. package/blockly-rc/tests/media/30px.png +0 -0
  768. package/blockly-rc/tests/media/50px.png +0 -0
  769. package/blockly-rc/tests/media/a.png +0 -0
  770. package/blockly-rc/tests/media/arrow.png +0 -0
  771. package/blockly-rc/tests/media/b.png +0 -0
  772. package/blockly-rc/tests/media/c.png +0 -0
  773. package/blockly-rc/tests/media/d.png +0 -0
  774. package/blockly-rc/tests/media/e.png +0 -0
  775. package/blockly-rc/tests/media/f.png +0 -0
  776. package/blockly-rc/tests/media/g.png +0 -0
  777. package/blockly-rc/tests/media/h.png +0 -0
  778. package/blockly-rc/tests/media/i.png +0 -0
  779. package/blockly-rc/tests/media/j.png +0 -0
  780. package/blockly-rc/tests/media/k.png +0 -0
  781. package/blockly-rc/tests/media/l.png +0 -0
  782. package/blockly-rc/tests/media/m.png +0 -0
  783. package/blockly-rc/tests/migration/renamings.schema.json +0 -59
  784. package/blockly-rc/tests/migration/validate-renamings.mjs +0 -60
  785. package/blockly-rc/tests/mocha/.eslintrc.json +0 -21
  786. package/blockly-rc/tests/mocha/.mocharc.js +0 -6
  787. package/blockly-rc/tests/mocha/astnode_test.js +0 -850
  788. package/blockly-rc/tests/mocha/block_json_test.js +0 -777
  789. package/blockly-rc/tests/mocha/block_test.js +0 -2743
  790. package/blockly-rc/tests/mocha/blocks/lists_test.js +0 -196
  791. package/blockly-rc/tests/mocha/blocks/logic_ternary_test.js +0 -320
  792. package/blockly-rc/tests/mocha/blocks/loops_test.js +0 -56
  793. package/blockly-rc/tests/mocha/blocks/procedures_test.js +0 -2495
  794. package/blockly-rc/tests/mocha/blocks/variables_test.js +0 -311
  795. package/blockly-rc/tests/mocha/clipboard_test.js +0 -136
  796. package/blockly-rc/tests/mocha/comment_deserialization_test.js +0 -122
  797. package/blockly-rc/tests/mocha/comment_test.js +0 -170
  798. package/blockly-rc/tests/mocha/comment_view_test.js +0 -188
  799. package/blockly-rc/tests/mocha/connection_checker_test.js +0 -666
  800. package/blockly-rc/tests/mocha/connection_db_test.js +0 -362
  801. package/blockly-rc/tests/mocha/connection_test.js +0 -3738
  802. package/blockly-rc/tests/mocha/contextmenu_items_test.js +0 -488
  803. package/blockly-rc/tests/mocha/contextmenu_test.js +0 -71
  804. package/blockly-rc/tests/mocha/cursor_test.js +0 -134
  805. package/blockly-rc/tests/mocha/dropdowndiv_test.js +0 -116
  806. package/blockly-rc/tests/mocha/event_block_change_test.js +0 -126
  807. package/blockly-rc/tests/mocha/event_block_create_test.js +0 -109
  808. package/blockly-rc/tests/mocha/event_block_delete_test.js +0 -55
  809. package/blockly-rc/tests/mocha/event_block_drag_test.js +0 -36
  810. package/blockly-rc/tests/mocha/event_block_field_intermediate_change_test.js +0 -67
  811. package/blockly-rc/tests/mocha/event_block_move_test.js +0 -39
  812. package/blockly-rc/tests/mocha/event_bubble_open_test.js +0 -42
  813. package/blockly-rc/tests/mocha/event_click_test.js +0 -40
  814. package/blockly-rc/tests/mocha/event_comment_change_test.js +0 -39
  815. package/blockly-rc/tests/mocha/event_comment_collapse_test.js +0 -34
  816. package/blockly-rc/tests/mocha/event_comment_create_test.js +0 -38
  817. package/blockly-rc/tests/mocha/event_comment_delete_test.js +0 -38
  818. package/blockly-rc/tests/mocha/event_comment_drag_test.js +0 -35
  819. package/blockly-rc/tests/mocha/event_comment_move_test.js +0 -40
  820. package/blockly-rc/tests/mocha/event_comment_resize_test.js +0 -38
  821. package/blockly-rc/tests/mocha/event_marker_move_test.js +0 -44
  822. package/blockly-rc/tests/mocha/event_selected_test.js +0 -41
  823. package/blockly-rc/tests/mocha/event_test.js +0 -1578
  824. package/blockly-rc/tests/mocha/event_theme_change_test.js +0 -36
  825. package/blockly-rc/tests/mocha/event_toolbox_item_select_test.js +0 -64
  826. package/blockly-rc/tests/mocha/event_trashcan_open_test.js +0 -36
  827. package/blockly-rc/tests/mocha/event_var_create_test.js +0 -54
  828. package/blockly-rc/tests/mocha/event_var_delete_test.js +0 -54
  829. package/blockly-rc/tests/mocha/event_var_rename_test.js +0 -39
  830. package/blockly-rc/tests/mocha/event_var_type_change_test.js +0 -43
  831. package/blockly-rc/tests/mocha/event_viewport_test.js +0 -39
  832. package/blockly-rc/tests/mocha/extensions_test.js +0 -613
  833. package/blockly-rc/tests/mocha/field_checkbox_test.js +0 -299
  834. package/blockly-rc/tests/mocha/field_colour_test.js +0 -395
  835. package/blockly-rc/tests/mocha/field_dropdown_test.js +0 -282
  836. package/blockly-rc/tests/mocha/field_image_test.js +0 -241
  837. package/blockly-rc/tests/mocha/field_label_serializable_test.js +0 -252
  838. package/blockly-rc/tests/mocha/field_label_test.js +0 -226
  839. package/blockly-rc/tests/mocha/field_number_test.js +0 -505
  840. package/blockly-rc/tests/mocha/field_registry_test.js +0 -116
  841. package/blockly-rc/tests/mocha/field_test.js +0 -822
  842. package/blockly-rc/tests/mocha/field_textinput_test.js +0 -297
  843. package/blockly-rc/tests/mocha/field_variable_test.js +0 -611
  844. package/blockly-rc/tests/mocha/flyout_test.js +0 -638
  845. package/blockly-rc/tests/mocha/generator_test.js +0 -233
  846. package/blockly-rc/tests/mocha/gesture_test.js +0 -97
  847. package/blockly-rc/tests/mocha/icon_test.js +0 -369
  848. package/blockly-rc/tests/mocha/index.html +0 -229
  849. package/blockly-rc/tests/mocha/input_test.js +0 -296
  850. package/blockly-rc/tests/mocha/insertion_marker_manager_test.js +0 -443
  851. package/blockly-rc/tests/mocha/insertion_marker_test.js +0 -432
  852. package/blockly-rc/tests/mocha/jso_deserialization_test.js +0 -849
  853. package/blockly-rc/tests/mocha/jso_serialization_test.js +0 -1067
  854. package/blockly-rc/tests/mocha/json_test.js +0 -315
  855. package/blockly-rc/tests/mocha/keydown_test.js +0 -364
  856. package/blockly-rc/tests/mocha/layering_test.js +0 -95
  857. package/blockly-rc/tests/mocha/metrics_test.js +0 -671
  858. package/blockly-rc/tests/mocha/mutator_test.js +0 -87
  859. package/blockly-rc/tests/mocha/names_test.js +0 -97
  860. package/blockly-rc/tests/mocha/old_workspace_comment_test.js +0 -256
  861. package/blockly-rc/tests/mocha/procedure_map_test.js +0 -57
  862. package/blockly-rc/tests/mocha/registry_test.js +0 -281
  863. package/blockly-rc/tests/mocha/render_management_test.js +0 -127
  864. package/blockly-rc/tests/mocha/serializer_test.js +0 -2104
  865. package/blockly-rc/tests/mocha/shortcut_registry_test.js +0 -450
  866. package/blockly-rc/tests/mocha/test_helpers/block_definitions.js +0 -204
  867. package/blockly-rc/tests/mocha/test_helpers/code_generation.js +0 -115
  868. package/blockly-rc/tests/mocha/test_helpers/common.js +0 -106
  869. package/blockly-rc/tests/mocha/test_helpers/events.js +0 -290
  870. package/blockly-rc/tests/mocha/test_helpers/fields.js +0 -310
  871. package/blockly-rc/tests/mocha/test_helpers/icon_mocks.js +0 -81
  872. package/blockly-rc/tests/mocha/test_helpers/procedures.js +0 -302
  873. package/blockly-rc/tests/mocha/test_helpers/serialization.js +0 -124
  874. package/blockly-rc/tests/mocha/test_helpers/setup_teardown.js +0 -209
  875. package/blockly-rc/tests/mocha/test_helpers/toolbox_definitions.js +0 -271
  876. package/blockly-rc/tests/mocha/test_helpers/user_input.js +0 -62
  877. package/blockly-rc/tests/mocha/test_helpers/variables.js +0 -23
  878. package/blockly-rc/tests/mocha/test_helpers/warnings.js +0 -83
  879. package/blockly-rc/tests/mocha/test_helpers/workspace.js +0 -1691
  880. package/blockly-rc/tests/mocha/theme_test.js +0 -307
  881. package/blockly-rc/tests/mocha/toolbox_test.js +0 -761
  882. package/blockly-rc/tests/mocha/tooltip_test.js +0 -276
  883. package/blockly-rc/tests/mocha/touch_test.js +0 -109
  884. package/blockly-rc/tests/mocha/trashcan_test.js +0 -375
  885. package/blockly-rc/tests/mocha/utils_test.js +0 -536
  886. package/blockly-rc/tests/mocha/variable_map_test.js +0 -509
  887. package/blockly-rc/tests/mocha/variable_model_test.js +0 -85
  888. package/blockly-rc/tests/mocha/webdriver.js +0 -96
  889. package/blockly-rc/tests/mocha/widget_div_test.js +0 -272
  890. package/blockly-rc/tests/mocha/workspace_comment_test.js +0 -171
  891. package/blockly-rc/tests/mocha/workspace_svg_test.js +0 -414
  892. package/blockly-rc/tests/mocha/workspace_test.js +0 -27
  893. package/blockly-rc/tests/mocha/xml_test.js +0 -951
  894. package/blockly-rc/tests/mocha/zoom_controls_test.js +0 -81
  895. package/blockly-rc/tests/multi_playground.html +0 -482
  896. package/blockly-rc/tests/node/.eslintrc.json +0 -12
  897. package/blockly-rc/tests/node/.mocharc.js +0 -6
  898. package/blockly-rc/tests/node/run_node_test.mjs +0 -72
  899. package/blockly-rc/tests/playground.html +0 -1280
  900. package/blockly-rc/tests/playgrounds/advanced_playground.html +0 -158
  901. package/blockly-rc/tests/playgrounds/iframe.html +0 -40
  902. package/blockly-rc/tests/playgrounds/screenshot.js +0 -123
  903. package/blockly-rc/tests/scripts/check_metadata.sh +0 -166
  904. package/blockly-rc/tests/scripts/compile_typings.sh +0 -32
  905. package/blockly-rc/tests/scripts/load.mjs +0 -140
  906. package/blockly-rc/tests/scripts/setup_linux_env.sh +0 -7
  907. package/blockly-rc/tests/scripts/update_metadata.sh +0 -46
  908. package/blockly-rc/tests/themes/test_themes.js +0 -62
  909. package/blockly-rc/tests/typescript/README.md +0 -4
  910. package/blockly-rc/tests/typescript/src/field/different_user_input.ts +0 -81
  911. package/blockly-rc/tests/typescript/src/generators/dart.ts +0 -24
  912. package/blockly-rc/tests/typescript/src/generators/javascript.ts +0 -28
  913. package/blockly-rc/tests/typescript/src/generators/lua.ts +0 -24
  914. package/blockly-rc/tests/typescript/src/generators/php.ts +0 -24
  915. package/blockly-rc/tests/typescript/src/generators/python.ts +0 -24
  916. package/blockly-rc/tests/typescript/src/generators.ts +0 -31
  917. package/blockly-rc/tests/typescript/src/msg.ts +0 -20
  918. package/blockly-rc/tests/typescript/tsconfig.json +0 -20
  919. package/blockly-rc/tests/xml/README.txt +0 -11
  920. package/blockly-rc/tests/xml/blockly.xsd +0 -178
  921. package/blockly-rc/tests/xml/invalid.xml +0 -6
  922. package/blockly-rc/tests/xml/toolbox.xml +0 -311
  923. package/blockly-rc/tests/xml/workspace.xml +0 -114
  924. package/blockly-rc/tsconfig.json +0 -37
  925. package/blockly-rc/tsdoc.json +0 -35
  926. package/blockly-rc/typings/README.md +0 -5
  927. package/blockly-rc/typings/blocks.d.ts +0 -17
  928. package/blockly-rc/typings/core.d.ts +0 -7
  929. package/blockly-rc/typings/dart.d.ts +0 -7
  930. package/blockly-rc/typings/index.d.ts +0 -10
  931. package/blockly-rc/typings/javascript.d.ts +0 -7
  932. package/blockly-rc/typings/lua.d.ts +0 -7
  933. package/blockly-rc/typings/msg/ab.d.ts +0 -8
  934. package/blockly-rc/typings/msg/ace.d.ts +0 -8
  935. package/blockly-rc/typings/msg/af.d.ts +0 -8
  936. package/blockly-rc/typings/msg/am.d.ts +0 -8
  937. package/blockly-rc/typings/msg/ar.d.ts +0 -8
  938. package/blockly-rc/typings/msg/ast.d.ts +0 -8
  939. package/blockly-rc/typings/msg/az.d.ts +0 -8
  940. package/blockly-rc/typings/msg/ba.d.ts +0 -8
  941. package/blockly-rc/typings/msg/bcc.d.ts +0 -8
  942. package/blockly-rc/typings/msg/be-tarask.d.ts +0 -8
  943. package/blockly-rc/typings/msg/be.d.ts +0 -8
  944. package/blockly-rc/typings/msg/bg.d.ts +0 -8
  945. package/blockly-rc/typings/msg/bn.d.ts +0 -8
  946. package/blockly-rc/typings/msg/br.d.ts +0 -8
  947. package/blockly-rc/typings/msg/bs.d.ts +0 -8
  948. package/blockly-rc/typings/msg/ca.d.ts +0 -8
  949. package/blockly-rc/typings/msg/cdo.d.ts +0 -8
  950. package/blockly-rc/typings/msg/ce.d.ts +0 -8
  951. package/blockly-rc/typings/msg/cs.d.ts +0 -8
  952. package/blockly-rc/typings/msg/da.d.ts +0 -8
  953. package/blockly-rc/typings/msg/de.d.ts +0 -8
  954. package/blockly-rc/typings/msg/diq.d.ts +0 -8
  955. package/blockly-rc/typings/msg/dtp.d.ts +0 -8
  956. package/blockly-rc/typings/msg/dty.d.ts +0 -8
  957. package/blockly-rc/typings/msg/ee.d.ts +0 -8
  958. package/blockly-rc/typings/msg/el.d.ts +0 -8
  959. package/blockly-rc/typings/msg/en-gb.d.ts +0 -8
  960. package/blockly-rc/typings/msg/en.d.ts +0 -8
  961. package/blockly-rc/typings/msg/eo.d.ts +0 -8
  962. package/blockly-rc/typings/msg/es.d.ts +0 -8
  963. package/blockly-rc/typings/msg/et.d.ts +0 -8
  964. package/blockly-rc/typings/msg/eu.d.ts +0 -8
  965. package/blockly-rc/typings/msg/fa.d.ts +0 -8
  966. package/blockly-rc/typings/msg/fi.d.ts +0 -8
  967. package/blockly-rc/typings/msg/fo.d.ts +0 -8
  968. package/blockly-rc/typings/msg/fr.d.ts +0 -8
  969. package/blockly-rc/typings/msg/frr.d.ts +0 -8
  970. package/blockly-rc/typings/msg/gl.d.ts +0 -8
  971. package/blockly-rc/typings/msg/gn.d.ts +0 -8
  972. package/blockly-rc/typings/msg/gor.d.ts +0 -8
  973. package/blockly-rc/typings/msg/ha.d.ts +0 -8
  974. package/blockly-rc/typings/msg/hak.d.ts +0 -8
  975. package/blockly-rc/typings/msg/he.d.ts +0 -8
  976. package/blockly-rc/typings/msg/hi.d.ts +0 -8
  977. package/blockly-rc/typings/msg/hr.d.ts +0 -8
  978. package/blockly-rc/typings/msg/hrx.d.ts +0 -8
  979. package/blockly-rc/typings/msg/hsb.d.ts +0 -8
  980. package/blockly-rc/typings/msg/hu.d.ts +0 -8
  981. package/blockly-rc/typings/msg/hy.d.ts +0 -8
  982. package/blockly-rc/typings/msg/ia.d.ts +0 -8
  983. package/blockly-rc/typings/msg/id.d.ts +0 -8
  984. package/blockly-rc/typings/msg/ig.d.ts +0 -8
  985. package/blockly-rc/typings/msg/inh.d.ts +0 -8
  986. package/blockly-rc/typings/msg/is.d.ts +0 -8
  987. package/blockly-rc/typings/msg/it.d.ts +0 -8
  988. package/blockly-rc/typings/msg/ja.d.ts +0 -8
  989. package/blockly-rc/typings/msg/ka.d.ts +0 -8
  990. package/blockly-rc/typings/msg/kab.d.ts +0 -8
  991. package/blockly-rc/typings/msg/kbd-cyrl.d.ts +0 -8
  992. package/blockly-rc/typings/msg/km.d.ts +0 -8
  993. package/blockly-rc/typings/msg/kn.d.ts +0 -8
  994. package/blockly-rc/typings/msg/ko.d.ts +0 -8
  995. package/blockly-rc/typings/msg/ksh.d.ts +0 -8
  996. package/blockly-rc/typings/msg/ku-latn.d.ts +0 -8
  997. package/blockly-rc/typings/msg/ky.d.ts +0 -8
  998. package/blockly-rc/typings/msg/la.d.ts +0 -8
  999. package/blockly-rc/typings/msg/lb.d.ts +0 -8
  1000. package/blockly-rc/typings/msg/lki.d.ts +0 -8
  1001. package/blockly-rc/typings/msg/lo.d.ts +0 -8
  1002. package/blockly-rc/typings/msg/lrc.d.ts +0 -8
  1003. package/blockly-rc/typings/msg/lt.d.ts +0 -8
  1004. package/blockly-rc/typings/msg/lv.d.ts +0 -8
  1005. package/blockly-rc/typings/msg/mg.d.ts +0 -8
  1006. package/blockly-rc/typings/msg/mk.d.ts +0 -8
  1007. package/blockly-rc/typings/msg/ml.d.ts +0 -8
  1008. package/blockly-rc/typings/msg/mnw.d.ts +0 -8
  1009. package/blockly-rc/typings/msg/ms.d.ts +0 -8
  1010. package/blockly-rc/typings/msg/msg.d.ts +0 -440
  1011. package/blockly-rc/typings/msg/my.d.ts +0 -8
  1012. package/blockly-rc/typings/msg/mzn.d.ts +0 -8
  1013. package/blockly-rc/typings/msg/nb.d.ts +0 -8
  1014. package/blockly-rc/typings/msg/ne.d.ts +0 -8
  1015. package/blockly-rc/typings/msg/nl.d.ts +0 -8
  1016. package/blockly-rc/typings/msg/oc.d.ts +0 -8
  1017. package/blockly-rc/typings/msg/olo.d.ts +0 -8
  1018. package/blockly-rc/typings/msg/pa.d.ts +0 -8
  1019. package/blockly-rc/typings/msg/pl.d.ts +0 -8
  1020. package/blockly-rc/typings/msg/pms.d.ts +0 -8
  1021. package/blockly-rc/typings/msg/ps.d.ts +0 -8
  1022. package/blockly-rc/typings/msg/pt-br.d.ts +0 -8
  1023. package/blockly-rc/typings/msg/pt.d.ts +0 -8
  1024. package/blockly-rc/typings/msg/ro.d.ts +0 -8
  1025. package/blockly-rc/typings/msg/ru.d.ts +0 -8
  1026. package/blockly-rc/typings/msg/sc.d.ts +0 -8
  1027. package/blockly-rc/typings/msg/sco.d.ts +0 -8
  1028. package/blockly-rc/typings/msg/sd.d.ts +0 -8
  1029. package/blockly-rc/typings/msg/shn.d.ts +0 -8
  1030. package/blockly-rc/typings/msg/si.d.ts +0 -8
  1031. package/blockly-rc/typings/msg/sk.d.ts +0 -8
  1032. package/blockly-rc/typings/msg/skr-arab.d.ts +0 -8
  1033. package/blockly-rc/typings/msg/sl.d.ts +0 -8
  1034. package/blockly-rc/typings/msg/smn.d.ts +0 -8
  1035. package/blockly-rc/typings/msg/sq.d.ts +0 -8
  1036. package/blockly-rc/typings/msg/sr-latn.d.ts +0 -8
  1037. package/blockly-rc/typings/msg/sr.d.ts +0 -8
  1038. package/blockly-rc/typings/msg/sv.d.ts +0 -8
  1039. package/blockly-rc/typings/msg/sw.d.ts +0 -8
  1040. package/blockly-rc/typings/msg/ta.d.ts +0 -8
  1041. package/blockly-rc/typings/msg/tcy.d.ts +0 -8
  1042. package/blockly-rc/typings/msg/tdd.d.ts +0 -8
  1043. package/blockly-rc/typings/msg/te.d.ts +0 -8
  1044. package/blockly-rc/typings/msg/th.d.ts +0 -8
  1045. package/blockly-rc/typings/msg/ti.d.ts +0 -8
  1046. package/blockly-rc/typings/msg/tl.d.ts +0 -8
  1047. package/blockly-rc/typings/msg/tlh.d.ts +0 -8
  1048. package/blockly-rc/typings/msg/tr.d.ts +0 -8
  1049. package/blockly-rc/typings/msg/ug-arab.d.ts +0 -8
  1050. package/blockly-rc/typings/msg/uk.d.ts +0 -8
  1051. package/blockly-rc/typings/msg/ur.d.ts +0 -8
  1052. package/blockly-rc/typings/msg/uz.d.ts +0 -8
  1053. package/blockly-rc/typings/msg/vi.d.ts +0 -8
  1054. package/blockly-rc/typings/msg/xmf.d.ts +0 -8
  1055. package/blockly-rc/typings/msg/yo.d.ts +0 -8
  1056. package/blockly-rc/typings/msg/zgh.d.ts +0 -8
  1057. package/blockly-rc/typings/msg/zh-hans.d.ts +0 -8
  1058. package/blockly-rc/typings/msg/zh-hant.d.ts +0 -8
  1059. package/blockly-rc/typings/php.d.ts +0 -7
  1060. package/blockly-rc/typings/python.d.ts +0 -7
  1061. package/blockly-rc/typings/templates/blockly-header.template +0 -11
  1062. package/blockly-rc/typings/templates/blockly-interfaces.template +0 -83
  1063. package/blockly-rc/typings/templates/msg.template +0 -15
  1064. package/blockly-rc/typings/tsconfig.json +0 -23
  1065. package/temp-use-blockly-v12-rc.sh +0 -26
@@ -1,3738 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- import {assert} from '../../node_modules/chai/chai.js';
8
- import {
9
- createGenUidStubWithReturns,
10
- sharedTestSetup,
11
- sharedTestTeardown,
12
- workspaceTeardown,
13
- } from './test_helpers/setup_teardown.js';
14
- import {
15
- defineRowBlock,
16
- defineStatementBlock,
17
- defineStackBlock,
18
- } from './test_helpers/block_definitions.js';
19
-
20
- suite('Connection', function () {
21
- setup(function () {
22
- sharedTestSetup.call(this);
23
- this.workspace = sinon.createStubInstance(Blockly.Workspace);
24
- this.workspace.connectionChecker = new Blockly.ConnectionChecker();
25
- this.createConnection = function (type) {
26
- const block = {
27
- workspace: this.workspace,
28
- isShadow: function () {
29
- return false;
30
- },
31
- };
32
- const connection = new Blockly.Connection(block, type);
33
- return connection;
34
- };
35
- });
36
-
37
- teardown(function () {
38
- sharedTestTeardown.call(this);
39
- });
40
-
41
- suite('Set Shadow', function () {
42
- function assertBlockMatches(block, isShadow, opt_id) {
43
- assert.equal(
44
- block.isShadow(),
45
- isShadow,
46
- `expected block ${block.id} to ${isShadow ? '' : 'not'} be a shadow`,
47
- );
48
- if (opt_id) {
49
- assert.equal(block.id, opt_id);
50
- }
51
- }
52
-
53
- function assertInputHasBlock(parent, inputName, isShadow, opt_name) {
54
- const block = parent.getInputTargetBlock(inputName);
55
- assert.exists(
56
- block,
57
- `expected block ${opt_name || ''} to be attached to ${inputName}`,
58
- );
59
- assertBlockMatches(block, isShadow, opt_name);
60
- }
61
-
62
- function assertNextHasBlock(parent, isShadow, opt_name) {
63
- const block = parent.getNextBlock();
64
- assert.exists(
65
- block,
66
- `expected block ${opt_name || ''} to be attached to next connection`,
67
- );
68
- assertBlockMatches(block, isShadow, opt_name);
69
- }
70
-
71
- function assertInputNotHasBlock(parent, inputName) {
72
- const block = parent.getInputTargetBlock(inputName);
73
- assert.notExists(
74
- block,
75
- `expected block ${
76
- block && block.id
77
- } to not be attached to ${inputName}`,
78
- );
79
- }
80
-
81
- function assertNextNotHasBlock(parent) {
82
- const block = parent.getNextBlock();
83
- assert.notExists(
84
- block,
85
- `expected block ${
86
- block && block.id
87
- } to not be attached to next connection`,
88
- );
89
- }
90
-
91
- function assertSerialization(block, jso, xmlText) {
92
- const actualJso = Blockly.serialization.blocks.save(block, {
93
- addNextBlocks: true,
94
- });
95
- const actualXml = Blockly.Xml.domToText(Blockly.Xml.blockToDom(block));
96
- assert.deepEqual(actualJso, jso);
97
- assert.equal(actualXml, xmlText);
98
- }
99
-
100
- const testSuites = [
101
- {
102
- title: 'Rendered',
103
- createWorkspace: () => {
104
- return Blockly.inject('blocklyDiv');
105
- },
106
- },
107
- {
108
- title: 'Headless',
109
- createWorkspace: () => {
110
- return new Blockly.Workspace();
111
- },
112
- },
113
- ];
114
-
115
- testSuites.forEach((testSuite) => {
116
- // Create a suite for each suite.
117
- suite(testSuite.title, function () {
118
- setup(function () {
119
- this.workspace = testSuite.createWorkspace();
120
-
121
- defineRowBlock();
122
- defineStatementBlock();
123
- defineStackBlock();
124
-
125
- createGenUidStubWithReturns(
126
- new Array(30).fill().map((_, i) => 'id' + i),
127
- );
128
- });
129
-
130
- teardown(function () {
131
- workspaceTeardown.call(this, this.workspace);
132
- });
133
-
134
- suite('setShadowDom', function () {
135
- suite('Add - No Block Connected', function () {
136
- // These are defined separately in each suite.
137
- function createRowBlock(workspace) {
138
- const block = Blockly.Xml.domToBlock(
139
- Blockly.utils.xml.textToDom(
140
- '<block type="row_block" id="id0"/>',
141
- ),
142
- workspace,
143
- );
144
- return block;
145
- }
146
-
147
- function createStatementBlock(workspace) {
148
- const block = Blockly.Xml.domToBlock(
149
- Blockly.utils.xml.textToDom(
150
- '<block type="statement_block" id="id0"/>',
151
- ),
152
- workspace,
153
- );
154
- return block;
155
- }
156
-
157
- function createStackBlock(workspace) {
158
- const block = Blockly.Xml.domToBlock(
159
- Blockly.utils.xml.textToDom(
160
- '<block type="stack_block" id="id0"/>',
161
- ),
162
- workspace,
163
- );
164
- return block;
165
- }
166
-
167
- test('Value', function () {
168
- const parent = createRowBlock(this.workspace);
169
- const xml = Blockly.utils.xml.textToDom(
170
- '<shadow type="row_block" id="id1"/>',
171
- );
172
- parent.getInput('INPUT').connection.setShadowDom(xml);
173
- assertInputHasBlock(parent, 'INPUT', true);
174
- assertSerialization(
175
- parent,
176
- {
177
- 'type': 'row_block',
178
- 'id': 'id0',
179
- 'inputs': {
180
- 'INPUT': {
181
- 'shadow': {
182
- 'type': 'row_block',
183
- 'id': 'id1',
184
- },
185
- },
186
- },
187
- },
188
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
189
- 'type="row_block" id="id0">' +
190
- '<value name="INPUT">' +
191
- '<shadow type="row_block" id="id1"></shadow>' +
192
- '</value>' +
193
- '</block>',
194
- );
195
- });
196
-
197
- test('Multiple Value', function () {
198
- const parent = createRowBlock(this.workspace);
199
- const xml = Blockly.utils.xml.textToDom(
200
- '<shadow type="row_block" id="id1">' +
201
- ' <value name="INPUT">' +
202
- ' <shadow type="row_block" id="id2"/>' +
203
- ' </value>' +
204
- '</shadow>',
205
- );
206
- parent.getInput('INPUT').connection.setShadowDom(xml);
207
- assertInputHasBlock(parent, 'INPUT', true);
208
- assertInputHasBlock(
209
- parent.getInputTargetBlock('INPUT'),
210
- 'INPUT',
211
- true,
212
- );
213
- assertSerialization(
214
- parent,
215
- {
216
- 'type': 'row_block',
217
- 'id': 'id0',
218
- 'inputs': {
219
- 'INPUT': {
220
- 'shadow': {
221
- 'type': 'row_block',
222
- 'id': 'id1',
223
- 'inputs': {
224
- 'INPUT': {
225
- 'shadow': {
226
- 'type': 'row_block',
227
- 'id': 'id2',
228
- },
229
- },
230
- },
231
- },
232
- },
233
- },
234
- },
235
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
236
- 'type="row_block" id="id0">' +
237
- '<value name="INPUT">' +
238
- '<shadow type="row_block" id="id1">' +
239
- '<value name="INPUT">' +
240
- '<shadow type="row_block" id="id2"></shadow>' +
241
- '</value>' +
242
- '</shadow>' +
243
- '</value>' +
244
- '</block>',
245
- );
246
- });
247
-
248
- test('Statement', function () {
249
- const parent = createStatementBlock(this.workspace);
250
- const xml = Blockly.utils.xml.textToDom(
251
- '<shadow type="statement_block" id="id1"/>',
252
- );
253
- parent.getInput('NAME').connection.setShadowDom(xml);
254
- assertInputHasBlock(parent, 'NAME', true);
255
- assertSerialization(
256
- parent,
257
- {
258
- 'type': 'statement_block',
259
- 'id': 'id0',
260
- 'inputs': {
261
- 'NAME': {
262
- 'shadow': {
263
- 'type': 'statement_block',
264
- 'id': 'id1',
265
- },
266
- },
267
- },
268
- },
269
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
270
- 'type="statement_block" id="id0">' +
271
- '<statement name="NAME">' +
272
- '<shadow type="statement_block" id="id1"></shadow>' +
273
- '</statement>' +
274
- '</block>',
275
- );
276
- });
277
-
278
- test('Multiple Statement', function () {
279
- const parent = createStatementBlock(this.workspace);
280
- const xml = Blockly.utils.xml.textToDom(
281
- '<shadow type="statement_block" id="id1">' +
282
- ' <statement name="NAME">' +
283
- ' <shadow type="statement_block" id="id2"/>' +
284
- ' </statement>' +
285
- '</shadow>',
286
- );
287
- parent.getInput('NAME').connection.setShadowDom(xml);
288
- assertInputHasBlock(parent, 'NAME', true);
289
- assertInputHasBlock(
290
- parent.getInputTargetBlock('NAME'),
291
- 'NAME',
292
- true,
293
- );
294
- assertSerialization(
295
- parent,
296
- {
297
- 'type': 'statement_block',
298
- 'id': 'id0',
299
- 'inputs': {
300
- 'NAME': {
301
- 'shadow': {
302
- 'type': 'statement_block',
303
- 'id': 'id1',
304
- 'inputs': {
305
- 'NAME': {
306
- 'shadow': {
307
- 'type': 'statement_block',
308
- 'id': 'id2',
309
- },
310
- },
311
- },
312
- },
313
- },
314
- },
315
- },
316
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
317
- 'type="statement_block" id="id0">' +
318
- '<statement name="NAME">' +
319
- '<shadow type="statement_block" id="id1">' +
320
- '<statement name="NAME">' +
321
- '<shadow type="statement_block" id="id2"></shadow>' +
322
- '</statement>' +
323
- '</shadow>' +
324
- '</statement>' +
325
- '</block>',
326
- );
327
- });
328
-
329
- test('Next', function () {
330
- const parent = createStackBlock(this.workspace);
331
- const xml = Blockly.utils.xml.textToDom(
332
- '<shadow type="stack_block" id="id1"/>',
333
- );
334
- parent.nextConnection.setShadowDom(xml);
335
- assertNextHasBlock(parent, true);
336
- assertSerialization(
337
- parent,
338
- {
339
- 'type': 'stack_block',
340
- 'id': 'id0',
341
- 'next': {
342
- 'shadow': {
343
- 'type': 'stack_block',
344
- 'id': 'id1',
345
- },
346
- },
347
- },
348
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
349
- 'type="stack_block" id="id0">' +
350
- '<next>' +
351
- '<shadow type="stack_block" id="id1"></shadow>' +
352
- '</next>' +
353
- '</block>',
354
- );
355
- });
356
-
357
- test('Multiple Next', function () {
358
- const parent = createStackBlock(this.workspace);
359
- const xml = Blockly.utils.xml.textToDom(
360
- '<shadow type="stack_block" id="id1">' +
361
- ' <next>' +
362
- ' <shadow type="stack_block" id="id2"/>' +
363
- ' </next>' +
364
- '</shadow>',
365
- );
366
- parent.nextConnection.setShadowDom(xml);
367
- assertNextHasBlock(parent, true);
368
- assertNextHasBlock(parent.getNextBlock(), true);
369
- assertSerialization(
370
- parent,
371
- {
372
- 'type': 'stack_block',
373
- 'id': 'id0',
374
- 'next': {
375
- 'shadow': {
376
- 'type': 'stack_block',
377
- 'id': 'id1',
378
- 'next': {
379
- 'shadow': {
380
- 'type': 'stack_block',
381
- 'id': 'id2',
382
- },
383
- },
384
- },
385
- },
386
- },
387
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
388
- 'type="stack_block" id="id0">' +
389
- '<next>' +
390
- '<shadow type="stack_block" id="id1">' +
391
- '<next>' +
392
- '<shadow type="stack_block" id="id2"></shadow>' +
393
- '</next>' +
394
- '</shadow>' +
395
- '</next>' +
396
- '</block>',
397
- );
398
- });
399
- });
400
-
401
- suite('Add - With Block Connected', function () {
402
- // These are defined separately in each suite.
403
- function createRowBlocks(workspace) {
404
- const block = Blockly.Xml.domToBlock(
405
- Blockly.utils.xml.textToDom(
406
- '<block type="row_block" id="id0">' +
407
- ' <value name="INPUT">' +
408
- ' <block type="row_block" id="idA"/>' +
409
- ' </value>' +
410
- '</block>',
411
- ),
412
- workspace,
413
- );
414
- return block;
415
- }
416
-
417
- function createStatementBlocks(workspace) {
418
- const block = Blockly.Xml.domToBlock(
419
- Blockly.utils.xml.textToDom(
420
- '<block type="statement_block" id="id0">' +
421
- ' <statement name="NAME">' +
422
- ' <block type="statement_block" id="idA"/>' +
423
- ' </statement>' +
424
- '</block>',
425
- ),
426
- workspace,
427
- );
428
- return block;
429
- }
430
-
431
- function createStackBlocks(workspace) {
432
- const block = Blockly.Xml.domToBlock(
433
- Blockly.utils.xml.textToDom(
434
- '<block type="stack_block" id="id0">' +
435
- ' <next>' +
436
- ' <block type="stack_block" id="idA"/>' +
437
- ' </next>' +
438
- '</block>',
439
- ),
440
- workspace,
441
- );
442
- return block;
443
- }
444
-
445
- test('Value', function () {
446
- const parent = createRowBlocks(this.workspace);
447
- const xml = Blockly.utils.xml.textToDom(
448
- '<shadow type="row_block" id="id1"/>',
449
- );
450
- parent.getInput('INPUT').connection.setShadowDom(xml);
451
- assertInputHasBlock(parent, 'INPUT', false);
452
- parent.getInput('INPUT').connection.disconnect();
453
- assertInputHasBlock(parent, 'INPUT', true);
454
- assertSerialization(
455
- parent,
456
- {
457
- 'type': 'row_block',
458
- 'id': 'id0',
459
- 'inputs': {
460
- 'INPUT': {
461
- 'shadow': {
462
- 'type': 'row_block',
463
- 'id': 'id1',
464
- },
465
- },
466
- },
467
- },
468
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
469
- 'type="row_block" id="id0">' +
470
- '<value name="INPUT">' +
471
- '<shadow type="row_block" id="id1"></shadow>' +
472
- '</value>' +
473
- '</block>',
474
- );
475
- });
476
-
477
- test('Multiple Value', function () {
478
- const parent = createRowBlocks(this.workspace);
479
- const xml = Blockly.utils.xml.textToDom(
480
- '<shadow type="row_block" id="id1">' +
481
- ' <value name="INPUT">' +
482
- ' <shadow type="row_block" id="id2"/>' +
483
- ' </value>' +
484
- '</shadow>',
485
- );
486
- parent.getInput('INPUT').connection.setShadowDom(xml);
487
- assertInputHasBlock(parent, 'INPUT', false);
488
- assertInputNotHasBlock(
489
- parent.getInputTargetBlock('INPUT'),
490
- 'INPUT',
491
- );
492
- parent.getInput('INPUT').connection.disconnect();
493
- assertInputHasBlock(parent, 'INPUT', true);
494
- assertInputHasBlock(
495
- parent.getInputTargetBlock('INPUT'),
496
- 'INPUT',
497
- true,
498
- );
499
- assertSerialization(
500
- parent,
501
- {
502
- 'type': 'row_block',
503
- 'id': 'id0',
504
- 'inputs': {
505
- 'INPUT': {
506
- 'shadow': {
507
- 'type': 'row_block',
508
- 'id': 'id1',
509
- 'inputs': {
510
- 'INPUT': {
511
- 'shadow': {
512
- 'type': 'row_block',
513
- 'id': 'id2',
514
- },
515
- },
516
- },
517
- },
518
- },
519
- },
520
- },
521
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
522
- 'type="row_block" id="id0">' +
523
- '<value name="INPUT">' +
524
- '<shadow type="row_block" id="id1">' +
525
- '<value name="INPUT">' +
526
- '<shadow type="row_block" id="id2"></shadow>' +
527
- '</value>' +
528
- '</shadow>' +
529
- '</value>' +
530
- '</block>',
531
- );
532
- });
533
-
534
- test('Statement', function () {
535
- const parent = createStatementBlocks(this.workspace);
536
- const xml = Blockly.utils.xml.textToDom(
537
- '<shadow type="statement_block" id="id1"/>',
538
- );
539
- parent.getInput('NAME').connection.setShadowDom(xml);
540
- assertInputHasBlock(parent, 'NAME', false);
541
- parent.getInput('NAME').connection.disconnect();
542
- assertInputHasBlock(parent, 'NAME', true);
543
- assertSerialization(
544
- parent,
545
- {
546
- 'type': 'statement_block',
547
- 'id': 'id0',
548
- 'inputs': {
549
- 'NAME': {
550
- 'shadow': {
551
- 'type': 'statement_block',
552
- 'id': 'id1',
553
- },
554
- },
555
- },
556
- },
557
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
558
- 'type="statement_block" id="id0">' +
559
- '<statement name="NAME">' +
560
- '<shadow type="statement_block" id="id1"></shadow>' +
561
- '</statement>' +
562
- '</block>',
563
- );
564
- });
565
-
566
- test('Multiple Statement', function () {
567
- const parent = createStatementBlocks(this.workspace);
568
- const xml = Blockly.utils.xml.textToDom(
569
- '<shadow type="statement_block" id="id1">' +
570
- ' <statement name="NAME">' +
571
- ' <shadow type="statement_block" id="id2"/>' +
572
- ' </statement>' +
573
- '</shadow>',
574
- );
575
- parent.getInput('NAME').connection.setShadowDom(xml);
576
- assertInputHasBlock(parent, 'NAME', false);
577
- assertInputNotHasBlock(
578
- parent.getInputTargetBlock('NAME'),
579
- 'NAME',
580
- );
581
- parent.getInput('NAME').connection.disconnect();
582
- assertInputHasBlock(parent, 'NAME', true);
583
- assertInputHasBlock(
584
- parent.getInputTargetBlock('NAME'),
585
- 'NAME',
586
- true,
587
- );
588
- assertSerialization(
589
- parent,
590
- {
591
- 'type': 'statement_block',
592
- 'id': 'id0',
593
- 'inputs': {
594
- 'NAME': {
595
- 'shadow': {
596
- 'type': 'statement_block',
597
- 'id': 'id1',
598
- 'inputs': {
599
- 'NAME': {
600
- 'shadow': {
601
- 'type': 'statement_block',
602
- 'id': 'id2',
603
- },
604
- },
605
- },
606
- },
607
- },
608
- },
609
- },
610
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
611
- 'type="statement_block" id="id0">' +
612
- '<statement name="NAME">' +
613
- '<shadow type="statement_block" id="id1">' +
614
- '<statement name="NAME">' +
615
- '<shadow type="statement_block" id="id2"></shadow>' +
616
- '</statement>' +
617
- '</shadow>' +
618
- '</statement>' +
619
- '</block>',
620
- );
621
- });
622
-
623
- test('Next', function () {
624
- const parent = createStackBlocks(this.workspace);
625
- const xml = Blockly.utils.xml.textToDom(
626
- '<shadow type="stack_block" id="id1"/>',
627
- );
628
- parent.nextConnection.setShadowDom(xml);
629
- assertNextHasBlock(parent, false);
630
- parent.nextConnection.disconnect();
631
- assertNextHasBlock(parent, true);
632
- assertSerialization(
633
- parent,
634
- {
635
- 'type': 'stack_block',
636
- 'id': 'id0',
637
- 'next': {
638
- 'shadow': {
639
- 'type': 'stack_block',
640
- 'id': 'id1',
641
- },
642
- },
643
- },
644
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
645
- 'type="stack_block" id="id0">' +
646
- '<next>' +
647
- '<shadow type="stack_block" id="id1"></shadow>' +
648
- '</next>' +
649
- '</block>',
650
- );
651
- });
652
-
653
- test('Multiple Next', function () {
654
- const parent = createStackBlocks(this.workspace);
655
- const xml = Blockly.utils.xml.textToDom(
656
- '<shadow type="stack_block" id="id1">' +
657
- ' <next>' +
658
- ' <shadow type="stack_block" id="id2"/>' +
659
- ' </next>' +
660
- '</shadow>',
661
- );
662
- parent.nextConnection.setShadowDom(xml);
663
- assertNextHasBlock(parent, false);
664
- assertNextNotHasBlock(parent.getNextBlock());
665
- parent.nextConnection.disconnect();
666
- assertNextHasBlock(parent, true);
667
- assertNextHasBlock(parent.getNextBlock(), true);
668
- assertSerialization(
669
- parent,
670
- {
671
- 'type': 'stack_block',
672
- 'id': 'id0',
673
- 'next': {
674
- 'shadow': {
675
- 'type': 'stack_block',
676
- 'id': 'id1',
677
- 'next': {
678
- 'shadow': {
679
- 'type': 'stack_block',
680
- 'id': 'id2',
681
- },
682
- },
683
- },
684
- },
685
- },
686
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
687
- 'type="stack_block" id="id0">' +
688
- '<next>' +
689
- '<shadow type="stack_block" id="id1">' +
690
- '<next>' +
691
- '<shadow type="stack_block" id="id2"></shadow>' +
692
- '</next>' +
693
- '</shadow>' +
694
- '</next>' +
695
- '</block>',
696
- );
697
- });
698
- });
699
-
700
- suite('Add - With Shadow Connected', function () {
701
- // These are defined separately in each suite.
702
- function createRowBlock(workspace) {
703
- const block = Blockly.Xml.domToBlock(
704
- Blockly.utils.xml.textToDom(
705
- '<block type="row_block" id="id0"/>',
706
- ),
707
- workspace,
708
- );
709
- return block;
710
- }
711
-
712
- function createStatementBlock(workspace) {
713
- const block = Blockly.Xml.domToBlock(
714
- Blockly.utils.xml.textToDom(
715
- '<block type="statement_block" id="id0"/>',
716
- ),
717
- workspace,
718
- );
719
- return block;
720
- }
721
-
722
- function createStackBlock(workspace) {
723
- const block = Blockly.Xml.domToBlock(
724
- Blockly.utils.xml.textToDom(
725
- '<block type="stack_block" id="id0"/>',
726
- ),
727
- workspace,
728
- );
729
- return block;
730
- }
731
-
732
- test('Value', function () {
733
- const parent = createRowBlock(this.workspace);
734
- const xml1 = Blockly.utils.xml.textToDom(
735
- '<shadow type="row_block" id="1"/>',
736
- );
737
- parent.getInput('INPUT').connection.setShadowDom(xml1);
738
- assertInputHasBlock(parent, 'INPUT', true, '1');
739
- const xml2 = Blockly.utils.xml.textToDom(
740
- '<shadow type="row_block" id="2"/>',
741
- );
742
- parent.getInput('INPUT').connection.setShadowDom(xml2);
743
- assertInputHasBlock(parent, 'INPUT', true, '2');
744
- assertSerialization(
745
- parent,
746
- {
747
- 'type': 'row_block',
748
- 'id': 'id0',
749
- 'inputs': {
750
- 'INPUT': {
751
- 'shadow': {
752
- 'type': 'row_block',
753
- 'id': '2',
754
- },
755
- },
756
- },
757
- },
758
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
759
- 'type="row_block" id="id0">' +
760
- '<value name="INPUT">' +
761
- '<shadow type="row_block" id="2"></shadow>' +
762
- '</value>' +
763
- '</block>',
764
- );
765
- });
766
-
767
- test('Multiple Value', function () {
768
- const parent = createRowBlock(this.workspace);
769
- const xml1 = Blockly.utils.xml.textToDom(
770
- '<shadow type="row_block" id="1">' +
771
- ' <value name="INPUT">' +
772
- ' <shadow type="row_block" id="a"/>' +
773
- ' </value>' +
774
- '</shadow>',
775
- );
776
- parent.getInput('INPUT').connection.setShadowDom(xml1);
777
- assertInputHasBlock(parent, 'INPUT', true, '1');
778
- assertInputHasBlock(
779
- parent.getInputTargetBlock('INPUT'),
780
- 'INPUT',
781
- true,
782
- 'a',
783
- );
784
- const xml2 = Blockly.utils.xml.textToDom(
785
- '<shadow type="row_block" id="2">' +
786
- ' <value name="INPUT">' +
787
- ' <shadow type="row_block" id="b"/>' +
788
- ' </value>' +
789
- '</shadow>',
790
- );
791
- parent.getInput('INPUT').connection.setShadowDom(xml2);
792
- assertInputHasBlock(parent, 'INPUT', true, '2');
793
- assertInputHasBlock(
794
- parent.getInputTargetBlock('INPUT'),
795
- 'INPUT',
796
- true,
797
- 'b',
798
- );
799
- assertSerialization(
800
- parent,
801
- {
802
- 'type': 'row_block',
803
- 'id': 'id0',
804
- 'inputs': {
805
- 'INPUT': {
806
- 'shadow': {
807
- 'type': 'row_block',
808
- 'id': '2',
809
- 'inputs': {
810
- 'INPUT': {
811
- 'shadow': {
812
- 'type': 'row_block',
813
- 'id': 'b',
814
- },
815
- },
816
- },
817
- },
818
- },
819
- },
820
- },
821
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
822
- 'type="row_block" id="id0">' +
823
- '<value name="INPUT">' +
824
- '<shadow type="row_block" id="2">' +
825
- '<value name="INPUT">' +
826
- '<shadow type="row_block" id="b"></shadow>' +
827
- '</value>' +
828
- '</shadow>' +
829
- '</value>' +
830
- '</block>',
831
- );
832
- });
833
-
834
- test('Statement', function () {
835
- const parent = createStatementBlock(this.workspace);
836
- const xml1 = Blockly.utils.xml.textToDom(
837
- '<shadow type="statement_block" id="1"/>',
838
- );
839
- parent.getInput('NAME').connection.setShadowDom(xml1);
840
- assertInputHasBlock(parent, 'NAME', true, '1');
841
- const xml2 = Blockly.utils.xml.textToDom(
842
- '<shadow type="statement_block" id="2"/>',
843
- );
844
- parent.getInput('NAME').connection.setShadowDom(xml2);
845
- assertInputHasBlock(parent, 'NAME', true, '2');
846
- assertSerialization(
847
- parent,
848
- {
849
- 'type': 'statement_block',
850
- 'id': 'id0',
851
- 'inputs': {
852
- 'NAME': {
853
- 'shadow': {
854
- 'type': 'statement_block',
855
- 'id': '2',
856
- },
857
- },
858
- },
859
- },
860
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
861
- 'type="statement_block" id="id0">' +
862
- '<statement name="NAME">' +
863
- '<shadow type="statement_block" id="2"></shadow>' +
864
- '</statement>' +
865
- '</block>',
866
- );
867
- });
868
-
869
- test('Multiple Statement', function () {
870
- const parent = createStatementBlock(this.workspace);
871
- const xml1 = Blockly.utils.xml.textToDom(
872
- '<shadow type="statement_block" id="1">' +
873
- ' <statement name="NAME">' +
874
- ' <shadow type="statement_block" id="a"/>' +
875
- ' </statement>' +
876
- '</shadow>',
877
- );
878
- parent.getInput('NAME').connection.setShadowDom(xml1);
879
- assertInputHasBlock(parent, 'NAME', true, '1');
880
- assertInputHasBlock(
881
- parent.getInputTargetBlock('NAME'),
882
- 'NAME',
883
- true,
884
- 'a',
885
- );
886
- const xml2 = Blockly.utils.xml.textToDom(
887
- '<shadow type="statement_block" id="2">' +
888
- ' <statement name="NAME">' +
889
- ' <shadow type="statement_block" id="b"/>' +
890
- ' </statement>' +
891
- '</shadow>',
892
- );
893
- parent.getInput('NAME').connection.setShadowDom(xml2);
894
- assertInputHasBlock(parent, 'NAME', true, '2');
895
- assertInputHasBlock(
896
- parent.getInputTargetBlock('NAME'),
897
- 'NAME',
898
- true,
899
- 'b',
900
- );
901
- assertSerialization(
902
- parent,
903
- {
904
- 'type': 'statement_block',
905
- 'id': 'id0',
906
- 'inputs': {
907
- 'NAME': {
908
- 'shadow': {
909
- 'type': 'statement_block',
910
- 'id': '2',
911
- 'inputs': {
912
- 'NAME': {
913
- 'shadow': {
914
- 'type': 'statement_block',
915
- 'id': 'b',
916
- },
917
- },
918
- },
919
- },
920
- },
921
- },
922
- },
923
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
924
- 'type="statement_block" id="id0">' +
925
- '<statement name="NAME">' +
926
- '<shadow type="statement_block" id="2">' +
927
- '<statement name="NAME">' +
928
- '<shadow type="statement_block" id="b"></shadow>' +
929
- '</statement>' +
930
- '</shadow>' +
931
- '</statement>' +
932
- '</block>',
933
- );
934
- });
935
-
936
- test('Next', function () {
937
- const parent = createStackBlock(this.workspace);
938
- const xml1 = Blockly.utils.xml.textToDom(
939
- '<shadow type="stack_block" id="1"/>',
940
- );
941
- parent.nextConnection.setShadowDom(xml1);
942
- assertNextHasBlock(parent, true, '1');
943
- const xml2 = Blockly.utils.xml.textToDom(
944
- '<shadow type="stack_block" id="2"/>',
945
- );
946
- parent.nextConnection.setShadowDom(xml2);
947
- assertNextHasBlock(parent, true, '2');
948
- assertSerialization(
949
- parent,
950
- {
951
- 'type': 'stack_block',
952
- 'id': 'id0',
953
- 'next': {
954
- 'shadow': {
955
- 'type': 'stack_block',
956
- 'id': '2',
957
- },
958
- },
959
- },
960
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
961
- 'type="stack_block" id="id0">' +
962
- '<next>' +
963
- '<shadow type="stack_block" id="2"></shadow>' +
964
- '</next>' +
965
- '</block>',
966
- );
967
- });
968
-
969
- test('Multiple Next', function () {
970
- const parent = createStackBlock(this.workspace);
971
- const xml1 = Blockly.utils.xml.textToDom(
972
- '<shadow type="stack_block" id="1">' +
973
- ' <next>' +
974
- ' <shadow type="stack_block" id="a"/>' +
975
- ' </next>' +
976
- '</shadow>',
977
- );
978
- parent.nextConnection.setShadowDom(xml1);
979
- assertNextHasBlock(parent, true, '1');
980
- assertNextHasBlock(parent.getNextBlock(), true, 'a');
981
- const xml2 = Blockly.utils.xml.textToDom(
982
- '<shadow type="stack_block" id="2">' +
983
- ' <next>' +
984
- ' <shadow type="stack_block" id="b"/>' +
985
- ' </next>' +
986
- '</shadow>',
987
- );
988
- parent.nextConnection.setShadowDom(xml2);
989
- assertNextHasBlock(parent, true, '2');
990
- assertNextHasBlock(parent.getNextBlock(), true, 'b');
991
- assertSerialization(
992
- parent,
993
- {
994
- 'type': 'stack_block',
995
- 'id': 'id0',
996
- 'next': {
997
- 'shadow': {
998
- 'type': 'stack_block',
999
- 'id': '2',
1000
- 'next': {
1001
- 'shadow': {
1002
- 'type': 'stack_block',
1003
- 'id': 'b',
1004
- },
1005
- },
1006
- },
1007
- },
1008
- },
1009
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
1010
- 'type="stack_block" id="id0">' +
1011
- '<next>' +
1012
- '<shadow type="stack_block" id="2">' +
1013
- '<next>' +
1014
- '<shadow type="stack_block" id="b"></shadow>' +
1015
- '</next>' +
1016
- '</shadow>' +
1017
- '</next>' +
1018
- '</block>',
1019
- );
1020
- });
1021
- });
1022
-
1023
- suite('Remove - No Block Connected', function () {
1024
- // These are defined separately in each suite.
1025
- function createRowBlock(workspace) {
1026
- const block = Blockly.Xml.domToBlock(
1027
- Blockly.utils.xml.textToDom(
1028
- '<block type="row_block" id="id0">' +
1029
- ' <value name="INPUT">' +
1030
- ' <shadow type="row_block" id="idA"/>' +
1031
- ' </value>' +
1032
- '</block>',
1033
- ),
1034
- workspace,
1035
- );
1036
- return block;
1037
- }
1038
-
1039
- function createStatementBlock(workspace) {
1040
- const block = Blockly.Xml.domToBlock(
1041
- Blockly.utils.xml.textToDom(
1042
- '<block type="statement_block" id="id0">' +
1043
- ' <statement name="NAME">' +
1044
- ' <shadow type="statement_block" id="idA"/>' +
1045
- ' </statement>' +
1046
- '</block>',
1047
- ),
1048
- workspace,
1049
- );
1050
- return block;
1051
- }
1052
-
1053
- function createStackBlock(workspace) {
1054
- const block = Blockly.Xml.domToBlock(
1055
- Blockly.utils.xml.textToDom(
1056
- '<block type="stack_block" id="id0">' +
1057
- ' <next>' +
1058
- ' <shadow type="stack_block" id="idA"/>' +
1059
- ' </next>' +
1060
- '</block>',
1061
- ),
1062
- workspace,
1063
- );
1064
- return block;
1065
- }
1066
-
1067
- test('Value', function () {
1068
- const parent = createRowBlock(this.workspace);
1069
- parent.getInput('INPUT').connection.setShadowDom(null);
1070
- assertInputNotHasBlock(parent, 'INPUT');
1071
- assertSerialization(
1072
- parent,
1073
- {
1074
- 'type': 'row_block',
1075
- 'id': 'id0',
1076
- },
1077
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
1078
- 'type="row_block" id="id0">' +
1079
- '</block>',
1080
- );
1081
- });
1082
-
1083
- test('Statement', function () {
1084
- const parent = createStatementBlock(this.workspace);
1085
- parent.getInput('NAME').connection.setShadowDom(null);
1086
- assertInputNotHasBlock(parent, 'STATEMENT');
1087
- assertSerialization(
1088
- parent,
1089
- {
1090
- 'type': 'statement_block',
1091
- 'id': 'id0',
1092
- },
1093
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
1094
- 'type="statement_block" id="id0">' +
1095
- '</block>',
1096
- );
1097
- });
1098
-
1099
- test('Next', function () {
1100
- const parent = createStackBlock(this.workspace);
1101
- parent.nextConnection.setShadowDom(null);
1102
- assertNextNotHasBlock(parent);
1103
- assertSerialization(
1104
- parent,
1105
- {
1106
- 'type': 'stack_block',
1107
- 'id': 'id0',
1108
- },
1109
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
1110
- 'type="stack_block" id="id0">' +
1111
- '</block>',
1112
- );
1113
- });
1114
- });
1115
-
1116
- suite('Remove - Block Connected', function () {
1117
- // These are defined separately in each suite.
1118
- function createRowBlock(workspace) {
1119
- const block = Blockly.Xml.domToBlock(
1120
- Blockly.utils.xml.textToDom(
1121
- '<block type="row_block" id="id0">' +
1122
- ' <value name="INPUT">' +
1123
- ' <shadow type="row_block" id="idA"/>' +
1124
- ' <block type="row_block" id="idB"/>' +
1125
- ' </value>' +
1126
- '</block>',
1127
- ),
1128
- workspace,
1129
- );
1130
- return block;
1131
- }
1132
-
1133
- function createStatementBlock(workspace) {
1134
- const block = Blockly.Xml.domToBlock(
1135
- Blockly.utils.xml.textToDom(
1136
- '<block type="statement_block" id="id0">' +
1137
- ' <statement name="NAME">' +
1138
- ' <shadow type="statement_block" id="idA"/>' +
1139
- ' <block type="statement_block" id="idB"/>' +
1140
- ' </statement>' +
1141
- '</block>',
1142
- ),
1143
- workspace,
1144
- );
1145
- return block;
1146
- }
1147
-
1148
- function createStackBlock(workspace) {
1149
- const block = Blockly.Xml.domToBlock(
1150
- Blockly.utils.xml.textToDom(
1151
- '<block type="stack_block" id="id0">' +
1152
- ' <next>' +
1153
- ' <shadow type="stack_block" id="idA"/>' +
1154
- ' <block type="stack_block" id="idB"/>' +
1155
- ' </next>' +
1156
- '</block>',
1157
- ),
1158
- workspace,
1159
- );
1160
- return block;
1161
- }
1162
-
1163
- test('Value', function () {
1164
- const parent = createRowBlock(this.workspace);
1165
- parent.getInput('INPUT').connection.setShadowDom(null);
1166
- assertInputHasBlock(parent, 'INPUT', false);
1167
- parent.getInput('INPUT').connection.disconnect();
1168
- assertInputNotHasBlock(parent, 'INPUT');
1169
- assertSerialization(
1170
- parent,
1171
- {
1172
- 'type': 'row_block',
1173
- 'id': 'id0',
1174
- },
1175
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
1176
- 'type="row_block" id="id0">' +
1177
- '</block>',
1178
- );
1179
- });
1180
-
1181
- test('Statement', function () {
1182
- const parent = createStatementBlock(this.workspace);
1183
- parent.getInput('NAME').connection.setShadowDom(null);
1184
- assertInputHasBlock(parent, 'NAME', false);
1185
- parent.getInput('NAME').connection.disconnect();
1186
- assertInputNotHasBlock(parent, 'NAME');
1187
- assertSerialization(
1188
- parent,
1189
- {
1190
- 'type': 'statement_block',
1191
- 'id': 'id0',
1192
- },
1193
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
1194
- 'type="statement_block" id="id0">' +
1195
- '</block>',
1196
- );
1197
- });
1198
-
1199
- test('Next', function () {
1200
- const parent = createStackBlock(this.workspace);
1201
- parent.nextConnection.setShadowDom(null);
1202
- assertNextHasBlock(parent, false);
1203
- parent.nextConnection.disconnect();
1204
- assertNextNotHasBlock(parent);
1205
- assertSerialization(
1206
- parent,
1207
- {
1208
- 'type': 'stack_block',
1209
- 'id': 'id0',
1210
- },
1211
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
1212
- 'type="stack_block" id="id0">' +
1213
- '</block>',
1214
- );
1215
- });
1216
- });
1217
-
1218
- suite('Add - Connect & Disconnect - Remove', function () {
1219
- // These are defined separately in each suite.
1220
- function createRowBlock(workspace) {
1221
- const block = Blockly.Xml.domToBlock(
1222
- Blockly.utils.xml.textToDom('<block type="row_block"/>'),
1223
- workspace,
1224
- );
1225
- return block;
1226
- }
1227
-
1228
- function createStatementBlock(workspace) {
1229
- const block = Blockly.Xml.domToBlock(
1230
- Blockly.utils.xml.textToDom('<block type="statement_block"/>'),
1231
- workspace,
1232
- );
1233
- return block;
1234
- }
1235
-
1236
- function createStackBlock(workspace) {
1237
- const block = Blockly.Xml.domToBlock(
1238
- Blockly.utils.xml.textToDom('<block type="stack_block"/>'),
1239
- workspace,
1240
- );
1241
- return block;
1242
- }
1243
-
1244
- test('Value', function () {
1245
- const parent = createRowBlock(this.workspace);
1246
- const xml = Blockly.utils.xml.textToDom(
1247
- '<shadow type="row_block"/>',
1248
- );
1249
- parent.getInput('INPUT').connection.setShadowDom(xml);
1250
- assertInputHasBlock(parent, 'INPUT', true);
1251
- const child = createRowBlock(this.workspace);
1252
- parent
1253
- .getInput('INPUT')
1254
- .connection.connect(child.outputConnection);
1255
- assertInputHasBlock(parent, 'INPUT', false);
1256
- parent.getInput('INPUT').connection.disconnect();
1257
- assertInputHasBlock(parent, 'INPUT', true);
1258
- parent.getInput('INPUT').connection.setShadowDom(null);
1259
- assertInputNotHasBlock(parent, 'INPUT');
1260
- });
1261
-
1262
- test('Multiple Value', function () {
1263
- const parent = createRowBlock(this.workspace);
1264
- const xml = Blockly.utils.xml.textToDom(
1265
- '<shadow type="row_block">' +
1266
- ' <value name="INPUT">' +
1267
- ' <shadow type="row_block"/>' +
1268
- ' </value>' +
1269
- '</shadow>',
1270
- );
1271
- parent.getInput('INPUT').connection.setShadowDom(xml);
1272
- assertInputHasBlock(parent, 'INPUT', true);
1273
- assertInputHasBlock(
1274
- parent.getInputTargetBlock('INPUT'),
1275
- 'INPUT',
1276
- true,
1277
- );
1278
- const child = createRowBlock(this.workspace);
1279
- parent
1280
- .getInput('INPUT')
1281
- .connection.connect(child.outputConnection);
1282
- assertInputHasBlock(parent, 'INPUT', false);
1283
- parent.getInput('INPUT').connection.disconnect();
1284
- assertInputHasBlock(parent, 'INPUT', true);
1285
- assertInputHasBlock(
1286
- parent.getInputTargetBlock('INPUT'),
1287
- 'INPUT',
1288
- true,
1289
- );
1290
- parent.getInput('INPUT').connection.setShadowDom(null);
1291
- assertInputNotHasBlock(parent, 'INPUT');
1292
- });
1293
-
1294
- test('Statement', function () {
1295
- const parent = createStatementBlock(this.workspace);
1296
- const xml = Blockly.utils.xml.textToDom(
1297
- '<shadow type="statement_block"/>',
1298
- );
1299
- parent.getInput('NAME').connection.setShadowDom(xml);
1300
- assertInputHasBlock(parent, 'NAME', true);
1301
- const child = createStatementBlock(this.workspace);
1302
- parent
1303
- .getInput('NAME')
1304
- .connection.connect(child.previousConnection);
1305
- assertInputHasBlock(parent, 'NAME', false);
1306
- parent.getInput('NAME').connection.disconnect();
1307
- assertInputHasBlock(parent, 'NAME', true);
1308
- parent.getInput('NAME').connection.setShadowDom(null);
1309
- assertInputNotHasBlock(parent, 'NAME');
1310
- });
1311
-
1312
- test('Multiple Statement', function () {
1313
- const parent = createStatementBlock(this.workspace);
1314
- const xml = Blockly.utils.xml.textToDom(
1315
- '<shadow type="statement_block">' +
1316
- ' <statement name="NAME">' +
1317
- ' <shadow type="statement_block"/>' +
1318
- ' </statement>' +
1319
- '</shadow>',
1320
- );
1321
- parent.getInput('NAME').connection.setShadowDom(xml);
1322
- assertInputHasBlock(parent, 'NAME', true);
1323
- assertInputHasBlock(
1324
- parent.getInputTargetBlock('NAME'),
1325
- 'NAME',
1326
- true,
1327
- );
1328
- const child = createStatementBlock(this.workspace);
1329
- parent
1330
- .getInput('NAME')
1331
- .connection.connect(child.previousConnection);
1332
- assertInputHasBlock(parent, 'NAME', false);
1333
- parent.getInput('NAME').connection.disconnect();
1334
- assertInputHasBlock(parent, 'NAME', true);
1335
- assertInputHasBlock(
1336
- parent.getInputTargetBlock('NAME'),
1337
- 'NAME',
1338
- true,
1339
- );
1340
- parent.getInput('NAME').connection.setShadowDom(null);
1341
- assertInputNotHasBlock(parent, 'NAME');
1342
- });
1343
-
1344
- test('Next', function () {
1345
- const parent = createStackBlock(this.workspace);
1346
- const xml = Blockly.utils.xml.textToDom(
1347
- '<shadow type="stack_block"/>',
1348
- );
1349
- parent.nextConnection.setShadowDom(xml);
1350
- assertNextHasBlock(parent, true);
1351
- const child = createStatementBlock(this.workspace);
1352
- parent.nextConnection.connect(child.previousConnection);
1353
- assertNextHasBlock(parent, false);
1354
- parent.nextConnection.disconnect();
1355
- assertNextHasBlock(parent, true);
1356
- parent.nextConnection.setShadowDom(null);
1357
- assertNextNotHasBlock(parent);
1358
- });
1359
-
1360
- test('Multiple Next', function () {
1361
- const parent = createStackBlock(this.workspace);
1362
- const xml = Blockly.utils.xml.textToDom(
1363
- '<shadow type="stack_block" id="parent">' +
1364
- ' <next>' +
1365
- ' <shadow type="stack_block" id="child"/>' +
1366
- ' </next>' +
1367
- '</shadow>',
1368
- );
1369
- parent.nextConnection.setShadowDom(xml);
1370
- assertNextHasBlock(parent, true);
1371
- assertNextHasBlock(parent.getNextBlock(), true);
1372
- const child = createStatementBlock(this.workspace);
1373
- parent.nextConnection.connect(child.previousConnection);
1374
- assertNextHasBlock(parent, false);
1375
- parent.nextConnection.disconnect();
1376
- assertNextHasBlock(parent, true);
1377
- assertNextHasBlock(parent.getNextBlock(), true);
1378
- parent.nextConnection.setShadowDom(null);
1379
- assertNextNotHasBlock(parent);
1380
- });
1381
- });
1382
-
1383
- suite('Invalid', function () {
1384
- test('Attach to output', function () {
1385
- const block = this.workspace.newBlock('row_block');
1386
- assert.throws(() =>
1387
- block.outputConnection.setShadowDom(
1388
- Blockly.utils.xml.textToDom('<block type="row_block">'),
1389
- ),
1390
- );
1391
- });
1392
-
1393
- test('Attach to previous', function () {
1394
- const block = this.workspace.newBlock('stack_block');
1395
- assert.throws(() =>
1396
- block.previousConnection.setShadowDom(
1397
- Blockly.utils.xml.textToDom('<block type="stack_block">'),
1398
- ),
1399
- );
1400
- });
1401
-
1402
- test('Missing output', function () {
1403
- const block = this.workspace.newBlock('row_block');
1404
- assert.throws(() =>
1405
- block.outputConnection.setShadowDom(
1406
- Blockly.utils.xml.textToDom('<block type="stack_block">'),
1407
- ),
1408
- );
1409
- });
1410
-
1411
- test('Missing previous', function () {
1412
- const block = this.workspace.newBlock('stack_block');
1413
- assert.throws(() =>
1414
- block.previousConnection.setShadowDom(
1415
- Blockly.utils.xml.textToDom('<block type="row_block">'),
1416
- ),
1417
- );
1418
- });
1419
-
1420
- test('Invalid connection checks, output', function () {
1421
- const block = this.workspace.newBlock('logic_operation');
1422
- assert.throws(() =>
1423
- block
1424
- .getInput('A')
1425
- .connection.setShadowDom(
1426
- Blockly.utils.xml.textToDom('<block type="stack_block">'),
1427
- ),
1428
- );
1429
- });
1430
-
1431
- test('Invalid connection checks, previous', function () {
1432
- Blockly.defineBlocksWithJsonArray([
1433
- {
1434
- 'type': 'stack_checks_block',
1435
- 'message0': '',
1436
- 'previousStatement': 'check 1',
1437
- 'nextStatement': 'check 2',
1438
- },
1439
- ]);
1440
- const block = this.workspace.newBlock('stack_checks_block');
1441
- assert.throws(() =>
1442
- block.nextConnection.setShadowDom(
1443
- Blockly.utils.xml.textToDom(
1444
- '<block type="stack_checks_block">',
1445
- ),
1446
- ),
1447
- );
1448
- });
1449
- });
1450
- });
1451
-
1452
- suite('setShadowState', function () {
1453
- suite('Add - No Block Connected', function () {
1454
- // These are defined separately in each suite.
1455
- function createRowBlock(workspace) {
1456
- return Blockly.serialization.blocks.append(
1457
- {'type': 'row_block', 'id': 'id0'},
1458
- workspace,
1459
- );
1460
- }
1461
-
1462
- function createStatementBlock(workspace) {
1463
- return Blockly.serialization.blocks.append(
1464
- {'type': 'statement_block', 'id': 'id0'},
1465
- workspace,
1466
- );
1467
- }
1468
-
1469
- function createStackBlock(workspace) {
1470
- return Blockly.serialization.blocks.append(
1471
- {'type': 'stack_block', 'id': 'id0'},
1472
- workspace,
1473
- );
1474
- }
1475
-
1476
- test('Value', function () {
1477
- const parent = createRowBlock(this.workspace);
1478
- parent
1479
- .getInput('INPUT')
1480
- .connection.setShadowState({'type': 'row_block', 'id': 'id1'});
1481
- assertInputHasBlock(parent, 'INPUT', true);
1482
- assertSerialization(
1483
- parent,
1484
- {
1485
- 'type': 'row_block',
1486
- 'id': 'id0',
1487
- 'inputs': {
1488
- 'INPUT': {
1489
- 'shadow': {
1490
- 'type': 'row_block',
1491
- 'id': 'id1',
1492
- },
1493
- },
1494
- },
1495
- },
1496
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
1497
- 'type="row_block" id="id0">' +
1498
- '<value name="INPUT">' +
1499
- '<shadow type="row_block" id="id1"></shadow>' +
1500
- '</value>' +
1501
- '</block>',
1502
- );
1503
- });
1504
-
1505
- test('Multiple Value', function () {
1506
- const parent = createRowBlock(this.workspace);
1507
- parent.getInput('INPUT').connection.setShadowState({
1508
- 'type': 'row_block',
1509
- 'id': 'id1',
1510
- 'inputs': {
1511
- 'INPUT': {
1512
- 'shadow': {
1513
- 'type': 'row_block',
1514
- 'id': 'id2',
1515
- },
1516
- },
1517
- },
1518
- });
1519
- assertInputHasBlock(parent, 'INPUT', true);
1520
- assertInputHasBlock(
1521
- parent.getInputTargetBlock('INPUT'),
1522
- 'INPUT',
1523
- true,
1524
- );
1525
- assertSerialization(
1526
- parent,
1527
- {
1528
- 'type': 'row_block',
1529
- 'id': 'id0',
1530
- 'inputs': {
1531
- 'INPUT': {
1532
- 'shadow': {
1533
- 'type': 'row_block',
1534
- 'id': 'id1',
1535
- 'inputs': {
1536
- 'INPUT': {
1537
- 'shadow': {
1538
- 'type': 'row_block',
1539
- 'id': 'id2',
1540
- },
1541
- },
1542
- },
1543
- },
1544
- },
1545
- },
1546
- },
1547
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
1548
- 'type="row_block" id="id0">' +
1549
- '<value name="INPUT">' +
1550
- '<shadow type="row_block" id="id1">' +
1551
- '<value name="INPUT">' +
1552
- '<shadow type="row_block" id="id2"></shadow>' +
1553
- '</value>' +
1554
- '</shadow>' +
1555
- '</value>' +
1556
- '</block>',
1557
- );
1558
- });
1559
-
1560
- test('Statement', function () {
1561
- const parent = createStatementBlock(this.workspace);
1562
- parent.getInput('NAME').connection.setShadowState({
1563
- 'type': 'statement_block',
1564
- 'id': 'id1',
1565
- });
1566
- assertInputHasBlock(parent, 'NAME', true);
1567
- assertSerialization(
1568
- parent,
1569
- {
1570
- 'type': 'statement_block',
1571
- 'id': 'id0',
1572
- 'inputs': {
1573
- 'NAME': {
1574
- 'shadow': {
1575
- 'type': 'statement_block',
1576
- 'id': 'id1',
1577
- },
1578
- },
1579
- },
1580
- },
1581
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
1582
- 'type="statement_block" id="id0">' +
1583
- '<statement name="NAME">' +
1584
- '<shadow type="statement_block" id="id1"></shadow>' +
1585
- '</statement>' +
1586
- '</block>',
1587
- );
1588
- });
1589
-
1590
- test('Multiple Statment', function () {
1591
- const parent = createStatementBlock(this.workspace);
1592
- parent.getInput('NAME').connection.setShadowState({
1593
- 'type': 'statement_block',
1594
- 'id': 'id1',
1595
- 'inputs': {
1596
- 'NAME': {
1597
- 'shadow': {
1598
- 'type': 'statement_block',
1599
- 'id': 'id2',
1600
- },
1601
- },
1602
- },
1603
- });
1604
- assertInputHasBlock(parent, 'NAME', true);
1605
- assertInputHasBlock(
1606
- parent.getInputTargetBlock('NAME'),
1607
- 'NAME',
1608
- true,
1609
- );
1610
- assertSerialization(
1611
- parent,
1612
- {
1613
- 'type': 'statement_block',
1614
- 'id': 'id0',
1615
- 'inputs': {
1616
- 'NAME': {
1617
- 'shadow': {
1618
- 'type': 'statement_block',
1619
- 'id': 'id1',
1620
- 'inputs': {
1621
- 'NAME': {
1622
- 'shadow': {
1623
- 'type': 'statement_block',
1624
- 'id': 'id2',
1625
- },
1626
- },
1627
- },
1628
- },
1629
- },
1630
- },
1631
- },
1632
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
1633
- 'type="statement_block" id="id0">' +
1634
- '<statement name="NAME">' +
1635
- '<shadow type="statement_block" id="id1">' +
1636
- '<statement name="NAME">' +
1637
- '<shadow type="statement_block" id="id2"></shadow>' +
1638
- '</statement>' +
1639
- '</shadow>' +
1640
- '</statement>' +
1641
- '</block>',
1642
- );
1643
- });
1644
-
1645
- test('Next', function () {
1646
- const parent = createStackBlock(this.workspace);
1647
- parent.nextConnection.setShadowState({
1648
- 'type': 'stack_block',
1649
- 'id': 'id1',
1650
- });
1651
- assertNextHasBlock(parent, true);
1652
- assertSerialization(
1653
- parent,
1654
- {
1655
- 'type': 'stack_block',
1656
- 'id': 'id0',
1657
- 'next': {
1658
- 'shadow': {
1659
- 'type': 'stack_block',
1660
- 'id': 'id1',
1661
- },
1662
- },
1663
- },
1664
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
1665
- 'type="stack_block" id="id0">' +
1666
- '<next>' +
1667
- '<shadow type="stack_block" id="id1"></shadow>' +
1668
- '</next>' +
1669
- '</block>',
1670
- );
1671
- });
1672
- test('Multiple Next', function () {
1673
- const parent = createStackBlock(this.workspace);
1674
- parent.nextConnection.setShadowState({
1675
- 'type': 'stack_block',
1676
- 'id': 'id1',
1677
- 'next': {
1678
- 'shadow': {
1679
- 'type': 'stack_block',
1680
- 'id': 'id2',
1681
- },
1682
- },
1683
- });
1684
- assertNextHasBlock(parent, true);
1685
- assertNextHasBlock(parent.getNextBlock(), true);
1686
- assertSerialization(
1687
- parent,
1688
- {
1689
- 'type': 'stack_block',
1690
- 'id': 'id0',
1691
- 'next': {
1692
- 'shadow': {
1693
- 'type': 'stack_block',
1694
- 'id': 'id1',
1695
- 'next': {
1696
- 'shadow': {
1697
- 'type': 'stack_block',
1698
- 'id': 'id2',
1699
- },
1700
- },
1701
- },
1702
- },
1703
- },
1704
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
1705
- 'type="stack_block" id="id0">' +
1706
- '<next>' +
1707
- '<shadow type="stack_block" id="id1">' +
1708
- '<next>' +
1709
- '<shadow type="stack_block" id="id2"></shadow>' +
1710
- '</next>' +
1711
- '</shadow>' +
1712
- '</next>' +
1713
- '</block>',
1714
- );
1715
- });
1716
- });
1717
-
1718
- suite('Add - With Block Connected', function () {
1719
- // These are defined separately in each suite.
1720
- function createRowBlocks(workspace) {
1721
- return Blockly.serialization.blocks.append(
1722
- {
1723
- 'type': 'row_block',
1724
- 'id': 'id0',
1725
- 'inputs': {
1726
- 'INPUT': {
1727
- 'block': {
1728
- 'type': 'row_block',
1729
- 'id': 'idA',
1730
- },
1731
- },
1732
- },
1733
- },
1734
- workspace,
1735
- );
1736
- }
1737
-
1738
- function createStatementBlocks(workspace) {
1739
- return Blockly.serialization.blocks.append(
1740
- {
1741
- 'type': 'statement_block',
1742
- 'id': 'id0',
1743
- 'inputs': {
1744
- 'NAME': {
1745
- 'block': {
1746
- 'type': 'statement_block',
1747
- 'id': 'idA',
1748
- },
1749
- },
1750
- },
1751
- },
1752
- workspace,
1753
- );
1754
- }
1755
-
1756
- function createStackBlocks(workspace) {
1757
- return Blockly.serialization.blocks.append(
1758
- {
1759
- 'type': 'stack_block',
1760
- 'id': 'id0',
1761
- 'next': {
1762
- 'block': {
1763
- 'type': 'stack_block',
1764
- 'id': 'idA',
1765
- },
1766
- },
1767
- },
1768
- workspace,
1769
- );
1770
- }
1771
-
1772
- test('Value', function () {
1773
- const parent = createRowBlocks(this.workspace);
1774
- parent
1775
- .getInput('INPUT')
1776
- .connection.setShadowState({'type': 'row_block', 'id': 'id1'});
1777
- assertInputHasBlock(parent, 'INPUT', false);
1778
- parent.getInput('INPUT').connection.disconnect();
1779
- assertInputHasBlock(parent, 'INPUT', true);
1780
- assertSerialization(
1781
- parent,
1782
- {
1783
- 'type': 'row_block',
1784
- 'id': 'id0',
1785
- 'inputs': {
1786
- 'INPUT': {
1787
- 'shadow': {
1788
- 'type': 'row_block',
1789
- 'id': 'id1',
1790
- },
1791
- },
1792
- },
1793
- },
1794
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
1795
- 'type="row_block" id="id0">' +
1796
- '<value name="INPUT">' +
1797
- '<shadow type="row_block" id="id1"></shadow>' +
1798
- '</value>' +
1799
- '</block>',
1800
- );
1801
- });
1802
-
1803
- test('Multiple Value', function () {
1804
- const parent = createRowBlocks(this.workspace);
1805
- parent.getInput('INPUT').connection.setShadowState({
1806
- 'type': 'row_block',
1807
- 'id': 'id1',
1808
- 'inputs': {
1809
- 'INPUT': {
1810
- 'shadow': {
1811
- 'type': 'row_block',
1812
- 'id': 'id2',
1813
- },
1814
- },
1815
- },
1816
- });
1817
- assertInputHasBlock(parent, 'INPUT', false);
1818
- assertInputNotHasBlock(
1819
- parent.getInputTargetBlock('INPUT'),
1820
- 'INPUT',
1821
- );
1822
- parent.getInput('INPUT').connection.disconnect();
1823
- assertInputHasBlock(parent, 'INPUT', true);
1824
- assertInputHasBlock(
1825
- parent.getInputTargetBlock('INPUT'),
1826
- 'INPUT',
1827
- true,
1828
- );
1829
- assertSerialization(
1830
- parent,
1831
- {
1832
- 'type': 'row_block',
1833
- 'id': 'id0',
1834
- 'inputs': {
1835
- 'INPUT': {
1836
- 'shadow': {
1837
- 'type': 'row_block',
1838
- 'id': 'id1',
1839
- 'inputs': {
1840
- 'INPUT': {
1841
- 'shadow': {
1842
- 'type': 'row_block',
1843
- 'id': 'id2',
1844
- },
1845
- },
1846
- },
1847
- },
1848
- },
1849
- },
1850
- },
1851
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
1852
- 'type="row_block" id="id0">' +
1853
- '<value name="INPUT">' +
1854
- '<shadow type="row_block" id="id1">' +
1855
- '<value name="INPUT">' +
1856
- '<shadow type="row_block" id="id2"></shadow>' +
1857
- '</value>' +
1858
- '</shadow>' +
1859
- '</value>' +
1860
- '</block>',
1861
- );
1862
- });
1863
-
1864
- test('Statement', function () {
1865
- const parent = createStatementBlocks(this.workspace);
1866
- parent.getInput('NAME').connection.setShadowState({
1867
- 'type': 'statement_block',
1868
- 'id': 'id1',
1869
- });
1870
- assertInputHasBlock(parent, 'NAME', false);
1871
- parent.getInput('NAME').connection.disconnect();
1872
- assertInputHasBlock(parent, 'NAME', true);
1873
- assertSerialization(
1874
- parent,
1875
- {
1876
- 'type': 'statement_block',
1877
- 'id': 'id0',
1878
- 'inputs': {
1879
- 'NAME': {
1880
- 'shadow': {
1881
- 'type': 'statement_block',
1882
- 'id': 'id1',
1883
- },
1884
- },
1885
- },
1886
- },
1887
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
1888
- 'type="statement_block" id="id0">' +
1889
- '<statement name="NAME">' +
1890
- '<shadow type="statement_block" id="id1"></shadow>' +
1891
- '</statement>' +
1892
- '</block>',
1893
- );
1894
- });
1895
-
1896
- test('Multiple Statement', function () {
1897
- const parent = createStatementBlocks(this.workspace);
1898
- parent.getInput('NAME').connection.setShadowState({
1899
- 'type': 'statement_block',
1900
- 'id': 'id1',
1901
- 'inputs': {
1902
- 'NAME': {
1903
- 'shadow': {
1904
- 'type': 'statement_block',
1905
- 'id': 'id2',
1906
- },
1907
- },
1908
- },
1909
- });
1910
- assertInputHasBlock(parent, 'NAME', false);
1911
- assertInputNotHasBlock(
1912
- parent.getInputTargetBlock('NAME'),
1913
- 'NAME',
1914
- );
1915
- parent.getInput('NAME').connection.disconnect();
1916
- assertInputHasBlock(parent, 'NAME', true);
1917
- assertInputHasBlock(
1918
- parent.getInputTargetBlock('NAME'),
1919
- 'NAME',
1920
- true,
1921
- );
1922
- assertSerialization(
1923
- parent,
1924
- {
1925
- 'type': 'statement_block',
1926
- 'id': 'id0',
1927
- 'inputs': {
1928
- 'NAME': {
1929
- 'shadow': {
1930
- 'type': 'statement_block',
1931
- 'id': 'id1',
1932
- 'inputs': {
1933
- 'NAME': {
1934
- 'shadow': {
1935
- 'type': 'statement_block',
1936
- 'id': 'id2',
1937
- },
1938
- },
1939
- },
1940
- },
1941
- },
1942
- },
1943
- },
1944
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
1945
- 'type="statement_block" id="id0">' +
1946
- '<statement name="NAME">' +
1947
- '<shadow type="statement_block" id="id1">' +
1948
- '<statement name="NAME">' +
1949
- '<shadow type="statement_block" id="id2"></shadow>' +
1950
- '</statement>' +
1951
- '</shadow>' +
1952
- '</statement>' +
1953
- '</block>',
1954
- );
1955
- });
1956
-
1957
- test('Next', function () {
1958
- const parent = createStackBlocks(this.workspace);
1959
- parent.nextConnection.setShadowState({
1960
- 'type': 'stack_block',
1961
- 'id': 'id1',
1962
- });
1963
- assertNextHasBlock(parent, false);
1964
- parent.nextConnection.disconnect();
1965
- assertNextHasBlock(parent, true);
1966
- assertSerialization(
1967
- parent,
1968
- {
1969
- 'type': 'stack_block',
1970
- 'id': 'id0',
1971
- 'next': {
1972
- 'shadow': {
1973
- 'type': 'stack_block',
1974
- 'id': 'id1',
1975
- },
1976
- },
1977
- },
1978
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
1979
- 'type="stack_block" id="id0">' +
1980
- '<next>' +
1981
- '<shadow type="stack_block" id="id1"></shadow>' +
1982
- '</next>' +
1983
- '</block>',
1984
- );
1985
- });
1986
-
1987
- test('Multiple Next', function () {
1988
- const parent = createStackBlocks(this.workspace);
1989
- parent.nextConnection.setShadowState({
1990
- 'type': 'stack_block',
1991
- 'id': 'id1',
1992
- 'next': {
1993
- 'shadow': {
1994
- 'type': 'stack_block',
1995
- 'id': 'id2',
1996
- },
1997
- },
1998
- });
1999
- assertNextHasBlock(parent, false);
2000
- assertNextNotHasBlock(parent.getNextBlock());
2001
- parent.nextConnection.disconnect();
2002
- assertNextHasBlock(parent, true);
2003
- assertNextHasBlock(parent.getNextBlock(), true);
2004
- assertSerialization(
2005
- parent,
2006
- {
2007
- 'type': 'stack_block',
2008
- 'id': 'id0',
2009
- 'next': {
2010
- 'shadow': {
2011
- 'type': 'stack_block',
2012
- 'id': 'id1',
2013
- 'next': {
2014
- 'shadow': {
2015
- 'type': 'stack_block',
2016
- 'id': 'id2',
2017
- },
2018
- },
2019
- },
2020
- },
2021
- },
2022
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
2023
- 'type="stack_block" id="id0">' +
2024
- '<next>' +
2025
- '<shadow type="stack_block" id="id1">' +
2026
- '<next>' +
2027
- '<shadow type="stack_block" id="id2"></shadow>' +
2028
- '</next>' +
2029
- '</shadow>' +
2030
- '</next>' +
2031
- '</block>',
2032
- );
2033
- });
2034
- });
2035
-
2036
- suite('Add - With Shadow Connected', function () {
2037
- // These are defined separately in each suite.
2038
- function createRowBlock(workspace) {
2039
- return Blockly.serialization.blocks.append(
2040
- {'type': 'row_block', 'id': 'id0'},
2041
- workspace,
2042
- );
2043
- }
2044
-
2045
- function createStatementBlock(workspace) {
2046
- return Blockly.serialization.blocks.append(
2047
- {'type': 'statement_block', 'id': 'id0'},
2048
- workspace,
2049
- );
2050
- }
2051
-
2052
- function createStackBlock(workspace) {
2053
- return Blockly.serialization.blocks.append(
2054
- {'type': 'stack_block', 'id': 'id0'},
2055
- workspace,
2056
- );
2057
- }
2058
-
2059
- test('Value', function () {
2060
- const parent = createRowBlock(this.workspace);
2061
- parent
2062
- .getInput('INPUT')
2063
- .connection.setShadowState({'type': 'row_block', 'id': '1'});
2064
- assertInputHasBlock(parent, 'INPUT', true, '1');
2065
- parent
2066
- .getInput('INPUT')
2067
- .connection.setShadowState({'type': 'row_block', 'id': '2'});
2068
- assertInputHasBlock(parent, 'INPUT', true, '2');
2069
- assertSerialization(
2070
- parent,
2071
- {
2072
- 'type': 'row_block',
2073
- 'id': 'id0',
2074
- 'inputs': {
2075
- 'INPUT': {
2076
- 'shadow': {
2077
- 'type': 'row_block',
2078
- 'id': '2',
2079
- },
2080
- },
2081
- },
2082
- },
2083
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
2084
- 'type="row_block" id="id0">' +
2085
- '<value name="INPUT">' +
2086
- '<shadow type="row_block" id="2"></shadow>' +
2087
- '</value>' +
2088
- '</block>',
2089
- );
2090
- });
2091
-
2092
- test('Multiple Value', function () {
2093
- const parent = createRowBlock(this.workspace);
2094
- parent.getInput('INPUT').connection.setShadowState({
2095
- 'type': 'row_block',
2096
- 'id': '1',
2097
- 'inputs': {
2098
- 'INPUT': {
2099
- 'shadow': {
2100
- 'type': 'row_block',
2101
- 'id': 'a',
2102
- },
2103
- },
2104
- },
2105
- });
2106
- assertInputHasBlock(parent, 'INPUT', true, '1');
2107
- assertInputHasBlock(
2108
- parent.getInputTargetBlock('INPUT'),
2109
- 'INPUT',
2110
- true,
2111
- 'a',
2112
- );
2113
- parent.getInput('INPUT').connection.setShadowState({
2114
- 'type': 'row_block',
2115
- 'id': '2',
2116
- 'inputs': {
2117
- 'INPUT': {
2118
- 'shadow': {
2119
- 'type': 'row_block',
2120
- 'id': 'b',
2121
- },
2122
- },
2123
- },
2124
- });
2125
- assertInputHasBlock(parent, 'INPUT', true, '2');
2126
- assertInputHasBlock(
2127
- parent.getInputTargetBlock('INPUT'),
2128
- 'INPUT',
2129
- true,
2130
- 'b',
2131
- );
2132
- assertSerialization(
2133
- parent,
2134
- {
2135
- 'type': 'row_block',
2136
- 'id': 'id0',
2137
- 'inputs': {
2138
- 'INPUT': {
2139
- 'shadow': {
2140
- 'type': 'row_block',
2141
- 'id': '2',
2142
- 'inputs': {
2143
- 'INPUT': {
2144
- 'shadow': {
2145
- 'type': 'row_block',
2146
- 'id': 'b',
2147
- },
2148
- },
2149
- },
2150
- },
2151
- },
2152
- },
2153
- },
2154
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
2155
- 'type="row_block" id="id0">' +
2156
- '<value name="INPUT">' +
2157
- '<shadow type="row_block" id="2">' +
2158
- '<value name="INPUT">' +
2159
- '<shadow type="row_block" id="b"></shadow>' +
2160
- '</value>' +
2161
- '</shadow>' +
2162
- '</value>' +
2163
- '</block>',
2164
- );
2165
- });
2166
-
2167
- test('Statement', function () {
2168
- const parent = createStatementBlock(this.workspace);
2169
- parent.getInput('NAME').connection.setShadowState({
2170
- 'type': 'statement_block',
2171
- 'id': '1',
2172
- });
2173
- assertInputHasBlock(parent, 'NAME', true, '1');
2174
- parent.getInput('NAME').connection.setShadowState({
2175
- 'type': 'statement_block',
2176
- 'id': '2',
2177
- });
2178
- assertInputHasBlock(parent, 'NAME', true, '2');
2179
- assertSerialization(
2180
- parent,
2181
- {
2182
- 'type': 'statement_block',
2183
- 'id': 'id0',
2184
- 'inputs': {
2185
- 'NAME': {
2186
- 'shadow': {
2187
- 'type': 'statement_block',
2188
- 'id': '2',
2189
- },
2190
- },
2191
- },
2192
- },
2193
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
2194
- 'type="statement_block" id="id0">' +
2195
- '<statement name="NAME">' +
2196
- '<shadow type="statement_block" id="2"></shadow>' +
2197
- '</statement>' +
2198
- '</block>',
2199
- );
2200
- });
2201
-
2202
- test('Multiple Statement', function () {
2203
- const parent = createStatementBlock(this.workspace);
2204
- parent.getInput('NAME').connection.setShadowState({
2205
- 'type': 'statement_block',
2206
- 'id': '1',
2207
- 'inputs': {
2208
- 'NAME': {
2209
- 'shadow': {
2210
- 'type': 'statement_block',
2211
- 'id': 'a',
2212
- },
2213
- },
2214
- },
2215
- });
2216
- assertInputHasBlock(parent, 'NAME', true, '1');
2217
- assertInputHasBlock(
2218
- parent.getInputTargetBlock('NAME'),
2219
- 'NAME',
2220
- true,
2221
- 'a',
2222
- );
2223
- parent.getInput('NAME').connection.setShadowState({
2224
- 'type': 'statement_block',
2225
- 'id': '2',
2226
- 'inputs': {
2227
- 'NAME': {
2228
- 'shadow': {
2229
- 'type': 'statement_block',
2230
- 'id': 'b',
2231
- },
2232
- },
2233
- },
2234
- });
2235
- assertInputHasBlock(parent, 'NAME', true, '2');
2236
- assertInputHasBlock(
2237
- parent.getInputTargetBlock('NAME'),
2238
- 'NAME',
2239
- true,
2240
- 'b',
2241
- );
2242
- assertSerialization(
2243
- parent,
2244
- {
2245
- 'type': 'statement_block',
2246
- 'id': 'id0',
2247
- 'inputs': {
2248
- 'NAME': {
2249
- 'shadow': {
2250
- 'type': 'statement_block',
2251
- 'id': '2',
2252
- 'inputs': {
2253
- 'NAME': {
2254
- 'shadow': {
2255
- 'type': 'statement_block',
2256
- 'id': 'b',
2257
- },
2258
- },
2259
- },
2260
- },
2261
- },
2262
- },
2263
- },
2264
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
2265
- 'type="statement_block" id="id0">' +
2266
- '<statement name="NAME">' +
2267
- '<shadow type="statement_block" id="2">' +
2268
- '<statement name="NAME">' +
2269
- '<shadow type="statement_block" id="b"></shadow>' +
2270
- '</statement>' +
2271
- '</shadow>' +
2272
- '</statement>' +
2273
- '</block>',
2274
- );
2275
- });
2276
-
2277
- test('Next', function () {
2278
- const parent = createStackBlock(this.workspace);
2279
- parent.nextConnection.setShadowState({
2280
- 'type': 'stack_block',
2281
- 'id': '1',
2282
- });
2283
- assertNextHasBlock(parent, true, '1');
2284
- parent.nextConnection.setShadowState({
2285
- 'type': 'stack_block',
2286
- 'id': '2',
2287
- });
2288
- assertNextHasBlock(parent, true, '2');
2289
- assertSerialization(
2290
- parent,
2291
- {
2292
- 'type': 'stack_block',
2293
- 'id': 'id0',
2294
- 'next': {
2295
- 'shadow': {
2296
- 'type': 'stack_block',
2297
- 'id': '2',
2298
- },
2299
- },
2300
- },
2301
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
2302
- 'type="stack_block" id="id0">' +
2303
- '<next>' +
2304
- '<shadow type="stack_block" id="2"></shadow>' +
2305
- '</next>' +
2306
- '</block>',
2307
- );
2308
- });
2309
-
2310
- test('Multiple Next', function () {
2311
- const parent = createStackBlock(this.workspace);
2312
- parent.nextConnection.setShadowState({
2313
- 'type': 'stack_block',
2314
- 'id': '1',
2315
- 'next': {
2316
- 'shadow': {
2317
- 'type': 'stack_block',
2318
- 'id': 'a',
2319
- },
2320
- },
2321
- });
2322
- assertNextHasBlock(parent, true, '1');
2323
- assertNextHasBlock(parent.getNextBlock(), true, 'a');
2324
- parent.nextConnection.setShadowState({
2325
- 'type': 'stack_block',
2326
- 'id': '2',
2327
- 'next': {
2328
- 'shadow': {
2329
- 'type': 'stack_block',
2330
- 'id': 'b',
2331
- },
2332
- },
2333
- });
2334
- assertNextHasBlock(parent, true, '2');
2335
- assertNextHasBlock(parent.getNextBlock(), true, 'b');
2336
- assertSerialization(
2337
- parent,
2338
- {
2339
- 'type': 'stack_block',
2340
- 'id': 'id0',
2341
- 'next': {
2342
- 'shadow': {
2343
- 'type': 'stack_block',
2344
- 'id': '2',
2345
- 'next': {
2346
- 'shadow': {
2347
- 'type': 'stack_block',
2348
- 'id': 'b',
2349
- },
2350
- },
2351
- },
2352
- },
2353
- },
2354
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
2355
- 'type="stack_block" id="id0">' +
2356
- '<next>' +
2357
- '<shadow type="stack_block" id="2">' +
2358
- '<next>' +
2359
- '<shadow type="stack_block" id="b"></shadow>' +
2360
- '</next>' +
2361
- '</shadow>' +
2362
- '</next>' +
2363
- '</block>',
2364
- );
2365
- });
2366
- });
2367
-
2368
- suite('Remove - No Block Connected', function () {
2369
- // These are defined separately in each suite.
2370
- function createRowBlocks(workspace) {
2371
- return Blockly.serialization.blocks.append(
2372
- {
2373
- 'type': 'row_block',
2374
- 'id': 'id0',
2375
- 'inputs': {
2376
- 'INPUT': {
2377
- 'shadow': {
2378
- 'type': 'row_block',
2379
- 'id': 'id1',
2380
- },
2381
- },
2382
- },
2383
- },
2384
- workspace,
2385
- );
2386
- }
2387
-
2388
- function createStatementBlocks(workspace) {
2389
- return Blockly.serialization.blocks.append(
2390
- {
2391
- 'type': 'statement_block',
2392
- 'id': 'id0',
2393
- 'inputs': {
2394
- 'NAME': {
2395
- 'shadow': {
2396
- 'type': 'statement_block',
2397
- 'id': 'id1',
2398
- },
2399
- },
2400
- },
2401
- },
2402
- workspace,
2403
- );
2404
- }
2405
-
2406
- function createStackBlocks(workspace) {
2407
- return Blockly.serialization.blocks.append(
2408
- {
2409
- 'type': 'stack_block',
2410
- 'id': 'id0',
2411
- 'next': {
2412
- 'shadow': {
2413
- 'type': 'stack_block',
2414
- 'id': 'id1',
2415
- },
2416
- },
2417
- },
2418
- workspace,
2419
- );
2420
- }
2421
-
2422
- test('Value', function () {
2423
- const parent = createRowBlocks(this.workspace);
2424
- parent.getInput('INPUT').connection.setShadowState(null);
2425
- assertInputNotHasBlock(parent, 'INPUT');
2426
- assertSerialization(
2427
- parent,
2428
- {
2429
- 'type': 'row_block',
2430
- 'id': 'id0',
2431
- },
2432
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
2433
- 'type="row_block" id="id0">' +
2434
- '</block>',
2435
- );
2436
- });
2437
-
2438
- test('Statement', function () {
2439
- const parent = createStatementBlocks(this.workspace);
2440
- parent.getInput('NAME').connection.setShadowState(null);
2441
- assertInputNotHasBlock(parent, 'NAME');
2442
- assertSerialization(
2443
- parent,
2444
- {
2445
- 'type': 'statement_block',
2446
- 'id': 'id0',
2447
- },
2448
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
2449
- 'type="statement_block" id="id0">' +
2450
- '</block>',
2451
- );
2452
- });
2453
-
2454
- test('Next', function () {
2455
- const parent = createStackBlocks(this.workspace);
2456
- parent.nextConnection.setShadowState(null);
2457
- assertNextNotHasBlock(parent);
2458
- assertSerialization(
2459
- parent,
2460
- {
2461
- 'type': 'stack_block',
2462
- 'id': 'id0',
2463
- },
2464
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
2465
- 'type="stack_block" id="id0">' +
2466
- '</block>',
2467
- );
2468
- });
2469
- });
2470
-
2471
- suite('Remove - Block Connected', function () {
2472
- // These are defined separately in each suite.
2473
- function createRowBlocks(workspace) {
2474
- return Blockly.serialization.blocks.append(
2475
- {
2476
- 'type': 'row_block',
2477
- 'id': 'id0',
2478
- 'inputs': {
2479
- 'INPUT': {
2480
- 'shadow': {
2481
- 'type': 'row_block',
2482
- 'id': 'id1',
2483
- },
2484
- 'block': {
2485
- 'type': 'row_block',
2486
- 'id': 'id2',
2487
- },
2488
- },
2489
- },
2490
- },
2491
- workspace,
2492
- );
2493
- }
2494
-
2495
- function createStatementBlocks(workspace) {
2496
- return Blockly.serialization.blocks.append(
2497
- {
2498
- 'type': 'statement_block',
2499
- 'id': 'id0',
2500
- 'inputs': {
2501
- 'NAME': {
2502
- 'shadow': {
2503
- 'type': 'statement_block',
2504
- 'id': 'id1',
2505
- },
2506
- 'block': {
2507
- 'type': 'statement_block',
2508
- 'id': 'id2',
2509
- },
2510
- },
2511
- },
2512
- },
2513
- workspace,
2514
- );
2515
- }
2516
-
2517
- function createStackBlocks(workspace) {
2518
- return Blockly.serialization.blocks.append(
2519
- {
2520
- 'type': 'stack_block',
2521
- 'id': 'id0',
2522
- 'next': {
2523
- 'shadow': {
2524
- 'type': 'stack_block',
2525
- 'id': 'id1',
2526
- },
2527
- 'block': {
2528
- 'type': 'stack_block',
2529
- 'id': 'id2',
2530
- },
2531
- },
2532
- },
2533
- workspace,
2534
- );
2535
- }
2536
-
2537
- test('Value', function () {
2538
- const parent = createRowBlocks(this.workspace);
2539
- parent.getInput('INPUT').connection.setShadowState(null);
2540
- assertInputHasBlock(parent, 'INPUT', false);
2541
- parent.getInput('INPUT').connection.disconnect();
2542
- assertInputNotHasBlock(parent, 'INPUT');
2543
- assertSerialization(
2544
- parent,
2545
- {
2546
- 'type': 'row_block',
2547
- 'id': 'id0',
2548
- },
2549
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
2550
- 'type="row_block" id="id0">' +
2551
- '</block>',
2552
- );
2553
- });
2554
-
2555
- test('Statement', function () {
2556
- const parent = createStatementBlocks(this.workspace);
2557
- parent.getInput('NAME').connection.setShadowState(null);
2558
- assertInputHasBlock(parent, 'NAME', false);
2559
- parent.getInput('NAME').connection.disconnect();
2560
- assertInputNotHasBlock(parent, 'NAME');
2561
- assertSerialization(
2562
- parent,
2563
- {
2564
- 'type': 'statement_block',
2565
- 'id': 'id0',
2566
- },
2567
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
2568
- 'type="statement_block" id="id0">' +
2569
- '</block>',
2570
- );
2571
- });
2572
-
2573
- test('Next', function () {
2574
- const parent = createStackBlocks(this.workspace);
2575
- parent.nextConnection.setShadowState(null);
2576
- assertNextHasBlock(parent, false);
2577
- parent.nextConnection.disconnect();
2578
- assertNextNotHasBlock(parent);
2579
- assertSerialization(
2580
- parent,
2581
- {
2582
- 'type': 'stack_block',
2583
- 'id': 'id0',
2584
- },
2585
- '<block xmlns="https://developers.google.com/blockly/xml" ' +
2586
- 'type="stack_block" id="id0">' +
2587
- '</block>',
2588
- );
2589
- });
2590
- });
2591
-
2592
- suite('Add - Connect & Disconnect - Remove', function () {
2593
- // These are defined separately in each suite.
2594
- function createRowBlock(workspace) {
2595
- return Blockly.serialization.blocks.append(
2596
- {'type': 'row_block'},
2597
- workspace,
2598
- );
2599
- }
2600
-
2601
- function createStatementBlock(workspace) {
2602
- return Blockly.serialization.blocks.append(
2603
- {'type': 'statement_block'},
2604
- workspace,
2605
- );
2606
- }
2607
-
2608
- function createStackBlock(workspace) {
2609
- return Blockly.serialization.blocks.append(
2610
- {'type': 'stack_block'},
2611
- workspace,
2612
- );
2613
- }
2614
-
2615
- test('Value', function () {
2616
- const parent = createRowBlock(this.workspace);
2617
- parent
2618
- .getInput('INPUT')
2619
- .connection.setShadowState({'type': 'row_block'});
2620
- assertInputHasBlock(parent, 'INPUT', true);
2621
- const child = createRowBlock(this.workspace);
2622
- parent
2623
- .getInput('INPUT')
2624
- .connection.connect(child.outputConnection);
2625
- assertInputHasBlock(parent, 'INPUT', false);
2626
- parent.getInput('INPUT').connection.disconnect();
2627
- assertInputHasBlock(parent, 'INPUT', true);
2628
- parent.getInput('INPUT').connection.setShadowState(null);
2629
- assertInputNotHasBlock(parent, 'INPUT');
2630
- });
2631
-
2632
- test('Multiple Value', function () {
2633
- const parent = createRowBlock(this.workspace);
2634
- parent.getInput('INPUT').connection.setShadowState({
2635
- 'type': 'row_block',
2636
- 'inputs': {
2637
- 'INPUT': {
2638
- 'shadow': {
2639
- 'type': 'row_block',
2640
- },
2641
- },
2642
- },
2643
- });
2644
- assertInputHasBlock(parent, 'INPUT', true);
2645
- assertInputHasBlock(
2646
- parent.getInputTargetBlock('INPUT'),
2647
- 'INPUT',
2648
- true,
2649
- );
2650
- const child = createRowBlock(this.workspace);
2651
- parent
2652
- .getInput('INPUT')
2653
- .connection.connect(child.outputConnection);
2654
- assertInputHasBlock(parent, 'INPUT', false);
2655
- parent.getInput('INPUT').connection.disconnect();
2656
- assertInputHasBlock(parent, 'INPUT', true);
2657
- assertInputHasBlock(
2658
- parent.getInputTargetBlock('INPUT'),
2659
- 'INPUT',
2660
- true,
2661
- );
2662
- parent.getInput('INPUT').connection.setShadowState(null);
2663
- assertInputNotHasBlock(parent, 'INPUT');
2664
- });
2665
-
2666
- test('Statement', function () {
2667
- const parent = createStatementBlock(this.workspace);
2668
- parent
2669
- .getInput('NAME')
2670
- .connection.setShadowState({'type': 'statement_block'});
2671
- assertInputHasBlock(parent, 'NAME', true);
2672
- const child = createStatementBlock(this.workspace);
2673
- parent
2674
- .getInput('NAME')
2675
- .connection.connect(child.previousConnection);
2676
- assertInputHasBlock(parent, 'NAME', false);
2677
- parent.getInput('NAME').connection.disconnect();
2678
- assertInputHasBlock(parent, 'NAME', true);
2679
- parent.getInput('NAME').connection.setShadowState(null);
2680
- assertInputNotHasBlock(parent, 'NAME');
2681
- });
2682
-
2683
- test('Multiple Statement', function () {
2684
- const parent = createStatementBlock(this.workspace);
2685
- parent.getInput('NAME').connection.setShadowState({
2686
- 'type': 'statement_block',
2687
- 'inputs': {
2688
- 'NAME': {
2689
- 'shadow': {
2690
- 'type': 'statement_block',
2691
- },
2692
- },
2693
- },
2694
- });
2695
- assertInputHasBlock(parent, 'NAME', true);
2696
- assertInputHasBlock(
2697
- parent.getInputTargetBlock('NAME'),
2698
- 'NAME',
2699
- true,
2700
- );
2701
- const child = createStatementBlock(this.workspace);
2702
- parent
2703
- .getInput('NAME')
2704
- .connection.connect(child.previousConnection);
2705
- assertInputHasBlock(parent, 'NAME', false);
2706
- parent.getInput('NAME').connection.disconnect();
2707
- assertInputHasBlock(parent, 'NAME', true);
2708
- assertInputHasBlock(
2709
- parent.getInputTargetBlock('NAME'),
2710
- 'NAME',
2711
- true,
2712
- );
2713
- parent.getInput('NAME').connection.setShadowState(null);
2714
- assertInputNotHasBlock(parent, 'NAME');
2715
- });
2716
-
2717
- test('Next', function () {
2718
- const parent = createStackBlock(this.workspace);
2719
- parent.nextConnection.setShadowState({'type': 'stack_block'});
2720
- const child = createStatementBlock(this.workspace);
2721
- parent.nextConnection.connect(child.previousConnection);
2722
- assertNextHasBlock(parent, false);
2723
- parent.nextConnection.disconnect();
2724
- assertNextHasBlock(parent, true);
2725
- parent.nextConnection.setShadowState(null);
2726
- assertNextNotHasBlock(parent);
2727
- });
2728
-
2729
- test('Multiple Next', function () {
2730
- const parent = createStackBlock(this.workspace);
2731
- parent.nextConnection.setShadowState({
2732
- 'type': 'stack_block',
2733
- 'next': {
2734
- 'shadow': {
2735
- 'type': 'stack_block',
2736
- },
2737
- },
2738
- });
2739
- assertNextHasBlock(parent, true);
2740
- assertNextHasBlock(parent.getNextBlock(), true);
2741
- const child = createStatementBlock(this.workspace);
2742
- parent.nextConnection.connect(child.previousConnection);
2743
- assertNextHasBlock(parent, false);
2744
- parent.nextConnection.disconnect();
2745
- assertNextHasBlock(parent, true);
2746
- assertNextHasBlock(parent.getNextBlock(), true);
2747
- parent.nextConnection.setShadowState(null);
2748
- assertNextNotHasBlock(parent);
2749
- });
2750
- });
2751
-
2752
- suite('Invalid', function () {
2753
- test('Attach to output', function () {
2754
- const block = this.workspace.newBlock('row_block');
2755
- assert.throws(() =>
2756
- block.outputConnection.setShadowState({'type': 'row_block'}),
2757
- );
2758
- });
2759
-
2760
- test('Attach to previous', function () {
2761
- const block = this.workspace.newBlock('stack_block');
2762
- assert.throws(() =>
2763
- block.previousConnection.setShadowState({
2764
- 'type': 'stack_block',
2765
- }),
2766
- );
2767
- });
2768
-
2769
- test('Missing output', function () {
2770
- const block = this.workspace.newBlock('row_block');
2771
- assert.throws(() =>
2772
- block.outputConnection.setShadowState({'type': 'stack_block'}),
2773
- );
2774
- });
2775
-
2776
- test('Missing previous', function () {
2777
- const block = this.workspace.newBlock('stack_block');
2778
- assert.throws(() =>
2779
- block.previousConnection.setShadowState({'type': 'row_block'}),
2780
- );
2781
- });
2782
-
2783
- test('Invalid connection checks, output', function () {
2784
- const block = this.workspace.newBlock('logic_operation');
2785
- assert.throws(() =>
2786
- block
2787
- .getInput('A')
2788
- .connection.setShadowState({'type': 'math_number'}),
2789
- );
2790
- });
2791
-
2792
- test('Invalid connection checks, previous', function () {
2793
- Blockly.defineBlocksWithJsonArray([
2794
- {
2795
- 'type': 'stack_checks_block',
2796
- 'message0': '',
2797
- 'previousStatement': 'check 1',
2798
- 'nextStatement': 'check 2',
2799
- },
2800
- ]);
2801
- const block = this.workspace.newBlock('stack_checks_block');
2802
- assert.throws(() =>
2803
- block.nextConnection.setShadowState({
2804
- 'type': 'stack_checks_block',
2805
- }),
2806
- );
2807
- });
2808
- });
2809
- });
2810
- });
2811
- });
2812
- });
2813
-
2814
- suite('Connect', function () {
2815
- setup(function () {
2816
- this.workspace = new Blockly.Workspace();
2817
- Blockly.defineBlocksWithJsonArray([
2818
- {
2819
- 'type': 'stack_block',
2820
- 'message0': '%1',
2821
- 'args0': [
2822
- {
2823
- 'type': 'field_input',
2824
- 'name': 'FIELD',
2825
- 'text': 'default',
2826
- },
2827
- ],
2828
- 'previousStatement': 'check1',
2829
- 'nextStatement': 'check1',
2830
- },
2831
- {
2832
- 'type': 'stack_block_1to2',
2833
- 'message0': '',
2834
- 'previousStatement': 'check1',
2835
- 'nextStatement': 'check2',
2836
- },
2837
- {
2838
- 'type': 'stack_block_2to1',
2839
- 'message0': '',
2840
- 'previousStatement': 'check2',
2841
- 'nextStatement': 'check1',
2842
- },
2843
- {
2844
- 'type': 'stack_block_noend',
2845
- 'message0': '',
2846
- 'previousStatement': 'check1',
2847
- },
2848
- {
2849
- 'type': 'row_block',
2850
- 'message0': '%1 %2',
2851
- 'args0': [
2852
- {
2853
- 'type': 'field_input',
2854
- 'name': 'FIELD',
2855
- 'text': 'default',
2856
- },
2857
- {
2858
- 'type': 'input_value',
2859
- 'name': 'INPUT',
2860
- 'check': 'check1',
2861
- },
2862
- ],
2863
- 'output': 'check1',
2864
- },
2865
- {
2866
- 'type': 'row_block_1to2',
2867
- 'message0': '%1',
2868
- 'args0': [
2869
- {
2870
- 'type': 'input_value',
2871
- 'name': 'INPUT',
2872
- 'check': 'check1',
2873
- },
2874
- ],
2875
- 'output': 'check2',
2876
- },
2877
- {
2878
- 'type': 'row_block_2to1',
2879
- 'message0': '%1',
2880
- 'args0': [
2881
- {
2882
- 'type': 'input_value',
2883
- 'name': 'INPUT',
2884
- 'check': 'check2',
2885
- },
2886
- ],
2887
- 'output': 'check1',
2888
- },
2889
- {
2890
- 'type': 'row_block_noend',
2891
- 'message0': '',
2892
- 'output': 'check1',
2893
- },
2894
- {
2895
- 'type': 'row_block_multiple_inputs',
2896
- 'message0': '%1 %2',
2897
- 'args0': [
2898
- {
2899
- 'type': 'input_value',
2900
- 'name': 'INPUT',
2901
- 'check': 'check1',
2902
- },
2903
- {
2904
- 'type': 'input_value',
2905
- 'name': 'INPUT2',
2906
- 'check': 'check1',
2907
- },
2908
- ],
2909
- 'output': 'check1',
2910
- },
2911
- {
2912
- 'type': 'output_to_statements',
2913
- 'message0': '%1 %2',
2914
- 'args0': [
2915
- {
2916
- 'type': 'input_statement',
2917
- 'name': 'INPUT',
2918
- 'check': 'check1',
2919
- },
2920
- {
2921
- 'type': 'input_statement',
2922
- 'name': 'INPUT2',
2923
- 'check': 'check1',
2924
- },
2925
- ],
2926
- 'output': 'check1',
2927
- },
2928
- {
2929
- 'type': 'statement_block',
2930
- 'message0': '%1 %2',
2931
- 'args0': [
2932
- {
2933
- 'type': 'field_input',
2934
- 'name': 'FIELD',
2935
- 'text': 'default',
2936
- },
2937
- {
2938
- 'type': 'input_statement',
2939
- 'name': 'NAME',
2940
- 'check': 'check1',
2941
- },
2942
- ],
2943
- 'previousStatement': 'check1',
2944
- 'nextStatement': 'check1',
2945
- },
2946
- {
2947
- 'type': 'statement_block_1to2',
2948
- 'message0': '%1',
2949
- 'args0': [
2950
- {
2951
- 'type': 'input_statement',
2952
- 'name': 'NAME',
2953
- 'check': 'check1',
2954
- },
2955
- ],
2956
- 'previousStatement': 'check1',
2957
- 'nextStatement': 'check2',
2958
- },
2959
- {
2960
- 'type': 'statement_block_2to1',
2961
- 'message0': '%1',
2962
- 'args0': [
2963
- {
2964
- 'type': 'input_statement',
2965
- 'name': 'NAME',
2966
- 'check': 'check2',
2967
- },
2968
- ],
2969
- 'previousStatement': 'check2',
2970
- 'nextStatement': 'check1',
2971
- },
2972
- {
2973
- 'type': 'statement_block_noend',
2974
- 'message0': '%1',
2975
- 'args0': [
2976
- {
2977
- 'type': 'input_statement',
2978
- 'name': 'NAME',
2979
- 'check': 'check1',
2980
- },
2981
- ],
2982
- 'previousStatement': 'check1',
2983
- },
2984
- ]);
2985
-
2986
- // Used to make sure we don't get stray shadow blocks or anything.
2987
- this.assertBlockCount = function (count) {
2988
- assert.equal(this.workspace.getAllBlocks().length, count);
2989
- };
2990
- });
2991
-
2992
- suite('Disconnect from old parent', function () {
2993
- test('Value', function () {
2994
- const oldParent = this.workspace.newBlock('row_block');
2995
- const newParent = this.workspace.newBlock('row_block');
2996
- const child = this.workspace.newBlock('row_block');
2997
-
2998
- oldParent.getInput('INPUT').connection.connect(child.outputConnection);
2999
- newParent.getInput('INPUT').connection.connect(child.outputConnection);
3000
-
3001
- assert.isFalse(oldParent.getInput('INPUT').connection.isConnected());
3002
- this.assertBlockCount(3);
3003
- });
3004
-
3005
- test('Statement', function () {
3006
- const oldParent = this.workspace.newBlock('statement_block');
3007
- const newParent = this.workspace.newBlock('statement_block');
3008
- const child = this.workspace.newBlock('stack_block');
3009
-
3010
- oldParent.getInput('NAME').connection.connect(child.previousConnection);
3011
- newParent.getInput('NAME').connection.connect(child.previousConnection);
3012
-
3013
- assert.isFalse(oldParent.getInput('NAME').connection.isConnected());
3014
- this.assertBlockCount(3);
3015
- });
3016
-
3017
- test('Next', function () {
3018
- const oldParent = this.workspace.newBlock('stack_block');
3019
- const newParent = this.workspace.newBlock('stack_block');
3020
- const child = this.workspace.newBlock('stack_block');
3021
-
3022
- oldParent.nextConnection.connect(child.previousConnection);
3023
- newParent.nextConnection.connect(child.previousConnection);
3024
-
3025
- assert.isFalse(oldParent.nextConnection.isConnected());
3026
- this.assertBlockCount(3);
3027
- });
3028
- });
3029
-
3030
- suite('Shadow dissolves', function () {
3031
- test('Value', function () {
3032
- const newParent = this.workspace.newBlock('row_block');
3033
- const child = this.workspace.newBlock('row_block');
3034
- const xml = Blockly.utils.xml.textToDom('<shadow type="row_block"/>');
3035
- newParent.getInput('INPUT').connection.setShadowDom(xml);
3036
- assert.isTrue(newParent.getInputTargetBlock('INPUT').isShadow());
3037
-
3038
- newParent.getInput('INPUT').connection.connect(child.outputConnection);
3039
-
3040
- assert.isFalse(newParent.getInputTargetBlock('INPUT').isShadow());
3041
- this.assertBlockCount(2);
3042
- });
3043
-
3044
- test('Statement', function () {
3045
- const newParent = this.workspace.newBlock('statement_block');
3046
- const child = this.workspace.newBlock('stack_block');
3047
- const xml = Blockly.utils.xml.textToDom('<shadow type="stack_block"/>');
3048
- newParent.getInput('NAME').connection.setShadowDom(xml);
3049
- assert.isTrue(newParent.getInputTargetBlock('NAME').isShadow());
3050
-
3051
- newParent.getInput('NAME').connection.connect(child.previousConnection);
3052
-
3053
- assert.isFalse(newParent.getInputTargetBlock('NAME').isShadow());
3054
- this.assertBlockCount(2);
3055
- });
3056
-
3057
- test('Next', function () {
3058
- const newParent = this.workspace.newBlock('stack_block');
3059
- const child = this.workspace.newBlock('stack_block');
3060
- const xml = Blockly.utils.xml.textToDom('<shadow type="stack_block"/>');
3061
- newParent.nextConnection.setShadowDom(xml);
3062
- assert.isTrue(newParent.getNextBlock().isShadow());
3063
-
3064
- newParent.nextConnection.connect(child.previousConnection);
3065
-
3066
- assert.isFalse(newParent.getNextBlock().isShadow());
3067
- this.assertBlockCount(2);
3068
- });
3069
- });
3070
-
3071
- suite('Saving shadow values', function () {
3072
- test('Value', function () {
3073
- const newParent = this.workspace.newBlock('row_block');
3074
- const child = this.workspace.newBlock('row_block');
3075
- const xml = Blockly.utils.xml.textToDom('<shadow type="row_block"/>');
3076
- newParent.getInput('INPUT').connection.setShadowDom(xml);
3077
- newParent.getInputTargetBlock('INPUT').setFieldValue('new', 'FIELD');
3078
-
3079
- newParent.getInput('INPUT').connection.connect(child.outputConnection);
3080
- newParent.getInput('INPUT').connection.disconnect();
3081
-
3082
- const target = newParent.getInputTargetBlock('INPUT');
3083
- assert.isTrue(target.isShadow());
3084
- assert.equal(target.getFieldValue('FIELD'), 'new');
3085
- this.assertBlockCount(3);
3086
- });
3087
-
3088
- test('Statement', function () {
3089
- const newParent = this.workspace.newBlock('statement_block');
3090
- const child = this.workspace.newBlock('stack_block');
3091
- const xml = Blockly.utils.xml.textToDom('<shadow type="stack_block"/>');
3092
- newParent.getInput('NAME').connection.setShadowDom(xml);
3093
- newParent.getInputTargetBlock('NAME').setFieldValue('new', 'FIELD');
3094
-
3095
- newParent.getInput('NAME').connection.connect(child.previousConnection);
3096
- newParent.getInput('NAME').connection.disconnect();
3097
-
3098
- const target = newParent.getInputTargetBlock('NAME');
3099
- assert.isTrue(target.isShadow());
3100
- assert.equal(target.getFieldValue('FIELD'), 'new');
3101
- this.assertBlockCount(3);
3102
- });
3103
-
3104
- test('Next', function () {
3105
- const newParent = this.workspace.newBlock('stack_block');
3106
- const child = this.workspace.newBlock('stack_block');
3107
- const xml = Blockly.utils.xml.textToDom('<shadow type="stack_block"/>');
3108
- newParent.nextConnection.setShadowDom(xml);
3109
- newParent.getNextBlock().setFieldValue('new', 'FIELD');
3110
-
3111
- newParent.nextConnection.connect(child.previousConnection);
3112
- newParent.nextConnection.disconnect();
3113
-
3114
- const target = newParent.getNextBlock();
3115
- assert.isTrue(target.isShadow());
3116
- assert.equal(target.getFieldValue('FIELD'), 'new');
3117
- this.assertBlockCount(3);
3118
- });
3119
- });
3120
-
3121
- suite('Reattach or bump orphan', function () {
3122
- suite('Value', function () {
3123
- suite('No available spots', function () {
3124
- test('No connection', function () {
3125
- const parent = this.workspace.newBlock('row_block');
3126
- const oldChild = this.workspace.newBlock('row_block');
3127
- const newChild = this.workspace.newBlock('row_block_noend');
3128
- parent
3129
- .getInput('INPUT')
3130
- .connection.connect(oldChild.outputConnection);
3131
-
3132
- parent
3133
- .getInput('INPUT')
3134
- .connection.connect(newChild.outputConnection);
3135
-
3136
- assert.isTrue(parent.getInput('INPUT').connection.isConnected());
3137
- assert.equal(parent.getInputTargetBlock('INPUT'), newChild);
3138
- assert.isFalse(oldChild.outputConnection.isConnected());
3139
- });
3140
-
3141
- test('All statements', function () {
3142
- const parent = this.workspace.newBlock('row_block');
3143
- const oldChild = this.workspace.newBlock('row_block');
3144
- const newChild = this.workspace.newBlock('output_to_statements');
3145
- parent
3146
- .getInput('INPUT')
3147
- .connection.connect(oldChild.outputConnection);
3148
-
3149
- parent
3150
- .getInput('INPUT')
3151
- .connection.connect(newChild.outputConnection);
3152
-
3153
- assert.isTrue(parent.getInput('INPUT').connection.isConnected());
3154
- assert.equal(parent.getInputTargetBlock('INPUT'), newChild);
3155
- assert.isFalse(oldChild.outputConnection.isConnected());
3156
- });
3157
-
3158
- test('Bad checks', function () {
3159
- const parent = this.workspace.newBlock('row_block');
3160
- const oldChild = this.workspace.newBlock('row_block');
3161
- const newChild = this.workspace.newBlock('row_block_2to1');
3162
- parent
3163
- .getInput('INPUT')
3164
- .connection.connect(oldChild.outputConnection);
3165
-
3166
- parent
3167
- .getInput('INPUT')
3168
- .connection.connect(newChild.outputConnection);
3169
-
3170
- assert.isTrue(parent.getInput('INPUT').connection.isConnected());
3171
- assert.equal(parent.getInputTargetBlock('INPUT'), newChild);
3172
- assert.isFalse(oldChild.outputConnection.isConnected());
3173
- });
3174
-
3175
- test('Through different types', function () {
3176
- const parent = this.workspace.newBlock('row_block');
3177
- const oldChild = this.workspace.newBlock('row_block');
3178
- const newChild = this.workspace.newBlock('row_block_2to1');
3179
- const otherChild = this.workspace.newBlock('row_block_1to2');
3180
-
3181
- parent
3182
- .getInput('INPUT')
3183
- .connection.connect(oldChild.outputConnection);
3184
- newChild
3185
- .getInput('INPUT')
3186
- .connection.connect(otherChild.outputConnection);
3187
-
3188
- parent
3189
- .getInput('INPUT')
3190
- .connection.connect(newChild.outputConnection);
3191
-
3192
- assert.isTrue(parent.getInput('INPUT').connection.isConnected());
3193
- assert.equal(parent.getInputTargetBlock('INPUT'), newChild);
3194
- assert.isFalse(oldChild.outputConnection.isConnected());
3195
- });
3196
- });
3197
-
3198
- suite('Multiple available spots', function () {
3199
- suite('No shadows', function () {
3200
- test('Top block', function () {
3201
- const parent = this.workspace.newBlock('row_block');
3202
- const oldChild = this.workspace.newBlock('row_block');
3203
- const newChild = this.workspace.newBlock(
3204
- 'row_block_multiple_inputs',
3205
- );
3206
-
3207
- parent
3208
- .getInput('INPUT')
3209
- .connection.connect(oldChild.outputConnection);
3210
-
3211
- parent
3212
- .getInput('INPUT')
3213
- .connection.connect(newChild.outputConnection);
3214
-
3215
- assert.isTrue(parent.getInput('INPUT').connection.isConnected());
3216
- assert.equal(parent.getInputTargetBlock('INPUT'), newChild);
3217
- assert.isFalse(oldChild.outputConnection.isConnected());
3218
- });
3219
-
3220
- test('Child blocks', function () {
3221
- const parent = this.workspace.newBlock('row_block');
3222
- const oldChild = this.workspace.newBlock('row_block');
3223
- const newChild = this.workspace.newBlock(
3224
- 'row_block_multiple_inputs',
3225
- );
3226
- const childX = this.workspace.newBlock('row_block');
3227
- const childY = this.workspace.newBlock('row_block');
3228
-
3229
- parent
3230
- .getInput('INPUT')
3231
- .connection.connect(oldChild.outputConnection);
3232
- newChild
3233
- .getInput('INPUT')
3234
- .connection.connect(childX.outputConnection);
3235
- newChild
3236
- .getInput('INPUT2')
3237
- .connection.connect(childY.outputConnection);
3238
-
3239
- parent
3240
- .getInput('INPUT')
3241
- .connection.connect(newChild.outputConnection);
3242
-
3243
- assert.isTrue(parent.getInput('INPUT').connection.isConnected());
3244
- assert.equal(parent.getInputTargetBlock('INPUT'), newChild);
3245
- assert.isFalse(oldChild.outputConnection.isConnected());
3246
- });
3247
-
3248
- test('Spots filled', function () {
3249
- const parent = this.workspace.newBlock('row_block');
3250
- const oldChild = this.workspace.newBlock('row_block');
3251
- const newChild = this.workspace.newBlock(
3252
- 'row_block_multiple_inputs',
3253
- );
3254
- const otherChild = this.workspace.newBlock('row_block_noend');
3255
-
3256
- parent
3257
- .getInput('INPUT')
3258
- .connection.connect(oldChild.outputConnection);
3259
- newChild
3260
- .getInput('INPUT')
3261
- .connection.connect(otherChild.outputConnection);
3262
-
3263
- parent
3264
- .getInput('INPUT')
3265
- .connection.connect(newChild.outputConnection);
3266
-
3267
- assert.isTrue(parent.getInput('INPUT').connection.isConnected());
3268
- assert.equal(parent.getInputTargetBlock('INPUT'), newChild);
3269
- assert.isFalse(oldChild.outputConnection.isConnected());
3270
- });
3271
- });
3272
-
3273
- suite('Shadows', function () {
3274
- test('Top block', function () {
3275
- const parent = this.workspace.newBlock('row_block');
3276
- const oldChild = this.workspace.newBlock('row_block');
3277
- const newChild = this.workspace.newBlock(
3278
- 'row_block_multiple_inputs',
3279
- );
3280
-
3281
- parent
3282
- .getInput('INPUT')
3283
- .connection.connect(oldChild.outputConnection);
3284
- newChild
3285
- .getInput('INPUT')
3286
- .connection.setShadowDom(
3287
- Blockly.utils.xml.textToDom(
3288
- '<xml><shadow type="row_block"/></xml>',
3289
- ).firstChild,
3290
- );
3291
- newChild
3292
- .getInput('INPUT2')
3293
- .connection.setShadowDom(
3294
- Blockly.utils.xml.textToDom(
3295
- '<xml><shadow type="row_block"/></xml>',
3296
- ).firstChild,
3297
- );
3298
-
3299
- parent
3300
- .getInput('INPUT')
3301
- .connection.connect(newChild.outputConnection);
3302
-
3303
- assert.isTrue(parent.getInput('INPUT').connection.isConnected());
3304
- assert.equal(parent.getInputTargetBlock('INPUT'), newChild);
3305
- assert.isFalse(oldChild.outputConnection.isConnected());
3306
- });
3307
-
3308
- test('Child blocks', function () {
3309
- const parent = this.workspace.newBlock('row_block');
3310
- const oldChild = this.workspace.newBlock('row_block');
3311
- const newChild = this.workspace.newBlock(
3312
- 'row_block_multiple_inputs',
3313
- );
3314
- const childX = this.workspace.newBlock('row_block');
3315
- const childY = this.workspace.newBlock('row_block');
3316
-
3317
- parent
3318
- .getInput('INPUT')
3319
- .connection.connect(oldChild.outputConnection);
3320
- newChild
3321
- .getInput('INPUT')
3322
- .connection.connect(childX.outputConnection);
3323
- newChild
3324
- .getInput('INPUT2')
3325
- .connection.connect(childY.outputConnection);
3326
- childX
3327
- .getInput('INPUT')
3328
- .connection.setShadowDom(
3329
- Blockly.utils.xml.textToDom(
3330
- '<xml><shadow type="row_block"/></xml>',
3331
- ).firstChild,
3332
- );
3333
- childY
3334
- .getInput('INPUT')
3335
- .connection.setShadowDom(
3336
- Blockly.utils.xml.textToDom(
3337
- '<xml><shadow type="row_block"/></xml>',
3338
- ).firstChild,
3339
- );
3340
-
3341
- parent
3342
- .getInput('INPUT')
3343
- .connection.connect(newChild.outputConnection);
3344
-
3345
- assert.isTrue(parent.getInput('INPUT').connection.isConnected());
3346
- assert.equal(parent.getInputTargetBlock('INPUT'), newChild);
3347
- assert.isFalse(oldChild.outputConnection.isConnected());
3348
- });
3349
-
3350
- test('Spots filled', function () {
3351
- const parent = this.workspace.newBlock('row_block');
3352
- const oldChild = this.workspace.newBlock('row_block');
3353
- const newChild = this.workspace.newBlock(
3354
- 'row_block_multiple_inputs',
3355
- );
3356
- const otherChild = this.workspace.newBlock('row_block_noend');
3357
-
3358
- parent
3359
- .getInput('INPUT')
3360
- .connection.connect(oldChild.outputConnection);
3361
- newChild
3362
- .getInput('INPUT')
3363
- .connection.connect(otherChild.outputConnection);
3364
- newChild
3365
- .getInput('INPUT2')
3366
- .connection.setShadowDom(
3367
- Blockly.utils.xml.textToDom(
3368
- '<xml><shadow type="row_block"/></xml>',
3369
- ).firstChild,
3370
- );
3371
-
3372
- parent
3373
- .getInput('INPUT')
3374
- .connection.connect(newChild.outputConnection);
3375
-
3376
- assert.isTrue(parent.getInput('INPUT').connection.isConnected());
3377
- assert.equal(parent.getInputTargetBlock('INPUT'), newChild);
3378
- assert.isFalse(oldChild.outputConnection.isConnected());
3379
- });
3380
- });
3381
- });
3382
-
3383
- suite('Single available spot', function () {
3384
- test('No shadows', function () {
3385
- const parent = this.workspace.newBlock('row_block');
3386
- const oldChild = this.workspace.newBlock('row_block');
3387
- const newChild = this.workspace.newBlock('row_block');
3388
-
3389
- parent
3390
- .getInput('INPUT')
3391
- .connection.connect(oldChild.outputConnection);
3392
-
3393
- parent
3394
- .getInput('INPUT')
3395
- .connection.connect(newChild.outputConnection);
3396
-
3397
- assert.isTrue(parent.getInput('INPUT').connection.isConnected());
3398
- assert.equal(parent.getInputTargetBlock('INPUT'), newChild);
3399
- assert.isTrue(newChild.getInput('INPUT').connection.isConnected());
3400
- assert.equal(newChild.getInputTargetBlock('INPUT'), oldChild);
3401
- });
3402
-
3403
- test('Shadows', function () {
3404
- const parent = this.workspace.newBlock('row_block');
3405
- const oldChild = this.workspace.newBlock('row_block');
3406
- const newChild = this.workspace.newBlock('row_block');
3407
-
3408
- parent
3409
- .getInput('INPUT')
3410
- .connection.connect(oldChild.outputConnection);
3411
- newChild
3412
- .getInput('INPUT')
3413
- .connection.setShadowDom(
3414
- Blockly.utils.xml.textToDom(
3415
- '<xml><shadow type="row_block"/></xml>',
3416
- ).firstChild,
3417
- );
3418
-
3419
- parent
3420
- .getInput('INPUT')
3421
- .connection.connect(newChild.outputConnection);
3422
-
3423
- assert.isTrue(parent.getInput('INPUT').connection.isConnected());
3424
- assert.equal(parent.getInputTargetBlock('INPUT'), newChild);
3425
- assert.isTrue(newChild.getInput('INPUT').connection.isConnected());
3426
- assert.equal(newChild.getInputTargetBlock('INPUT'), oldChild);
3427
- });
3428
- });
3429
- });
3430
-
3431
- suite('Statement', function () {
3432
- suite('No shadows', function () {
3433
- test('Simple', function () {
3434
- const parent = this.workspace.newBlock('statement_block');
3435
- const oldChild = this.workspace.newBlock('stack_block');
3436
- const newChild = this.workspace.newBlock('stack_block');
3437
- parent
3438
- .getInput('NAME')
3439
- .connection.connect(oldChild.previousConnection);
3440
-
3441
- parent
3442
- .getInput('NAME')
3443
- .connection.connect(newChild.previousConnection);
3444
-
3445
- assert.isTrue(parent.getInput('NAME').connection.isConnected());
3446
- assert.equal(parent.getInputTargetBlock('NAME'), newChild);
3447
- assert.isTrue(newChild.nextConnection.isConnected());
3448
- assert.equal(newChild.getNextBlock(), oldChild);
3449
- this.assertBlockCount(3);
3450
- });
3451
-
3452
- test('Bad check in between', function () {
3453
- const parent = this.workspace.newBlock('statement_block');
3454
- const oldChild = this.workspace.newBlock('stack_block');
3455
- const newChild1 = this.workspace.newBlock('stack_block_1to2');
3456
- const newChild2 = this.workspace.newBlock('stack_block_2to1');
3457
- parent
3458
- .getInput('NAME')
3459
- .connection.connect(oldChild.previousConnection);
3460
- newChild1.nextConnection.connect(newChild2.previousConnection);
3461
-
3462
- parent
3463
- .getInput('NAME')
3464
- .connection.connect(newChild1.previousConnection);
3465
-
3466
- assert.isTrue(parent.getInput('NAME').connection.isConnected());
3467
- assert.equal(parent.getInputTargetBlock('NAME'), newChild1);
3468
- assert.isTrue(newChild2.nextConnection.isConnected());
3469
- assert.equal(newChild2.getNextBlock(), oldChild);
3470
- this.assertBlockCount(4);
3471
- });
3472
-
3473
- test('Bad check at end', function () {
3474
- const parent = this.workspace.newBlock('statement_block');
3475
- const oldChild = this.workspace.newBlock('stack_block');
3476
- const newChild = this.workspace.newBlock('stack_block_1to2');
3477
- parent
3478
- .getInput('NAME')
3479
- .connection.connect(oldChild.previousConnection);
3480
- const spy = sinon.spy(
3481
- oldChild.previousConnection,
3482
- 'onFailedConnect',
3483
- );
3484
-
3485
- parent
3486
- .getInput('NAME')
3487
- .connection.connect(newChild.previousConnection);
3488
-
3489
- assert.isTrue(parent.getInput('NAME').connection.isConnected());
3490
- assert.equal(parent.getInputTargetBlock('NAME'), newChild);
3491
- assert.isFalse(newChild.nextConnection.isConnected());
3492
- assert.isTrue(spy.calledOnce);
3493
- this.assertBlockCount(3);
3494
- });
3495
-
3496
- test('No end connection', function () {
3497
- const parent = this.workspace.newBlock('statement_block');
3498
- const oldChild = this.workspace.newBlock('stack_block');
3499
- const newChild = this.workspace.newBlock('stack_block_noend');
3500
- parent
3501
- .getInput('NAME')
3502
- .connection.connect(oldChild.previousConnection);
3503
- const spy = sinon.spy(
3504
- oldChild.previousConnection,
3505
- 'onFailedConnect',
3506
- );
3507
-
3508
- parent
3509
- .getInput('NAME')
3510
- .connection.connect(newChild.previousConnection);
3511
-
3512
- assert.isTrue(parent.getInput('NAME').connection.isConnected());
3513
- assert.equal(parent.getInputTargetBlock('NAME'), newChild);
3514
- assert.isTrue(spy.calledOnce);
3515
- this.assertBlockCount(3);
3516
- });
3517
- });
3518
-
3519
- suite('Shadows', function () {
3520
- test('Simple', function () {
3521
- const parent = this.workspace.newBlock('statement_block');
3522
- const oldChild = this.workspace.newBlock('stack_block');
3523
- const newChild = this.workspace.newBlock('stack_block');
3524
- parent
3525
- .getInput('NAME')
3526
- .connection.connect(oldChild.previousConnection);
3527
- const xml = Blockly.utils.xml.textToDom(
3528
- '<shadow type="stack_block"/>',
3529
- );
3530
- newChild.nextConnection.setShadowDom(xml);
3531
-
3532
- parent
3533
- .getInput('NAME')
3534
- .connection.connect(newChild.previousConnection);
3535
-
3536
- assert.isTrue(parent.getInput('NAME').connection.isConnected());
3537
- assert.equal(parent.getInputTargetBlock('NAME'), newChild);
3538
- assert.isTrue(newChild.nextConnection.isConnected());
3539
- assert.equal(newChild.getNextBlock(), oldChild);
3540
- this.assertBlockCount(3);
3541
- });
3542
-
3543
- test('Bad check in between', function () {
3544
- const parent = this.workspace.newBlock('statement_block');
3545
- const oldChild = this.workspace.newBlock('stack_block');
3546
- const newChild1 = this.workspace.newBlock('stack_block_1to2');
3547
- const newChild2 = this.workspace.newBlock('stack_block_2to1');
3548
- parent
3549
- .getInput('NAME')
3550
- .connection.connect(oldChild.previousConnection);
3551
- newChild1.nextConnection.connect(newChild2.previousConnection);
3552
- const xml = Blockly.utils.xml.textToDom(
3553
- '<shadow type="stack_block"/>',
3554
- );
3555
- newChild2.nextConnection.setShadowDom(xml);
3556
-
3557
- parent
3558
- .getInput('NAME')
3559
- .connection.connect(newChild1.previousConnection);
3560
-
3561
- assert.isTrue(parent.getInput('NAME').connection.isConnected());
3562
- assert.equal(parent.getInputTargetBlock('NAME'), newChild1);
3563
- assert.isTrue(newChild2.nextConnection.isConnected());
3564
- assert.equal(newChild2.getNextBlock(), oldChild);
3565
- this.assertBlockCount(4);
3566
- });
3567
-
3568
- test('Bad check at end', function () {
3569
- const parent = this.workspace.newBlock('statement_block');
3570
- const oldChild = this.workspace.newBlock('stack_block');
3571
- const newChild = this.workspace.newBlock('stack_block_1to2');
3572
- parent
3573
- .getInput('NAME')
3574
- .connection.connect(oldChild.previousConnection);
3575
- const xml = Blockly.utils.xml.textToDom(
3576
- '<shadow type="stack_block_2to1"/>',
3577
- );
3578
- newChild.nextConnection.setShadowDom(xml);
3579
- const spy = sinon.spy(
3580
- oldChild.previousConnection,
3581
- 'onFailedConnect',
3582
- );
3583
-
3584
- parent
3585
- .getInput('NAME')
3586
- .connection.connect(newChild.previousConnection);
3587
-
3588
- assert.isTrue(parent.getInput('NAME').connection.isConnected());
3589
- assert.equal(parent.getInputTargetBlock('NAME'), newChild);
3590
- assert.isTrue(newChild.nextConnection.isConnected());
3591
- assert.isTrue(newChild.getNextBlock().isShadow());
3592
- assert.isTrue(spy.calledOnce);
3593
- this.assertBlockCount(4);
3594
- });
3595
- });
3596
- });
3597
-
3598
- suite('Next', function () {
3599
- suite('No shadows', function () {
3600
- test('Simple', function () {
3601
- const parent = this.workspace.newBlock('stack_block');
3602
- const oldChild = this.workspace.newBlock('stack_block');
3603
- const newChild = this.workspace.newBlock('stack_block');
3604
- parent.nextConnection.connect(oldChild.previousConnection);
3605
-
3606
- parent.nextConnection.connect(newChild.previousConnection);
3607
-
3608
- assert.isTrue(parent.nextConnection.isConnected());
3609
- assert.equal(parent.getNextBlock(), newChild);
3610
- assert.isTrue(newChild.nextConnection.isConnected());
3611
- assert.equal(newChild.getNextBlock(), oldChild);
3612
- this.assertBlockCount(3);
3613
- });
3614
-
3615
- test('Bad check in between', function () {
3616
- const parent = this.workspace.newBlock('stack_block');
3617
- const oldChild = this.workspace.newBlock('stack_block');
3618
- const newChild1 = this.workspace.newBlock('stack_block_1to2');
3619
- const newChild2 = this.workspace.newBlock('stack_block_2to1');
3620
- parent.nextConnection.connect(oldChild.previousConnection);
3621
- newChild1.nextConnection.connect(newChild2.previousConnection);
3622
-
3623
- parent.nextConnection.connect(newChild1.previousConnection);
3624
-
3625
- assert.isTrue(parent.nextConnection.isConnected());
3626
- assert.equal(parent.getNextBlock(), newChild1);
3627
- assert.isTrue(newChild2.nextConnection.isConnected());
3628
- assert.equal(newChild2.getNextBlock(), oldChild);
3629
- this.assertBlockCount(4);
3630
- });
3631
-
3632
- test('Bad check at end', function () {
3633
- const parent = this.workspace.newBlock('stack_block');
3634
- const oldChild = this.workspace.newBlock('stack_block');
3635
- const newChild = this.workspace.newBlock('stack_block_1to2');
3636
- parent.nextConnection.connect(oldChild.previousConnection);
3637
- const spy = sinon.spy(
3638
- oldChild.previousConnection,
3639
- 'onFailedConnect',
3640
- );
3641
-
3642
- parent.nextConnection.connect(newChild.previousConnection);
3643
-
3644
- assert.isTrue(parent.nextConnection.isConnected());
3645
- assert.equal(parent.getNextBlock(), newChild);
3646
- assert.isFalse(newChild.nextConnection.isConnected());
3647
- assert.isTrue(spy.calledOnce);
3648
- this.assertBlockCount(3);
3649
- });
3650
-
3651
- test('No end connection', function () {
3652
- const parent = this.workspace.newBlock('stack_block');
3653
- const oldChild = this.workspace.newBlock('stack_block');
3654
- const newChild = this.workspace.newBlock('stack_block_noend');
3655
- parent.nextConnection.connect(oldChild.previousConnection);
3656
- const spy = sinon.spy(
3657
- oldChild.previousConnection,
3658
- 'onFailedConnect',
3659
- );
3660
-
3661
- parent.nextConnection.connect(newChild.previousConnection);
3662
-
3663
- assert.isTrue(parent.nextConnection.isConnected());
3664
- assert.equal(parent.getNextBlock(), newChild);
3665
- assert.isTrue(spy.calledOnce);
3666
- this.assertBlockCount(3);
3667
- });
3668
- });
3669
-
3670
- suite('Shadows', function () {
3671
- test('Simple', function () {
3672
- const parent = this.workspace.newBlock('stack_block');
3673
- const oldChild = this.workspace.newBlock('stack_block');
3674
- const newChild = this.workspace.newBlock('stack_block');
3675
- parent.nextConnection.connect(oldChild.previousConnection);
3676
- const xml = Blockly.utils.xml.textToDom(
3677
- '<shadow type="stack_block"/>',
3678
- );
3679
- newChild.nextConnection.setShadowDom(xml);
3680
-
3681
- parent.nextConnection.connect(newChild.previousConnection);
3682
-
3683
- assert.isTrue(parent.nextConnection.isConnected());
3684
- assert.equal(parent.getNextBlock(), newChild);
3685
- assert.isTrue(newChild.nextConnection.isConnected());
3686
- assert.equal(newChild.getNextBlock(), oldChild);
3687
- this.assertBlockCount(3);
3688
- });
3689
-
3690
- test('Bad check in between', function () {
3691
- const parent = this.workspace.newBlock('stack_block');
3692
- const oldChild = this.workspace.newBlock('stack_block');
3693
- const newChild1 = this.workspace.newBlock('stack_block_1to2');
3694
- const newChild2 = this.workspace.newBlock('stack_block_2to1');
3695
- parent.nextConnection.connect(oldChild.previousConnection);
3696
- newChild1.nextConnection.connect(newChild2.previousConnection);
3697
- const xml = Blockly.utils.xml.textToDom(
3698
- '<shadow type="stack_block"/>',
3699
- );
3700
- newChild2.nextConnection.setShadowDom(xml);
3701
-
3702
- parent.nextConnection.connect(newChild1.previousConnection);
3703
-
3704
- assert.isTrue(parent.nextConnection.isConnected());
3705
- assert.equal(parent.getNextBlock(), newChild1);
3706
- assert.isTrue(newChild2.nextConnection.isConnected());
3707
- assert.equal(newChild2.getNextBlock(), oldChild);
3708
- this.assertBlockCount(4);
3709
- });
3710
-
3711
- test('Bad check at end', function () {
3712
- const parent = this.workspace.newBlock('stack_block');
3713
- const oldChild = this.workspace.newBlock('stack_block');
3714
- const newChild = this.workspace.newBlock('stack_block_1to2');
3715
- parent.nextConnection.connect(oldChild.previousConnection);
3716
- const xml = Blockly.utils.xml.textToDom(
3717
- '<shadow type="stack_block_2to1"/>',
3718
- );
3719
- newChild.nextConnection.setShadowDom(xml);
3720
- const spy = sinon.spy(
3721
- oldChild.previousConnection,
3722
- 'onFailedConnect',
3723
- );
3724
-
3725
- parent.nextConnection.connect(newChild.previousConnection);
3726
-
3727
- assert.isTrue(parent.nextConnection.isConnected());
3728
- assert.equal(parent.getNextBlock(), newChild);
3729
- assert.isTrue(newChild.nextConnection.isConnected());
3730
- assert.isTrue(newChild.getNextBlock().isShadow());
3731
- assert.isTrue(spy.calledOnce);
3732
- this.assertBlockCount(4);
3733
- });
3734
- });
3735
- });
3736
- });
3737
- });
3738
- });