From 2546b01d70314c0d7c05ef4f7bbfecf225a055b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Jul 2023 14:56:10 +0000 Subject: [PATCH] chore(deps): Bump prettier from 2.8.8 to 3.0.0 (#7322) * chore(deps): Bump prettier from 2.8.8 to 3.0.0 Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.0.0) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * chore: Reformat using Prettier v3.0 defaults The main change is to add trailing commas to the last line of block-formatted function calls. --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Christopher Allen --- blocks/blocks.ts | 2 +- blocks/lists.ts | 34 +- blocks/logic.ts | 24 +- blocks/loops.ts | 19 +- blocks/math.ts | 12 +- blocks/procedures.ts | 50 +- blocks/text.ts | 28 +- blocks/variables.ts | 8 +- blocks/variables_dynamic.ts | 4 +- core/block.ts | 70 +-- core/block_animations.ts | 8 +- core/block_dragger.ts | 18 +- core/block_svg.ts | 32 +- core/blockly.ts | 10 +- core/browser_events.ts | 6 +- core/bubble_dragger.ts | 11 +- core/bubbles/bubble.ts | 26 +- core/bubbles/mini_workspace_bubble.ts | 18 +- core/bubbles/text_bubble.ts | 10 +- core/bubbles/textinput_bubble.ts | 38 +- core/bump_objects.ts | 18 +- core/common.ts | 6 +- core/component_manager.ts | 12 +- core/connection.ts | 23 +- core/connection_checker.ts | 12 +- core/connection_db.ts | 6 +- core/contextmenu.ts | 20 +- core/contextmenu_items.ts | 4 +- core/contextmenu_registry.ts | 2 +- core/dialog.ts | 14 +- core/dropdowndiv.ts | 44 +- core/events/events_abstract.ts | 4 +- core/events/events_block_base.ts | 6 +- core/events/events_block_change.ts | 16 +- core/events/events_block_create.ts | 14 +- core/events/events_block_delete.ts | 16 +- core/events/events_block_drag.ts | 8 +- .../events_block_field_intermediate_change.ts | 10 +- core/events/events_block_move.ts | 11 +- core/events/events_bubble_open.ts | 10 +- core/events/events_click.ts | 6 +- core/events/events_comment_base.ts | 10 +- core/events/events_comment_change.ts | 18 +- core/events/events_comment_create.ts | 8 +- core/events/events_comment_delete.ts | 8 +- core/events/events_comment_move.ts | 16 +- core/events/events_marker_move.ts | 10 +- core/events/events_selected.ts | 6 +- core/events/events_theme_change.ts | 6 +- core/events/events_toolbox_item_select.ts | 8 +- core/events/events_trashcan_open.ts | 6 +- core/events/events_var_base.ts | 6 +- core/events/events_var_create.ts | 12 +- core/events/events_var_delete.ts | 12 +- core/events/events_var_rename.ts | 14 +- core/events/events_viewport.ts | 16 +- core/events/utils.ts | 8 +- core/events/workspace_events.ts | 2 +- core/extensions.ts | 42 +- core/field.ts | 40 +- core/field_angle.ts | 30 +- core/field_checkbox.ts | 4 +- core/field_colour.ts | 28 +- core/field_dropdown.ts | 42 +- core/field_image.ts | 15 +- core/field_input.ts | 32 +- core/field_label.ts | 4 +- core/field_label_serializable.ts | 2 +- core/field_multilineinput.ts | 16 +- core/field_number.ts | 8 +- core/field_registry.ts | 2 +- core/field_textinput.ts | 4 +- core/field_variable.ts | 26 +- core/flyout_base.ts | 70 +-- core/flyout_button.ts | 22 +- core/flyout_horizontal.ts | 14 +- core/flyout_metrics_manager.ts | 2 +- core/flyout_vertical.ts | 12 +- core/generator.ts | 30 +- core/gesture.ts | 64 +-- core/grid.ts | 15 +- core/icons/comment_icon.ts | 18 +- core/icons/exceptions.ts | 2 +- core/icons/icon.ts | 4 +- core/icons/mutator_icon.ts | 36 +- core/icons/registry.ts | 2 +- core/icons/warning_icon.ts | 14 +- core/inject.ts | 28 +- core/inputs/dummy_input.ts | 5 +- core/inputs/input.ts | 7 +- core/inputs/statement_input.ts | 5 +- core/inputs/value_input.ts | 5 +- core/insertion_marker_manager.ts | 34 +- core/interfaces/i_connection_checker.ts | 8 +- core/interfaces/i_flyout.ts | 2 +- core/interfaces/i_legacy_procedure_blocks.ts | 4 +- core/interfaces/i_metrics_manager.ts | 2 +- core/interfaces/i_procedure_block.ts | 2 +- core/interfaces/i_selectable_toolbox_item.ts | 2 +- .../i_variable_backed_parameter_model.ts | 2 +- core/keyboard_nav/ast_node.ts | 18 +- core/keyboard_nav/basic_cursor.ts | 6 +- core/main.js | 8 +- core/marker_manager.ts | 4 +- core/menu.ts | 10 +- core/menuitem.ts | 4 +- core/metrics_manager.ts | 22 +- core/names.ts | 6 +- core/options.ts | 6 +- core/positionable_helpers.ts | 6 +- core/procedures.ts | 20 +- core/registry.ts | 28 +- core/render_management.ts | 4 +- core/rendered_connection.ts | 12 +- core/renderers/common/block_rendering.ts | 2 +- core/renderers/common/constants.ts | 42 +- core/renderers/common/drawer.ts | 10 +- core/renderers/common/info.ts | 28 +- core/renderers/common/marker_svg.ts | 38 +- core/renderers/common/path_object.ts | 8 +- core/renderers/common/renderer.ts | 12 +- core/renderers/geras/drawer.ts | 6 +- core/renderers/geras/highlight_constants.ts | 12 +- core/renderers/geras/highlighter.ts | 18 +- core/renderers/geras/info.ts | 16 +- core/renderers/geras/path_object.ts | 10 +- core/renderers/geras/renderer.ts | 6 +- core/renderers/measurables/connection.ts | 2 +- core/renderers/measurables/field.ts | 2 +- core/renderers/measurables/icon.ts | 5 +- .../renderers/measurables/input_connection.ts | 5 +- core/renderers/measurables/next_connection.ts | 2 +- .../measurables/output_connection.ts | 2 +- .../measurables/previous_connection.ts | 2 +- core/renderers/measurables/spacer_row.ts | 2 +- core/renderers/minimalist/constants.ts | 2 +- core/renderers/minimalist/drawer.ts | 2 +- core/renderers/minimalist/info.ts | 2 +- core/renderers/minimalist/renderer.ts | 4 +- core/renderers/thrasos/info.ts | 10 +- core/renderers/zelos/constants.ts | 48 +- core/renderers/zelos/drawer.ts | 4 +- core/renderers/zelos/info.ts | 12 +- core/renderers/zelos/marker_svg.ts | 4 +- core/renderers/zelos/path_object.ts | 12 +- core/renderers/zelos/renderer.ts | 6 +- core/scrollbar.ts | 26 +- core/scrollbar_pair.ts | 6 +- core/serialization/blocks.ts | 38 +- core/serialization/exceptions.ts | 16 +- core/serialization/procedures.ts | 22 +- core/serialization/variables.ts | 2 +- core/serialization/workspaces.ts | 4 +- core/shortcut_registry.ts | 12 +- core/theme.ts | 2 +- core/theme_manager.ts | 9 +- core/toolbox/category.ts | 14 +- core/toolbox/collapsible_category.ts | 14 +- core/toolbox/separator.ts | 2 +- core/toolbox/toolbox.ts | 32 +- core/toolbox/toolbox_item.ts | 2 +- core/tooltip.ts | 6 +- core/trashcan.ts | 40 +- core/utils/aria.ts | 2 +- core/utils/colour.ts | 2 +- core/utils/coordinate.ts | 7 +- core/utils/deprecation.ts | 2 +- core/utils/dom.ts | 14 +- core/utils/math.ts | 2 +- core/utils/object.ts | 2 +- core/utils/parsing.ts | 8 +- core/utils/rect.ts | 2 +- core/utils/size.ts | 5 +- core/utils/string.ts | 10 +- core/utils/style.ts | 6 +- core/utils/svg.ts | 4 +- core/utils/svg_math.ts | 14 +- core/utils/svg_paths.ts | 2 +- core/utils/toolbox.ts | 12 +- core/utils/xml.ts | 6 +- core/variable_map.ts | 14 +- core/variable_model.ts | 2 +- core/variables.ts | 36 +- core/variables_dynamic.ts | 12 +- core/widgetdiv.ts | 6 +- core/workspace.ts | 12 +- core/workspace_audio.ts | 2 +- core/workspace_comment.ts | 12 +- core/workspace_comment_svg.ts | 72 +-- core/workspace_svg.ts | 84 ++-- core/xml.ts | 43 +- core/zoom_controls.ts | 58 +-- package-lock.json | 18 +- package.json | 2 +- scripts/tsick.js | 2 +- tests/bootstrap.js | 4 +- tests/bootstrap_done.mjs | 2 +- .../browser/test/basic_block_factory_test.js | 4 +- tests/browser/test/basic_block_test.js | 2 +- tests/browser/test/basic_playground_test.js | 20 +- tests/browser/test/block_undo_test.js | 2 +- tests/browser/test/extensive_test.js | 2 +- tests/browser/test/field_edits_test.js | 4 +- tests/browser/test/procedure_test.js | 12 +- tests/browser/test/test_setup.js | 20 +- tests/migration/validate-renamings.mjs | 4 +- tests/mocha/astnode_test.js | 32 +- tests/mocha/block_json_test.js | 90 ++-- tests/mocha/block_test.js | 172 ++++--- tests/mocha/blocks/lists_test.js | 10 +- tests/mocha/blocks/logic_ternary_test.js | 38 +- tests/mocha/blocks/procedures_test.js | 308 ++++++------ tests/mocha/blocks/variables_test.js | 54 +- tests/mocha/comment_deserialization_test.js | 8 +- tests/mocha/comment_test.js | 10 +- tests/mocha/connection_checker_test.js | 140 +++--- tests/mocha/connection_db_test.js | 42 +- tests/mocha/connection_test.js | 474 +++++++++--------- tests/mocha/contextmenu_items_test.js | 74 +-- tests/mocha/cursor_test.js | 8 +- tests/mocha/dropdowndiv_test.js | 10 +- tests/mocha/event_block_change_test.js | 14 +- tests/mocha/event_block_create_test.js | 4 +- ...nt_block_field_intermediate_change_test.js | 2 +- tests/mocha/event_bubble_open_test.js | 2 +- tests/mocha/event_click_test.js | 2 +- tests/mocha/event_comment_change_test.js | 4 +- tests/mocha/event_comment_create_test.js | 2 +- tests/mocha/event_comment_delete_test.js | 2 +- tests/mocha/event_comment_move_test.js | 2 +- tests/mocha/event_marker_move_test.js | 2 +- tests/mocha/event_selected_test.js | 2 +- tests/mocha/event_test.js | 102 ++-- tests/mocha/event_theme_change_test.js | 2 +- tests/mocha/event_toolbox_item_select_test.js | 2 +- tests/mocha/event_trashcan_open_test.js | 2 +- tests/mocha/event_var_create_test.js | 4 +- tests/mocha/event_var_delete_test.js | 4 +- tests/mocha/event_var_rename_test.js | 2 +- tests/mocha/event_viewport_test.js | 2 +- tests/mocha/extensions_test.js | 52 +- tests/mocha/field_angle_test.js | 10 +- tests/mocha/field_checkbox_test.js | 16 +- tests/mocha/field_colour_test.js | 14 +- tests/mocha/field_dropdown_test.js | 6 +- tests/mocha/field_image_test.js | 6 +- tests/mocha/field_label_serializable_test.js | 22 +- tests/mocha/field_label_test.js | 22 +- tests/mocha/field_multilineinput_test.js | 18 +- tests/mocha/field_number_test.js | 26 +- tests/mocha/field_test.js | 50 +- tests/mocha/field_textinput_test.js | 12 +- tests/mocha/field_variable_test.js | 46 +- tests/mocha/flyout_test.js | 42 +- tests/mocha/generator_test.js | 12 +- tests/mocha/gesture_test.js | 4 +- tests/mocha/icon_test.js | 58 +-- tests/mocha/index.html | 2 +- tests/mocha/input_test.js | 2 +- tests/mocha/insertion_marker_manager_test.js | 6 +- tests/mocha/insertion_marker_test.js | 64 +-- tests/mocha/jso_deserialization_test.js | 90 ++-- tests/mocha/jso_serialization_test.js | 50 +- tests/mocha/json_test.js | 12 +- tests/mocha/keydown_test.js | 14 +- tests/mocha/metrics_test.js | 44 +- tests/mocha/mutator_test.js | 6 +- tests/mocha/names_test.js | 38 +- tests/mocha/registry_test.js | 10 +- tests/mocha/serializer_test.js | 360 ++++++------- tests/mocha/shortcut_registry_test.js | 30 +- tests/mocha/test_helpers/events.js | 22 +- tests/mocha/test_helpers/fields.js | 16 +- tests/mocha/test_helpers/procedures.js | 28 +- tests/mocha/test_helpers/serialization.js | 10 +- tests/mocha/test_helpers/setup_teardown.js | 4 +- .../mocha/test_helpers/toolbox_definitions.js | 4 +- tests/mocha/test_helpers/workspace.js | 80 +-- tests/mocha/theme_test.js | 20 +- tests/mocha/toolbox_test.js | 40 +- tests/mocha/tooltip_test.js | 14 +- tests/mocha/touch_test.js | 4 +- tests/mocha/trashcan_test.js | 62 +-- tests/mocha/utils_test.js | 108 ++-- tests/mocha/variable_map_test.js | 32 +- tests/mocha/variable_model_test.js | 10 +- tests/mocha/widget_div_test.js | 44 +- tests/mocha/workspace_comment_test.js | 32 +- tests/mocha/workspace_svg_test.js | 88 ++-- tests/mocha/xml_test.js | 142 +++--- tests/mocha/zoom_controls_test.js | 6 +- tests/multi_playground.html | 12 +- tests/playground.html | 10 +- tests/playgrounds/advanced_playground.html | 8 +- tests/playgrounds/iframe.html | 2 +- tests/playgrounds/screenshot.js | 6 +- tests/playgrounds/shared_procedures.html | 2 +- 297 files changed, 3247 insertions(+), 3181 deletions(-) diff --git a/blocks/blocks.ts b/blocks/blocks.ts index a147b360d..7ac097990 100644 --- a/blocks/blocks.ts +++ b/blocks/blocks.ts @@ -42,5 +42,5 @@ export const blocks: {[key: string]: BlockDefinition} = Object.assign( math.blocks, procedures.blocks, variables.blocks, - variablesDynamic.blocks + variablesDynamic.blocks, ); diff --git a/blocks/lists.ts b/blocks/lists.ts index 3c2b101b8..e1c7c0a7a 100644 --- a/blocks/lists.ts +++ b/blocks/lists.ts @@ -130,7 +130,7 @@ const LISTS_CREATE_WITH = { this.updateShape_(); this.setOutput(true, 'Array'); this.setMutator( - new MutatorIcon(['lists_create_with_item'], this as unknown as BlockSvg) + new MutatorIcon(['lists_create_with_item'], this as unknown as BlockSvg), ); // BUG(#6905) this.setTooltip(Msg['LISTS_CREATE_WITH_TOOLTIP']); }, @@ -182,16 +182,16 @@ const LISTS_CREATE_WITH = { */ decompose: function ( this: CreateWithBlock, - workspace: Workspace + workspace: Workspace, ): ContainerBlock { const containerBlock = workspace.newBlock( - 'lists_create_with_container' + 'lists_create_with_container', ) as ContainerBlock; (containerBlock as BlockSvg).initSvg(); let connection = containerBlock.getInput('STACK')!.connection; for (let i = 0; i < this.itemCount_; i++) { const itemBlock = workspace.newBlock( - 'lists_create_with_item' + 'lists_create_with_item', ) as ItemBlock; (itemBlock as BlockSvg).initSvg(); if (!itemBlock.previousConnection) { @@ -209,7 +209,7 @@ const LISTS_CREATE_WITH = { */ compose: function (this: CreateWithBlock, containerBlock: Block) { let itemBlock: ItemBlock | null = containerBlock.getInputTargetBlock( - 'STACK' + 'STACK', ) as ItemBlock; // Count number of inputs. const connections: Connection[] = []; @@ -242,7 +242,7 @@ const LISTS_CREATE_WITH = { */ saveConnections: function (this: CreateWithBlock, containerBlock: Block) { let itemBlock: ItemBlock | null = containerBlock.getInputTargetBlock( - 'STACK' + 'STACK', ) as ItemBlock; let i = 0; while (itemBlock) { @@ -265,7 +265,7 @@ const LISTS_CREATE_WITH = { this.removeInput('EMPTY'); } else if (!this.itemCount_ && !this.getInput('EMPTY')) { this.appendDummyInput('EMPTY').appendField( - Msg['LISTS_CREATE_EMPTY_TITLE'] + Msg['LISTS_CREATE_EMPTY_TITLE'], ); } // Add new inputs. @@ -297,7 +297,7 @@ const LISTS_CREATE_WITH_CONTAINER = { init: function (this: ContainerBlock) { this.setStyle('list_blocks'); this.appendDummyInput().appendField( - Msg['LISTS_CREATE_WITH_CONTAINER_TITLE_ADD'] + Msg['LISTS_CREATE_WITH_CONTAINER_TITLE_ADD'], ); this.appendStatementInput('STACK'); this.setTooltip(Msg['LISTS_CREATE_WITH_CONTAINER_TOOLTIP']); @@ -358,7 +358,7 @@ const LISTS_INDEXOF = { this.setTooltip(() => { return Msg['LISTS_INDEX_OF_TOOLTIP'].replace( '%1', - this.workspace.options.oneBasedIndex ? '0' : '-1' + this.workspace.options.oneBasedIndex ? '0' : '-1', ); }); }, @@ -401,7 +401,7 @@ const LISTS_GETINDEX = { const isStatement = value === 'REMOVE'; (this.getSourceBlock() as GetIndexBlock).updateStatement_(isStatement); return undefined; - } + }, ); this.appendValueInput('VALUE') .setCheck('Array') @@ -568,7 +568,7 @@ const LISTS_GETINDEX = { this.appendValueInput('AT').setCheck('Number'); if (Msg['ORDINAL_NUMBER_SUFFIX']) { this.appendDummyInput('ORDINAL').appendField( - Msg['ORDINAL_NUMBER_SUFFIX'] + Msg['ORDINAL_NUMBER_SUFFIX'], ); } } else { @@ -596,7 +596,7 @@ const LISTS_GETINDEX = { return null; } return undefined; - } + }, ); this.getInput('AT')!.appendField(menu, 'WHERE'); if (Msg['LISTS_GET_INDEX_TAIL']) { @@ -685,7 +685,7 @@ const LISTS_SETINDEX = { ' ' + Msg['LISTS_INDEX_FROM_START_TOOLTIP'].replace( '%1', - this.workspace.options.oneBasedIndex ? '#1' : '#0' + this.workspace.options.oneBasedIndex ? '#1' : '#0', ); } return tooltip; @@ -747,7 +747,7 @@ const LISTS_SETINDEX = { this.appendValueInput('AT').setCheck('Number'); if (Msg['ORDINAL_NUMBER_SUFFIX']) { this.appendDummyInput('ORDINAL').appendField( - Msg['ORDINAL_NUMBER_SUFFIX'] + Msg['ORDINAL_NUMBER_SUFFIX'], ); } } else { @@ -775,7 +775,7 @@ const LISTS_SETINDEX = { return null; } return undefined; - } + }, ); this.moveInputBefore('AT', 'TO'); if (this.getInput('ORDINAL')) { @@ -887,7 +887,7 @@ const LISTS_GETSUBLIST = { this.appendValueInput('AT' + n).setCheck('Number'); if (Msg['ORDINAL_NUMBER_SUFFIX']) { this.appendDummyInput('ORDINAL' + n).appendField( - Msg['ORDINAL_NUMBER_SUFFIX'] + Msg['ORDINAL_NUMBER_SUFFIX'], ); } } else { @@ -915,7 +915,7 @@ const LISTS_GETSUBLIST = { block.setFieldValue(value, 'WHERE' + n); return null; } - } + }, ); this.getInput('AT' + n)!.appendField(menu, 'WHERE' + n); if (n === 1) { diff --git a/blocks/logic.ts b/blocks/logic.ts index 6996d1721..4c1034261 100644 --- a/blocks/logic.ts +++ b/blocks/logic.ts @@ -276,7 +276,7 @@ const TOOLTIPS_BY_OP = { Extensions.register( 'logic_op_tooltip', - Extensions.buildTooltipForDropdown('OP', TOOLTIPS_BY_OP) + Extensions.buildTooltipForDropdown('OP', TOOLTIPS_BY_OP), ); /** Type of a block that has CONTROLS_IF_MUTATOR_MIXIN */ @@ -417,10 +417,10 @@ const CONTROLS_IF_MUTATOR_MIXIN = { this.elseifCount_++; // TODO(#6920): null valid, undefined not. valueConnections.push( - clauseBlock.valueConnection_ as Connection | null + clauseBlock.valueConnection_ as Connection | null, ); statementConnections.push( - clauseBlock.statementConnection_ as Connection | null + clauseBlock.statementConnection_ as Connection | null, ); break; case 'controls_if_else': @@ -438,7 +438,7 @@ const CONTROLS_IF_MUTATOR_MIXIN = { this.reconnectChildBlocks_( valueConnections, statementConnections, - elseStatementConnection + elseStatementConnection, ); }, /** @@ -500,7 +500,7 @@ const CONTROLS_IF_MUTATOR_MIXIN = { this.reconnectChildBlocks_( valueConnections, statementConnections, - elseStatementConnection + elseStatementConnection, ); }, /** @@ -523,12 +523,12 @@ const CONTROLS_IF_MUTATOR_MIXIN = { .setCheck('Boolean') .appendField(Msg['CONTROLS_IF_MSG_ELSEIF']); this.appendStatementInput('DO' + i).appendField( - Msg['CONTROLS_IF_MSG_THEN'] + Msg['CONTROLS_IF_MSG_THEN'], ); } if (this.elseCount_) { this.appendStatementInput('ELSE').appendField( - Msg['CONTROLS_IF_MSG_ELSE'] + Msg['CONTROLS_IF_MSG_ELSE'], ); } }, @@ -545,7 +545,7 @@ const CONTROLS_IF_MUTATOR_MIXIN = { this: IfBlock, valueConnections: Array, statementConnections: Array, - elseStatementConnection: Connection | null + elseStatementConnection: Connection | null, ) { for (let i = 1; i <= this.elseifCount_; i++) { valueConnections[i]?.reconnect(this, 'IF' + i); @@ -559,7 +559,7 @@ Extensions.registerMutator( 'controls_if_mutator', CONTROLS_IF_MUTATOR_MIXIN, null as unknown as undefined, // TODO(#6920) - ['controls_if_elseif', 'controls_if_else'] + ['controls_if_elseif', 'controls_if_else'], ); /** @@ -579,7 +579,7 @@ const CONTROLS_IF_TOOLTIP_EXTENSION = function (this: IfBlock) { return Msg['CONTROLS_IF_TOOLTIP_4']; } return ''; - }.bind(this) + }.bind(this), ); }; @@ -617,7 +617,7 @@ const LOGIC_COMPARE_ONCHANGE_MIXIN = { blockB && !this.workspace.connectionChecker.doTypeChecks( blockA.outputConnection!, - blockB.outputConnection! + blockB.outputConnection!, ) ) { // Mismatch between two inputs. Revert the block connections, @@ -686,7 +686,7 @@ const LOGIC_TERNARY_ONCHANGE_MIXIN = { block && !block.workspace.connectionChecker.doTypeChecks( block.outputConnection!, - parentConnection + parentConnection, ) ) { // Ensure that any disconnections are grouped with the causing diff --git a/blocks/loops.ts b/blocks/loops.ts index fa9d77656..77090343e 100644 --- a/blocks/loops.ts +++ b/blocks/loops.ts @@ -227,7 +227,7 @@ const WHILE_UNTIL_TOOLTIPS = { Extensions.register( 'controls_whileUntil_tooltip', - Extensions.buildTooltipForDropdown('MODE', WHILE_UNTIL_TOOLTIPS) + Extensions.buildTooltipForDropdown('MODE', WHILE_UNTIL_TOOLTIPS), ); /** @@ -242,7 +242,7 @@ const BREAK_CONTINUE_TOOLTIPS = { Extensions.register( 'controls_flow_tooltip', - Extensions.buildTooltipForDropdown('FLOW', BREAK_CONTINUE_TOOLTIPS) + Extensions.buildTooltipForDropdown('FLOW', BREAK_CONTINUE_TOOLTIPS), ); /** Type of a block that has CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN */ @@ -264,7 +264,7 @@ const CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN = { */ customContextMenu: function ( this: CustomContextMenuBlock, - options: Array + options: Array, ) { if (this.isInFlyout) { return; @@ -289,17 +289,20 @@ const CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN = { Extensions.registerMixin( 'contextMenu_newGetVariableBlock', - CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN + CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN, ); Extensions.register( 'controls_for_tooltip', - Extensions.buildTooltipWithFieldText('%{BKY_CONTROLS_FOR_TOOLTIP}', 'VAR') + Extensions.buildTooltipWithFieldText('%{BKY_CONTROLS_FOR_TOOLTIP}', 'VAR'), ); Extensions.register( 'controls_forEach_tooltip', - Extensions.buildTooltipWithFieldText('%{BKY_CONTROLS_FOREACH_TOOLTIP}', 'VAR') + Extensions.buildTooltipWithFieldText( + '%{BKY_CONTROLS_FOREACH_TOOLTIP}', + 'VAR', + ), ); /** @@ -366,7 +369,7 @@ const CONTROL_FLOW_IN_LOOP_CHECK_MIXIN = { } const enabled = !!this.getSurroundLoop(); this.setWarningText( - enabled ? null : Msg['CONTROLS_FLOW_STATEMENTS_WARNING'] + enabled ? null : Msg['CONTROLS_FLOW_STATEMENTS_WARNING'], ); if (!this.isInFlyout) { const group = Events.getGroup(); @@ -380,7 +383,7 @@ const CONTROL_FLOW_IN_LOOP_CHECK_MIXIN = { Extensions.registerMixin( 'controls_flow_in_loop_check', - CONTROL_FLOW_IN_LOOP_CHECK_MIXIN + CONTROL_FLOW_IN_LOOP_CHECK_MIXIN, ); // Register provided blocks. diff --git a/blocks/math.ts b/blocks/math.ts index c67979215..7232888d2 100644 --- a/blocks/math.ts +++ b/blocks/math.ts @@ -427,7 +427,7 @@ const TOOLTIPS_BY_OP = { Extensions.register( 'math_op_tooltip', - Extensions.buildTooltipForDropdown('OP', TOOLTIPS_BY_OP) + Extensions.buildTooltipForDropdown('OP', TOOLTIPS_BY_OP), ); /** Type of a block that has IS_DIVISBLEBY_MUTATOR_MIXIN */ @@ -502,20 +502,20 @@ const IS_DIVISIBLE_MUTATOR_EXTENSION = function (this: DivisiblebyBlock) { const divisorInput = option === 'DIVISIBLE_BY'; (this.getSourceBlock() as DivisiblebyBlock).updateShape_(divisorInput); return undefined; // FieldValidators can't be void. Use option as-is. - } + }, ); }; Extensions.registerMutator( 'math_is_divisibleby_mutator', IS_DIVISIBLEBY_MUTATOR_MIXIN, - IS_DIVISIBLE_MUTATOR_EXTENSION + IS_DIVISIBLE_MUTATOR_EXTENSION, ); // Update the tooltip of 'math_change' block to reference the variable. Extensions.register( 'math_change_tooltip', - Extensions.buildTooltipWithFieldText('%{BKY_MATH_CHANGE_TOOLTIP}', 'VAR') + Extensions.buildTooltipWithFieldText('%{BKY_MATH_CHANGE_TOOLTIP}', 'VAR'), ); /** Type of a block that has LIST_MODES_MUTATOR_MIXIN */ @@ -578,14 +578,14 @@ const LIST_MODES_MUTATOR_EXTENSION = function (this: ListModesBlock) { function (this: ListModesBlock, newOp: string) { this.updateType_(newOp); return undefined; - }.bind(this) + }.bind(this), ); }; Extensions.registerMutator( 'math_modes_of_list_mutator', LIST_MODES_MUTATOR_MIXIN, - LIST_MODES_MUTATOR_EXTENSION + LIST_MODES_MUTATOR_EXTENSION, ); // Register provided blocks. diff --git a/blocks/procedures.ts b/blocks/procedures.ts index 58095c81d..54d635589 100644 --- a/blocks/procedures.ts +++ b/blocks/procedures.ts @@ -77,7 +77,7 @@ const PROCEDURE_DEF_COMMON = { } if (hasStatements) { this.appendStatementInput('STACK').appendField( - Msg['PROCEDURES_DEFNORETURN_DO'] + Msg['PROCEDURES_DEFNORETURN_DO'], ); if (this.getInput('RETURN')) { this.moveInputBefore('STACK', 'RETURN'); @@ -118,7 +118,7 @@ const PROCEDURE_DEF_COMMON = { */ mutationToDom: function ( this: ProcedureBlock, - opt_paramIds: boolean + opt_paramIds: boolean, ): Element { const container = xmlUtils.createElement('mutation'); if (opt_paramIds) { @@ -162,13 +162,13 @@ const PROCEDURE_DEF_COMMON = { this.workspace, varId, varName, - '' + '', ); if (variable !== null) { this.argumentVarModels_.push(variable); } else { console.log( - `Failed to create a variable named "${varName}", ignoring.` + `Failed to create a variable named "${varName}", ignoring.`, ); } } @@ -221,7 +221,7 @@ const PROCEDURE_DEF_COMMON = { this.workspace, param['id'], param['name'], - '' + '', ); this.arguments_.push(variable.name); this.argumentVarModels_.push(variable); @@ -239,7 +239,7 @@ const PROCEDURE_DEF_COMMON = { */ decompose: function ( this: ProcedureBlock, - workspace: Workspace + workspace: Workspace, ): ContainerBlock { /* * Creates the following XML: @@ -277,7 +277,7 @@ const PROCEDURE_DEF_COMMON = { const containerBlock = Xml.domToBlock( containerBlockNode, - workspace + workspace, ) as ContainerBlock; if (this.type === 'procedures_defreturn') { @@ -366,7 +366,7 @@ const PROCEDURE_DEF_COMMON = { renameVarById: function ( this: ProcedureBlock & BlockSvg, oldId: string, - newId: string + newId: string, ) { const oldVariable = this.workspace.getVariableById(oldId)!; if (oldVariable.type !== '') { @@ -397,7 +397,7 @@ const PROCEDURE_DEF_COMMON = { */ updateVarName: function ( this: ProcedureBlock & BlockSvg, - variable: VariableModel + variable: VariableModel, ) { const newName = variable.name; let change = false; @@ -424,7 +424,7 @@ const PROCEDURE_DEF_COMMON = { displayRenamedVar_: function ( this: ProcedureBlock & BlockSvg, oldName: string, - newName: string + newName: string, ) { this.updateParams_(); // Update the mutator's variables if the mutator is open. @@ -448,7 +448,7 @@ const PROCEDURE_DEF_COMMON = { */ customContextMenu: function ( this: ProcedureBlock, - options: Array + options: Array, ) { if (this.isInFlyout) { return; @@ -599,7 +599,7 @@ const PROCEDURES_MUTATORCONTAINER = { */ init: function (this: ContainerBlock) { this.appendDummyInput().appendField( - Msg['PROCEDURES_MUTATORCONTAINER_TITLE'] + Msg['PROCEDURES_MUTATORCONTAINER_TITLE'], ); this.appendStatementInput('STACK'); this.appendDummyInput('STATEMENT_INPUT') @@ -609,7 +609,7 @@ const PROCEDURES_MUTATORCONTAINER = { type: 'field_checkbox', checked: true, }) as FieldCheckbox, - 'STATEMENTS' + 'STATEMENTS', ); this.setStyle('procedure_blocks'); this.setTooltip(Msg['PROCEDURES_MUTATORCONTAINER_TOOLTIP']); @@ -678,7 +678,7 @@ const PROCEDURES_MUTATORARGUMENT = { */ validator_: function ( this: FieldTextInputForArgument, - varName: string + varName: string, ): string | null { const sourceBlock = this.getSourceBlock()!; const outerWs = sourceBlock!.workspace.getRootWorkspace()!; @@ -734,7 +734,7 @@ const PROCEDURES_MUTATORARGUMENT = { */ deleteIntermediateVars_: function ( this: FieldTextInputForArgument, - newText: string + newText: string, ) { const outerWs = this.getSourceBlock()!.workspace.getRootWorkspace(); if (!outerWs) { @@ -792,7 +792,7 @@ const PROCEDURE_CALL_COMMON = { renameProcedure: function ( this: CallBlock, oldName: string, - newName: string + newName: string, ) { if (Names.equals(oldName, this.getProcedureCall())) { this.setFieldValue(newName, 'NAME'); @@ -814,7 +814,7 @@ const PROCEDURE_CALL_COMMON = { setProcedureParameters_: function ( this: CallBlock, paramNames: string[], - paramIds: string[] + paramIds: string[], ) { // Data structures: // this.arguments = ['x', 'y'] @@ -827,7 +827,7 @@ const PROCEDURE_CALL_COMMON = { // which might reappear if a param is reattached in the mutator. const defBlock = Procedures.getDefinition( this.getProcedureCall(), - this.workspace + this.workspace, ); const mutatorIcon = defBlock && defBlock.getIcon(Mutator.TYPE); const mutatorOpen = mutatorIcon && mutatorIcon.bubbleIsVisible(); @@ -880,7 +880,7 @@ const PROCEDURE_CALL_COMMON = { this.workspace, null, this.arguments_[i], - '' + '', ); this.argumentVarModels_.push(variable); } @@ -1126,7 +1126,7 @@ const PROCEDURE_CALL_COMMON = { // investigate. If the use ends up being valid we may need to reorder // events in the undo stack. console.log( - 'Saw an existing group while responding to a definition change' + 'Saw an existing group while responding to a definition change', ); } Events.setGroup(event.group); @@ -1147,7 +1147,7 @@ const PROCEDURE_CALL_COMMON = { */ customContextMenu: function ( this: CallBlock, - options: Array + options: Array, ) { if (!(this.workspace as WorkspaceSvg).isMovable()) { // If we center on the block and the workspace isn't movable we could @@ -1230,7 +1230,7 @@ const PROCEDURES_IFRETURN = { .setCheck('Boolean') .appendField(Msg['CONTROLS_IF_MSG_IF']); this.appendValueInput('VALUE').appendField( - Msg['PROCEDURES_DEFRETURN_RETURN'] + Msg['PROCEDURES_DEFRETURN_RETURN'], ); this.setInputsInline(true); this.setPreviousStatement(true); @@ -1261,7 +1261,7 @@ const PROCEDURES_IFRETURN = { if (!this.hasReturnValue_) { this.removeInput('VALUE'); this.appendDummyInput('VALUE').appendField( - Msg['PROCEDURES_DEFRETURN_RETURN'] + Msg['PROCEDURES_DEFRETURN_RETURN'], ); } }, @@ -1300,7 +1300,7 @@ const PROCEDURES_IFRETURN = { if (block.type === 'procedures_defnoreturn' && this.hasReturnValue_) { this.removeInput('VALUE'); this.appendDummyInput('VALUE').appendField( - Msg['PROCEDURES_DEFRETURN_RETURN'] + Msg['PROCEDURES_DEFRETURN_RETURN'], ); this.hasReturnValue_ = false; } else if ( @@ -1309,7 +1309,7 @@ const PROCEDURES_IFRETURN = { ) { this.removeInput('VALUE'); this.appendValueInput('VALUE').appendField( - Msg['PROCEDURES_DEFRETURN_RETURN'] + Msg['PROCEDURES_DEFRETURN_RETURN'], ); this.hasReturnValue_ = true; } diff --git a/blocks/text.ts b/blocks/text.ts index 0ce745d14..fca84a519 100644 --- a/blocks/text.ts +++ b/blocks/text.ts @@ -311,7 +311,7 @@ const GET_SUBSTRING_BLOCK = { this.appendValueInput('AT' + n).setCheck('Number'); if (Msg['ORDINAL_NUMBER_SUFFIX']) { this.appendDummyInput('ORDINAL' + n).appendField( - Msg['ORDINAL_NUMBER_SUFFIX'] + Msg['ORDINAL_NUMBER_SUFFIX'], ); } } else { @@ -345,7 +345,7 @@ const GET_SUBSTRING_BLOCK = { return null; } return undefined; - } + }, ); this.getInput('AT' + n)!.appendField(menu, 'WHERE' + n); @@ -379,7 +379,7 @@ blocks['text_changeCase'] = { type: 'field_dropdown', options: OPERATORS, }) as FieldDropdown, - 'CASE' + 'CASE', ); this.setOutput(true, 'String'); this.setTooltip(Msg['TEXT_CHANGECASE_TOOLTIP']); @@ -405,7 +405,7 @@ blocks['text_trim'] = { type: 'field_dropdown', options: OPERATORS, }) as FieldDropdown, - 'MODE' + 'MODE', ); this.setOutput(true, 'String'); this.setTooltip(Msg['TEXT_TRIM_TOOLTIP']); @@ -542,7 +542,7 @@ const TEXT_PROMPT_BLOCK = { type: 'field_input', text: '', }) as FieldTextInput, - 'TEXT' + 'TEXT', ) .appendField(this.newQuote_(false)); this.setOutput(true, 'String'); @@ -691,7 +691,7 @@ const QUOTE_IMAGE_MIXIN = { } } console.warn( - 'field named "' + fieldName + '" not found in ' + this.toDevString() + 'field named "' + fieldName + '" not found in ' + this.toDevString(), ); }, @@ -790,13 +790,13 @@ const JOIN_MUTATOR_MIXIN = { */ decompose: function (this: JoinMutatorBlock, workspace: Workspace): Block { const containerBlock = workspace.newBlock( - 'text_create_join_container' + 'text_create_join_container', ) as BlockSvg; containerBlock.initSvg(); let connection = containerBlock.getInput('STACK')!.connection!; for (let i = 0; i < this.itemCount_; i++) { const itemBlock = workspace.newBlock( - 'text_create_join_item' + 'text_create_join_item', ) as JoinItemBlock; itemBlock.initSvg(); connection.connect(itemBlock.previousConnection); @@ -811,7 +811,7 @@ const JOIN_MUTATOR_MIXIN = { */ compose: function (this: JoinMutatorBlock, containerBlock: Block) { let itemBlock = containerBlock.getInputTargetBlock( - 'STACK' + 'STACK', ) as JoinItemBlock; // Count number of inputs. const connections = []; @@ -901,7 +901,7 @@ const JOIN_EXTENSION = function (this: JoinMutatorBlock) { // Update the tooltip of 'text_append' block to reference the variable. Extensions.register( 'text_append_tooltip', - Extensions.buildTooltipWithFieldText('%{BKY_TEXT_APPEND_TOOLTIP}', 'VAR') + Extensions.buildTooltipWithFieldText('%{BKY_TEXT_APPEND_TOOLTIP}', 'VAR'), ); /** @@ -911,7 +911,7 @@ const INDEXOF_TOOLTIP_EXTENSION = function (this: Block) { this.setTooltip(() => { return Msg['TEXT_INDEXOF_TOOLTIP'].replace( '%1', - this.workspace.options.oneBasedIndex ? '0' : '-1' + this.workspace.options.oneBasedIndex ? '0' : '-1', ); }); }; @@ -970,7 +970,7 @@ const CHARAT_MUTATOR_MIXIN = { this.appendValueInput('AT').setCheck('Number'); if (Msg['ORDINAL_NUMBER_SUFFIX']) { this.appendDummyInput('ORDINAL').appendField( - Msg['ORDINAL_NUMBER_SUFFIX'] + Msg['ORDINAL_NUMBER_SUFFIX'], ); } } @@ -1022,13 +1022,13 @@ Extensions.register('text_quotes', QUOTES_EXTENSION); Extensions.registerMutator( 'text_join_mutator', JOIN_MUTATOR_MIXIN, - JOIN_EXTENSION + JOIN_EXTENSION, ); Extensions.registerMutator( 'text_charAt_mutator', CHARAT_MUTATOR_MIXIN, - CHARAT_EXTENSION + CHARAT_EXTENSION, ); // Register provided blocks. diff --git a/blocks/variables.ts b/blocks/variables.ts index 19705f4ae..d0a2814bd 100644 --- a/blocks/variables.ts +++ b/blocks/variables.ts @@ -89,7 +89,7 @@ const CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN = { */ customContextMenu: function ( this: VariableBlock, - options: Array + options: Array, ) { if (!this.isInFlyout) { let oppositeType; @@ -148,7 +148,7 @@ const CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN = { * @returns A function that renames the variable. */ const renameOptionCallbackFactory = function ( - block: VariableBlock + block: VariableBlock, ): () => void { return function () { const workspace = block.workspace; @@ -166,7 +166,7 @@ const renameOptionCallbackFactory = function ( * @returns A function that deletes the variable. */ const deleteOptionCallbackFactory = function ( - block: VariableBlock + block: VariableBlock, ): () => void { return function () { const workspace = block.workspace; @@ -179,7 +179,7 @@ const deleteOptionCallbackFactory = function ( Extensions.registerMixin( 'contextMenu_variableSetterGetter', - CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN + CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN, ); // Register provided blocks. diff --git a/blocks/variables_dynamic.ts b/blocks/variables_dynamic.ts index 70fd4bb2c..fed8cbcb3 100644 --- a/blocks/variables_dynamic.ts +++ b/blocks/variables_dynamic.ts @@ -90,7 +90,7 @@ const CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN = { */ customContextMenu: function ( this: VariableBlock, - options: Array + options: Array, ) { // Getter blocks have the option to create a setter block, and vice versa. if (!this.isInFlyout) { @@ -194,7 +194,7 @@ const deleteOptionCallbackFactory = function (block: VariableBlock) { Extensions.registerMixin( 'contextMenu_variableDynamicSetterGetter', - CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN + CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN, ); // Register provided blocks. diff --git a/core/block.ts b/core/block.ts index 70f16bd6e..7c7de425a 100644 --- a/core/block.ts +++ b/core/block.ts @@ -430,7 +430,7 @@ export class Block implements IASTNodeLocation, IDeletable { this.workspace.connectionChecker.canConnect( childConnection, parentConnection, - false + false, ) ) { parentConnection.connect(childConnection!); @@ -491,7 +491,7 @@ export class Block implements IASTNodeLocation, IDeletable { this.workspace.connectionChecker.canConnect( previousTarget, nextTarget, - false + false, ) ) { // Attach the next statement to the previous statement. @@ -719,7 +719,7 @@ export class Block implements IASTNodeLocation, IDeletable { } else if (isConnected && !newParent) { throw Error( 'Cannot set parent to null while block is still connected to' + - ' superior block.' + ' superior block.', ); } @@ -844,7 +844,7 @@ export class Block implements IASTNodeLocation, IDeletable { return true; } return this.workspace.isCapacityAvailable( - common.getBlockTypeCounts(this, true) + common.getBlockTypeCounts(this, true), ); } @@ -945,7 +945,7 @@ export class Block implements IASTNodeLocation, IDeletable { */ getMatchingConnection( otherBlock: Block, - conn: Connection + conn: Connection, ): Connection | null { const connections = this.getConnections_(true); const otherConnections = otherBlock.getConnections_(true); @@ -1071,7 +1071,7 @@ export class Block implements IASTNodeLocation, IDeletable { 'Block.prototype.getField expects a string ' + 'with the field name but received ' + (name === undefined ? 'nothing' : name + ' of type ' + typeof name) + - ' instead' + ' instead', ); } for (let i = 0, input; (input = this.inputList[i]); i++) { @@ -1114,7 +1114,7 @@ export class Block implements IASTNodeLocation, IDeletable { for (let j = 0, field; (field = input.fieldRow[j]); j++) { if (field.referencesVariables()) { const model = this.workspace.getVariableById( - field.getValue() as string + field.getValue() as string, ); // Check if the variable actually exists (and isn't just a potential // variable). @@ -1202,7 +1202,7 @@ export class Block implements IASTNodeLocation, IDeletable { */ setPreviousStatement( newBoolean: boolean, - opt_check?: string | string[] | null + opt_check?: string | string[] | null, ) { if (newBoolean) { if (opt_check === undefined) { @@ -1210,7 +1210,7 @@ export class Block implements IASTNodeLocation, IDeletable { } if (!this.previousConnection) { this.previousConnection = this.makeConnection_( - ConnectionType.PREVIOUS_STATEMENT + ConnectionType.PREVIOUS_STATEMENT, ); } this.previousConnection.setCheck(opt_check); @@ -1219,7 +1219,7 @@ export class Block implements IASTNodeLocation, IDeletable { if (this.previousConnection.isConnected()) { throw Error( 'Must disconnect previous statement before removing ' + - 'connection.' + 'connection.', ); } this.previousConnection.dispose(); @@ -1242,7 +1242,7 @@ export class Block implements IASTNodeLocation, IDeletable { } if (!this.nextConnection) { this.nextConnection = this.makeConnection_( - ConnectionType.NEXT_STATEMENT + ConnectionType.NEXT_STATEMENT, ); } this.nextConnection.setCheck(opt_check); @@ -1250,7 +1250,7 @@ export class Block implements IASTNodeLocation, IDeletable { if (this.nextConnection) { if (this.nextConnection.isConnected()) { throw Error( - 'Must disconnect next statement before removing ' + 'connection.' + 'Must disconnect next statement before removing ' + 'connection.', ); } this.nextConnection.dispose(); @@ -1273,7 +1273,7 @@ export class Block implements IASTNodeLocation, IDeletable { } if (!this.outputConnection) { this.outputConnection = this.makeConnection_( - ConnectionType.OUTPUT_VALUE + ConnectionType.OUTPUT_VALUE, ); } this.outputConnection.setCheck(opt_check); @@ -1281,7 +1281,7 @@ export class Block implements IASTNodeLocation, IDeletable { if (this.outputConnection) { if (this.outputConnection.isConnected()) { throw Error( - 'Must disconnect output value before removing connection.' + 'Must disconnect output value before removing connection.', ); } this.outputConnection.dispose(); @@ -1303,8 +1303,8 @@ export class Block implements IASTNodeLocation, IDeletable { 'inline', null, this.inputsInline, - newBoolean - ) + newBoolean, + ), ); this.inputsInline = newBoolean; } @@ -1384,8 +1384,8 @@ export class Block implements IASTNodeLocation, IDeletable { 'disabled', null, oldValue, - !enabled - ) + !enabled, + ), ); } } @@ -1430,8 +1430,8 @@ export class Block implements IASTNodeLocation, IDeletable { 'collapsed', null, this.collapsed_, - collapsed - ) + collapsed, + ), ); this.collapsed_ = collapsed; } @@ -1583,7 +1583,7 @@ export class Block implements IASTNodeLocation, IDeletable { const inputConstructor = registry.getClass( registry.Type.INPUT, type, - false + false, ); if (!inputConstructor) return null; return this.appendInput(new inputConstructor(name, this)); @@ -1601,7 +1601,7 @@ export class Block implements IASTNodeLocation, IDeletable { // Validate inputs. if (json['output'] && json['previousStatement']) { throw Error( - warningPrefix + 'Must not have both an output and a previousStatement.' + warningPrefix + 'Must not have both an output and a previousStatement.', ); } @@ -1629,7 +1629,7 @@ export class Block implements IASTNodeLocation, IDeletable { json['message' + i], json['args' + i] || [], json['lastDummyAlign' + i], - warningPrefix + warningPrefix, ); i++; } @@ -1672,7 +1672,7 @@ export class Block implements IASTNodeLocation, IDeletable { "JSON attribute 'extensions' should be an array of" + " strings. Found raw string in JSON for '" + json['type'] + - "' block." + "' block.", ); json['extensions'] = [json['extensions']]; // Correct and continue. } @@ -1752,7 +1752,7 @@ export class Block implements IASTNodeLocation, IDeletable { } if (overwrites.length) { throw Error( - 'Mixin will overwrite block members: ' + JSON.stringify(overwrites) + 'Mixin will overwrite block members: ' + JSON.stringify(overwrites), ); } } @@ -1773,7 +1773,7 @@ export class Block implements IASTNodeLocation, IDeletable { message: string, args: AnyDuringMigration[], lastDummyAlign: string | undefined, - warningPrefix: string + warningPrefix: string, ) { const tokens = parsing.tokenizeInterpolation(message); this.validateTokens_(tokens, args.length); @@ -1825,7 +1825,7 @@ export class Block implements IASTNodeLocation, IDeletable { '": ' + 'Message index %' + token + - ' out of range.' + ' out of range.', ); } if (visitedArgsHash[token]) { @@ -1835,7 +1835,7 @@ export class Block implements IASTNodeLocation, IDeletable { '": ' + 'Message index %' + token + - ' duplicated.' + ' duplicated.', ); } visitedArgsHash[token] = true; @@ -1848,7 +1848,7 @@ export class Block implements IASTNodeLocation, IDeletable { '": ' + 'Message does not reference all ' + argsCount + - ' arg(s).' + ' arg(s).', ); } } @@ -1867,7 +1867,7 @@ export class Block implements IASTNodeLocation, IDeletable { private interpolateArguments_( tokens: Array, args: Array, - lastDummyAlign: string | undefined + lastDummyAlign: string | undefined, ): AnyDuringMigration[] { const elements = []; for (let i = 0; i < tokens.length; i++) { @@ -1891,7 +1891,7 @@ export class Block implements IASTNodeLocation, IDeletable { if ( length && !this.isInputKeyword_( - (elements as AnyDuringMigration)[length - 1]['type'] + (elements as AnyDuringMigration)[length - 1]['type'], ) ) { const dummyInput = {'type': 'input_dummy'}; @@ -1940,7 +1940,7 @@ export class Block implements IASTNodeLocation, IDeletable { */ private inputFromJson_( element: AnyDuringMigration, - warningPrefix: string + warningPrefix: string, ): Input | null { const alignmentLookup = { 'LEFT': Align.LEFT, @@ -2160,8 +2160,8 @@ export class Block implements IASTNodeLocation, IDeletable { 'comment', null, oldText, - text - ) + text, + ), ); if (text !== null) { @@ -2266,7 +2266,7 @@ export class Block implements IASTNodeLocation, IDeletable { throw Error('Block has parent'); } const event = new (eventUtils.get(eventUtils.BLOCK_MOVE))( - this + this, ) as BlockMove; reason && event.setReason(reason); this.xy_.translate(dx, dy); diff --git a/core/block_animations.ts b/core/block_animations.ts index 9c9a52aa7..7e0ec7b74 100644 --- a/core/block_animations.ts +++ b/core/block_animations.ts @@ -68,7 +68,7 @@ function disposeUiStep( rect: CloneRect, rtl: boolean, start: Date, - workspaceScale: number + workspaceScale: number, ) { const ms = new Date().getTime() - start.getTime(); const percent = ms / 150; @@ -81,7 +81,7 @@ function disposeUiStep( const scale = (1 - percent) * workspaceScale; clone.setAttribute( 'transform', - 'translate(' + x + ',' + y + ')' + ' scale(' + scale + ')' + 'translate(' + x + ',' + y + ')' + ' scale(' + scale + ')', ); setTimeout(disposeUiStep, 10, clone, rect, rtl, start, workspaceScale); } @@ -120,7 +120,7 @@ export function connectionUiEffect(block: BlockSvg) { 'stroke': '#888', 'stroke-width': 10, }, - workspace.getParentSvg() + workspace.getParentSvg(), ); // Start the animation. connectionUiStep(ripple, new Date(), scale); @@ -187,7 +187,7 @@ function disconnectUiStep(block: BlockSvg, magnitude: number, start: Date) { let skew = ''; if (percent <= 1) { const val = Math.round( - Math.sin(percent * Math.PI * WIGGLES) * (1 - percent) * magnitude + Math.sin(percent * Math.PI * WIGGLES) * (1 - percent) * magnitude, ); skew = `skewX(${val})`; disconnectPid = setTimeout(disconnectUiStep, 10, block, magnitude, start); diff --git a/core/block_dragger.ts b/core/block_dragger.ts index 1e6d34a7d..b6f3ab7ba 100644 --- a/core/block_dragger.ts +++ b/core/block_dragger.ts @@ -60,7 +60,7 @@ export class BlockDragger implements IBlockDragger { /** Object that keeps track of connections on dragged blocks. */ this.draggedConnectionManager_ = new InsertionMarkerManager( - this.draggingBlock_ + this.draggingBlock_, ); this.workspace_ = workspace; @@ -149,7 +149,7 @@ export class BlockDragger implements IBlockDragger { */ protected disconnectBlock_( healStack: boolean, - currentDragDeltaXY: Coordinate + currentDragDeltaXY: Coordinate, ) { this.draggingBlock_.unplug(healStack); const delta = this.pixelsToWorkspaceUnits_(currentDragDeltaXY); @@ -165,7 +165,7 @@ export class BlockDragger implements IBlockDragger { const event = new (eventUtils.get(eventUtils.BLOCK_DRAG))( this.draggingBlock_, true, - this.draggingBlock_.getDescendants(false) + this.draggingBlock_.getDescendants(false), ); eventUtils.fire(event); } @@ -247,7 +247,7 @@ export class BlockDragger implements IBlockDragger { bumpObjects.bumpIntoBounds( this.draggingBlock_.workspace, this.workspace_.getMetricsManager().getScrollMetrics(true), - this.draggingBlock_ + this.draggingBlock_, ); } } @@ -313,7 +313,7 @@ export class BlockDragger implements IBlockDragger { const event = new (eventUtils.get(eventUtils.BLOCK_DRAG))( this.draggingBlock_, false, - this.draggingBlock_.getDescendants(false) + this.draggingBlock_.getDescendants(false), ); eventUtils.fire(event); } @@ -359,7 +359,7 @@ export class BlockDragger implements IBlockDragger { protected fireMoveEvent_() { if (this.draggingBlock_.isDeadOrDying()) return; const event = new (eventUtils.get(eventUtils.BLOCK_MOVE))( - this.draggingBlock_ + this.draggingBlock_, ) as BlockMove; event.setReason(['drag']); event.oldCoordinate = this.startXY_; @@ -387,7 +387,7 @@ export class BlockDragger implements IBlockDragger { protected pixelsToWorkspaceUnits_(pixelCoord: Coordinate): Coordinate { const result = new Coordinate( pixelCoord.x / this.workspace_.scale, - pixelCoord.y / this.workspace_.scale + pixelCoord.y / this.workspace_.scale, ); if (this.workspace_.isMutator) { // If we're in a mutator, its scale is always 1, purely because of some @@ -447,7 +447,7 @@ export interface IconPositionData { */ function initIconData( block: BlockSvg, - blockOrigin: Coordinate + blockOrigin: Coordinate, ): IconPositionData[] { // Build a list of icons that need to be moved and where they started. const dragIconData = []; @@ -462,7 +462,7 @@ function initIconData( for (const child of block.getChildren(false)) { dragIconData.push( - ...initIconData(child, Coordinate.sum(blockOrigin, child.relativeCoords)) + ...initIconData(child, Coordinate.sum(blockOrigin, child.relativeCoords)), ); } // AnyDuringMigration because: Type '{ location: Coordinate | null; icon: diff --git a/core/block_svg.ts b/core/block_svg.ts index d87e042be..ebcf2bb25 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -87,7 +87,7 @@ export class BlockSvg // override compose?: ((p1: BlockSvg) => void)|null; saveConnections?: (p1: BlockSvg) => void; customContextMenu?: ( - p1: Array + p1: Array, ) => void; /** @@ -212,7 +212,7 @@ export class BlockSvg svg, 'pointerdown', this, - this.onMouseDown_ + this.onMouseDown_, ); } this.eventsInit_ = true; @@ -267,7 +267,7 @@ export class BlockSvg const event = new (eventUtils.get(eventUtils.SELECTED))( oldId, this.id, - this.workspace.id + this.workspace.id, ); eventUtils.fire(event); common.setSelected(this); @@ -285,7 +285,7 @@ export class BlockSvg const event = new (eventUtils.get(eventUtils.SELECTED))( this.id, null, - this.workspace.id + this.workspace.id, ); event.workspaceId = this.workspace.id; eventUtils.fire(event); @@ -451,10 +451,10 @@ export class BlockSvg const half = spacing / 2; const xy = this.getRelativeToSurfaceXY(); const dx = Math.round( - Math.round((xy.x - half) / spacing) * spacing + half - xy.x + Math.round((xy.x - half) / spacing) * spacing + half - xy.x, ); const dy = Math.round( - Math.round((xy.y - half) / spacing) * spacing + half - xy.y + Math.round((xy.y - half) / spacing) * spacing + half - xy.y, ); if (dx || dy) { this.moveBy(dx, dy, ['snap']); @@ -611,7 +611,7 @@ export class BlockSvg } const menuOptions = ContextMenuRegistry.registry.getContextMenuOptions( ContextMenuRegistry.ScopeType.BLOCK, - {block: this} + {block: this}, ); // Allow the block to add or modify menuOptions. @@ -737,7 +737,7 @@ export class BlockSvg this.isInsertionMarker_ = insertionMarker; if (this.isInsertionMarker_) { this.setColour( - this.workspace.getRenderer().getConstants().INSERTION_MARKER_COLOUR + this.workspace.getRenderer().getConstants().INSERTION_MARKER_COLOUR, ); this.pathObject.updateInsertionMarker(true); } @@ -922,7 +922,7 @@ export class BlockSvg this.warningTextDb.delete(id); this.setWarningText(text, id); } - }, 100) + }, 100), ); return; } @@ -944,7 +944,7 @@ export class BlockSvg if (collapsedParent) { collapsedParent.setWarningText( Msg['COLLAPSED_WARNINGS_WARNING'], - BlockSvg.COLLAPSED_WARNING_ID + BlockSvg.COLLAPSED_WARNING_ID, ); } @@ -1165,7 +1165,7 @@ export class BlockSvg */ override setPreviousStatement( newBoolean: boolean, - opt_check?: string | string[] | null + opt_check?: string | string[] | null, ) { super.setPreviousStatement(newBoolean, opt_check); @@ -1184,7 +1184,7 @@ export class BlockSvg */ override setNextStatement( newBoolean: boolean, - opt_check?: string | string[] | null + opt_check?: string | string[] | null, ) { super.setNextStatement(newBoolean, opt_check); @@ -1203,7 +1203,7 @@ export class BlockSvg */ override setOutput( newBoolean: boolean, - opt_check?: string | string[] | null + opt_check?: string | string[] | null, ) { super.setOutput(newBoolean, opt_check); @@ -1365,7 +1365,7 @@ export class BlockSvg * @internal */ override lastConnectionInStack( - ignoreShadows: boolean + ignoreShadows: boolean, ): RenderedConnection | null { return super.lastConnectionInStack(ignoreShadows) as RenderedConnection; } @@ -1382,7 +1382,7 @@ export class BlockSvg */ override getMatchingConnection( otherBlock: Block, - conn: Connection + conn: Connection, ): RenderedConnection | null { return super.getMatchingConnection(otherBlock, conn) as RenderedConnection; } @@ -1505,7 +1505,7 @@ export class BlockSvg */ positionNearConnection( sourceConnection: RenderedConnection, - targetConnection: RenderedConnection + targetConnection: RenderedConnection, ) { // We only need to position the new block if it's before the existing one, // otherwise its position is set by the previous block. diff --git a/core/blockly.ts b/core/blockly.ts index ed74064bb..c14f3452b 100644 --- a/core/blockly.ts +++ b/core/blockly.ts @@ -410,14 +410,14 @@ export const PROCEDURE_CATEGORY_NAME: string = Procedures.CATEGORY_NAME; // clang-format off Workspace.prototype.newBlock = function ( prototypeName: string, - opt_id?: string + opt_id?: string, ): Block { return new Block(this, prototypeName, opt_id); }; WorkspaceSvg.prototype.newBlock = function ( prototypeName: string, - opt_id?: string + opt_id?: string, ): BlockSvg { return new BlockSvg(this, prototypeName, opt_id); }; @@ -428,7 +428,7 @@ WorkspaceSvg.newTrashcan = function (workspace: WorkspaceSvg): Trashcan { WorkspaceCommentSvg.prototype.showContextMenu = function ( this: WorkspaceCommentSvg, - e: Event + e: Event, ) { if (this.workspace.options.readOnly) { return; @@ -444,14 +444,14 @@ WorkspaceCommentSvg.prototype.showContextMenu = function ( }; MiniWorkspaceBubble.prototype.newWorkspaceSvg = function ( - options: Options + options: Options, ): WorkspaceSvg { return new WorkspaceSvg(options); }; Names.prototype.populateProcedures = function ( this: Names, - workspace: Workspace + workspace: Workspace, ) { const procedures = Procedures.allProcedures(workspace); // Flatten the return vs no-return procedure lists. diff --git a/core/browser_events.ts b/core/browser_events.ts index d5fdff0a1..20c41f63e 100644 --- a/core/browser_events.ts +++ b/core/browser_events.ts @@ -50,7 +50,7 @@ export function conditionalBind( name: string, thisObject: Object | null, func: Function, - opt_noCaptureIdentifier?: boolean + opt_noCaptureIdentifier?: boolean, ): Data { /** * @@ -98,7 +98,7 @@ export function bind( node: EventTarget, name: string, thisObject: Object | null, - func: Function + func: Function, ): Data { /** * @@ -208,7 +208,7 @@ export function isRightButton(e: MouseEvent): boolean { export function mouseToSvg( e: MouseEvent, svg: SVGSVGElement, - matrix: SVGMatrix | null + matrix: SVGMatrix | null, ): SVGPoint { const svgPoint = svg.createSVGPoint(); svgPoint.x = e.clientX; diff --git a/core/bubble_dragger.ts b/core/bubble_dragger.ts index 31abf6c7b..5c87249fa 100644 --- a/core/bubble_dragger.ts +++ b/core/bubble_dragger.ts @@ -39,7 +39,10 @@ export class BubbleDragger { * @param bubble The item on the bubble canvas to drag. * @param workspace The workspace to drag on. */ - constructor(private bubble: IBubble, private workspace: WorkspaceSvg) { + constructor( + private bubble: IBubble, + private workspace: WorkspaceSvg, + ) { /** * The location of the top left corner of the dragging bubble's body at the * beginning of the drag, in workspace coordinates. @@ -108,7 +111,7 @@ export class BubbleDragger { const componentManager = this.workspace.getComponentManager(); const isDeleteArea = componentManager.hasCapability( dragTarget.id, - ComponentManager.Capability.DELETE_AREA + ComponentManager.Capability.DELETE_AREA, ); if (isDeleteArea) { return (dragTarget as IDeleteArea).wouldDelete(this.bubble, false); @@ -173,7 +176,7 @@ export class BubbleDragger { private fireMoveEvent_() { if (this.bubble instanceof WorkspaceCommentSvg) { const event = new (eventUtils.get(eventUtils.COMMENT_MOVE))( - this.bubble + this.bubble, ) as CommentMove; event.setOldCoordinate(this.startXY_); event.recordNew(); @@ -195,7 +198,7 @@ export class BubbleDragger { private pixelsToWorkspaceUnits_(pixelCoord: Coordinate): Coordinate { const result = new Coordinate( pixelCoord.x / this.workspace.scale, - pixelCoord.y / this.workspace.scale + pixelCoord.y / this.workspace.scale, ); if (this.workspace.isMutator) { // If we're in a mutator, its scale is always 1, purely because of some diff --git a/core/bubbles/bubble.ts b/core/bubbles/bubble.ts index 7eaee873e..4bea9d863 100644 --- a/core/bubbles/bubble.ts +++ b/core/bubbles/bubble.ts @@ -88,7 +88,7 @@ export abstract class Bubble implements IBubble { constructor( protected readonly workspace: WorkspaceSvg, protected anchor: Coordinate, - protected ownerRect?: Rect + protected ownerRect?: Rect, ) { this.svgRoot = dom.createSvgElement(Svg.G, {}, workspace.getBubbleCanvas()); const embossGroup = dom.createSvgElement( @@ -98,7 +98,7 @@ export abstract class Bubble implements IBubble { this.workspace.getRenderer().getConstants().embossFilterId })`, }, - this.svgRoot + this.svgRoot, ); this.tail = dom.createSvgElement(Svg.PATH, {}, embossGroup); this.background = dom.createSvgElement( @@ -110,7 +110,7 @@ export abstract class Bubble implements IBubble { 'rx': Bubble.BORDER_WIDTH, 'ry': Bubble.BORDER_WIDTH, }, - embossGroup + embossGroup, ); this.contentContainer = dom.createSvgElement(Svg.G, {}, this.svgRoot); @@ -118,7 +118,7 @@ export abstract class Bubble implements IBubble { this.background, 'pointerdown', this, - this.onMouseDown + this.onMouseDown, ); } @@ -250,7 +250,7 @@ export abstract class Bubble implements IBubble { const closerPositionOverlap = this.getOverlap(closerPosition, viewMetrics); const fartherPositionOverlap = this.getOverlap( fartherPosition, - viewMetrics + viewMetrics, ); // Set the position to whichever position shows the most of the bubble, @@ -259,7 +259,7 @@ export abstract class Bubble implements IBubble { topPositionOverlap, startPositionOverlap, closerPositionOverlap, - fartherPositionOverlap + fartherPositionOverlap, ); if (topPositionOverlap === mostOverlap) { this.relativeLeft = topPosition.x; @@ -299,7 +299,7 @@ export abstract class Bubble implements IBubble { */ private getOverlap( relativeMin: {x: number; y: number}, - viewMetrics: ContainerRegion + viewMetrics: ContainerRegion, ): number { // The position of the top-left corner of the bubble in workspace units. const bubbleMin = { @@ -337,8 +337,8 @@ export abstract class Bubble implements IBubble { 0, Math.min( 1, - (overlapWidth * overlapHeight) / (this.size.width * this.size.height) - ) + (overlapWidth * overlapHeight) / (this.size.width * this.size.height), + ), ); } @@ -497,7 +497,7 @@ export abstract class Bubble implements IBubble { // Distortion to curve the tail. const radians = math.toRadians( - this.workspace.RTL ? -Bubble.TAIL_ANGLE : Bubble.TAIL_ANGLE + this.workspace.RTL ? -Bubble.TAIL_ANGLE : Bubble.TAIL_ANGLE, ); let swirlAngle = angle + radians; if (swirlAngle > Math.PI * 2) { @@ -519,7 +519,7 @@ export abstract class Bubble implements IBubble { ' ' + relAnchorX + ',' + - relAnchorY + relAnchorY, ); steps.push( 'C' + @@ -533,7 +533,7 @@ export abstract class Bubble implements IBubble { ' ' + baseX2 + ',' + - baseY2 + baseY2, ); } steps.push('z'); @@ -560,7 +560,7 @@ export abstract class Bubble implements IBubble { this.workspace.RTL ? -this.relativeLeft + this.anchor.x - this.size.width : this.anchor.x + this.relativeLeft, - this.anchor.y + this.relativeTop + this.anchor.y + this.relativeTop, ); } diff --git a/core/bubbles/mini_workspace_bubble.ts b/core/bubbles/mini_workspace_bubble.ts index 7d3877b9a..035d7c661 100644 --- a/core/bubbles/mini_workspace_bubble.ts +++ b/core/bubbles/mini_workspace_bubble.ts @@ -49,7 +49,7 @@ export class MiniWorkspaceBubble extends Bubble { workspaceOptions: BlocklyOptions, protected readonly workspace: WorkspaceSvg, protected anchor: Coordinate, - protected ownerRect?: Rect + protected ownerRect?: Rect, ) { super(workspace, anchor, ownerRect); const options = new Options(workspaceOptions); @@ -61,7 +61,7 @@ export class MiniWorkspaceBubble extends Bubble { 'x': Bubble.BORDER_WIDTH, 'y': Bubble.BORDER_WIDTH, }, - this.contentContainer + this.contentContainer, ); workspaceOptions.parentWorkspace = this.workspace; this.miniWorkspace = this.newWorkspaceSvg(new Options(workspaceOptions)); @@ -70,7 +70,7 @@ export class MiniWorkspaceBubble extends Bubble { if (options.languageTree) { background.insertBefore( this.miniWorkspace.addFlyout(Svg.G), - this.miniWorkspace.getCanvas() + this.miniWorkspace.getCanvas(), ); const flyout = this.miniWorkspace.getFlyout(); flyout?.init(this.miniWorkspace); @@ -107,7 +107,7 @@ export class MiniWorkspaceBubble extends Bubble { private validateWorkspaceOptions(options: Options) { if (options.hasCategories) { throw new Error( - 'The miniworkspace bubble does not support toolboxes with categories' + 'The miniworkspace bubble does not support toolboxes with categories', ); } if (options.hasTrashcan) { @@ -126,12 +126,12 @@ export class MiniWorkspaceBubble extends Bubble { options.moveOptions.drag ) { throw new Error( - 'The miniworkspace bubble does not scrolling/moving the workspace' + 'The miniworkspace bubble does not scrolling/moving the workspace', ); } if (options.horizontalLayout) { throw new Error( - 'The miniworkspace bubble does not support horizontal layouts' + 'The miniworkspace bubble does not support horizontal layouts', ); } } @@ -206,9 +206,9 @@ export class MiniWorkspaceBubble extends Bubble { this.setSize( new Size( newSize.width + Bubble.DOUBLE_BORDER, - newSize.height + Bubble.DOUBLE_BORDER + newSize.height + Bubble.DOUBLE_BORDER, ), - this.autoLayout + this.autoLayout, ); this.miniWorkspace.resize(); this.miniWorkspace.recordDragTargets(); @@ -276,7 +276,7 @@ export class MiniWorkspaceBubble extends Bubble { newWorkspaceSvg(options: Options): WorkspaceSvg { throw new Error( 'The implementation of newWorkspaceSvg should be ' + - 'monkey-patched in by blockly.ts' + 'monkey-patched in by blockly.ts', ); } } diff --git a/core/bubbles/text_bubble.ts b/core/bubbles/text_bubble.ts index ecbe5a200..6f50d303b 100644 --- a/core/bubbles/text_bubble.ts +++ b/core/bubbles/text_bubble.ts @@ -22,7 +22,7 @@ export class TextBubble extends Bubble { private text: string, protected readonly workspace: WorkspaceSvg, protected anchor: Coordinate, - protected ownerRect?: Rect + protected ownerRect?: Rect, ) { super(workspace, anchor, ownerRect); this.paragraph = this.stringToSvg(text, this.contentContainer); @@ -62,7 +62,7 @@ export class TextBubble extends Bubble { 'class': 'blocklyText blocklyBubbleText blocklyNoPointerEvents', 'y': Bubble.BORDER_WIDTH, }, - container + container, ); } @@ -72,7 +72,7 @@ export class TextBubble extends Bubble { const tspan = dom.createSvgElement( Svg.TSPAN, {'dy': '1em', 'x': Bubble.BORDER_WIDTH}, - parent + parent, ); const textNode = document.createTextNode(line); tspan.appendChild(textNode); @@ -94,9 +94,9 @@ export class TextBubble extends Bubble { this.setSize( new Size( bbox.width + Bubble.BORDER_WIDTH * 2, - bbox.height + Bubble.BORDER_WIDTH * 2 + bbox.height + Bubble.BORDER_WIDTH * 2, ), - true + true, ); } } diff --git a/core/bubbles/textinput_bubble.ts b/core/bubbles/textinput_bubble.ts index 5f86e235b..081f86097 100644 --- a/core/bubbles/textinput_bubble.ts +++ b/core/bubbles/textinput_bubble.ts @@ -53,13 +53,13 @@ export class TextInputBubble extends Bubble { /** The default size of this bubble, including borders. */ private readonly DEFAULT_SIZE = new Size( 160 + Bubble.DOUBLE_BORDER, - 80 + Bubble.DOUBLE_BORDER + 80 + Bubble.DOUBLE_BORDER, ); /** The minimum size of this bubble, including borders. */ private readonly MIN_SIZE = new Size( 45 + Bubble.DOUBLE_BORDER, - 20 + Bubble.DOUBLE_BORDER + 20 + Bubble.DOUBLE_BORDER, ); /** @@ -72,11 +72,11 @@ export class TextInputBubble extends Bubble { constructor( protected readonly workspace: WorkspaceSvg, protected anchor: Coordinate, - protected ownerRect?: Rect + protected ownerRect?: Rect, ) { super(workspace, anchor, ownerRect); ({inputRoot: this.inputRoot, textArea: this.textArea} = this.createEditor( - this.contentContainer + this.contentContainer, )); this.resizeGroup = this.createResizeHandle(this.svgRoot); this.setSize(this.DEFAULT_SIZE, true); @@ -115,7 +115,7 @@ export class TextInputBubble extends Bubble { 'x': Bubble.BORDER_WIDTH, 'y': Bubble.BORDER_WIDTH, }, - container + container, ); const body = document.createElementNS(dom.HTML_NS, 'body'); @@ -124,7 +124,7 @@ export class TextInputBubble extends Bubble { const textArea = document.createElementNS( dom.HTML_NS, - 'textarea' + 'textarea', ) as HTMLTextAreaElement; textArea.className = 'blocklyCommentTextarea'; textArea.setAttribute('dir', this.workspace.RTL ? 'RTL' : 'LTR'); @@ -152,7 +152,7 @@ export class TextInputBubble extends Bubble { 'focus', this, this.onStartEdit, - true + true, ); browserEvents.conditionalBind(textArea, 'change', this, this.onTextChange); } @@ -164,13 +164,13 @@ export class TextInputBubble extends Bubble { { 'class': this.workspace.RTL ? 'blocklyResizeSW' : 'blocklyResizeSE', }, - container + container, ); const size = 2 * Bubble.BORDER_WIDTH; dom.createSvgElement( Svg.POLYGON, {'points': `0,${size} ${size},${size} ${size},0`}, - resizeGroup + resizeGroup, ); dom.createSvgElement( Svg.LINE, @@ -181,7 +181,7 @@ export class TextInputBubble extends Bubble { 'x2': size - 1, 'y2': size / 3, }, - resizeGroup + resizeGroup, ); dom.createSvgElement( Svg.LINE, @@ -192,14 +192,14 @@ export class TextInputBubble extends Bubble { 'x2': size - 1, 'y2': (size * 2) / 3, }, - resizeGroup + resizeGroup, ); browserEvents.conditionalBind( resizeGroup, 'pointerdown', this, - this.onResizePointerDown + this.onResizePointerDown, ); return resizeGroup; @@ -227,12 +227,12 @@ export class TextInputBubble extends Bubble { if (this.workspace.RTL) { this.resizeGroup.setAttribute( 'transform', - `translate(${Bubble.DOUBLE_BORDER}, ${heightMinusBorder}) scale(-1 1)` + `translate(${Bubble.DOUBLE_BORDER}, ${heightMinusBorder}) scale(-1 1)`, ); } else { this.resizeGroup.setAttribute( 'transform', - `translate(${widthMinusBorder}, ${heightMinusBorder})` + `translate(${widthMinusBorder}, ${heightMinusBorder})`, ); } @@ -258,21 +258,21 @@ export class TextInputBubble extends Bubble { e, new Coordinate( this.workspace.RTL ? -this.getSize().width : this.getSize().width, - this.getSize().height - ) + this.getSize().height, + ), ); this.resizePointerUpListener = browserEvents.conditionalBind( document, 'pointerup', this, - this.onResizePointerUp + this.onResizePointerUp, ); this.resizePointerMoveListener = browserEvents.conditionalBind( document, 'pointermove', this, - this.onResizePointerMove + this.onResizePointerMove, ); this.workspace.hideChaff(); // This event has been handled. No need to bubble up to the document. @@ -297,7 +297,7 @@ export class TextInputBubble extends Bubble { const delta = this.workspace.moveDrag(e); this.setSize( new Size(this.workspace.RTL ? -delta.x : delta.x, delta.y), - false + false, ); this.onSizeChange(); } diff --git a/core/bump_objects.ts b/core/bump_objects.ts index 7f4816791..4810f2b1c 100644 --- a/core/bump_objects.ts +++ b/core/bump_objects.ts @@ -35,7 +35,7 @@ import type {WorkspaceSvg} from './workspace_svg.js'; function bumpObjectIntoBounds( workspace: WorkspaceSvg, bounds: ContainerRegion, - object: IBoundedElement + object: IBoundedElement, ): boolean { // Compute new top/left position for object. const objectMetrics = object.getBoundingRectangle(); @@ -50,7 +50,7 @@ function bumpObjectIntoBounds( const newYPosition = mathUtils.clamp( topClamp, objectMetrics.top, - bottomClamp + bottomClamp, ); const deltaY = newYPosition - objectMetrics.top; @@ -73,7 +73,7 @@ function bumpObjectIntoBounds( const newXPosition = mathUtils.clamp( leftClamp, objectMetrics.left, - rightClamp + rightClamp, ); const deltaX = newXPosition - objectMetrics.left; @@ -92,7 +92,7 @@ export const bumpIntoBounds = bumpObjectIntoBounds; * @returns The event handler. */ export function bumpIntoBoundsHandler( - workspace: WorkspaceSvg + workspace: WorkspaceSvg, ): (p1: Abstract) => void { return (e) => { const metricsManager = workspace.getMetricsManager(); @@ -106,7 +106,7 @@ export function bumpIntoBoundsHandler( // Triggered by move/create event const object = extractObjectFromEvent( workspace, - e as eventUtils.BumpEvent + e as eventUtils.BumpEvent, ); if (!object) { return; @@ -118,13 +118,13 @@ export function bumpIntoBoundsHandler( const wasBumped = bumpObjectIntoBounds( workspace, scrollMetricsInWsCoords, - object as IBoundedElement + object as IBoundedElement, ); if (wasBumped && !e.group) { console.warn( 'Moved object in bounds but there was no' + - ' event group. This may break undo.' + ' event group. This may break undo.', ); } eventUtils.setGroup(existingGroup); @@ -152,7 +152,7 @@ export function bumpIntoBoundsHandler( */ function extractObjectFromEvent( workspace: WorkspaceSvg, - e: eventUtils.BumpEvent + e: eventUtils.BumpEvent, ): BlockSvg | null | WorkspaceCommentSvg { let object = null; switch (e.type) { @@ -166,7 +166,7 @@ function extractObjectFromEvent( case eventUtils.COMMENT_CREATE: case eventUtils.COMMENT_MOVE: object = workspace.getCommentById( - (e as CommentCreate | CommentMove).commentId! + (e as CommentCreate | CommentMove).commentId!, ) as WorkspaceCommentSvg | null; break; } diff --git a/core/common.ts b/core/common.ts index ec10d222d..b5fcd3540 100644 --- a/core/common.ts +++ b/core/common.ts @@ -188,7 +188,7 @@ export const draggingConnections: Connection[] = []; */ export function getBlockTypeCounts( block: Block, - opt_stripFollowing?: boolean + opt_stripFollowing?: boolean, ): {[key: string]: number} { const typeCountsMap = Object.create(null); const descendants = block.getDescendants(true); @@ -249,7 +249,7 @@ function defineBlocksWithJsonArrayInternal(jsonArray: AnyDuringMigration[]) { * definitions created. */ export function createBlockDefinitionsFromJsonArray( - jsonArray: AnyDuringMigration[] + jsonArray: AnyDuringMigration[], ): {[key: string]: BlockDefinition} { const blocks: {[key: string]: BlockDefinition} = {}; for (let i = 0; i < jsonArray.length; i++) { @@ -262,7 +262,7 @@ export function createBlockDefinitionsFromJsonArray( if (!type) { console.warn( `Block definition #${i} in JSON array is missing a type attribute. ` + - 'Skipping.' + 'Skipping.', ); continue; } diff --git a/core/component_manager.ts b/core/component_manager.ts index 4eed1d2a4..548cafcb3 100644 --- a/core/component_manager.ts +++ b/core/component_manager.ts @@ -70,7 +70,7 @@ export class ComponentManager { id + '" with capabilities "' + this.componentData.get(id)?.capabilities + - '" already added.' + '" already added.', ); } this.componentData.set(id, componentInfo); @@ -117,12 +117,12 @@ export class ComponentManager { capability + '". Plugin "' + id + - '" has not been added to the ComponentManager' + '" has not been added to the ComponentManager', ); } if (this.hasCapability(id, capability)) { console.warn( - 'Plugin "' + id + 'already has capability "' + capability + '"' + 'Plugin "' + id + 'already has capability "' + capability + '"', ); return; } @@ -144,7 +144,7 @@ export class ComponentManager { capability + '". Plugin "' + id + - '" has not been added to the ComponentManager' + '" has not been added to the ComponentManager', ); } if (!this.hasCapability(id, capability)) { @@ -153,7 +153,7 @@ export class ComponentManager { id + 'doesn\'t have capability "' + capability + - '" to remove' + '" to remove', ); return; } @@ -196,7 +196,7 @@ export class ComponentManager { */ getComponents( capability: string | Capability, - sorted: boolean + sorted: boolean, ): T[] { capability = `${capability}`.toLowerCase(); const componentIds = this.capabilityToComponentIds.get(capability); diff --git a/core/connection.ts b/core/connection.ts index c7c9a3da6..5dd8f06b9 100644 --- a/core/connection.ts +++ b/core/connection.ts @@ -75,7 +75,10 @@ export class Connection implements IASTNodeLocationWithBlock { * @param source The block establishing this connection. * @param type The type of the connection. */ - constructor(source: Block, public type: number) { + constructor( + source: Block, + public type: number, + ) { this.sourceBlock_ = source; } @@ -113,7 +116,7 @@ export class Connection implements IASTNodeLocationWithBlock { let event; if (eventUtils.isEnabled()) { event = new (eventUtils.get(eventUtils.BLOCK_MOVE))( - childBlock + childBlock, ) as BlockMove; event.setReason(['connect']); } @@ -133,7 +136,7 @@ export class Connection implements IASTNodeLocationWithBlock { if (!orphanConnection) return; const connection = Connection.getConnectionForOrphanedConnection( childBlock, - orphanConnection + orphanConnection, ); if (connection) { orphanConnection.connect(connection); @@ -278,7 +281,7 @@ export class Connection implements IASTNodeLocationWithBlock { let event; if (eventUtils.isEnabled()) { event = new (eventUtils.get(eventUtils.BLOCK_MOVE))( - childConnection.getSourceBlock() + childConnection.getSourceBlock(), ) as BlockMove; event.setReason(['disconnect']); } @@ -386,7 +389,7 @@ export class Connection implements IASTNodeLocationWithBlock { !this.getConnectionChecker().canConnect( this, this.targetConnection, - false + false, )) ) { const child = this.isSuperior() ? this.targetBlock() : this.sourceBlock_; @@ -666,7 +669,7 @@ export class Connection implements IASTNodeLocationWithBlock { } } else { throw new Error( - 'Cannot connect a shadow block to a previous/output connection' + 'Cannot connect a shadow block to a previous/output connection', ); } } @@ -700,12 +703,12 @@ export class Connection implements IASTNodeLocationWithBlock { */ static getConnectionForOrphanedConnection( startBlock: Block, - orphanConnection: Connection + orphanConnection: Connection, ): Connection | null { if (orphanConnection.type === ConnectionType.OUTPUT_VALUE) { return getConnectionForOrphanedOutput( startBlock, - orphanConnection.getSourceBlock() + orphanConnection.getSourceBlock(), ); } // Otherwise we're dealing with a stack. @@ -743,7 +746,7 @@ function connectReciprocally(first: Connection, second: Connection) { */ function getSingleConnection( block: Block, - orphanBlock: Block + orphanBlock: Block, ): Connection | null { let foundConnection = null; const output = orphanBlock.outputConnection; @@ -774,7 +777,7 @@ function getSingleConnection( */ function getConnectionForOrphanedOutput( startBlock: Block, - orphanBlock: Block + orphanBlock: Block, ): Connection | null { let newBlock: Block | null = startBlock; let connection; diff --git a/core/connection_checker.ts b/core/connection_checker.ts index 25cf87130..a0361d219 100644 --- a/core/connection_checker.ts +++ b/core/connection_checker.ts @@ -40,7 +40,7 @@ export class ConnectionChecker implements IConnectionChecker { a: Connection | null, b: Connection | null, isDragging: boolean, - opt_distance?: number + opt_distance?: number, ): boolean { return ( this.canConnectWithReason(a, b, isDragging, opt_distance) === @@ -64,7 +64,7 @@ export class ConnectionChecker implements IConnectionChecker { a: Connection | null, b: Connection | null, isDragging: boolean, - opt_distance?: number + opt_distance?: number, ): number { const safety = this.doSafetyChecks(a, b); if (safety !== Connection.CAN_CONNECT) { @@ -83,7 +83,7 @@ export class ConnectionChecker implements IConnectionChecker { !this.doDragChecks( a as RenderedConnection, b as RenderedConnection, - opt_distance || 0 + opt_distance || 0, ) ) { return Connection.REASON_DRAG_CHECKS_FAILED; @@ -103,7 +103,7 @@ export class ConnectionChecker implements IConnectionChecker { getErrorMessage( errorCode: number, a: Connection | null, - b: Connection | null + b: Connection | null, ): string { switch (errorCode) { case Connection.REASON_SELF_CONNECTION: @@ -230,7 +230,7 @@ export class ConnectionChecker implements IConnectionChecker { doDragChecks( a: RenderedConnection, b: RenderedConnection, - distance: number + distance: number, ): boolean { if (a.distanceFrom(b) > distance) { return false; @@ -345,5 +345,5 @@ export class ConnectionChecker implements IConnectionChecker { registry.register( registry.Type.CONNECTION_CHECKER, registry.DEFAULT, - ConnectionChecker + ConnectionChecker, ); diff --git a/core/connection_db.ts b/core/connection_db.ts index 1cf8900b7..781608bb7 100644 --- a/core/connection_db.ts +++ b/core/connection_db.ts @@ -59,7 +59,7 @@ export class ConnectionDB { */ private findIndexOfConnection( conn: RenderedConnection, - yPos: number + yPos: number, ): number { if (!this.connections.length) { return -1; @@ -145,7 +145,7 @@ export class ConnectionDB { */ getNeighbours( connection: RenderedConnection, - maxRadius: number + maxRadius: number, ): RenderedConnection[] { const db = this.connections; const currentX = connection.x; @@ -225,7 +225,7 @@ export class ConnectionDB { searchForClosest( conn: RenderedConnection, maxRadius: number, - dxy: Coordinate + dxy: Coordinate, ): {connection: RenderedConnection | null; radius: number} { if (!this.connections.length) { // Don't bother. diff --git a/core/contextmenu.ts b/core/contextmenu.ts index dc8cf1512..5a0c15943 100644 --- a/core/contextmenu.ts +++ b/core/contextmenu.ts @@ -70,7 +70,7 @@ let menu_: Menu | null = null; export function show( e: Event, options: (ContextMenuOption | LegacyContextMenuOption)[], - rtl: boolean + rtl: boolean, ) { WidgetDiv.show(dummyOwner, rtl, dispose); if (!options.length) { @@ -98,7 +98,7 @@ export function show( */ function populate_( options: (ContextMenuOption | LegacyContextMenuOption)[], - rtl: boolean + rtl: boolean, ): Menu { /* Here's what one option object looks like: {text: 'Make It So', @@ -151,7 +151,7 @@ function position_(menu: Menu, e: Event, rtl: boolean) { mouseEvent.clientY + viewportBBox.top, mouseEvent.clientY + viewportBBox.top, mouseEvent.clientX + viewportBBox.left, - mouseEvent.clientX + viewportBBox.left + mouseEvent.clientX + viewportBBox.left, ); createWidget_(menu); @@ -188,7 +188,7 @@ function createWidget_(menu: Menu) { menuDom as EventTarget, 'contextmenu', null, - haltPropagation + haltPropagation, ); // Focus only after the initial render to avoid issue #1329. menu.focus(); @@ -267,7 +267,7 @@ export function callbackFactory(block: Block, xml: Element): () => void { * @internal */ export function commentDeleteOption( - comment: WorkspaceCommentSvg + comment: WorkspaceCommentSvg, ): LegacyContextMenuOption { const deleteOption = { text: Msg['REMOVE_COMMENT'], @@ -291,7 +291,7 @@ export function commentDeleteOption( * @internal */ export function commentDuplicateOption( - comment: WorkspaceCommentSvg + comment: WorkspaceCommentSvg, ): LegacyContextMenuOption { const duplicateOption = { text: Msg['DUPLICATE_COMMENT'], @@ -315,7 +315,7 @@ export function commentDuplicateOption( */ export function workspaceCommentOption( ws: WorkspaceSvg, - e: Event + e: Event, ): ContextMenuOption { /** * Helper function to create and position a comment correctly based on the @@ -326,7 +326,7 @@ export function workspaceCommentOption( ws, Msg['WORKSPACE_COMMENT_DEFAULT_TEXT'], WorkspaceCommentSvg.DEFAULT_SIZE, - WorkspaceCommentSvg.DEFAULT_SIZE + WorkspaceCommentSvg.DEFAULT_SIZE, ); const injectionDiv = ws.getInjectionDiv(); @@ -339,7 +339,7 @@ export function workspaceCommentOption( const mouseEvent = e as MouseEvent; const clientOffsetPixels = new Coordinate( mouseEvent.clientX - boundingRect.left, - mouseEvent.clientY - boundingRect.top + mouseEvent.clientY - boundingRect.top, ); // The offset in pixels between the main workspace's origin and the upper @@ -350,7 +350,7 @@ export function workspaceCommentOption( // main workspace. const finalOffset = Coordinate.difference( clientOffsetPixels, - mainOffsetPixels + mainOffsetPixels, ); // The position of the new comment in main workspace coordinates. finalOffset.scale(1 / ws.scale); diff --git a/core/contextmenu_items.ts b/core/contextmenu_items.ts index ab0b104fc..aedd72614 100644 --- a/core/contextmenu_items.ts +++ b/core/contextmenu_items.ts @@ -286,13 +286,13 @@ export function registerDeleteAll() { dialog.confirm( Msg['DELETE_ALL_BLOCKS'].replace( '%1', - String(deletableBlocks.length) + String(deletableBlocks.length), ), function (ok) { if (ok) { deleteNext_(deletableBlocks); } - } + }, ); } }, diff --git a/core/contextmenu_registry.ts b/core/contextmenu_registry.ts index cd7534a63..440022d5c 100644 --- a/core/contextmenu_registry.ts +++ b/core/contextmenu_registry.ts @@ -82,7 +82,7 @@ export class ContextMenuRegistry { */ getContextMenuOptions( scopeType: ScopeType, - scope: Scope + scope: Scope, ): ContextMenuOption[] { const menuOptions: ContextMenuOption[] = []; for (const item of this.registry_.values()) { diff --git a/core/dialog.ts b/core/dialog.ts index 046b40c13..2de954bdc 100644 --- a/core/dialog.ts +++ b/core/dialog.ts @@ -9,7 +9,7 @@ goog.declareModuleId('Blockly.dialog'); let alertImplementation = function ( message: string, - opt_callback?: () => void + opt_callback?: () => void, ) { window.alert(message); if (opt_callback) { @@ -19,7 +19,7 @@ let alertImplementation = function ( let confirmImplementation = function ( message: string, - callback: (result: boolean) => void + callback: (result: boolean) => void, ) { callback(window.confirm(message)); }; @@ -27,7 +27,7 @@ let confirmImplementation = function ( let promptImplementation = function ( message: string, defaultValue: string, - callback: (result: string | null) => void + callback: (result: string | null) => void, ) { callback(window.prompt(message, defaultValue)); }; @@ -78,7 +78,7 @@ function confirmInternal(message: string, callback: (p1: boolean) => void) { * @see Blockly.dialog.confirm */ export function setConfirm( - confirmFunction: (p1: string, p2: (p1: boolean) => void) => void + confirmFunction: (p1: string, p2: (p1: boolean) => void) => void, ) { confirmImplementation = confirmFunction; } @@ -96,7 +96,7 @@ export function setConfirm( export function prompt( message: string, defaultValue: string, - callback: (p1: string | null) => void + callback: (p1: string | null) => void, ) { promptImplementation(message, defaultValue, callback); } @@ -111,8 +111,8 @@ export function setPrompt( promptFunction: ( p1: string, p2: string, - p3: (p1: string | null) => void - ) => void + p3: (p1: string | null) => void, + ) => void, ) { promptImplementation = promptFunction; } diff --git a/core/dropdowndiv.ts b/core/dropdowndiv.ts index f4b69b00a..76a7ad298 100644 --- a/core/dropdowndiv.ts +++ b/core/dropdowndiv.ts @@ -204,13 +204,13 @@ export function showPositionedByBlock( field: Field, block: BlockSvg, opt_onHide?: Function, - opt_secondaryYOffset?: number + opt_secondaryYOffset?: number, ): boolean { return showPositionedByRect( getScaledBboxOfBlock(block), field as Field, opt_onHide, - opt_secondaryYOffset + opt_secondaryYOffset, ); } @@ -228,14 +228,14 @@ export function showPositionedByBlock( export function showPositionedByField( field: Field, opt_onHide?: Function, - opt_secondaryYOffset?: number + opt_secondaryYOffset?: number, ): boolean { positionToField = true; return showPositionedByRect( getScaledBboxOfField(field as Field), field as Field, opt_onHide, - opt_secondaryYOffset + opt_secondaryYOffset, ); } /** @@ -280,7 +280,7 @@ function showPositionedByRect( bBox: Rect, field: Field, opt_onHide?: Function, - opt_secondaryYOffset?: number + opt_secondaryYOffset?: number, ): boolean { // If we can fit it, render below the block. const primaryX = bBox.left + (bBox.right - bBox.left) / 2; @@ -305,7 +305,7 @@ function showPositionedByRect( primaryY, secondaryX, secondaryY, - opt_onHide + opt_onHide, ); } @@ -335,7 +335,7 @@ export function show( primaryY: number, secondaryX: number, secondaryY: number, - opt_onHide?: Function + opt_onHide?: Function, ): boolean { owner = newOwner as Field; onHide = opt_onHide || null; @@ -399,7 +399,7 @@ const internal = { primaryX: number, primaryY: number, secondaryX: number, - secondaryY: number + secondaryY: number, ): PositionMetrics { const boundsInfo = internal.getBoundsInfo(); const divSize = style.getSize(div as Element); @@ -414,7 +414,7 @@ const internal = { secondaryX, secondaryY, boundsInfo, - divSize + divSize, ); } // Can we fit outside the workspace bounds (but inside the window) @@ -429,7 +429,7 @@ const internal = { secondaryX, secondaryY, boundsInfo, - divSize + divSize, ); } @@ -454,13 +454,13 @@ function getPositionBelowMetrics( primaryX: number, primaryY: number, boundsInfo: BoundsInfo, - divSize: Size + divSize: Size, ): PositionMetrics { const xCoords = getPositionX( primaryX, boundsInfo.left, boundsInfo.right, - divSize.width + divSize.width, ); const arrowY = -(ARROW_SIZE / 2 + BORDER_SIZE); @@ -494,13 +494,13 @@ function getPositionAboveMetrics( secondaryX: number, secondaryY: number, boundsInfo: BoundsInfo, - divSize: Size + divSize: Size, ): PositionMetrics { const xCoords = getPositionX( secondaryX, boundsInfo.left, boundsInfo.right, - divSize.width + divSize.width, ); const arrowY = divSize.height - BORDER_SIZE * 2 - ARROW_SIZE / 2; @@ -533,13 +533,13 @@ function getPositionAboveMetrics( function getPositionTopOfPageMetrics( sourceX: number, boundsInfo: BoundsInfo, - divSize: Size + divSize: Size, ): PositionMetrics { const xCoords = getPositionX( sourceX, boundsInfo.left, boundsInfo.right, - divSize.width + divSize.width, ); // No need to provide arrow-specific information because it won't be visible. @@ -571,7 +571,7 @@ export function getPositionX( sourceX: number, boundsLeft: number, boundsRight: number, - divWidth: number + divWidth: number, ): {divX: number; arrowX: number} { let divX = sourceX; // Offset the topLeft coord so that the dropdowndiv is centered. @@ -589,7 +589,7 @@ export function getPositionX( relativeArrowX = math.clamp( horizPadding, relativeArrowX, - divWidth - horizPadding - ARROW_SIZE + divWidth - horizPadding - ARROW_SIZE, ); return {arrowX: relativeArrowX, divX}; @@ -614,7 +614,7 @@ export function isVisible(): boolean { */ export function hideIfOwner( divOwner: Field, - opt_withoutAnimation?: boolean + opt_withoutAnimation?: boolean, ): boolean { if (owner === divOwner) { if (opt_withoutAnimation) { @@ -693,13 +693,13 @@ function positionInternal( primaryX: number, primaryY: number, secondaryX: number, - secondaryY: number + secondaryY: number, ): boolean { const metrics = internal.getPositionMetrics( primaryX, primaryY, secondaryX, - secondaryY + secondaryY, ); // Update arrow CSS. @@ -715,7 +715,7 @@ function positionInternal( 'class', metrics.arrowAtTop ? 'blocklyDropDownArrow blocklyArrowTop' - : 'blocklyDropDownArrow blocklyArrowBottom' + : 'blocklyDropDownArrow blocklyArrowBottom', ); } else { arrow.style.display = 'none'; diff --git a/core/events/events_abstract.ts b/core/events/events_abstract.ts index 4e6b6de12..284d2fa7a 100644 --- a/core/events/events_abstract.ts +++ b/core/events/events_abstract.ts @@ -77,7 +77,7 @@ export abstract class Abstract { static fromJson( json: AbstractEventJson, workspace: Workspace, - event: any + event: any, ): Abstract { event.isBlank = false; event.group = json['group'] || ''; @@ -119,7 +119,7 @@ export abstract class Abstract { if (!workspace) { throw Error( 'Workspace is null. Event must have been generated from real' + - ' Blockly events.' + ' Blockly events.', ); } return workspace; diff --git a/core/events/events_block_base.ts b/core/events/events_block_base.ts index 10fb84278..456669c26 100644 --- a/core/events/events_block_base.ts +++ b/core/events/events_block_base.ts @@ -53,7 +53,7 @@ export class BlockBase extends AbstractEvent { if (!this.blockId) { throw new Error( 'The block ID is undefined. Either pass a block to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } json['blockId'] = this.blockId; @@ -72,12 +72,12 @@ export class BlockBase extends AbstractEvent { static fromJson( json: BlockBaseJson, workspace: Workspace, - event?: any + event?: any, ): BlockBase { const newEvent = super.fromJson( json, workspace, - event ?? new BlockBase() + event ?? new BlockBase(), ) as BlockBase; newEvent.blockId = json['blockId']; return newEvent; diff --git a/core/events/events_block_change.ts b/core/events/events_block_change.ts index ff638266f..242af9e73 100644 --- a/core/events/events_block_change.ts +++ b/core/events/events_block_change.ts @@ -57,7 +57,7 @@ export class BlockChange extends BlockBase { opt_element?: string, opt_name?: string | null, opt_oldValue?: unknown, - opt_newValue?: unknown + opt_newValue?: unknown, ) { super(opt_block); @@ -80,7 +80,7 @@ export class BlockChange extends BlockBase { if (!this.element) { throw new Error( 'The changed element is undefined. Either pass an ' + - 'element to the constructor, or call fromJson' + 'element to the constructor, or call fromJson', ); } json['element'] = this.element; @@ -102,12 +102,12 @@ export class BlockChange extends BlockBase { static fromJson( json: BlockChangeJson, workspace: Workspace, - event?: any + event?: any, ): BlockChange { const newEvent = super.fromJson( json, workspace, - event ?? new BlockChange() + event ?? new BlockChange(), ) as BlockChange; newEvent.element = json['element']; newEvent.name = json['name']; @@ -135,14 +135,14 @@ export class BlockChange extends BlockBase { if (!this.blockId) { throw new Error( 'The block ID is undefined. Either pass a block to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } const block = workspace.getBlockById(this.blockId); if (!block) { throw new Error( 'The associated block is undefined. Either pass a ' + - 'block to the constructor, or call fromJson' + 'block to the constructor, or call fromJson', ); } // Assume the block is rendered so that then we can check. @@ -180,11 +180,11 @@ export class BlockChange extends BlockBase { block.loadExtraState(JSON.parse((value as string) || '{}')); } else if (block.domToMutation) { block.domToMutation( - utilsXml.textToDom((value as string) || '') + utilsXml.textToDom((value as string) || ''), ); } eventUtils.fire( - new BlockChange(block, 'mutation', null, oldState, value) + new BlockChange(block, 'mutation', null, oldState, value), ); break; } diff --git a/core/events/events_block_create.ts b/core/events/events_block_create.ts index 285a5b9e8..9abf5bac3 100644 --- a/core/events/events_block_create.ts +++ b/core/events/events_block_create.ts @@ -67,19 +67,19 @@ export class BlockCreate extends BlockBase { if (!this.xml) { throw new Error( 'The block XML is undefined. Either pass a block to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (!this.ids) { throw new Error( 'The block IDs are undefined. Either pass a block to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (!this.json) { throw new Error( 'The block JSON is undefined. Either pass a block to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } json['xml'] = Xml.domToText(this.xml); @@ -103,12 +103,12 @@ export class BlockCreate extends BlockBase { static fromJson( json: BlockCreateJson, workspace: Workspace, - event?: any + event?: any, ): BlockCreate { const newEvent = super.fromJson( json, workspace, - event ?? new BlockCreate() + event ?? new BlockCreate(), ) as BlockCreate; newEvent.xml = utilsXml.textToDom(json['xml']); newEvent.ids = json['ids']; @@ -129,13 +129,13 @@ export class BlockCreate extends BlockBase { if (!this.json) { throw new Error( 'The block JSON is undefined. Either pass a block to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (!this.ids) { throw new Error( 'The block IDs are undefined. Either pass a block to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (forward) { diff --git a/core/events/events_block_delete.ts b/core/events/events_block_delete.ts index 737939a65..627b388df 100644 --- a/core/events/events_block_delete.ts +++ b/core/events/events_block_delete.ts @@ -75,25 +75,25 @@ export class BlockDelete extends BlockBase { if (!this.oldXml) { throw new Error( 'The old block XML is undefined. Either pass a block ' + - 'to the constructor, or call fromJson' + 'to the constructor, or call fromJson', ); } if (!this.ids) { throw new Error( 'The block IDs are undefined. Either pass a block to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (this.wasShadow === undefined) { throw new Error( 'Whether the block was a shadow is undefined. Either ' + - 'pass a block to the constructor, or call fromJson' + 'pass a block to the constructor, or call fromJson', ); } if (!this.oldJson) { throw new Error( 'The old block JSON is undefined. Either pass a block ' + - 'to the constructor, or call fromJson' + 'to the constructor, or call fromJson', ); } json['oldXml'] = Xml.domToText(this.oldXml); @@ -118,12 +118,12 @@ export class BlockDelete extends BlockBase { static fromJson( json: BlockDeleteJson, workspace: Workspace, - event?: any + event?: any, ): BlockDelete { const newEvent = super.fromJson( json, workspace, - event ?? new BlockDelete() + event ?? new BlockDelete(), ) as BlockDelete; newEvent.oldXml = utilsXml.textToDom(json['oldXml']); newEvent.ids = json['ids']; @@ -146,13 +146,13 @@ export class BlockDelete extends BlockBase { if (!this.ids) { throw new Error( 'The block IDs are undefined. Either pass a block to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (!this.oldJson) { throw new Error( 'The old block JSON is undefined. Either pass a block ' + - 'to the constructor, or call fromJson' + 'to the constructor, or call fromJson', ); } if (forward) { diff --git a/core/events/events_block_drag.ts b/core/events/events_block_drag.ts index 501c36076..78f8de7a3 100644 --- a/core/events/events_block_drag.ts +++ b/core/events/events_block_drag.ts @@ -65,13 +65,13 @@ export class BlockDrag extends UiBase { if (this.isStart === undefined) { throw new Error( 'Whether this event is the start of a drag is undefined. ' + - 'Either pass the value to the constructor, or call fromJson' + 'Either pass the value to the constructor, or call fromJson', ); } if (this.blockId === undefined) { throw new Error( 'The block ID is undefined. Either pass a block to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } json['isStart'] = this.isStart; @@ -94,12 +94,12 @@ export class BlockDrag extends UiBase { static fromJson( json: BlockDragJson, workspace: Workspace, - event?: any + event?: any, ): BlockDrag { const newEvent = super.fromJson( json, workspace, - event ?? new BlockDrag() + event ?? new BlockDrag(), ) as BlockDrag; newEvent.isStart = json['isStart']; newEvent.blockId = json['blockId']; diff --git a/core/events/events_block_field_intermediate_change.ts b/core/events/events_block_field_intermediate_change.ts index 76e3c1068..9eacee8be 100644 --- a/core/events/events_block_field_intermediate_change.ts +++ b/core/events/events_block_field_intermediate_change.ts @@ -59,7 +59,7 @@ export class BlockFieldIntermediateChange extends BlockBase { opt_block?: Block, opt_name?: string, opt_oldValue?: unknown, - opt_newValue?: unknown + opt_newValue?: unknown, ) { super(opt_block); if (!opt_block) { @@ -81,7 +81,7 @@ export class BlockFieldIntermediateChange extends BlockBase { if (!this.name) { throw new Error( 'The changed field name is undefined. Either pass a ' + - 'name to the constructor, or call fromJson.' + 'name to the constructor, or call fromJson.', ); } json['name'] = this.name; @@ -102,12 +102,12 @@ export class BlockFieldIntermediateChange extends BlockBase { static fromJson( json: BlockFieldIntermediateChangeJson, workspace: Workspace, - event?: any + event?: any, ): BlockFieldIntermediateChange { const newEvent = super.fromJson( json, workspace, - event ?? new BlockFieldIntermediateChange() + event ?? new BlockFieldIntermediateChange(), ) as BlockFieldIntermediateChange; newEvent.name = json['name']; newEvent.oldValue = json['oldValue']; @@ -134,5 +134,5 @@ export interface BlockFieldIntermediateChangeJson extends BlockBaseJson { registry.register( registry.Type.EVENT, eventUtils.BLOCK_FIELD_INTERMEDIATE_CHANGE, - BlockFieldIntermediateChange + BlockFieldIntermediateChange, ); diff --git a/core/events/events_block_move.ts b/core/events/events_block_move.ts index de32299a9..114a1b09d 100644 --- a/core/events/events_block_move.ts +++ b/core/events/events_block_move.ts @@ -139,12 +139,12 @@ export class BlockMove extends BlockBase { static fromJson( json: BlockMoveJson, workspace: Workspace, - event?: any + event?: any, ): BlockMove { const newEvent = super.fromJson( json, workspace, - event ?? new BlockMove() + event ?? new BlockMove(), ) as BlockMove; newEvent.oldParentId = json['oldParentId']; newEvent.oldInputName = json['oldInputName']; @@ -195,13 +195,14 @@ export class BlockMove extends BlockBase { if (!this.blockId) { throw new Error( 'The block ID is undefined. Either pass a block to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } const block = workspace.getBlockById(this.blockId); if (!block) { throw new Error( - 'The block associated with the block move event ' + 'could not be found' + 'The block associated with the block move event ' + + 'could not be found', ); } const location = {} as BlockLocation; @@ -241,7 +242,7 @@ export class BlockMove extends BlockBase { if (!this.blockId) { throw new Error( 'The block ID is undefined. Either pass a block to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } const block = workspace.getBlockById(this.blockId); diff --git a/core/events/events_bubble_open.ts b/core/events/events_bubble_open.ts index 32c76b490..d275ee683 100644 --- a/core/events/events_bubble_open.ts +++ b/core/events/events_bubble_open.ts @@ -44,7 +44,7 @@ export class BubbleOpen extends UiBase { constructor( opt_block?: BlockSvg, opt_isOpen?: boolean, - opt_bubbleType?: BubbleType + opt_bubbleType?: BubbleType, ) { const workspaceId = opt_block ? opt_block.workspace.id : undefined; super(workspaceId); @@ -65,13 +65,13 @@ export class BubbleOpen extends UiBase { if (this.isOpen === undefined) { throw new Error( 'Whether this event is for opening the bubble is undefined. ' + - 'Either pass the value to the constructor, or call fromJson' + 'Either pass the value to the constructor, or call fromJson', ); } if (!this.bubbleType) { throw new Error( 'The type of bubble is undefined. Either pass the ' + - 'value to the constructor, or call fromJson' + 'value to the constructor, or call fromJson', ); } json['isOpen'] = this.isOpen; @@ -92,12 +92,12 @@ export class BubbleOpen extends UiBase { static fromJson( json: BubbleOpenJson, workspace: Workspace, - event?: any + event?: any, ): BubbleOpen { const newEvent = super.fromJson( json, workspace, - event ?? new BubbleOpen() + event ?? new BubbleOpen(), ) as BubbleOpen; newEvent.isOpen = json['isOpen']; newEvent.bubbleType = json['bubbleType']; diff --git a/core/events/events_click.ts b/core/events/events_click.ts index a33ea8897..8b324f9e1 100644 --- a/core/events/events_click.ts +++ b/core/events/events_click.ts @@ -46,7 +46,7 @@ export class Click extends UiBase { constructor( opt_block?: Block | null, opt_workspaceId?: string | null, - opt_targetType?: ClickTarget + opt_targetType?: ClickTarget, ) { let workspaceId = opt_block ? opt_block.workspace.id : opt_workspaceId; if (workspaceId === null) { @@ -68,7 +68,7 @@ export class Click extends UiBase { if (!this.targetType) { throw new Error( 'The click target type is undefined. Either pass a block to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } json['targetType'] = this.targetType; @@ -89,7 +89,7 @@ export class Click extends UiBase { const newEvent = super.fromJson( json, workspace, - event ?? new Click() + event ?? new Click(), ) as Click; newEvent.targetType = json['targetType']; newEvent.blockId = json['blockId']; diff --git a/core/events/events_comment_base.ts b/core/events/events_comment_base.ts index 0dc4ee62f..1612a180c 100644 --- a/core/events/events_comment_base.ts +++ b/core/events/events_comment_base.ts @@ -61,7 +61,7 @@ export class CommentBase extends AbstractEvent { if (!this.commentId) { throw new Error( 'The comment ID is undefined. Either pass a comment to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } json['commentId'] = this.commentId; @@ -80,12 +80,12 @@ export class CommentBase extends AbstractEvent { static fromJson( json: CommentBaseJson, workspace: Workspace, - event?: any + event?: any, ): CommentBase { const newEvent = super.fromJson( json, workspace, - event ?? new CommentBase() + event ?? new CommentBase(), ) as CommentBase; newEvent.commentId = json['commentId']; return newEvent; @@ -99,7 +99,7 @@ export class CommentBase extends AbstractEvent { */ static CommentCreateDeleteHelper( event: CommentCreate | CommentDelete, - create: boolean + create: boolean, ) { const workspace = event.getEventWorkspace_(); if (create) { @@ -113,7 +113,7 @@ export class CommentBase extends AbstractEvent { if (!event.commentId) { throw new Error( 'The comment ID is undefined. Either pass a comment to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } const comment = workspace.getCommentById(event.commentId); diff --git a/core/events/events_comment_change.ts b/core/events/events_comment_change.ts index 62064f41a..bbdd171c4 100644 --- a/core/events/events_comment_change.ts +++ b/core/events/events_comment_change.ts @@ -41,7 +41,7 @@ export class CommentChange extends CommentBase { constructor( opt_comment?: WorkspaceComment, opt_oldContents?: string, - opt_newContents?: string + opt_newContents?: string, ) { super(opt_comment); @@ -65,13 +65,13 @@ export class CommentChange extends CommentBase { if (!this.oldContents_) { throw new Error( 'The old contents is undefined. Either pass a value to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (!this.newContents_) { throw new Error( 'The new contents is undefined. Either pass a value to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } json['oldContents'] = this.oldContents_; @@ -91,12 +91,12 @@ export class CommentChange extends CommentBase { static fromJson( json: CommentChangeJson, workspace: Workspace, - event?: any + event?: any, ): CommentChange { const newEvent = super.fromJson( json, workspace, - event ?? new CommentChange() + event ?? new CommentChange(), ) as CommentChange; newEvent.oldContents_ = json['oldContents']; newEvent.newContents_ = json['newContents']; @@ -122,7 +122,7 @@ export class CommentChange extends CommentBase { if (!this.commentId) { throw new Error( 'The comment ID is undefined. Either pass a comment to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } const comment = workspace.getCommentById(this.commentId); @@ -135,12 +135,12 @@ export class CommentChange extends CommentBase { if (forward) { throw new Error( 'The new contents is undefined. Either pass a value to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } throw new Error( 'The old contents is undefined. Either pass a value to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } comment.setContent(contents); @@ -155,5 +155,5 @@ export interface CommentChangeJson extends CommentBaseJson { registry.register( registry.Type.EVENT, eventUtils.COMMENT_CHANGE, - CommentChange + CommentChange, ); diff --git a/core/events/events_comment_create.ts b/core/events/events_comment_create.ts index 6bd317b3d..e7d7f7360 100644 --- a/core/events/events_comment_create.ts +++ b/core/events/events_comment_create.ts @@ -55,7 +55,7 @@ export class CommentCreate extends CommentBase { if (!this.xml) { throw new Error( 'The comment XML is undefined. Either pass a comment to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } json['xml'] = Xml.domToText(this.xml); @@ -74,12 +74,12 @@ export class CommentCreate extends CommentBase { static fromJson( json: CommentCreateJson, workspace: Workspace, - event?: any + event?: any, ): CommentCreate { const newEvent = super.fromJson( json, workspace, - event ?? new CommentCreate() + event ?? new CommentCreate(), ) as CommentCreate; newEvent.xml = utilsXml.textToDom(json['xml']); return newEvent; @@ -102,5 +102,5 @@ export interface CommentCreateJson extends CommentBaseJson { registry.register( registry.Type.EVENT, eventUtils.COMMENT_CREATE, - CommentCreate + CommentCreate, ); diff --git a/core/events/events_comment_delete.ts b/core/events/events_comment_delete.ts index 8b418735d..e920c47fd 100644 --- a/core/events/events_comment_delete.ts +++ b/core/events/events_comment_delete.ts @@ -63,7 +63,7 @@ export class CommentDelete extends CommentBase { if (!this.xml) { throw new Error( 'The comment XML is undefined. Either pass a comment to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } json['xml'] = Xml.domToText(this.xml); @@ -82,12 +82,12 @@ export class CommentDelete extends CommentBase { static fromJson( json: CommentDeleteJson, workspace: Workspace, - event?: any + event?: any, ): CommentDelete { const newEvent = super.fromJson( json, workspace, - event ?? new CommentDelete() + event ?? new CommentDelete(), ) as CommentDelete; newEvent.xml = utilsXml.textToDom(json['xml']); return newEvent; @@ -101,5 +101,5 @@ export interface CommentDeleteJson extends CommentBaseJson { registry.register( registry.Type.EVENT, eventUtils.COMMENT_DELETE, - CommentDelete + CommentDelete, ); diff --git a/core/events/events_comment_move.ts b/core/events/events_comment_move.ts index a5039a24f..243071b85 100644 --- a/core/events/events_comment_move.ts +++ b/core/events/events_comment_move.ts @@ -59,13 +59,13 @@ export class CommentMove extends CommentBase { if (this.newCoordinate_) { throw Error( 'Tried to record the new position of a comment on the ' + - 'same event twice.' + 'same event twice.', ); } if (!this.comment_) { throw new Error( 'The comment is undefined. Pass a comment to ' + - 'the constructor if you want to use the record functionality' + 'the constructor if you want to use the record functionality', ); } this.newCoordinate_ = this.comment_.getRelativeToSurfaceXY(); @@ -92,13 +92,13 @@ export class CommentMove extends CommentBase { if (!this.oldCoordinate_) { throw new Error( 'The old comment position is undefined. Either pass a comment to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (!this.newCoordinate_) { throw new Error( 'The new comment position is undefined. Either call recordNew, or ' + - 'call fromJson' + 'call fromJson', ); } json['oldCoordinate'] = @@ -123,12 +123,12 @@ export class CommentMove extends CommentBase { static fromJson( json: CommentMoveJson, workspace: Workspace, - event?: any + event?: any, ): CommentMove { const newEvent = super.fromJson( json, workspace, - event ?? new CommentMove() + event ?? new CommentMove(), ) as CommentMove; let xy = json['oldCoordinate'].split(','); newEvent.oldCoordinate_ = new Coordinate(Number(xy[0]), Number(xy[1])); @@ -156,7 +156,7 @@ export class CommentMove extends CommentBase { if (!this.commentId) { throw new Error( 'The comment ID is undefined. Either pass a comment to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } const comment = workspace.getCommentById(this.commentId); @@ -170,7 +170,7 @@ export class CommentMove extends CommentBase { throw new Error( 'Either oldCoordinate_ or newCoordinate_ is undefined. ' + 'Either pass a comment to the constructor and call recordNew, ' + - 'or call fromJson' + 'or call fromJson', ); } // TODO: Check if the comment is being dragged, and give up if so. diff --git a/core/events/events_marker_move.ts b/core/events/events_marker_move.ts index 074532510..dc82b7c82 100644 --- a/core/events/events_marker_move.ts +++ b/core/events/events_marker_move.ts @@ -58,7 +58,7 @@ export class MarkerMove extends UiBase { opt_block?: Block | null, isCursor?: boolean, opt_oldNode?: ASTNode | null, - opt_newNode?: ASTNode + opt_newNode?: ASTNode, ) { let workspaceId = opt_block ? opt_block.workspace.id : undefined; if (opt_newNode && opt_newNode.getType() === ASTNode.types.WORKSPACE) { @@ -82,13 +82,13 @@ export class MarkerMove extends UiBase { if (this.isCursor === undefined) { throw new Error( 'Whether this is a cursor event or not is undefined. Either pass ' + - 'a value to the constructor, or call fromJson' + 'a value to the constructor, or call fromJson', ); } if (!this.newNode) { throw new Error( 'The new node is undefined. Either pass a node to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } json['isCursor'] = this.isCursor; @@ -110,12 +110,12 @@ export class MarkerMove extends UiBase { static fromJson( json: MarkerMoveJson, workspace: Workspace, - event?: any + event?: any, ): MarkerMove { const newEvent = super.fromJson( json, workspace, - event ?? new MarkerMove() + event ?? new MarkerMove(), ) as MarkerMove; newEvent.isCursor = json['isCursor']; newEvent.blockId = json['blockId']; diff --git a/core/events/events_selected.ts b/core/events/events_selected.ts index 833420a5a..e857db5f0 100644 --- a/core/events/events_selected.ts +++ b/core/events/events_selected.ts @@ -46,7 +46,7 @@ export class Selected extends UiBase { constructor( opt_oldElementId?: string | null, opt_newElementId?: string | null, - opt_workspaceId?: string + opt_workspaceId?: string, ) { super(opt_workspaceId); @@ -78,12 +78,12 @@ export class Selected extends UiBase { static fromJson( json: SelectedJson, workspace: Workspace, - event?: any + event?: any, ): Selected { const newEvent = super.fromJson( json, workspace, - event ?? new Selected() + event ?? new Selected(), ) as Selected; newEvent.oldElementId = json['oldElementId']; newEvent.newElementId = json['newElementId']; diff --git a/core/events/events_theme_change.ts b/core/events/events_theme_change.ts index 4deb1d70a..b236dcc5f 100644 --- a/core/events/events_theme_change.ts +++ b/core/events/events_theme_change.ts @@ -47,7 +47,7 @@ export class ThemeChange extends UiBase { if (!this.themeName) { throw new Error( 'The theme name is undefined. Either pass a theme name to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } json['themeName'] = this.themeName; @@ -66,12 +66,12 @@ export class ThemeChange extends UiBase { static fromJson( json: ThemeChangeJson, workspace: Workspace, - event?: any + event?: any, ): ThemeChange { const newEvent = super.fromJson( json, workspace, - event ?? new ThemeChange() + event ?? new ThemeChange(), ) as ThemeChange; newEvent.themeName = json['themeName']; return newEvent; diff --git a/core/events/events_toolbox_item_select.ts b/core/events/events_toolbox_item_select.ts index f89485da6..56bbb189b 100644 --- a/core/events/events_toolbox_item_select.ts +++ b/core/events/events_toolbox_item_select.ts @@ -41,7 +41,7 @@ export class ToolboxItemSelect extends UiBase { constructor( opt_oldItem?: string | null, opt_newItem?: string | null, - opt_workspaceId?: string + opt_workspaceId?: string, ) { super(opt_workspaceId); this.oldItem = opt_oldItem ?? undefined; @@ -72,12 +72,12 @@ export class ToolboxItemSelect extends UiBase { static fromJson( json: ToolboxItemSelectJson, workspace: Workspace, - event?: any + event?: any, ): ToolboxItemSelect { const newEvent = super.fromJson( json, workspace, - event ?? new ToolboxItemSelect() + event ?? new ToolboxItemSelect(), ) as ToolboxItemSelect; newEvent.oldItem = json['oldItem']; newEvent.newItem = json['newItem']; @@ -93,5 +93,5 @@ export interface ToolboxItemSelectJson extends AbstractEventJson { registry.register( registry.Type.EVENT, eventUtils.TOOLBOX_ITEM_SELECT, - ToolboxItemSelect + ToolboxItemSelect, ); diff --git a/core/events/events_trashcan_open.ts b/core/events/events_trashcan_open.ts index 71b12dbe2..567197b65 100644 --- a/core/events/events_trashcan_open.ts +++ b/core/events/events_trashcan_open.ts @@ -51,7 +51,7 @@ export class TrashcanOpen extends UiBase { if (this.isOpen === undefined) { throw new Error( 'Whether this is already open or not is undefined. Either pass ' + - 'a value to the constructor, or call fromJson' + 'a value to the constructor, or call fromJson', ); } json['isOpen'] = this.isOpen; @@ -70,12 +70,12 @@ export class TrashcanOpen extends UiBase { static fromJson( json: TrashcanOpenJson, workspace: Workspace, - event?: any + event?: any, ): TrashcanOpen { const newEvent = super.fromJson( json, workspace, - event ?? new TrashcanOpen() + event ?? new TrashcanOpen(), ) as TrashcanOpen; newEvent.isOpen = json['isOpen']; return newEvent; diff --git a/core/events/events_var_base.ts b/core/events/events_var_base.ts index 1792c411a..98f9ed1ba 100644 --- a/core/events/events_var_base.ts +++ b/core/events/events_var_base.ts @@ -51,7 +51,7 @@ export class VarBase extends AbstractEvent { if (!this.varId) { throw new Error( 'The var ID is undefined. Either pass a variable to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } json['varId'] = this.varId; @@ -70,12 +70,12 @@ export class VarBase extends AbstractEvent { static fromJson( json: VarBaseJson, workspace: Workspace, - event?: any + event?: any, ): VarBase { const newEvent = super.fromJson( json, workspace, - event ?? new VarBase() + event ?? new VarBase(), ) as VarBase; newEvent.varId = json['varId']; return newEvent; diff --git a/core/events/events_var_create.ts b/core/events/events_var_create.ts index 83f541f9a..0e17f0a3e 100644 --- a/core/events/events_var_create.ts +++ b/core/events/events_var_create.ts @@ -54,13 +54,13 @@ export class VarCreate extends VarBase { if (this.varType === undefined) { throw new Error( 'The var type is undefined. Either pass a variable to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (!this.varName) { throw new Error( 'The var name is undefined. Either pass a variable to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } json['varType'] = this.varType; @@ -80,12 +80,12 @@ export class VarCreate extends VarBase { static fromJson( json: VarCreateJson, workspace: Workspace, - event?: any + event?: any, ): VarCreate { const newEvent = super.fromJson( json, workspace, - event ?? new VarCreate() + event ?? new VarCreate(), ) as VarCreate; newEvent.varType = json['varType']; newEvent.varName = json['varName']; @@ -102,13 +102,13 @@ export class VarCreate extends VarBase { if (!this.varId) { throw new Error( 'The var ID is undefined. Either pass a variable to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (!this.varName) { throw new Error( 'The var name is undefined. Either pass a variable to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (forward) { diff --git a/core/events/events_var_delete.ts b/core/events/events_var_delete.ts index e12dcf592..bdb3d19fc 100644 --- a/core/events/events_var_delete.ts +++ b/core/events/events_var_delete.ts @@ -49,13 +49,13 @@ export class VarDelete extends VarBase { if (this.varType === undefined) { throw new Error( 'The var type is undefined. Either pass a variable to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (!this.varName) { throw new Error( 'The var name is undefined. Either pass a variable to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } json['varType'] = this.varType; @@ -75,12 +75,12 @@ export class VarDelete extends VarBase { static fromJson( json: VarDeleteJson, workspace: Workspace, - event?: any + event?: any, ): VarDelete { const newEvent = super.fromJson( json, workspace, - event ?? new VarDelete() + event ?? new VarDelete(), ) as VarDelete; newEvent.varType = json['varType']; newEvent.varName = json['varName']; @@ -97,13 +97,13 @@ export class VarDelete extends VarBase { if (!this.varId) { throw new Error( 'The var ID is undefined. Either pass a variable to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (!this.varName) { throw new Error( 'The var name is undefined. Either pass a variable to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (forward) { diff --git a/core/events/events_var_rename.ts b/core/events/events_var_rename.ts index c80b4e2ef..4d2d31019 100644 --- a/core/events/events_var_rename.ts +++ b/core/events/events_var_rename.ts @@ -52,13 +52,13 @@ export class VarRename extends VarBase { if (!this.oldName) { throw new Error( 'The old var name is undefined. Either pass a variable to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (!this.newName) { throw new Error( 'The new var name is undefined. Either pass a value to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } json['oldName'] = this.oldName; @@ -78,12 +78,12 @@ export class VarRename extends VarBase { static fromJson( json: VarRenameJson, workspace: Workspace, - event?: any + event?: any, ): VarRename { const newEvent = super.fromJson( json, workspace, - event ?? new VarRename() + event ?? new VarRename(), ) as VarRename; newEvent.oldName = json['oldName']; newEvent.newName = json['newName']; @@ -100,19 +100,19 @@ export class VarRename extends VarBase { if (!this.varId) { throw new Error( 'The var ID is undefined. Either pass a variable to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (!this.oldName) { throw new Error( 'The old var name is undefined. Either pass a variable to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (!this.newName) { throw new Error( 'The new var name is undefined. Either pass a value to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (forward) { diff --git a/core/events/events_viewport.ts b/core/events/events_viewport.ts index 31e35e18c..3a0a7961b 100644 --- a/core/events/events_viewport.ts +++ b/core/events/events_viewport.ts @@ -61,7 +61,7 @@ export class ViewportChange extends UiBase { opt_left?: number, opt_scale?: number, opt_workspaceId?: string, - opt_oldScale?: number + opt_oldScale?: number, ) { super(opt_workspaceId); @@ -81,25 +81,25 @@ export class ViewportChange extends UiBase { if (this.viewTop === undefined) { throw new Error( 'The view top is undefined. Either pass a value to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (this.viewLeft === undefined) { throw new Error( 'The view left is undefined. Either pass a value to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (this.scale === undefined) { throw new Error( 'The scale is undefined. Either pass a value to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } if (this.oldScale === undefined) { throw new Error( 'The old scale is undefined. Either pass a value to ' + - 'the constructor, or call fromJson' + 'the constructor, or call fromJson', ); } json['viewTop'] = this.viewTop; @@ -121,12 +121,12 @@ export class ViewportChange extends UiBase { static fromJson( json: ViewportChangeJson, workspace: Workspace, - event?: any + event?: any, ): ViewportChange { const newEvent = super.fromJson( json, workspace, - event ?? new ViewportChange() + event ?? new ViewportChange(), ) as ViewportChange; newEvent.viewTop = json['viewTop']; newEvent.viewLeft = json['viewLeft']; @@ -146,5 +146,5 @@ export interface ViewportChangeJson extends AbstractEventJson { registry.register( registry.Type.EVENT, eventUtils.VIEWPORT_CHANGE, - ViewportChange + ViewportChange, ); diff --git a/core/events/utils.ts b/core/events/utils.ts index 0636a39fe..3ca6065b0 100644 --- a/core/events/utils.ts +++ b/core/events/utils.ts @@ -343,7 +343,7 @@ export function filter(queueIn: Abstract[], forward: boolean): Abstract[] { if (lastEvent.reason) { // Concatenate reasons without duplicates. const reasonSet = new Set( - moveEvent.reason.concat(lastEvent.reason) + moveEvent.reason.concat(lastEvent.reason), ); lastEvent.reason = Array.from(reasonSet); } else { @@ -489,7 +489,7 @@ export function getDescendantIds(block: Block): string[] { */ export function fromJson( json: AnyDuringMigration, - workspace: Workspace + workspace: Workspace, ): Abstract { const eventClass = get(json['type']); if (!eventClass) throw Error('Unknown event type.'); @@ -504,7 +504,7 @@ export function fromJson( * @returns The event class with the given type. */ export function get( - eventType: string + eventType: string, ): new (...p1: AnyDuringMigration[]) => Abstract { const event = registry.getClass(registry.Type.EVENT, eventType); if (!event) { @@ -528,7 +528,7 @@ export function disableOrphans(event: Abstract) { return; } const eventWorkspace = common.getWorkspaceById( - blockEvent.workspaceId + blockEvent.workspaceId, ) as WorkspaceSvg; if (!blockEvent.blockId) { throw new Error('Encountered a blockEvent without a proper blockId'); diff --git a/core/events/workspace_events.ts b/core/events/workspace_events.ts index 550b6ebda..ab947320c 100644 --- a/core/events/workspace_events.ts +++ b/core/events/workspace_events.ts @@ -43,5 +43,5 @@ export class FinishedLoading extends AbstractEvent { registry.register( registry.Type.EVENT, eventUtils.FINISHED_LOADING, - FinishedLoading + FinishedLoading, ); diff --git a/core/extensions.ts b/core/extensions.ts index 1b133f7ef..b3da9f137 100644 --- a/core/extensions.ts +++ b/core/extensions.ts @@ -75,7 +75,7 @@ export function registerMutator( name: string, mixinObj: AnyDuringMigration, opt_helperFn?: () => AnyDuringMigration, - opt_blockList?: string[] + opt_blockList?: string[], ) { const errorPrefix = 'Error when registering mutator "' + name + '": '; @@ -110,7 +110,7 @@ export function unregister(name: string) { delete allExtensions[name]; } else { console.warn( - 'No extension mapping for name "' + name + '" found to unregister' + 'No extension mapping for name "' + name + '" found to unregister', ); } } @@ -161,7 +161,7 @@ export function apply(name: string, block: Block, isMutator: boolean) { 'Error when applying extension "' + name + '": ' + - 'mutation properties changed when applying a non-mutator extension.' + 'mutation properties changed when applying a non-mutator extension.', ); } } @@ -184,7 +184,7 @@ function checkNoMutatorProperties(mutationName: string, block: Block) { mutationName + '" to a block that already has mutator functions.' + ' Block id: ' + - block.id + block.id, ); } } @@ -202,12 +202,12 @@ function checkNoMutatorProperties(mutationName: string, block: Block) { */ function checkXmlHooks( object: AnyDuringMigration, - errorPrefix: string + errorPrefix: string, ): boolean { return checkHasFunctionPair( object.mutationToDom, object.domToMutation, - errorPrefix + ' mutationToDom/domToMutation' + errorPrefix + ' mutationToDom/domToMutation', ); } /** @@ -223,12 +223,12 @@ function checkXmlHooks( */ function checkJsonHooks( object: AnyDuringMigration, - errorPrefix: string + errorPrefix: string, ): boolean { return checkHasFunctionPair( object.saveExtraState, object.loadExtraState, - errorPrefix + ' saveExtraState/loadExtraState' + errorPrefix + ' saveExtraState/loadExtraState', ); } @@ -244,12 +244,12 @@ function checkJsonHooks( */ function checkMutatorDialog( object: AnyDuringMigration, - errorPrefix: string + errorPrefix: string, ): boolean { return checkHasFunctionPair( object.compose, object.decompose, - errorPrefix + ' compose/decompose' + errorPrefix + ' compose/decompose', ); } @@ -268,7 +268,7 @@ function checkMutatorDialog( function checkHasFunctionPair( func1: AnyDuringMigration, func2: AnyDuringMigration, - errorPrefix: string + errorPrefix: string, ): boolean { if (func1 && func2) { if (typeof func1 !== 'function' || typeof func2 !== 'function') { @@ -289,14 +289,14 @@ function checkHasFunctionPair( */ function checkHasMutatorProperties( errorPrefix: string, - object: AnyDuringMigration + object: AnyDuringMigration, ) { const hasXmlHooks = checkXmlHooks(object, errorPrefix); const hasJsonHooks = checkJsonHooks(object, errorPrefix); if (!hasXmlHooks && !hasJsonHooks) { throw Error( errorPrefix + - 'Mutations must contain either XML hooks, or JSON hooks, or both' + 'Mutations must contain either XML hooks, or JSON hooks, or both', ); } // A block with a mutator isn't required to have a mutation dialog, but @@ -347,7 +347,7 @@ function getMutatorProperties(block: Block): AnyDuringMigration[] { */ function mutatorPropertiesMatch( oldProperties: AnyDuringMigration[], - block: Block + block: Block, ): boolean { const newProperties = getMutatorProperties(block); if (newProperties.length !== oldProperties.length) { @@ -406,7 +406,7 @@ export function runAfterPageLoad(fn: () => void) { */ export function buildTooltipForDropdown( dropdownName: string, - lookupTable: {[key: string]: string} + lookupTable: {[key: string]: string}, ): Function { // List of block types already validated, to minimize duplicate warnings. const blockTypesChecked: AnyDuringMigration[] = []; @@ -453,7 +453,7 @@ export function buildTooltipForDropdown( tooltip = parsing.replaceMessageReferences(tooltip); } return tooltip; - }.bind(this) + }.bind(this), ); } return extensionFn; @@ -470,7 +470,7 @@ export function buildTooltipForDropdown( function checkDropdownOptionsInTable( block: Block, dropdownName: string, - lookupTable: {[key: string]: string} + lookupTable: {[key: string]: string}, ) { // Validate all dropdown options have values. const dropdown = block.getField(dropdownName); @@ -485,7 +485,7 @@ function checkDropdownOptionsInTable( ' of field ' + dropdownName + ' of block type ' + - block.type + block.type, ); } } @@ -504,7 +504,7 @@ function checkDropdownOptionsInTable( */ export function buildTooltipWithFieldText( msgTemplate: string, - fieldName: string + fieldName: string, ): Function { // Check the tooltip string messages for invalid references. // Wait for load, in case Blockly.Msg is not yet populated. @@ -526,7 +526,7 @@ export function buildTooltipWithFieldText( return parsing .replaceMessageReferences(msgTemplate) .replace('%1', field ? field.getText() : ''); - }.bind(this) + }.bind(this), ); } return extensionFn; @@ -547,7 +547,7 @@ function extensionParentTooltip(this: Block) { (parent && parent.getInputsInline() && parent.tooltip) || tooltipWhenNotConnected ); - }.bind(this) + }.bind(this), ); } register('parent_tooltip_when_inline', extensionParentTooltip); diff --git a/core/field.ts b/core/field.ts index 866d31bf7..ba5478008 100644 --- a/core/field.ts +++ b/core/field.ts @@ -214,7 +214,7 @@ export abstract class Field constructor( value: T | typeof Field.SKIP_SETUP, validator?: FieldValidator | null, - config?: FieldConfig + config?: FieldConfig, ) { /** * A generic value possessed by the field. @@ -354,7 +354,7 @@ export abstract class Field 'width': this.size_.width, 'class': 'blocklyFieldRect', }, - this.fieldGroup_ + this.fieldGroup_, ); } @@ -369,7 +369,7 @@ export abstract class Field { 'class': 'blocklyText', }, - this.fieldGroup_ + this.fieldGroup_, ); if (this.getConstants()!.FIELD_TEXT_BASELINE_CENTER) { this.textElement_.setAttribute('dominant-baseline', 'central'); @@ -390,7 +390,7 @@ export abstract class Field clickTarget, 'pointerdown', this, - this.onMouseDown_ + this.onMouseDown_, ); } @@ -471,7 +471,7 @@ export abstract class Field const text = utilsXml.domToText(this.toXml(elem)); return text.replace( ' xmlns="https://developers.google.com/blockly/xml"', - '' + '', ); } // Either they called this on purpose from their saveState, or they have @@ -490,7 +490,7 @@ export abstract class Field */ loadLegacyState( callingClass: FieldProto, - state: AnyDuringMigration + state: AnyDuringMigration, ): boolean { if ( callingClass.prototype.loadState === this.loadState && @@ -605,7 +605,7 @@ export abstract class Field console.warn( 'Detected an editable field that was not serializable.' + ' Please define SERIALIZABLE property as true on all editable custom' + - ' fields. Proceeding with serialization.' + ' fields. Proceeding with serialization.', ); isSerializable = true; } @@ -813,7 +813,7 @@ export abstract class Field this.textElement_, constants!.FIELD_TEXT_FONTSIZE, constants!.FIELD_TEXT_FONTWEIGHT, - constants!.FIELD_TEXT_FONTFAMILY + constants!.FIELD_TEXT_FONTFAMILY, ); totalWidth += contentWidth; } @@ -847,8 +847,8 @@ export abstract class Field String( this.getSourceBlock()?.RTL ? this.size_.width - contentWidth - xOffset - : xOffset - ) + : xOffset, + ), ); this.textElement_.setAttribute( 'y', @@ -857,8 +857,8 @@ export abstract class Field ? halfHeight : halfHeight - constants!.FIELD_TEXT_HEIGHT / 2 + - constants!.FIELD_TEXT_BASELINE - ) + constants!.FIELD_TEXT_BASELINE, + ), ); } @@ -871,11 +871,11 @@ export abstract class Field this.borderRect_.setAttribute('height', String(this.size_.height)); this.borderRect_.setAttribute( 'rx', - String(this.getConstants()!.FIELD_BORDER_RECT_RADIUS) + String(this.getConstants()!.FIELD_BORDER_RECT_RADIUS), ); this.borderRect_.setAttribute( 'ry', - String(this.getConstants()!.FIELD_BORDER_RECT_RADIUS) + String(this.getConstants()!.FIELD_BORDER_RECT_RADIUS), ); } @@ -902,7 +902,7 @@ export abstract class Field if (this.size_.width !== 0) { console.warn( 'Deprecated use of setting size_.width to 0 to rerender a' + - ' field. Set field.isDirty_ to true instead.' + ' field. Set field.isDirty_ to true instead.', ); } } @@ -1090,8 +1090,8 @@ export abstract class Field 'field', this.name || null, oldValue, - localValue - ) + localValue, + ), ); } if (this.isDirty_) { @@ -1109,7 +1109,7 @@ export abstract class Field */ private processValidation_( newValue: AnyDuringMigration, - validatedValue: T | null | undefined + validatedValue: T | null | undefined, ): T | Error { if (validatedValue === null) { this.doValueInvalid_(newValue); @@ -1153,7 +1153,7 @@ export abstract class Field protected doClassValidation_(newValue: T): T | null | undefined; protected doClassValidation_(newValue?: AnyDuringMigration): T | null; protected doClassValidation_( - newValue?: T | AnyDuringMigration + newValue?: T | AnyDuringMigration, ): T | null | undefined { if (newValue === null || newValue === undefined) { return null; @@ -1416,7 +1416,7 @@ export class UnattachedFieldError extends Error { constructor() { super( 'The field has not yet been attached to its input. ' + - 'Call appendField to attach it.' + 'Call appendField to attach it.', ); } } diff --git a/core/field_angle.ts b/core/field_angle.ts index 1f06bfc44..918b885da 100644 --- a/core/field_angle.ts +++ b/core/field_angle.ts @@ -121,7 +121,7 @@ export class FieldAngle extends FieldInput { constructor( value?: string | number | typeof Field.SKIP_SETUP, validator?: FieldAngleValidator, - config?: FieldAngleConfig + config?: FieldAngleConfig, ) { super(Field.SKIP_SETUP); @@ -200,7 +200,7 @@ export class FieldAngle extends FieldInput { if (this.sourceBlock_ instanceof BlockSvg) { dropDownDiv.setColour( this.sourceBlock_.style.colourPrimary, - this.sourceBlock_.style.colourTertiary + this.sourceBlock_.style.colourTertiary, ); } @@ -232,12 +232,12 @@ export class FieldAngle extends FieldInput { 'r': FieldAngle.RADIUS, 'class': 'blocklyAngleCircle', }, - svg + svg, ); this.gauge = dom.createSvgElement( Svg.PATH, {'class': 'blocklyAngleGauge'}, - svg + svg, ); this.line = dom.createSvgElement( Svg.LINE, @@ -246,7 +246,7 @@ export class FieldAngle extends FieldInput { 'y1': FieldAngle.HALF, 'class': 'blocklyAngleLine', }, - svg + svg, ); // Draw markers around the edge. for (let angle = 0; angle < 360; angle += 15) { @@ -268,7 +268,7 @@ export class FieldAngle extends FieldInput { FieldAngle.HALF + ')', }, - svg + svg, ); } @@ -276,7 +276,7 @@ export class FieldAngle extends FieldInput { // mousemove even if it's not in the middle of a drag. In future we may // change this behaviour. this.boundEvents.push( - browserEvents.conditionalBind(svg, 'click', this, this.hide) + browserEvents.conditionalBind(svg, 'click', this, this.hide), ); // On touch devices, the picker's value is only updated with a drag. Add // a click handler on the drag surface to update the value if the surface @@ -287,8 +287,8 @@ export class FieldAngle extends FieldInput { 'pointerdown', this, this.onMouseMove_, - true - ) + true, + ), ); this.boundEvents.push( browserEvents.conditionalBind( @@ -296,8 +296,8 @@ export class FieldAngle extends FieldInput { 'pointermove', this, this.onMouseMove_, - true - ) + true, + ), ); return svg; } @@ -380,8 +380,8 @@ export class FieldAngle extends FieldInput { this.sourceBlock_, this.name || null, oldValue, - this.value_ - ) + this.value_, + ), ); } } @@ -411,7 +411,7 @@ export class FieldAngle extends FieldInput { y2 -= Math.sin(angleRadians) * FieldAngle.RADIUS; // Don't ask how the flag calculations work. They just do. let largeFlag = Math.abs( - Math.floor((angleRadians - angle1) / Math.PI) % 2 + Math.floor((angleRadians - angle1) / Math.PI) % 2, ); if (clockwiseFlag) { largeFlag = 1 - largeFlag; @@ -433,7 +433,7 @@ export class FieldAngle extends FieldInput { x2, ',', y2, - ' z' + ' z', ); } this.gauge.setAttribute('d', path.join('')); diff --git a/core/field_checkbox.ts b/core/field_checkbox.ts index bd8533c2d..44dea25fa 100644 --- a/core/field_checkbox.ts +++ b/core/field_checkbox.ts @@ -64,7 +64,7 @@ export class FieldCheckbox extends Field { constructor( value?: CheckboxBool | typeof Field.SKIP_SETUP, validator?: FieldCheckboxValidator, - config?: FieldCheckboxConfig + config?: FieldCheckboxConfig, ) { super(Field.SKIP_SETUP); @@ -155,7 +155,7 @@ export class FieldCheckbox extends Field { * @returns A valid value ('TRUE' or 'FALSE), or null if invalid. */ protected override doClassValidation_( - newValue?: AnyDuringMigration + newValue?: AnyDuringMigration, ): BoolString | null { if (newValue === true || newValue === 'TRUE') { return 'TRUE'; diff --git a/core/field_colour.ts b/core/field_colour.ts index 5ff12c595..d5ea7ee80 100644 --- a/core/field_colour.ts +++ b/core/field_colour.ts @@ -135,7 +135,7 @@ export class FieldColour extends Field { constructor( value?: string | typeof Field.SKIP_SETUP, validator?: FieldColourValidator, - config?: FieldColourConfig + config?: FieldColourConfig, ) { super(Field.SKIP_SETUP); @@ -169,7 +169,7 @@ export class FieldColour extends Field { override initView() { this.size_ = new Size( this.getConstants()!.FIELD_COLOUR_DEFAULT_WIDTH, - this.getConstants()!.FIELD_COLOUR_DEFAULT_HEIGHT + this.getConstants()!.FIELD_COLOUR_DEFAULT_HEIGHT, ); if (!this.getConstants()!.FIELD_COLOUR_FULL_BLOCK) { this.createBorderRect_(); @@ -190,7 +190,7 @@ export class FieldColour extends Field { } else if (this.sourceBlock_ instanceof BlockSvg) { this.sourceBlock_.pathObject.svgPath.setAttribute( 'fill', - this.getValue() as string + this.getValue() as string, ); this.sourceBlock_.pathObject.svgPath.setAttribute('stroke', '#fff'); } @@ -486,7 +486,7 @@ export class FieldColour extends Field { aria.setState( table, aria.State.ROWCOUNT, - Math.floor(colours.length / columns) + Math.floor(colours.length / columns), ); aria.setState(table, aria.State.COLCOUNT, columns); let row: Element; @@ -520,8 +520,8 @@ export class FieldColour extends Field { 'pointerdown', this, this.onClick, - true - ) + true, + ), ); this.boundEvents.push( browserEvents.conditionalBind( @@ -529,8 +529,8 @@ export class FieldColour extends Field { 'pointermove', this, this.onMouseMove, - true - ) + true, + ), ); this.boundEvents.push( browserEvents.conditionalBind( @@ -538,8 +538,8 @@ export class FieldColour extends Field { 'pointerenter', this, this.onMouseEnter, - true - ) + true, + ), ); this.boundEvents.push( browserEvents.conditionalBind( @@ -547,8 +547,8 @@ export class FieldColour extends Field { 'pointerleave', this, this.onMouseLeave, - true - ) + true, + ), ); this.boundEvents.push( browserEvents.conditionalBind( @@ -556,8 +556,8 @@ export class FieldColour extends Field { 'keydown', this, this.onKeyDown, - false - ) + false, + ), ); this.picker = table; diff --git a/core/field_dropdown.ts b/core/field_dropdown.ts index 251ebd81a..3f9465762 100644 --- a/core/field_dropdown.ts +++ b/core/field_dropdown.ts @@ -115,13 +115,13 @@ export class FieldDropdown extends Field { constructor( menuGenerator: MenuGenerator, validator?: FieldDropdownValidator, - config?: FieldDropdownConfig + config?: FieldDropdownConfig, ); constructor(menuGenerator: typeof Field.SKIP_SETUP); constructor( menuGenerator: MenuGenerator | typeof Field.SKIP_SETUP, validator?: FieldDropdownValidator, - config?: FieldDropdownConfig + config?: FieldDropdownConfig, ) { super(Field.SKIP_SETUP); @@ -229,8 +229,8 @@ export class FieldDropdown extends Field { document.createTextNode( this.getSourceBlock()?.RTL ? FieldDropdown.ARROW_CHAR + ' ' - : ' ' + FieldDropdown.ARROW_CHAR - ) + : ' ' + FieldDropdown.ARROW_CHAR, + ), ); if (this.getSourceBlock()?.RTL) { this.getTextElement().insertBefore(this.arrow, this.textContent_); @@ -247,12 +247,12 @@ export class FieldDropdown extends Field { 'height': this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_SIZE + 'px', 'width': this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_SIZE + 'px', }, - this.fieldGroup_ + this.fieldGroup_, ); this.svgArrow!.setAttributeNS( dom.XLINK_NS, 'xlink:href', - this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_DATAURI + this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_DATAURI, ); } @@ -302,7 +302,7 @@ export class FieldDropdown extends Field { style.scrollIntoContainerView( this.selectedMenuItem.getElement()!, dropDownDiv.getContentDiv(), - true + true, ); } @@ -428,7 +428,7 @@ export class FieldDropdown extends Field { ', Field name: ' + this.name + ', Value: ' + - newValue + newValue, ); } return null; @@ -506,7 +506,7 @@ export class FieldDropdown extends Field { this.imageElement!.setAttributeNS( dom.XLINK_NS, 'xlink:href', - imageJson.src + imageJson.src, ); this.imageElement!.setAttribute('height', String(imageJson.height)); this.imageElement!.setAttribute('width', String(imageJson.width)); @@ -518,7 +518,7 @@ export class FieldDropdown extends Field { const hasBorder = !!this.borderRect_; const height = Math.max( hasBorder ? this.getConstants()!.FIELD_DROPDOWN_BORDER_RECT_HEIGHT : 0, - imageHeight + IMAGE_Y_PADDING + imageHeight + IMAGE_Y_PADDING, ); const xPadding = hasBorder ? this.getConstants()!.FIELD_BORDER_RECT_X_PADDING @@ -527,14 +527,14 @@ export class FieldDropdown extends Field { if (this.svgArrow) { arrowWidth = this.positionSVGArrow( imageWidth + xPadding, - height / 2 - this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_SIZE / 2 + height / 2 - this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_SIZE / 2, ); } else { arrowWidth = dom.getFastTextWidth( this.arrow as SVGTSpanElement, this.getConstants()!.FIELD_TEXT_FONTSIZE, this.getConstants()!.FIELD_TEXT_FONTWEIGHT, - this.getConstants()!.FIELD_TEXT_FONTFAMILY + this.getConstants()!.FIELD_TEXT_FONTFAMILY, ); } this.size_.width = imageWidth + arrowWidth + xPadding * 2; @@ -566,13 +566,13 @@ export class FieldDropdown extends Field { const hasBorder = !!this.borderRect_; const height = Math.max( hasBorder ? this.getConstants()!.FIELD_DROPDOWN_BORDER_RECT_HEIGHT : 0, - this.getConstants()!.FIELD_TEXT_HEIGHT + this.getConstants()!.FIELD_TEXT_HEIGHT, ); const textWidth = dom.getFastTextWidth( this.getTextElement(), this.getConstants()!.FIELD_TEXT_FONTSIZE, this.getConstants()!.FIELD_TEXT_FONTWEIGHT, - this.getConstants()!.FIELD_TEXT_FONTFAMILY + this.getConstants()!.FIELD_TEXT_FONTFAMILY, ); const xPadding = hasBorder ? this.getConstants()!.FIELD_BORDER_RECT_X_PADDING @@ -581,7 +581,7 @@ export class FieldDropdown extends Field { if (this.svgArrow) { arrowWidth = this.positionSVGArrow( textWidth + xPadding, - height / 2 - this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_SIZE / 2 + height / 2 - this.getConstants()!.FIELD_DROPDOWN_SVG_ARROW_SIZE / 2, ); } this.size_.width = textWidth + arrowWidth + xPadding * 2; @@ -614,7 +614,7 @@ export class FieldDropdown extends Field { const arrowX = block.RTL ? xPadding : x + textPadding; this.svgArrow.setAttribute( 'transform', - 'translate(' + arrowX + ',' + y + ')' + 'translate(' + arrowX + ',' + y + ')', ); return svgArrowSize + textPadding; } @@ -650,7 +650,7 @@ export class FieldDropdown extends Field { throw new Error( 'options are required for the dropdown field. The ' + 'options property must be assigned an array of ' + - '[humanReadableValue, languageNeutralValue] tuples.' + '[humanReadableValue, languageNeutralValue] tuples.', ); } // `this` might be a subclass of FieldDropdown if that class doesn't @@ -794,7 +794,7 @@ function trimOptions(options: MenuOption[]): { function applyTrim( options: [string, string][], prefixLength: number, - suffixLength: number + suffixLength: number, ): MenuOption[] { return options.map(([text, value]) => [ text.substring(prefixLength, text.length - suffixLength), @@ -825,7 +825,7 @@ function validateOptions(options: MenuOption[]) { i + ']: Each FieldDropdown option must be an ' + 'array. Found: ', - tuple + tuple, ); } else if (typeof tuple[1] !== 'string') { foundError = true; @@ -836,7 +836,7 @@ function validateOptions(options: MenuOption[]) { 'a string. Found ' + tuple[1] + ' in: ', - tuple + tuple, ); } else if ( tuple[0] && @@ -851,7 +851,7 @@ function validateOptions(options: MenuOption[]) { 'string label or image description. Found' + tuple[0] + ' in: ', - tuple + tuple, ); } } diff --git a/core/field_image.ts b/core/field_image.ts index b8f04f2d4..752ef3e78 100644 --- a/core/field_image.ts +++ b/core/field_image.ts @@ -79,7 +79,7 @@ export class FieldImage extends Field { alt?: string, onClick?: (p1: FieldImage) => void, flipRtl?: boolean, - config?: FieldImageConfig + config?: FieldImageConfig, ) { super(Field.SKIP_SETUP); @@ -87,12 +87,13 @@ export class FieldImage extends Field { const imageWidth = Number(parsing.replaceMessageReferences(width)); if (isNaN(imageHeight) || isNaN(imageWidth)) { throw Error( - 'Height and width values of an image field must cast to' + ' numbers.' + 'Height and width values of an image field must cast to' + ' numbers.', ); } if (imageHeight <= 0 || imageWidth <= 0) { throw Error( - 'Height and width values of an image field must be greater' + ' than 0.' + 'Height and width values of an image field must be greater' + + ' than 0.', ); } @@ -145,12 +146,12 @@ export class FieldImage extends Field { 'width': this.size_.width + 'px', 'alt': this.altText, }, - this.fieldGroup_ + this.fieldGroup_, ); this.imageElement.setAttributeNS( dom.XLINK_NS, 'xlink:href', - this.value_ as string + this.value_ as string, ); if (this.clickHandler) { @@ -256,7 +257,7 @@ export class FieldImage extends Field { if (!options.src || !options.width || !options.height) { throw new Error( 'src, width, and height values for an image field are' + - 'required. The width and height must be non-zero.' + 'required. The width and height must be non-zero.', ); } // `this` might be a subclass of FieldImage if that class doesn't override @@ -268,7 +269,7 @@ export class FieldImage extends Field { undefined, undefined, undefined, - options + options, ); } } diff --git a/core/field_input.ts b/core/field_input.ts index 59c161573..ee6f66915 100644 --- a/core/field_input.ts +++ b/core/field_input.ts @@ -120,7 +120,7 @@ export abstract class FieldInput extends Field< constructor( value?: string | typeof Field.SKIP_SETUP, validator?: FieldInputValidator | null, - config?: FieldInputConfig + config?: FieldInputConfig, ) { super(Field.SKIP_SETUP); @@ -200,8 +200,8 @@ export abstract class FieldInput extends Field< 'field', this.name || null, oldValue, - this.value_ - ) + this.value_, + ), ); } } @@ -234,7 +234,7 @@ export abstract class FieldInput extends Field< } else { source.pathObject.svgPath.setAttribute( 'fill', - this.getConstants()!.FIELD_BORDER_RECT_COLOUR + this.getConstants()!.FIELD_BORDER_RECT_COLOUR, ); } } @@ -275,7 +275,7 @@ export abstract class FieldInput extends Field< // assignable to parameter of type 'string'. this.htmlInput_.setAttribute( 'spellcheck', - this.spellcheck_ as AnyDuringMigration + this.spellcheck_ as AnyDuringMigration, ); } } @@ -318,7 +318,7 @@ export abstract class FieldInput extends Field< if (text !== null) { this.setValue(this.getValueFromEditorText_(text)); } - } + }, ); } @@ -368,7 +368,7 @@ export abstract class FieldInput extends Field< // to parameter of type 'string'. htmlInput.setAttribute( 'spellcheck', - this.spellcheck_ as AnyDuringMigration + this.spellcheck_ as AnyDuringMigration, ); const scale = this.workspace_!.getScale(); const fontSize = this.getConstants()!.FIELD_TEXT_FONTSIZE * scale + 'pt'; @@ -435,8 +435,8 @@ export abstract class FieldInput extends Field< 'field', this.name || null, this.valueWhenEditorWasOpened_, - this.value_ - ) + this.value_, + ), ); this.valueWhenEditorWasOpened_ = null; } @@ -478,14 +478,14 @@ export abstract class FieldInput extends Field< htmlInput, 'keydown', this, - this.onHtmlInputKeyDown_ + this.onHtmlInputKeyDown_, ); // Resize after every input change. this.onKeyInputWrapper_ = browserEvents.conditionalBind( htmlInput, 'input', this, - this.onHtmlInputChange_ + this.onHtmlInputChange_, ); } @@ -512,7 +512,7 @@ export abstract class FieldInput extends Field< dropDownDiv.hideWithoutAnimation(); } else if (e.key === 'Escape') { this.setValue( - this.htmlInput_!.getAttribute('data-untyped-default-value') + this.htmlInput_!.getAttribute('data-untyped-default-value'), ); WidgetDiv.hide(); dropDownDiv.hideWithoutAnimation(); @@ -549,8 +549,8 @@ export abstract class FieldInput extends Field< this.sourceBlock_, this.name || null, oldValue, - this.value_ - ) + this.value_, + ), ); } @@ -572,7 +572,7 @@ export abstract class FieldInput extends Field< */ protected setEditorValue_( newValue: AnyDuringMigration, - fireChangeEvent = true + fireChangeEvent = true, ) { this.isDirty_ = true; if (this.isBeingEdited_) { @@ -622,7 +622,7 @@ export abstract class FieldInput extends Field< bumpObjects.bumpIntoBounds( this.workspace_!, this.workspace_!.getMetricsManager().getViewMetrics(true), - block + block, ); this.resizeEditor_(); diff --git a/core/field_label.ts b/core/field_label.ts index 06426a4c2..9d3d98744 100644 --- a/core/field_label.ts +++ b/core/field_label.ts @@ -49,7 +49,7 @@ export class FieldLabel extends Field { constructor( value?: string | typeof Field.SKIP_SETUP, textClass?: string, - config?: FieldLabelConfig + config?: FieldLabelConfig, ) { super(Field.SKIP_SETUP); @@ -86,7 +86,7 @@ export class FieldLabel extends Field { * @returns A valid string, or null if invalid. */ protected override doClassValidation_( - newValue?: AnyDuringMigration + newValue?: AnyDuringMigration, ): string | null { if (newValue === null || newValue === undefined) { return null; diff --git a/core/field_label_serializable.ts b/core/field_label_serializable.ts index d493aa598..3a37e0696 100644 --- a/core/field_label_serializable.ts +++ b/core/field_label_serializable.ts @@ -62,7 +62,7 @@ export class FieldLabelSerializable extends FieldLabel { * @internal */ static override fromJson( - options: FieldLabelFromJsonConfig + options: FieldLabelFromJsonConfig, ): FieldLabelSerializable { const text = parsing.replaceMessageReferences(options.text); // `this` might be a subclass of FieldLabelSerializable if that class diff --git a/core/field_multilineinput.ts b/core/field_multilineinput.ts index 631d7e31e..cb812b428 100644 --- a/core/field_multilineinput.ts +++ b/core/field_multilineinput.ts @@ -64,7 +64,7 @@ export class FieldMultilineInput extends FieldTextInput { constructor( value?: string | typeof Field.SKIP_SETUP, validator?: FieldMultilineInputValidator, - config?: FieldMultilineInputConfig + config?: FieldMultilineInputConfig, ) { super(Field.SKIP_SETUP); @@ -103,7 +103,7 @@ export class FieldMultilineInput extends FieldTextInput { // limitation of the plain-text format). fieldElement.textContent = (this.getValue() as string).replace( /\n/g, - ' ' + ' ', ); return fieldElement; } @@ -162,7 +162,7 @@ export class FieldMultilineInput extends FieldTextInput { { 'class': 'blocklyEditableText', }, - this.fieldGroup_ + this.fieldGroup_, ); } @@ -255,7 +255,7 @@ export class FieldMultilineInput extends FieldTextInput { 'y': y + this.getConstants()!.FIELD_BORDER_RECT_Y_PADDING, 'dy': this.getConstants()!.FIELD_TEXT_BASELINE, }, - textGroup + textGroup, ); span.appendChild(document.createTextNode(lines[i])); y += lineHeight; @@ -306,7 +306,7 @@ export class FieldMultilineInput extends FieldTextInput { tspan, fontSize, fontWeight, - fontFamily + fontFamily, ); if (textWidth > totalWidth) { totalWidth = textWidth; @@ -330,7 +330,7 @@ export class FieldMultilineInput extends FieldTextInput { if (actualEditorLines[i].length > this.maxDisplayLength) { actualEditorLines[i] = actualEditorLines[i].substring( 0, - this.maxDisplayLength + this.maxDisplayLength, ); } dummyTextElement.textContent = actualEditorLines[i]; @@ -338,7 +338,7 @@ export class FieldMultilineInput extends FieldTextInput { dummyTextElement, fontSize, fontWeight, - fontFamily + fontFamily, ); if (lineWidth > totalWidth) { totalWidth = lineWidth; @@ -468,7 +468,7 @@ export class FieldMultilineInput extends FieldTextInput { * @internal */ static override fromJson( - options: FieldMultilineInputFromJsonConfig + options: FieldMultilineInputFromJsonConfig, ): FieldMultilineInput { const text = parsing.replaceMessageReferences(options.text); // `this` might be a subclass of FieldMultilineInput if that class doesn't diff --git a/core/field_number.ts b/core/field_number.ts index 511f27553..f7f219988 100644 --- a/core/field_number.ts +++ b/core/field_number.ts @@ -68,7 +68,7 @@ export class FieldNumber extends FieldInput { max?: string | number | null, precision?: string | number | null, validator?: FieldNumberValidator | null, - config?: FieldNumberConfig + config?: FieldNumberConfig, ) { // Pass SENTINEL so that we can define properties before value validation. super(Field.SKIP_SETUP); @@ -113,7 +113,7 @@ export class FieldNumber extends FieldInput { setConstraints( min: number | string | undefined | null, max: number | string | undefined | null, - precision: number | string | undefined | null + precision: number | string | undefined | null, ) { this.setMinInternal(min); this.setMaxInternal(max); @@ -253,7 +253,7 @@ export class FieldNumber extends FieldInput { * @returns A valid number, or null if invalid. */ protected override doClassValidation_( - newValue?: AnyDuringMigration + newValue?: AnyDuringMigration, ): number | null { if (newValue === null) { return null; @@ -325,7 +325,7 @@ export class FieldNumber extends FieldInput { undefined, undefined, undefined, - options + options, ); } } diff --git a/core/field_registry.ts b/core/field_registry.ts index 119302723..2f3c70981 100644 --- a/core/field_registry.ts +++ b/core/field_registry.ts @@ -67,7 +67,7 @@ function fromJsonInternal(options: RegistryOptions): Field | null { options['type'] + '. The field is probably not being registered. This could be because' + ' the file is not loaded, the field does not register itself (Issue' + - ' #1584), or the registration is not being reached.' + ' #1584), or the registration is not being reached.', ); return null; } else if (typeof (fieldObject as any).fromJson !== 'function') { diff --git a/core/field_textinput.ts b/core/field_textinput.ts index 3dc1052b0..48f8a0c6e 100644 --- a/core/field_textinput.ts +++ b/core/field_textinput.ts @@ -45,7 +45,7 @@ export class FieldTextInput extends FieldInput { constructor( value?: string | typeof Field.SKIP_SETUP, validator?: FieldTextInputValidator | null, - config?: FieldTextInputConfig + config?: FieldTextInputConfig, ) { super(value, validator, config); } @@ -57,7 +57,7 @@ export class FieldTextInput extends FieldInput { * @returns A valid string, or null if invalid. */ protected override doClassValidation_( - newValue?: AnyDuringMigration + newValue?: AnyDuringMigration, ): string | null { if (newValue === undefined) { return null; diff --git a/core/field_variable.ts b/core/field_variable.ts index 6c9bfed41..8c1fa54b6 100644 --- a/core/field_variable.ts +++ b/core/field_variable.ts @@ -84,7 +84,7 @@ export class FieldVariable extends FieldDropdown { validator?: FieldVariableValidator, variableTypes?: string[], defaultType?: string, - config?: FieldVariableConfig + config?: FieldVariableConfig, ) { super(Field.SKIP_SETUP); @@ -145,7 +145,7 @@ export class FieldVariable extends FieldDropdown { block.workspace, null, this.defaultVariableName, - this.defaultType + this.defaultType, ); // Don't call setValue because we don't want to cause a rerender. this.doValueUpdate_(variable.getId()); @@ -189,7 +189,7 @@ export class FieldVariable extends FieldDropdown { block.workspace, id, variableName as AnyDuringMigration, - variableType + variableType, ); // This should never happen :) @@ -202,7 +202,7 @@ export class FieldVariable extends FieldDropdown { ', and ' + 'does not match variable field that references it: ' + Xml.domToText(fieldElement) + - '.' + '.', ); } @@ -271,7 +271,7 @@ export class FieldVariable extends FieldDropdown { block.workspace, state['id'] || null, state['name'], - state['type'] || '' + state['type'] || '', ); this.setValue(variable.getId()); } @@ -344,7 +344,7 @@ export class FieldVariable extends FieldDropdown { * @returns The validated ID, or null if invalid. */ protected override doClassValidation_( - newValue?: AnyDuringMigration + newValue?: AnyDuringMigration, ): string | null { if (newValue === null) { return null; @@ -357,7 +357,7 @@ export class FieldVariable extends FieldDropdown { const variable = Variables.getVariable(block.workspace, newId); if (!variable) { console.warn( - "Variable id doesn't point to a real variable! " + 'ID was ' + newId + "Variable id doesn't point to a real variable! " + 'ID was ' + newId, ); return null; } @@ -425,7 +425,7 @@ export class FieldVariable extends FieldDropdown { // Throw an error if variableTypes is an empty list. const name = this.getText(); throw Error( - "'variableTypes' of field variable " + name + ' was an empty list' + "'variableTypes' of field variable " + name + ' was an empty list', ); } return variableTypes; @@ -460,13 +460,13 @@ export class FieldVariable extends FieldDropdown { "Invalid default type '" + defaultType + "' in " + - 'the definition of a FieldVariable' + 'the definition of a FieldVariable', ); } } else if (variableTypes !== null) { throw Error( "'variableTypes' was not an array in the definition of " + - 'a FieldVariable' + 'a FieldVariable', ); } // Only update the field once all checks pass. @@ -501,7 +501,7 @@ export class FieldVariable extends FieldDropdown { // Rename variable. Variables.renameVariable( this.sourceBlock_.workspace, - this.variable as VariableModel + this.variable as VariableModel, ); return; } else if (id === internalConstants.DELETE_VARIABLE_ID) { @@ -536,7 +536,7 @@ export class FieldVariable extends FieldDropdown { * @internal */ static override fromJson( - options: FieldVariableFromJsonConfig + options: FieldVariableFromJsonConfig, ): FieldVariable { const varName = parsing.replaceMessageReferences(options.variable); // `this` might be a subclass of FieldVariable if that class doesn't @@ -554,7 +554,7 @@ export class FieldVariable extends FieldDropdown { if (!this.variable) { throw Error( 'Tried to call dropdownCreate on a variable field with no' + - ' variable selected.' + ' variable selected.', ); } const name = this.getText(); diff --git a/core/flyout_base.ts b/core/flyout_base.ts index 25fe446e6..e523c91a4 100644 --- a/core/flyout_base.ts +++ b/core/flyout_base.ts @@ -263,7 +263,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { this.workspace_ = new WorkspaceSvg(workspaceOptions); this.workspace_.setMetricsManager( - new FlyoutMetricsManager(this.workspace_, this) + new FlyoutMetricsManager(this.workspace_, this), ); this.workspace_.internalIsFlyout = true; @@ -328,7 +328,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { * @returns The flyout's SVG group. */ createDom( - tagName: string | Svg | Svg + tagName: string | Svg | Svg, ): SVGElement { /* @@ -345,7 +345,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { this.svgBackground_ = dom.createSvgElement( Svg.PATH, {'class': 'blocklyFlyoutBackground'}, - this.svgGroup_ + this.svgGroup_, ); this.svgGroup_.appendChild(this.workspace_.createDom()); this.workspace_ @@ -372,7 +372,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { this.horizontalLayout, !this.horizontalLayout, 'blocklyFlyoutScrollbar', - this.SCROLLBAR_MARGIN + this.SCROLLBAR_MARGIN, ); this.hide(); @@ -382,8 +382,8 @@ export abstract class Flyout extends DeleteArea implements IFlyout { this.svgGroup_ as SVGGElement, 'wheel', this, - this.wheel_ - ) + this.wheel_, + ), ); if (!this.autoClose) { this.filterWrapper = this.filterForCapacity.bind(this); @@ -396,13 +396,13 @@ export abstract class Flyout extends DeleteArea implements IFlyout { this.svgBackground_ as SVGPathElement, 'pointerdown', this, - this.onMouseDown - ) + this.onMouseDown, + ), ); // A flyout connected to a workspace doesn't have its own current gesture. this.workspace_.getGesture = this.targetWorkspace.getGesture.bind( - this.targetWorkspace + this.targetWorkspace, ); // Get variables from the main workspace rather than the target workspace. @@ -571,13 +571,13 @@ export abstract class Flyout extends DeleteArea implements IFlyout { if (scrollbar.hScroll) { scrollbar.hScroll.setPosition( scrollbar.hScroll.position.x, - scrollbar.hScroll.position.y + scrollbar.hScroll.position.y, ); } if (scrollbar.vScroll) { scrollbar.vScroll.setPosition( scrollbar.vScroll.position.x, - scrollbar.vScroll.position.y + scrollbar.vScroll.position.y, ); } } @@ -717,7 +717,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { * flyout in one of its many forms. */ private getDynamicCategoryContents( - categoryName: string + categoryName: string, ): toolbox.FlyoutDefinition { // Look up the correct category generation function and call that to get a // valid XML list. @@ -726,7 +726,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { if (typeof fnToApply !== 'function') { throw TypeError( "Couldn't find a callback function when opening" + - ' a toolbox category.' + ' a toolbox category.', ); } return fnToApply(this.workspace_.targetWorkspace!); @@ -742,13 +742,13 @@ export abstract class Flyout extends DeleteArea implements IFlyout { */ private createButton( btnInfo: toolbox.ButtonOrLabelInfo, - isLabel: boolean + isLabel: boolean, ): FlyoutButton { const curButton = new FlyoutButton( this.workspace_, this.targetWorkspace as WorkspaceSvg, btnInfo, - isLabel + isLabel, ); return curButton; } @@ -821,7 +821,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { private addBlockGap( blockInfo: toolbox.BlockInfo, gaps: number[], - defaultGap: number + defaultGap: number, ) { let gap; if (blockInfo['gap']) { @@ -849,7 +849,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { private addSeparatorGap( sepInfo: toolbox.SeparatorInfo, gaps: number[], - defaultGap: number + defaultGap: number, ) { // Change the gap between two toolbox elements. // @@ -941,35 +941,35 @@ export abstract class Flyout extends DeleteArea implements IFlyout { protected addBlockListeners_( root: SVGElement, block: BlockSvg, - rect: SVGElement + rect: SVGElement, ) { this.listeners.push( browserEvents.conditionalBind( root, 'pointerdown', null, - this.blockMouseDown(block) - ) + this.blockMouseDown(block), + ), ); this.listeners.push( browserEvents.conditionalBind( rect, 'pointerdown', null, - this.blockMouseDown(block) - ) + this.blockMouseDown(block), + ), ); this.listeners.push( - browserEvents.bind(root, 'pointerenter', block, block.addSelect) + browserEvents.bind(root, 'pointerenter', block, block.addSelect), ); this.listeners.push( - browserEvents.bind(root, 'pointerleave', block, block.removeSelect) + browserEvents.bind(root, 'pointerleave', block, block.removeSelect), ); this.listeners.push( - browserEvents.bind(rect, 'pointerenter', block, block.addSelect) + browserEvents.bind(rect, 'pointerenter', block, block.addSelect), ); this.listeners.push( - browserEvents.bind(rect, 'pointerleave', block, block.removeSelect) + browserEvents.bind(rect, 'pointerleave', block, block.removeSelect), ); } @@ -1038,7 +1038,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { const newVariables = Variables.getAddedVariables( this.targetWorkspace, - variablesBeforeCreation + variablesBeforeCreation, ); if (eventUtils.isEnabled()) { @@ -1047,7 +1047,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { for (let i = 0; i < newVariables.length; i++) { const thisVariable = newVariables[i]; eventUtils.fire( - new (eventUtils.get(eventUtils.VAR_CREATE))(thisVariable) + new (eventUtils.get(eventUtils.VAR_CREATE))(thisVariable), ); } @@ -1082,8 +1082,8 @@ export abstract class Flyout extends DeleteArea implements IFlyout { buttonSvg, 'pointerdown', this, - this.onMouseDown - ) + this.onMouseDown, + ), ); this.buttons_.push(button); @@ -1107,7 +1107,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { x: number, y: number, blockHW: {height: number; width: number}, - index: number + index: number, ): SVGElement { // Create an invisible rectangle under the block to act as a button. Just // using the block as a button is poor, since blocks have holes in them. @@ -1144,7 +1144,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { rect.setAttribute('y', String(blockXY.y)); rect.setAttribute( 'x', - String(this.RTL ? blockXY.x - blockHW.width : blockXY.x) + String(this.RTL ? blockXY.x - blockHW.width : blockXY.x), ); } @@ -1159,7 +1159,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { for (let i = 0, block; (block = blocks[i]); i++) { if (this.permanentlyDisabled.indexOf(block) === -1) { const enable = this.targetWorkspace.isCapacityAvailable( - common.getBlockTypeCounts(block) + common.getBlockTypeCounts(block), ); while (block) { block.setEnabled(enable); @@ -1244,14 +1244,14 @@ export abstract class Flyout extends DeleteArea implements IFlyout { // of the injection div. const oldBlockOffsetPixels = Coordinate.sum( flyoutOffsetPixels, - oldBlockPos + oldBlockPos, ); // The position of the old block in pixels relative to the origin of the // main workspace. const finalOffset = Coordinate.difference( oldBlockOffsetPixels, - mainOffsetPixels + mainOffsetPixels, ); // The position of the old block in main workspace coordinates. finalOffset.scale(1 / targetWorkspace.scale); diff --git a/core/flyout_button.ts b/core/flyout_button.ts index e9bf40d5f..a5f8f3662 100644 --- a/core/flyout_button.ts +++ b/core/flyout_button.ts @@ -67,7 +67,7 @@ export class FlyoutButton { private readonly workspace: WorkspaceSvg, private readonly targetWorkspace: WorkspaceSvg, json: toolbox.ButtonOrLabelInfo, - private readonly isLabel_: boolean + private readonly isLabel_: boolean, ) { this.text = json['text']; @@ -102,7 +102,7 @@ export class FlyoutButton { this.svgGroup = dom.createSvgElement( Svg.G, {'class': cssClass}, - this.workspace.getCanvas() + this.workspace.getCanvas(), ); let shadow; @@ -117,7 +117,7 @@ export class FlyoutButton { 'x': 1, 'y': 1, }, - this.svgGroup! + this.svgGroup!, ); } // Background rectangle. @@ -130,7 +130,7 @@ export class FlyoutButton { 'rx': FlyoutButton.BORDER_RADIUS, 'ry': FlyoutButton.BORDER_RADIUS, }, - this.svgGroup! + this.svgGroup!, ); const svgText = dom.createSvgElement( @@ -141,7 +141,7 @@ export class FlyoutButton { 'y': 0, 'text-anchor': 'middle', }, - this.svgGroup! + this.svgGroup!, ); let text = parsing.replaceMessageReferences(this.text); if (this.workspace.RTL) { @@ -163,13 +163,13 @@ export class FlyoutButton { svgText, fontSize, fontWeight, - fontFamily + fontFamily, ); const fontMetrics = dom.measureFontMetrics( text, fontSize, fontWeight, - fontFamily + fontFamily, ); this.height = fontMetrics.height; @@ -185,7 +185,7 @@ export class FlyoutButton { svgText.setAttribute('x', String(this.width / 2)); svgText.setAttribute( 'y', - String(this.height / 2 - fontMetrics.height / 2 + fontMetrics.baseline) + String(this.height / 2 - fontMetrics.height / 2 + fontMetrics.baseline), ); this.updateTransform(); @@ -196,7 +196,7 @@ export class FlyoutButton { this.svgGroup as AnyDuringMigration, 'pointerup', this, - this.onMouseUp + this.onMouseUp, ); return this.svgGroup!; } @@ -211,7 +211,7 @@ export class FlyoutButton { private updateTransform() { this.svgGroup!.setAttribute( 'transform', - 'translate(' + this.position.x + ',' + this.position.y + ')' + 'translate(' + this.position.x + ',' + this.position.y + ')', ); } @@ -282,7 +282,7 @@ export class FlyoutButton { if (this.isLabel_ && this.callbackKey) { console.warn( - 'Labels should not have callbacks. Label text: ' + this.text + 'Labels should not have callbacks. Label text: ' + this.text, ); } else if ( !this.isLabel_ && diff --git a/core/flyout_horizontal.ts b/core/flyout_horizontal.ts index 192b46797..ad27ca1dc 100644 --- a/core/flyout_horizontal.ts +++ b/core/flyout_horizontal.ts @@ -60,7 +60,7 @@ export class HorizontalFlyout extends Flyout { this.workspace_.translate( this.workspace_.scrollX + absoluteMetrics.left, - this.workspace_.scrollY + absoluteMetrics.top + this.workspace_.scrollY + absoluteMetrics.top, ); } @@ -170,7 +170,7 @@ export class HorizontalFlyout extends Flyout { 0, 1, -this.CORNER_RADIUS, - this.CORNER_RADIUS + this.CORNER_RADIUS, ); path.push('h', -width); // Left. @@ -182,7 +182,7 @@ export class HorizontalFlyout extends Flyout { 0, 1, -this.CORNER_RADIUS, - -this.CORNER_RADIUS + -this.CORNER_RADIUS, ); path.push('z'); } else { @@ -195,7 +195,7 @@ export class HorizontalFlyout extends Flyout { 0, 1, this.CORNER_RADIUS, - -this.CORNER_RADIUS + -this.CORNER_RADIUS, ); path.push('h', width); // Right. @@ -207,7 +207,7 @@ export class HorizontalFlyout extends Flyout { 0, 1, this.CORNER_RADIUS, - this.CORNER_RADIUS + this.CORNER_RADIUS, ); path.push('v', height); // Bottom. @@ -393,7 +393,7 @@ export class HorizontalFlyout extends Flyout { // (ie toolbox edge). this.targetWorkspace!.translate( this.targetWorkspace!.scrollX, - this.targetWorkspace!.scrollY + flyoutHeight + this.targetWorkspace!.scrollY + flyoutHeight, ); } this.height_ = flyoutHeight; @@ -406,5 +406,5 @@ export class HorizontalFlyout extends Flyout { registry.register( registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX, registry.DEFAULT, - HorizontalFlyout + HorizontalFlyout, ); diff --git a/core/flyout_metrics_manager.ts b/core/flyout_metrics_manager.ts index baccbbbd5..52bdf3cbb 100644 --- a/core/flyout_metrics_manager.ts +++ b/core/flyout_metrics_manager.ts @@ -70,7 +70,7 @@ export class FlyoutMetricsManager extends MetricsManager { override getScrollMetrics( opt_getWorkspaceCoordinates?: boolean, opt_viewMetrics?: ContainerRegion, - opt_contentMetrics?: ContainerRegion + opt_contentMetrics?: ContainerRegion, ) { const contentMetrics = opt_contentMetrics || this.getContentMetrics(); const margin = this.flyout_.MARGIN * this.workspace_.scale; diff --git a/core/flyout_vertical.ts b/core/flyout_vertical.ts index 2d24cfb33..d0c4a5d58 100644 --- a/core/flyout_vertical.ts +++ b/core/flyout_vertical.ts @@ -59,7 +59,7 @@ export class VerticalFlyout extends Flyout { } this.workspace_.translate( this.workspace_.scrollX + absoluteMetrics.left, - this.workspace_.scrollY + absoluteMetrics.top + this.workspace_.scrollY + absoluteMetrics.top, ); } @@ -167,7 +167,7 @@ export class VerticalFlyout extends Flyout { 0, atRight ? 0 : 1, atRight ? -this.CORNER_RADIUS : this.CORNER_RADIUS, - this.CORNER_RADIUS + this.CORNER_RADIUS, ); // Side closest to workspace. path.push('v', Math.max(0, height)); @@ -180,7 +180,7 @@ export class VerticalFlyout extends Flyout { 0, atRight ? 0 : 1, atRight ? this.CORNER_RADIUS : -this.CORNER_RADIUS, - this.CORNER_RADIUS + this.CORNER_RADIUS, ); // Bottom. path.push('h', atRight ? width : -width); @@ -253,7 +253,7 @@ export class VerticalFlyout extends Flyout { this.RTL ? moveX - blockHW.width : moveX, cursorY, blockHW, - i + i, ); this.addBlockListeners_(root, block!, rect); @@ -386,7 +386,7 @@ export class VerticalFlyout extends Flyout { // (ie toolbox edge). this.targetWorkspace!.translate( this.targetWorkspace!.scrollX + flyoutWidth, - this.targetWorkspace!.scrollY + this.targetWorkspace!.scrollY, ); } this.width_ = flyoutWidth; @@ -399,5 +399,5 @@ export class VerticalFlyout extends Flyout { registry.register( registry.Type.FLYOUTS_VERTICAL_TOOLBOX, registry.DEFAULT, - VerticalFlyout + VerticalFlyout, ); diff --git a/core/generator.ts b/core/generator.ts index 28d6d1f76..f70856367 100644 --- a/core/generator.ts +++ b/core/generator.ts @@ -31,7 +31,7 @@ import {warn} from './utils/deprecation.js'; */ export type BlockGenerator = ( block: Block, - generator: CodeGenerator + generator: CodeGenerator, ) => [string, number] | string | null; /** @@ -117,7 +117,7 @@ export class CodeGenerator { this.FUNCTION_NAME_PLACEHOLDER_REGEXP_ = new RegExp( this.FUNCTION_NAME_PLACEHOLDER_, - 'g' + 'g', ); } @@ -131,7 +131,7 @@ export class CodeGenerator { if (!workspace) { // Backwards compatibility from before there could be multiple workspaces. console.warn( - 'No workspace specified in workspaceToCode call. Guessing.' + 'No workspace specified in workspaceToCode call. Guessing.', ); workspace = common.getMainWorkspace(); } @@ -220,11 +220,11 @@ export class CodeGenerator { */ blockToCode( block: Block | null, - opt_thisOnly?: boolean + opt_thisOnly?: boolean, ): string | [string, number] { if (this.isInitialized === false) { console.warn( - 'CodeGenerator init was not called before blockToCode was called.' + 'CodeGenerator init was not called before blockToCode was called.', ); } if (!block) { @@ -247,14 +247,14 @@ export class CodeGenerator { 'block generator functions on CodeGenerator objects', '10.0', '11.0', - 'the .forBlock[blockType] dictionary' + 'the .forBlock[blockType] dictionary', ); func = (this as any)[block.type]; } if (typeof func !== 'function') { throw Error( `${this.name_} generator does not know how to generate code` + - `for block type "${block.type}".` + `for block type "${block.type}".`, ); } // First argument to func.call is the value of 'this' in the generator. @@ -313,14 +313,14 @@ export class CodeGenerator { throw TypeError( `Expecting tuple from value block: ${targetBlock.type} See ` + `developers.google.com/blockly/guides/create-custom-blocks/generating-code ` + - `for more information` + `for more information`, ); } let code = tuple[0]; const innerOrder = tuple[1]; if (isNaN(innerOrder)) { throw TypeError( - 'Expecting valid order from value block: ' + targetBlock.type + 'Expecting valid order from value block: ' + targetBlock.type, ); } if (!code) { @@ -383,7 +383,7 @@ export class CodeGenerator { if (typeof code !== 'string') { throw TypeError( 'Expecting code from statement block: ' + - (targetBlock && targetBlock.type) + (targetBlock && targetBlock.type), ); } if (code) { @@ -407,14 +407,14 @@ export class CodeGenerator { branch = this.prefixLines( this.injectId(this.INFINITE_LOOP_TRAP, block), - this.INDENT + this.INDENT, ) + branch; } if (this.STATEMENT_SUFFIX && !block.suppressPrefixSuffix) { branch = this.prefixLines( this.injectId(this.STATEMENT_SUFFIX, block), - this.INDENT + this.INDENT, ) + branch; } if (this.STATEMENT_PREFIX && !block.suppressPrefixSuffix) { @@ -422,7 +422,7 @@ export class CodeGenerator { branch + this.prefixLines( this.injectId(this.STATEMENT_PREFIX, block), - this.INDENT + this.INDENT, ); } return branch; @@ -475,7 +475,7 @@ export class CodeGenerator { if (!this.definitions_[desiredName]) { const functionName = this.nameDB_!.getDistinctName( desiredName, - NameType.PROCEDURE + NameType.PROCEDURE, ); this.functionNames_[desiredName] = functionName; if (Array.isArray(code)) { @@ -531,7 +531,7 @@ export class CodeGenerator { protected scrub_( _block: Block, code: string, - _opt_thisOnly?: boolean + _opt_thisOnly?: boolean, ): string { // Optionally override return code; diff --git a/core/gesture.ts b/core/gesture.ts index 2c882027f..f720b67f0 100644 --- a/core/gesture.ts +++ b/core/gesture.ts @@ -177,7 +177,7 @@ export class Gesture { */ constructor( e: PointerEvent, - private readonly creatorWorkspace: WorkspaceSvg + private readonly creatorWorkspace: WorkspaceSvg, ) { this.mostRecentEvent = e; @@ -245,7 +245,7 @@ export class Gesture { private updateDragDelta(currentXY: Coordinate): boolean { this.currentDragDeltaXY = Coordinate.difference( currentXY, - this.mouseDownXY + this.mouseDownXY, ); if (!this.hasExceededDragRadius) { @@ -361,7 +361,7 @@ export class Gesture { if (!this.startWorkspace_) { throw new Error( 'Cannot update dragging the workspace because the ' + - 'start workspace is undefined' + 'start workspace is undefined', ); } @@ -406,12 +406,12 @@ export class Gesture { const BlockDraggerClass = registry.getClassFromOptions( registry.Type.BLOCK_DRAGGER, this.creatorWorkspace.options, - true + true, ); this.blockDragger = new BlockDraggerClass!( this.targetBlock, - this.startWorkspace_ + this.startWorkspace_, ); this.blockDragger!.startDrag(this.currentDragDeltaXY, this.healStack); this.blockDragger!.drag(this.mostRecentEvent, this.currentDragDeltaXY); @@ -422,24 +422,24 @@ export class Gesture { if (!this.startBubble) { throw new Error( 'Cannot update dragging the bubble because the start ' + - 'bubble is undefined' + 'bubble is undefined', ); } if (!this.startWorkspace_) { throw new Error( 'Cannot update dragging the bubble because the start ' + - 'workspace is undefined' + 'workspace is undefined', ); } this.bubbleDragger = new BubbleDragger( this.startBubble, - this.startWorkspace_ + this.startWorkspace_, ); this.bubbleDragger.startBubbleDrag(); this.bubbleDragger.dragBubble( this.mostRecentEvent, - this.currentDragDeltaXY + this.currentDragDeltaXY, ); } @@ -454,7 +454,7 @@ export class Gesture { if (!this.startWorkspace_) { throw new Error( 'Cannot start the touch gesture becauase the start ' + - 'workspace is undefined' + 'workspace is undefined', ); } this.isPinchZoomEnabled = @@ -524,8 +524,8 @@ export class Gesture { 'pointerdown', null, this.handleStart.bind(this), - /* opt_noCaptureIdentifier */ true - ) + /* opt_noCaptureIdentifier */ true, + ), ); this.boundEvents.push( browserEvents.conditionalBind( @@ -533,8 +533,8 @@ export class Gesture { 'pointermove', null, this.handleMove.bind(this), - /* opt_noCaptureIdentifier */ true - ) + /* opt_noCaptureIdentifier */ true, + ), ); this.boundEvents.push( browserEvents.conditionalBind( @@ -542,8 +542,8 @@ export class Gesture { 'pointerup', null, this.handleUp.bind(this), - /* opt_noCaptureIdentifier */ true - ) + /* opt_noCaptureIdentifier */ true, + ), ); e.preventDefault(); @@ -587,7 +587,7 @@ export class Gesture { } else if (this.bubbleDragger) { this.bubbleDragger.dragBubble( this.mostRecentEvent, - this.currentDragDeltaXY + this.currentDragDeltaXY, ); } e.preventDefault(); @@ -717,14 +717,14 @@ export class Gesture { : gestureScale * ZOOM_OUT_MULTIPLIER; if (!this.startWorkspace_) { throw new Error( - 'Cannot handle a pinch because the start workspace ' + 'is undefined' + 'Cannot handle a pinch because the start workspace ' + 'is undefined', ); } const workspace = this.startWorkspace_; const position = browserEvents.mouseToSvg( e, workspace.getParentSvg(), - workspace.getInverseScreenCTM() + workspace.getInverseScreenCTM(), ); workspace.zoom(position.x, position.y, delta); } @@ -790,7 +790,7 @@ export class Gesture { if (this.bubbleDragger) { this.bubbleDragger.endBubbleDrag( this.mostRecentEvent, - this.currentDragDeltaXY + this.currentDragDeltaXY, ); } else if (this.blockDragger) { this.blockDragger.endDrag(this.mostRecentEvent, this.currentDragDeltaXY); @@ -836,7 +836,7 @@ export class Gesture { if (this.gestureHasStarted) { throw Error( 'Tried to call gesture.handleWsStart, ' + - 'but the gesture had already been started.' + 'but the gesture had already been started.', ); } this.setStartWorkspace(ws); @@ -851,7 +851,7 @@ export class Gesture { */ private fireWorkspaceClick(ws: WorkspaceSvg) { eventUtils.fire( - new (eventUtils.get(eventUtils.CLICK))(null, ws.id, 'workspace') + new (eventUtils.get(eventUtils.CLICK))(null, ws.id, 'workspace'), ); } @@ -866,7 +866,7 @@ export class Gesture { if (this.gestureHasStarted) { throw Error( 'Tried to call gesture.handleFlyoutStart, ' + - 'but the gesture had already been started.' + 'but the gesture had already been started.', ); } this.setStartFlyout(flyout); @@ -884,7 +884,7 @@ export class Gesture { if (this.gestureHasStarted) { throw Error( 'Tried to call gesture.handleBlockStart, ' + - 'but the gesture had already been started.' + 'but the gesture had already been started.', ); } this.setStartBlock(block); @@ -902,7 +902,7 @@ export class Gesture { if (this.gestureHasStarted) { throw Error( 'Tried to call gesture.handleBubbleStart, ' + - 'but the gesture had already been started.' + 'but the gesture had already been started.', ); } this.setStartBubble(bubble); @@ -926,7 +926,7 @@ export class Gesture { private doFieldClick() { if (!this.startField) { throw new Error( - 'Cannot do a field click because the start field is undefined' + 'Cannot do a field click because the start field is undefined', ); } @@ -943,7 +943,7 @@ export class Gesture { private doIconClick() { if (!this.startIcon) { throw new Error( - 'Cannot do an icon click because the start icon is undefined' + 'Cannot do an icon click because the start icon is undefined', ); } @@ -956,7 +956,7 @@ export class Gesture { if (this.flyout && this.flyout.autoClose) { if (!this.targetBlock) { throw new Error( - 'Cannot do a block click because the target block is ' + 'undefined' + 'Cannot do a block click because the target block is ' + 'undefined', ); } if (this.targetBlock.isEnabled()) { @@ -970,14 +970,14 @@ export class Gesture { if (!this.startWorkspace_) { throw new Error( 'Cannot do a block click because the start workspace ' + - 'is undefined' + 'is undefined', ); } // Clicks events are on the start block, even if it was a shadow. const event = new (eventUtils.get(eventUtils.CLICK))( this.startBlock, this.startWorkspace_.id, - 'block' + 'block', ); eventUtils.fire(event); } @@ -1027,7 +1027,7 @@ export class Gesture { if (this.gestureHasStarted) { throw Error( 'Tried to call gesture.setStartField, ' + - 'but the gesture had already been started.' + 'but the gesture had already been started.', ); } if (!this.startField) { @@ -1045,7 +1045,7 @@ export class Gesture { if (this.gestureHasStarted) { throw Error( 'Tried to call gesture.setStartIcon, ' + - 'but the gesture had already been started.' + 'but the gesture had already been started.', ); } diff --git a/core/grid.ts b/core/grid.ts index 491ca5df4..b43fb148e 100644 --- a/core/grid.ts +++ b/core/grid.ts @@ -33,7 +33,10 @@ export class Grid { * See grid documentation: * https://developers.google.com/blockly/guides/configure/web/grid */ - constructor(private pattern: SVGElement, options: GridOptions) { + constructor( + private pattern: SVGElement, + options: GridOptions, + ) { /** The spacing of the grid lines (in px). */ this.spacing = options['spacing'] ?? 0; @@ -122,7 +125,7 @@ export class Grid { x1: number, x2: number, y1: number, - y2: number + y2: number, ) { if (line) { line.setAttribute('stroke-width', `${width}`); @@ -158,7 +161,7 @@ export class Grid { static createDom( rnd: string, gridOptions: GridOptions, - defs: SVGElement + defs: SVGElement, ): SVGElement { /* @@ -169,20 +172,20 @@ export class Grid { const gridPattern = dom.createSvgElement( Svg.PATTERN, {'id': 'blocklyGridPattern' + rnd, 'patternUnits': 'userSpaceOnUse'}, - defs + defs, ); // x1, y1, x1, x2 properties will be set later in update. if ((gridOptions['length'] ?? 1) > 0 && (gridOptions['spacing'] ?? 0) > 0) { dom.createSvgElement( Svg.LINE, {'stroke': gridOptions['colour']}, - gridPattern + gridPattern, ); if (gridOptions['length'] ?? 1 > 1) { dom.createSvgElement( Svg.LINE, {'stroke': gridOptions['colour']}, - gridPattern + gridPattern, ); } } else { diff --git a/core/icons/comment_icon.ts b/core/icons/comment_icon.ts index 4533c6f39..45a7aa8c4 100644 --- a/core/icons/comment_icon.ts +++ b/core/icons/comment_icon.ts @@ -84,7 +84,7 @@ export class CommentIcon extends Icon implements IHasBubble, ISerializable { dom.createSvgElement( Svg.CIRCLE, {'class': 'blocklyIconShape', 'r': '8', 'cx': '8', 'cy': '8'}, - this.svgRoot + this.svgRoot, ); // Can't use a real '?' text character since different browsers and // operating systems render it differently. Body of question mark. @@ -97,7 +97,7 @@ export class CommentIcon extends Icon implements IHasBubble, ISerializable { '0.607,-5.534 -3.765,-3.874v1.7c3.12,-1.657 3.698,0.118 2.336,1.25' + '-1.201,0.998 -1.201,1.528 -1.204,2.19z', }, - this.svgRoot + this.svgRoot, ); // Dot of question mark. dom.createSvgElement( @@ -109,7 +109,7 @@ export class CommentIcon extends Icon implements IHasBubble, ISerializable { 'height': '2', 'width': '2', }, - this.svgRoot + this.svgRoot, ); } @@ -201,7 +201,7 @@ export class CommentIcon extends Icon implements IHasBubble, ISerializable { this.text = state['text'] ?? ''; this.bubbleSize = new Size( state['width'] ?? DEFAULT_BUBBLE_WIDTH, - state['height'] ?? DEFAULT_BUBBLE_HEIGHT + state['height'] ?? DEFAULT_BUBBLE_HEIGHT, ); this.bubbleVisiblity = state['pinned'] ?? false; // Give the block a chance to be positioned and rendered before showing. @@ -260,8 +260,8 @@ export class CommentIcon extends Icon implements IHasBubble, ISerializable { new (eventUtils.get(eventUtils.BUBBLE_OPEN))( this.sourceBlock, visible, - 'comment' - ) + 'comment', + ), ); } @@ -273,7 +273,7 @@ export class CommentIcon extends Icon implements IHasBubble, ISerializable { this.textInputBubble = new TextInputBubble( this.sourceBlock.workspace as WorkspaceSvg, this.getAnchorLocation(), - this.getBubbleOwnerRect() + this.getBubbleOwnerRect(), ); this.textInputBubble.setText(this.getText()); this.textInputBubble.setSize(this.bubbleSize, true); @@ -287,7 +287,7 @@ export class CommentIcon extends Icon implements IHasBubble, ISerializable { this.getText(), this.sourceBlock.workspace as WorkspaceSvg, this.getAnchorLocation(), - this.getBubbleOwnerRect() + this.getBubbleOwnerRect(), ); } @@ -307,7 +307,7 @@ export class CommentIcon extends Icon implements IHasBubble, ISerializable { const midIcon = SIZE / 2; return Coordinate.sum( this.workspaceLocation, - new Coordinate(midIcon, midIcon) + new Coordinate(midIcon, midIcon), ); } diff --git a/core/icons/exceptions.ts b/core/icons/exceptions.ts index 55d0ef830..26b48e7c8 100644 --- a/core/icons/exceptions.ts +++ b/core/icons/exceptions.ts @@ -17,7 +17,7 @@ export class DuplicateIconType extends Error { super( `Tried to append an icon of type ${icon.getType()} when an icon of ` + `that type already exists on the block. ` + - `Use getIcon to access the existing icon.` + `Use getIcon to access the existing icon.`, ); } } diff --git a/core/icons/icon.ts b/core/icons/icon.ts index bdc5129c4..095f52509 100644 --- a/core/icons/icon.ts +++ b/core/icons/icon.ts @@ -52,7 +52,7 @@ export abstract class Icon implements IIcon { this.svgRoot, 'pointerdown', this, - pointerdownListener + pointerdownListener, ); } @@ -101,7 +101,7 @@ export abstract class Icon implements IIcon { private updateSvgRootOffset(): void { this.svgRoot?.setAttribute( 'transform', - `translate(${this.offsetInBlock.x}, ${this.offsetInBlock.y})` + `translate(${this.offsetInBlock.x}, ${this.offsetInBlock.y})`, ); } diff --git a/core/icons/mutator_icon.ts b/core/icons/mutator_icon.ts index 8817450ce..f0798a39e 100644 --- a/core/icons/mutator_icon.ts +++ b/core/icons/mutator_icon.ts @@ -62,7 +62,7 @@ export class MutatorIcon extends Icon implements IHasBubble { constructor( private readonly flyoutBlockTypes: string[], - protected readonly sourceBlock: BlockSvg + protected readonly sourceBlock: BlockSvg, ) { super(sourceBlock); } @@ -86,7 +86,7 @@ export class MutatorIcon extends Icon implements IHasBubble { 'height': '16', 'width': '16', }, - this.svgRoot + this.svgRoot, ); // Gear teeth. dom.createSvgElement( @@ -102,13 +102,13 @@ export class MutatorIcon extends Icon implements IHasBubble { '-0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,' + '0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z', }, - this.svgRoot + this.svgRoot, ); // Axle hole. dom.createSvgElement( Svg.CIRCLE, {'class': 'blocklyIconShape', 'r': '2.7', 'cx': '8', 'cy': '8'}, - this.svgRoot + this.svgRoot, ); } @@ -158,13 +158,13 @@ export class MutatorIcon extends Icon implements IHasBubble { this.getMiniWorkspaceConfig(), this.sourceBlock.workspace, this.getAnchorLocation(), - this.getBubbleOwnerRect() + this.getBubbleOwnerRect(), ); this.applyColour(); this.createRootBlock(); this.addSaveConnectionsListener(); this.miniWorkspaceBubble?.addWorkspaceChangeListener( - this.createMiniWorkspaceChangeListener() + this.createMiniWorkspaceChangeListener(), ); } else { this.miniWorkspaceBubble?.dispose(); @@ -175,8 +175,8 @@ export class MutatorIcon extends Icon implements IHasBubble { new (eventUtils.get(eventUtils.BUBBLE_OPEN))( this.sourceBlock, visible, - 'mutator' - ) + 'mutator', + ), ); } @@ -212,7 +212,7 @@ export class MutatorIcon extends Icon implements IHasBubble { const midIcon = SIZE / 2; return Coordinate.sum( this.workspaceLocation, - new Coordinate(midIcon, midIcon) + new Coordinate(midIcon, midIcon), ); } @@ -229,11 +229,11 @@ export class MutatorIcon extends Icon implements IHasBubble { private createRootBlock() { if (!this.sourceBlock.decompose) { throw new Error( - 'Blocks with mutator icons must include a decompose method' + 'Blocks with mutator icons must include a decompose method', ); } this.rootBlock = this.sourceBlock.decompose( - this.miniWorkspaceBubble!.getWorkspace() + this.miniWorkspaceBubble!.getWorkspace(), )!; for (const child of this.rootBlock.getDescendants(false)) { @@ -247,7 +247,7 @@ export class MutatorIcon extends Icon implements IHasBubble { this.miniWorkspaceBubble?.getWorkspace()?.getFlyout()?.getWidth() ?? 0; this.rootBlock.moveBy( this.rootBlock.RTL ? -(flyoutWidth + WORKSPACE_MARGIN) : WORKSPACE_MARGIN, - WORKSPACE_MARGIN + WORKSPACE_MARGIN, ); } @@ -297,7 +297,7 @@ export class MutatorIcon extends Icon implements IHasBubble { if (!this.rootBlock) return; if (!this.sourceBlock.compose) { throw new Error( - 'Blocks with mutator icons must include a compose method' + 'Blocks with mutator icons must include a compose method', ); } @@ -315,8 +315,8 @@ export class MutatorIcon extends Icon implements IHasBubble { 'mutation', null, oldExtraState, - newExtraState - ) + newExtraState, + ), ); } @@ -339,13 +339,13 @@ export class MutatorIcon extends Icon implements IHasBubble { static reconnect( connectionChild: Connection | null, block: Block, - inputName: string + inputName: string, ): boolean { deprecation.warn( 'MutatorIcon.reconnect', 'v10', 'v11', - 'connection.reconnect' + 'connection.reconnect', ); if (!connectionChild) return false; return connectionChild.reconnect(block, inputName); @@ -362,7 +362,7 @@ export class MutatorIcon extends Icon implements IHasBubble { 'MutatorIcon.findParentWs', 'v10', 'v11', - 'workspace.getRootWorkspace' + 'workspace.getRootWorkspace', ); return workspace.getRootWorkspace(); } diff --git a/core/icons/registry.ts b/core/icons/registry.ts index 5585a32a3..ed6be0a00 100644 --- a/core/icons/registry.ts +++ b/core/icons/registry.ts @@ -18,7 +18,7 @@ import {IconType} from './icon_types.js'; */ export function register( type: IconType, - iconConstructor: new (block: Block) => IIcon + iconConstructor: new (block: Block) => IIcon, ) { registry.register(registry.Type.ICON, type.toString(), iconConstructor); } diff --git a/core/icons/warning_icon.ts b/core/icons/warning_icon.ts index f28e5effd..9ae2c67b0 100644 --- a/core/icons/warning_icon.ts +++ b/core/icons/warning_icon.ts @@ -65,7 +65,7 @@ export class WarningIcon extends Icon implements IHasBubble { 'class': 'blocklyIconShape', 'd': 'M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z', }, - this.svgRoot + this.svgRoot, ); // Can't use a real '!' text character since different browsers and // operating systems render it differently. Body of exclamation point. @@ -75,7 +75,7 @@ export class WarningIcon extends Icon implements IHasBubble { 'class': 'blocklyIconSymbol', 'd': 'm7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z', }, - this.svgRoot + this.svgRoot, ); // Dot of exclamation point. dom.createSvgElement( @@ -87,7 +87,7 @@ export class WarningIcon extends Icon implements IHasBubble { 'height': '2', 'width': '2', }, - this.svgRoot + this.svgRoot, ); } @@ -172,7 +172,7 @@ export class WarningIcon extends Icon implements IHasBubble { this.getText(), this.sourceBlock.workspace, this.getAnchorLocation(), - this.getBubbleOwnerRect() + this.getBubbleOwnerRect(), ); this.applyColour(); } else { @@ -184,8 +184,8 @@ export class WarningIcon extends Icon implements IHasBubble { new (eventUtils.get(eventUtils.BUBBLE_OPEN))( this.sourceBlock, visible, - 'warning' - ) + 'warning', + ), ); } @@ -197,7 +197,7 @@ export class WarningIcon extends Icon implements IHasBubble { const midIcon = SIZE / 2; return Coordinate.sum( this.workspaceLocation, - new Coordinate(midIcon, midIcon) + new Coordinate(midIcon, midIcon), ); } diff --git a/core/inject.ts b/core/inject.ts index be9891e4c..cc8668a29 100644 --- a/core/inject.ts +++ b/core/inject.ts @@ -36,7 +36,7 @@ import {WorkspaceSvg} from './workspace_svg.js'; */ export function inject( container: Element | string, - opt_options?: BlocklyOptions + opt_options?: BlocklyOptions, ): WorkspaceSvg { let containerElement: Element | null = null; if (typeof container === 'string') { @@ -115,7 +115,7 @@ function createDom(container: Element, options: Options): SVGElement { 'class': 'blocklySvg', 'tabindex': '0', }, - container + container, ); /* @@ -177,7 +177,7 @@ function createMainWorkspace(svg: SVGElement, options: Options): WorkspaceSvg { mainWorkspace.translate(0, 0); mainWorkspace.addChangeListener( - bumpObjects.bumpIntoBoundsHandler(mainWorkspace) + bumpObjects.bumpIntoBoundsHandler(mainWorkspace), ); // The SVG is now fully assembled. @@ -206,7 +206,7 @@ function init(mainWorkspace: WorkspaceSvg) { if (!browserEvents.isTargetInput(e)) { e.preventDefault(); } - } + }, ); const workspaceResizeHandler = browserEvents.conditionalBind( @@ -222,7 +222,7 @@ function init(mainWorkspace: WorkspaceSvg) { WidgetDiv.repositionForWindowResize(); common.svgResize(mainWorkspace); bumpObjects.bumpTopObjectsIntoBounds(mainWorkspace); - } + }, ); mainWorkspace.setResizeHandlerWrapper(workspaceResizeHandler); @@ -261,7 +261,7 @@ function init(mainWorkspace: WorkspaceSvg) { mainWorkspace, horizontalScroll, verticalScroll, - 'blocklyMainWorkspaceScrollbar' + 'blocklyMainWorkspaceScrollbar', ); mainWorkspace.scrollbar.resize(); } else { @@ -340,7 +340,7 @@ function bindDocumentEvents() { function () { // TODO (#397): Fix for multiple Blockly workspaces. common.svgResize(common.getMainWorkspace() as WorkspaceSvg); - } + }, ); } } @@ -361,7 +361,7 @@ function loadSounds(pathToMedia: string, workspace: WorkspaceSvg) { pathToMedia + 'click.wav', pathToMedia + 'click.ogg', ], - 'click' + 'click', ); audioMgr.load( [ @@ -369,7 +369,7 @@ function loadSounds(pathToMedia: string, workspace: WorkspaceSvg) { pathToMedia + 'disconnect.mp3', pathToMedia + 'disconnect.ogg', ], - 'disconnect' + 'disconnect', ); audioMgr.load( [ @@ -377,7 +377,7 @@ function loadSounds(pathToMedia: string, workspace: WorkspaceSvg) { pathToMedia + 'delete.ogg', pathToMedia + 'delete.wav', ], - 'delete' + 'delete', ); // Bind temporary hooks that preload the sounds. @@ -407,8 +407,8 @@ function loadSounds(pathToMedia: string, workspace: WorkspaceSvg) { 'pointermove', null, unbindSounds, - true - ) + true, + ), ); soundBinds.push( browserEvents.conditionalBind( @@ -416,7 +416,7 @@ function loadSounds(pathToMedia: string, workspace: WorkspaceSvg) { 'touchstart', null, unbindSounds, - true - ) + true, + ), ); } diff --git a/core/inputs/dummy_input.ts b/core/inputs/dummy_input.ts index 3521b9df0..afb4b375b 100644 --- a/core/inputs/dummy_input.ts +++ b/core/inputs/dummy_input.ts @@ -17,7 +17,10 @@ export class DummyInput extends Input { * again. * @param block The block containing this input. */ - constructor(public name: string, block: Block) { + constructor( + public name: string, + block: Block, + ) { super(name, block); } } diff --git a/core/inputs/input.ts b/core/inputs/input.ts index 557f0d939..31d3773b6 100644 --- a/core/inputs/input.ts +++ b/core/inputs/input.ts @@ -42,7 +42,10 @@ export class Input { * again. * @param sourceBlock The block containing this input. */ - constructor(public name: string, private sourceBlock: Block) {} + constructor( + public name: string, + private sourceBlock: Block, + ) {} /** * Get the source block for this input. @@ -80,7 +83,7 @@ export class Input { insertFieldAt( index: number, field: string | Field, - opt_name?: string + opt_name?: string, ): number { if (index < 0 || index > this.fieldRow.length) { throw Error('index ' + index + ' out of bounds.'); diff --git a/core/inputs/statement_input.ts b/core/inputs/statement_input.ts index ee0663459..cf97de234 100644 --- a/core/inputs/statement_input.ts +++ b/core/inputs/statement_input.ts @@ -21,7 +21,10 @@ export class StatementInput extends Input { * again. * @param block The block containing this input. */ - constructor(public name: string, block: Block) { + constructor( + public name: string, + block: Block, + ) { // Errors are maintained for people not using typescript. if (!name) throw new Error('Statement inputs must have a non-empty name'); diff --git a/core/inputs/value_input.ts b/core/inputs/value_input.ts index ef88ac58e..e8049b471 100644 --- a/core/inputs/value_input.ts +++ b/core/inputs/value_input.ts @@ -18,7 +18,10 @@ export class ValueInput extends Input { * again. * @param block The block containing this input. */ - constructor(public name: string, block: Block) { + constructor( + public name: string, + block: Block, + ) { // Errors are maintained for people not using typescript. if (!name) throw new Error('Value inputs must have a non-empty name'); super(name, block); diff --git a/core/insertion_marker_manager.ts b/core/insertion_marker_manager.ts index 016d76b90..660cc0611 100644 --- a/core/insertion_marker_manager.ts +++ b/core/insertion_marker_manager.ts @@ -136,7 +136,7 @@ export class InsertionMarkerManager { if (this.lastOnStack) { this.lastMarker = this.createMarkerBlock( - this.lastOnStack.getSourceBlock() + this.lastOnStack.getSourceBlock(), ); } } @@ -311,7 +311,7 @@ export class InsertionMarkerManager { */ private shouldUpdatePreviews( newCandidate: CandidateConnection | null, - dxy: Coordinate + dxy: Coordinate, ): boolean { // Only need to update if we were showing a preview before. if (!newCandidate) return !!this.activeCandidate; @@ -404,18 +404,18 @@ export class InsertionMarkerManager { */ private shouldDelete( newCandidate: boolean, - dragTarget: IDragTarget | null + dragTarget: IDragTarget | null, ): boolean { if (dragTarget) { const componentManager = this.workspace.getComponentManager(); const isDeleteArea = componentManager.hasCapability( dragTarget.id, - ComponentManager.Capability.DELETE_AREA + ComponentManager.Capability.DELETE_AREA, ); if (isDeleteArea) { return (dragTarget as IDeleteArea).wouldDelete( this.topBlock, - newCandidate + newCandidate, ); } } @@ -462,7 +462,7 @@ export class InsertionMarkerManager { const method = renderer.getConnectionPreviewMethod( activeCandidate.closest, activeCandidate.local, - this.topBlock + this.topBlock, ); switch (method) { @@ -552,14 +552,14 @@ export class InsertionMarkerManager { if (!insertionMarker) { throw new Error( 'Cannot show the insertion marker because there is no insertion ' + - 'marker block' + 'marker block', ); } let imConn; try { imConn = insertionMarker.getMatchingConnection( local.getSourceBlock(), - local + local, ); } catch (e) { // It's possible that the number of connections on the local block has @@ -571,7 +571,7 @@ export class InsertionMarkerManager { if (isLastInStack && this.lastOnStack) { this.disposeInsertionMarker(this.lastMarker); this.lastMarker = this.createMarkerBlock( - this.lastOnStack.getSourceBlock() + this.lastOnStack.getSourceBlock(), ); insertionMarker = this.lastMarker; } else { @@ -583,26 +583,26 @@ export class InsertionMarkerManager { if (!insertionMarker) { throw new Error( 'Cannot show the insertion marker because there is no insertion ' + - 'marker block' + 'marker block', ); } imConn = insertionMarker.getMatchingConnection( local.getSourceBlock(), - local + local, ); } if (!imConn) { throw new Error( 'Cannot show the insertion marker because there is no ' + - 'associated connection' + 'associated connection', ); } if (imConn === this.markerConnection) { throw new Error( "Made it to showInsertionMarker_ even though the marker isn't " + - 'changing' + 'changing', ); } @@ -648,7 +648,7 @@ export class InsertionMarkerManager { if (markerConn.targetConnection) { throw Error( 'markerConnection still connected at the end of ' + - 'disconnectInsertionMarker' + 'disconnectInsertionMarker', ); } @@ -678,12 +678,12 @@ export class InsertionMarkerManager { if (!this.activeCandidate) { throw new Error( 'Cannot hide the insertion marker outline because ' + - 'there is no active candidate' + 'there is no active candidate', ); } this.highlightedBlock.highlightShapeForInput( this.activeCandidate.closest, - false + false, ); this.highlightedBlock = null; } @@ -700,7 +700,7 @@ export class InsertionMarkerManager { if (!this.fadedBlock) { throw new Error( 'Cannot show the replacement fade because the ' + - 'closest connection does not have a target block' + 'closest connection does not have a target block', ); } this.fadedBlock.fadeForReplacement(true); diff --git a/core/interfaces/i_connection_checker.ts b/core/interfaces/i_connection_checker.ts index 7264895df..9d98deb3e 100644 --- a/core/interfaces/i_connection_checker.ts +++ b/core/interfaces/i_connection_checker.ts @@ -28,7 +28,7 @@ export interface IConnectionChecker { a: Connection | null, b: Connection | null, isDragging: boolean, - opt_distance?: number + opt_distance?: number, ): boolean; /** @@ -47,7 +47,7 @@ export interface IConnectionChecker { a: Connection | null, b: Connection | null, isDragging: boolean, - opt_distance?: number + opt_distance?: number, ): number; /** @@ -61,7 +61,7 @@ export interface IConnectionChecker { getErrorMessage( errorCode: number, a: Connection | null, - b: Connection | null + b: Connection | null, ): string; /** @@ -96,6 +96,6 @@ export interface IConnectionChecker { doDragChecks( a: RenderedConnection, b: RenderedConnection, - distance: number + distance: number, ): boolean; } diff --git a/core/interfaces/i_flyout.ts b/core/interfaces/i_flyout.ts index 540f9ad69..719245a8e 100644 --- a/core/interfaces/i_flyout.ts +++ b/core/interfaces/i_flyout.ts @@ -46,7 +46,7 @@ export interface IFlyout extends IRegistrable { * @returns The flyout's SVG group. */ createDom( - tagName: string | Svg | Svg + tagName: string | Svg | Svg, ): SVGElement; /** diff --git a/core/interfaces/i_legacy_procedure_blocks.ts b/core/interfaces/i_legacy_procedure_blocks.ts index cab4dc93f..3bd7e19bf 100644 --- a/core/interfaces/i_legacy_procedure_blocks.ts +++ b/core/interfaces/i_legacy_procedure_blocks.ts @@ -28,7 +28,7 @@ export interface LegacyProcedureDefBlock { /** @internal */ export function isLegacyProcedureDefBlock( - block: Object + block: Object, ): block is LegacyProcedureDefBlock { return (block as any).getProcedureDef !== undefined; } @@ -41,7 +41,7 @@ export interface LegacyProcedureCallBlock { /** @internal */ export function isLegacyProcedureCallBlock( - block: Object + block: Object, ): block is LegacyProcedureCallBlock { return ( (block as any).getProcedureCall !== undefined && diff --git a/core/interfaces/i_metrics_manager.ts b/core/interfaces/i_metrics_manager.ts index a06e0ca4a..36151863f 100644 --- a/core/interfaces/i_metrics_manager.ts +++ b/core/interfaces/i_metrics_manager.ts @@ -43,7 +43,7 @@ export interface IMetricsManager { getScrollMetrics( opt_getWorkspaceCoordinates?: boolean, opt_viewMetrics?: ContainerRegion, - opt_contentMetrics?: ContainerRegion + opt_contentMetrics?: ContainerRegion, ): ContainerRegion; /** diff --git a/core/interfaces/i_procedure_block.ts b/core/interfaces/i_procedure_block.ts index e24e2ced3..d37a6ea13 100644 --- a/core/interfaces/i_procedure_block.ts +++ b/core/interfaces/i_procedure_block.ts @@ -18,7 +18,7 @@ export interface IProcedureBlock { /** A type guard which checks if the given block is a procedure block. */ export function isProcedureBlock( - block: Block | IProcedureBlock + block: Block | IProcedureBlock, ): block is IProcedureBlock { return ( (block as IProcedureBlock).getProcedureModel !== undefined && diff --git a/core/interfaces/i_selectable_toolbox_item.ts b/core/interfaces/i_selectable_toolbox_item.ts index 453608c95..d9ceedf81 100644 --- a/core/interfaces/i_selectable_toolbox_item.ts +++ b/core/interfaces/i_selectable_toolbox_item.ts @@ -58,7 +58,7 @@ export interface ISelectableToolboxItem extends IToolboxItem { * Type guard that checks whether an IToolboxItem is an ISelectableToolboxItem. */ export function isSelectableToolboxItem( - toolboxItem: IToolboxItem + toolboxItem: IToolboxItem, ): toolboxItem is ISelectableToolboxItem { return toolboxItem.isSelectable(); } diff --git a/core/interfaces/i_variable_backed_parameter_model.ts b/core/interfaces/i_variable_backed_parameter_model.ts index 71433f94f..b2042bfb2 100644 --- a/core/interfaces/i_variable_backed_parameter_model.ts +++ b/core/interfaces/i_variable_backed_parameter_model.ts @@ -17,7 +17,7 @@ export interface IVariableBackedParameterModel extends IParameterModel { * Returns whether the given object is a variable holder or not. */ export function isVariableBackedParameterModel( - param: IParameterModel + param: IParameterModel, ): param is IVariableBackedParameterModel { return (param as any).getVariableModel !== undefined; } diff --git a/core/keyboard_nav/ast_node.ts b/core/keyboard_nav/ast_node.ts index ce01b1a7b..932bec622 100644 --- a/core/keyboard_nav/ast_node.ts +++ b/core/keyboard_nav/ast_node.ts @@ -174,7 +174,7 @@ export class ASTNode { const block = location.getSourceBlock(); if (!block) { throw new Error( - 'The current AST location is not associated with a block' + 'The current AST location is not associated with a block', ); } const curIdx = block.inputList.indexOf(input); @@ -238,7 +238,7 @@ export class ASTNode { const block = location.getSourceBlock(); if (!block) { throw new Error( - 'The current AST location is not associated with a block' + 'The current AST location is not associated with a block', ); } const curIdx = block.inputList.indexOf(parentInput); @@ -301,7 +301,7 @@ export class ASTNode { } } throw Error( - "Couldn't find " + (forward ? 'next' : 'previous') + ' stack?!' + "Couldn't find " + (forward ? 'next' : 'previous') + ' stack?!', ); } @@ -348,7 +348,7 @@ export class ASTNode { // AnyDuringMigration because: Argument of type 'Input | null' is not // assignable to parameter of type 'Input'. return ASTNode.createInputNode( - topConnection.targetConnection.getParentInput() as AnyDuringMigration + topConnection.targetConnection.getParentInput() as AnyDuringMigration, ); } else { // Go to stack level if you are not underneath an input. @@ -534,7 +534,7 @@ export class ASTNode { // TODO: Make sure this is in the bounds of the workspace. const wsCoordinate = new Coordinate( blockPos.x, - blockPos.y + ASTNode.DEFAULT_OFFSET_Y + blockPos.y + ASTNode.DEFAULT_OFFSET_Y, ); return ASTNode.createWorkspaceNode(block.workspace, wsCoordinate); } @@ -551,7 +551,7 @@ export class ASTNode { const block = field.getSourceBlock(); if (!block) { throw new Error( - 'The current AST location is not associated with a block' + 'The current AST location is not associated with a block', ); } return ASTNode.createBlockNode(block); @@ -624,7 +624,7 @@ export class ASTNode { // AnyDuringMigration because: Argument of type 'Input | null' is not // assignable to parameter of type 'Input'. return ASTNode.createInputNode( - connection.getParentInput() as AnyDuringMigration + connection.getParentInput() as AnyDuringMigration, ); } else if ( type === ConnectionType.NEXT_STATEMENT && @@ -633,7 +633,7 @@ export class ASTNode { // AnyDuringMigration because: Argument of type 'Input | null' is not // assignable to parameter of type 'Input'. return ASTNode.createInputNode( - connection.getParentInput() as AnyDuringMigration + connection.getParentInput() as AnyDuringMigration, ); } else if (type === ConnectionType.NEXT_STATEMENT) { return new ASTNode(ASTNode.types.NEXT, connection); @@ -699,7 +699,7 @@ export class ASTNode { */ static createWorkspaceNode( workspace: Workspace | null, - wsCoordinate: Coordinate | null + wsCoordinate: Coordinate | null, ): ASTNode | null { if (!wsCoordinate || !workspace) { return null; diff --git a/core/keyboard_nav/basic_cursor.ts b/core/keyboard_nav/basic_cursor.ts index 96566a4c0..71bd879f9 100644 --- a/core/keyboard_nav/basic_cursor.ts +++ b/core/keyboard_nav/basic_cursor.ts @@ -105,7 +105,7 @@ export class BasicCursor extends Cursor { */ protected getNextNode_( node: ASTNode | null, - isValid: (p1: ASTNode | null) => boolean + isValid: (p1: ASTNode | null) => boolean, ): ASTNode | null { if (!node) { return null; @@ -138,7 +138,7 @@ export class BasicCursor extends Cursor { */ protected getPreviousNode_( node: ASTNode | null, - isValid: (p1: ASTNode | null) => boolean + isValid: (p1: ASTNode | null) => boolean, ): ASTNode | null { if (!node) { return null; @@ -220,5 +220,5 @@ export class BasicCursor extends Cursor { registry.register( registry.Type.CURSOR, BasicCursor.registrationName, - BasicCursor + BasicCursor, ); diff --git a/core/main.js b/core/main.js index cc83733d4..9606a67b6 100644 --- a/core/main.js +++ b/core/main.js @@ -42,7 +42,7 @@ Object.defineProperties(Blockly, { 'Blockly.HSV_SATURATION', 'version 10', 'version 11', - 'Blockly.utils.colour.getHsvSaturation()' + 'Blockly.utils.colour.getHsvSaturation()', ); return colour.getHsvSaturation(); }, @@ -51,7 +51,7 @@ Object.defineProperties(Blockly, { 'Blockly.HSV_SATURATION', 'version 10', 'version 11', - 'Blockly.utils.colour.setHsvSaturation()' + 'Blockly.utils.colour.setHsvSaturation()', ); colour.setHsvSaturation(newValue); }, @@ -71,7 +71,7 @@ Object.defineProperties(Blockly, { 'Blockly.HSV_VALUE', 'version 10', 'version 11', - 'Blockly.utils.colour.getHsvValue()' + 'Blockly.utils.colour.getHsvValue()', ); return colour.getHsvValue(); }, @@ -80,7 +80,7 @@ Object.defineProperties(Blockly, { 'Blockly.HSV_VALUE', 'version 10', 'version 11', - 'Blockly.utils.colour.setHsvValue()' + 'Blockly.utils.colour.setHsvValue()', ); colour.setHsvValue(newValue); }, diff --git a/core/marker_manager.ts b/core/marker_manager.ts index c811c7e33..51cbee170 100644 --- a/core/marker_manager.ts +++ b/core/marker_manager.ts @@ -52,7 +52,7 @@ export class MarkerManager { this.unregisterMarker(id); } marker.setDrawer( - this.workspace.getRenderer().makeMarkerDrawer(this.workspace, marker) + this.workspace.getRenderer().makeMarkerDrawer(this.workspace, marker), ); this.setMarkerSvg(marker.getDrawer().createDom()); this.markers.set(id, marker); @@ -73,7 +73,7 @@ export class MarkerManager { 'Marker with ID ' + id + ' does not exist. ' + - 'Can only unregister markers that exist.' + 'Can only unregister markers that exist.', ); } } diff --git a/core/menu.ts b/core/menu.ts index b5a214515..f3239122c 100644 --- a/core/menu.ts +++ b/core/menu.ts @@ -105,34 +105,34 @@ export class Menu { 'pointerover', this, this.handleMouseOver, - true + true, ); this.clickHandler = browserEvents.conditionalBind( element, 'pointerup', this, this.handleClick, - true + true, ); this.mouseEnterHandler = browserEvents.conditionalBind( element, 'pointerenter', this, this.handleMouseEnter, - true + true, ); this.mouseLeaveHandler = browserEvents.conditionalBind( element, 'pointerleave', this, this.handleMouseLeave, - true + true, ); this.onKeyDownHandler = browserEvents.conditionalBind( element, 'keydown', this, - this.handleKeyEvent + this.handleKeyEvent, ); container.appendChild(element); diff --git a/core/menuitem.ts b/core/menuitem.ts index f2df7f94e..6687f61cf 100644 --- a/core/menuitem.ts +++ b/core/menuitem.ts @@ -51,7 +51,7 @@ export class MenuItem { */ constructor( private readonly content: string | HTMLElement, - private readonly opt_value?: string + private readonly opt_value?: string, ) {} /** @@ -98,7 +98,7 @@ export class MenuItem { aria.setState( element, aria.State.SELECTED, - (this.checkable && this.checked) || false + (this.checkable && this.checked) || false, ); aria.setState(element, aria.State.DISABLED, !this.enabled); diff --git a/core/metrics_manager.ts b/core/metrics_manager.ts index a24d257d1..c7c0fbf7a 100644 --- a/core/metrics_manager.ts +++ b/core/metrics_manager.ts @@ -64,7 +64,7 @@ export class MetricsManager implements IMetricsManager { */ getFlyoutMetrics(opt_own?: boolean): ToolboxMetrics { const flyoutDimensions = this.getDimensionsPx_( - this.workspace_.getFlyout(opt_own) + this.workspace_.getFlyout(opt_own), ); return { width: flyoutDimensions.width, @@ -83,7 +83,7 @@ export class MetricsManager implements IMetricsManager { */ getToolboxMetrics(): ToolboxMetrics { const toolboxDimensions = this.getDimensionsPx_( - this.workspace_.getToolbox() + this.workspace_.getToolbox(), ); return { @@ -237,7 +237,7 @@ export class MetricsManager implements IMetricsManager { * @returns The fixed edges of the scroll area. */ protected getComputedFixedEdges_( - opt_viewMetrics?: ContainerRegion + opt_viewMetrics?: ContainerRegion, ): FixedEdges { if (!this.hasFixedEdges()) { // Return early if there are no edges. @@ -270,7 +270,7 @@ export class MetricsManager implements IMetricsManager { */ protected getPaddedContent_( viewMetrics: ContainerRegion, - contentMetrics: ContainerRegion + contentMetrics: ContainerRegion, ): {top: number; bottom: number; left: number; right: number} { const contentBottom = contentMetrics.top + contentMetrics.height; const contentRight = contentMetrics.left + contentMetrics.width; @@ -284,19 +284,19 @@ export class MetricsManager implements IMetricsManager { // Ensure padding is wide enough that blocks can scroll over entire screen. const top = Math.min( contentMetrics.top - halfHeight, - contentBottom - viewHeight + contentBottom - viewHeight, ); const left = Math.min( contentMetrics.left - halfWidth, - contentRight - viewWidth + contentRight - viewWidth, ); const bottom = Math.max( contentBottom + halfHeight, - contentMetrics.top + viewHeight + contentMetrics.top + viewHeight, ); const right = Math.max( contentRight + halfWidth, - contentMetrics.left + viewWidth + contentMetrics.left + viewWidth, ); return {top, bottom, left, right}; @@ -318,7 +318,7 @@ export class MetricsManager implements IMetricsManager { getScrollMetrics( opt_getWorkspaceCoordinates?: boolean, opt_viewMetrics?: ContainerRegion, - opt_contentMetrics?: ContainerRegion + opt_contentMetrics?: ContainerRegion, ): ContainerRegion { const scale = opt_getWorkspaceCoordinates ? this.workspace_.scale : 1; const viewMetrics = opt_viewMetrics || this.getViewMetrics(false); @@ -406,7 +406,7 @@ export class MetricsManager implements IMetricsManager { const scrollMetrics = this.getScrollMetrics( false, viewMetrics, - contentMetrics + contentMetrics, ); return { @@ -494,5 +494,5 @@ export type UiMetrics = MetricsManager.UiMetrics; registry.register( registry.Type.METRICS_MANAGER, registry.DEFAULT, - MetricsManager + MetricsManager, ); diff --git a/core/names.ts b/core/names.ts index 8f8b45c07..8413de615 100644 --- a/core/names.ts +++ b/core/names.ts @@ -53,7 +53,7 @@ export class Names { this.variablePrefix = opt_variablePrefix || ''; this.reservedWords = new Set( - reservedWordsList ? reservedWordsList.split(',') : [] + reservedWordsList ? reservedWordsList.split(',') : [], ); } @@ -90,7 +90,7 @@ export class Names { 'defining a variable map. To fix, add the following code in your ' + "generator's init() function:\n" + 'Blockly.YourGeneratorName.nameDB_.setVariableMap(' + - 'workspace.getVariableMap());' + 'workspace.getVariableMap());', ); return null; } @@ -122,7 +122,7 @@ export class Names { populateProcedures(workspace: Workspace) { throw new Error( 'The implementation of populateProcedures should be ' + - 'monkey-patched in by blockly.ts' + 'monkey-patched in by blockly.ts', ); } diff --git a/core/options.ts b/core/options.ts index 03060f9f3..99a0e83a2 100644 --- a/core/options.ts +++ b/core/options.ts @@ -92,7 +92,7 @@ export class Options { const readOnly = !!options['readOnly']; if (!readOnly) { toolboxJsonDef = toolbox.convertToolboxDefToJson( - options['toolbox'] ?? null + options['toolbox'] ?? null, ); hasCategories = toolbox.hasCategories(toolboxJsonDef); const rawHasTrashcan = options['trashcan']; @@ -209,7 +209,7 @@ export class Options { */ private static parseMoveOptions_( options: BlocklyOptions, - hasCategories: boolean + hasCategories: boolean, ): MoveOptions { const move = options['move'] || {}; const moveOptions = {} as MoveOptions; @@ -342,7 +342,7 @@ export class Options { } return Theme.defineTheme( theme.name || 'builtin' + idGenerator.getNextUniqueId(), - theme + theme, ); } } diff --git a/core/positionable_helpers.ts b/core/positionable_helpers.ts index ae221468a..d7eb5d258 100644 --- a/core/positionable_helpers.ts +++ b/core/positionable_helpers.ts @@ -75,7 +75,7 @@ export function getStartPositionRect( horizontalPadding: number, verticalPadding: number, metrics: UiMetrics, - workspace: WorkspaceSvg + workspace: WorkspaceSvg, ): Rect { // Horizontal positioning. let left = 0; @@ -129,7 +129,7 @@ export function getStartPositionRect( */ export function getCornerOppositeToolbox( workspace: WorkspaceSvg, - metrics: UiMetrics + metrics: UiMetrics, ): Position { const leftCorner = metrics.toolboxMetrics.position !== toolbox.Position.LEFT && @@ -160,7 +160,7 @@ export function bumpPositionRect( startRect: Rect, margin: number, bumpDir: bumpDirection, - savedPositions: Rect[] + savedPositions: Rect[], ): Rect { let top = startRect.top; const left = startRect.left; diff --git a/core/procedures.ts b/core/procedures.ts index 03e4db229..db03a9dcf 100644 --- a/core/procedures.ts +++ b/core/procedures.ts @@ -63,7 +63,7 @@ export const DEFAULT_ARG = 'x'; * list of name, parameter list, and return value boolean. */ export function allProcedures( - root: Workspace + root: Workspace, ): [ProcedureTuple[], ProcedureTuple[]] { const proceduresNoReturn: ProcedureTuple[] = root .getProcedureMap() @@ -150,7 +150,7 @@ export function findLegalName(name: string, block: Block): string { function isLegalName( name: string, workspace: Workspace, - opt_exclude?: Block + opt_exclude?: Block, ): boolean { return !isNameUsed(name, workspace, opt_exclude); } @@ -167,7 +167,7 @@ function isLegalName( export function isNameUsed( name: string, workspace: Workspace, - opt_exclude?: Block + opt_exclude?: Block, ): boolean { for (const block of workspace.getAllBlocks(false)) { if (block === opt_exclude) continue; @@ -243,7 +243,7 @@ export function flyoutCategory(workspace: WorkspaceSvg): Element[] { const nameField = utilsXml.createElement('field'); nameField.setAttribute('name', 'NAME'); nameField.appendChild( - utilsXml.createTextNode(Msg['PROCEDURES_DEFNORETURN_PROCEDURE']) + utilsXml.createTextNode(Msg['PROCEDURES_DEFNORETURN_PROCEDURE']), ); block.appendChild(nameField); xmlList.push(block); @@ -258,7 +258,7 @@ export function flyoutCategory(workspace: WorkspaceSvg): Element[] { const nameField = utilsXml.createElement('field'); nameField.setAttribute('name', 'NAME'); nameField.appendChild( - utilsXml.createTextNode(Msg['PROCEDURES_DEFRETURN_PROCEDURE']) + utilsXml.createTextNode(Msg['PROCEDURES_DEFRETURN_PROCEDURE']), ); block.appendChild(nameField); xmlList.push(block); @@ -284,7 +284,7 @@ export function flyoutCategory(workspace: WorkspaceSvg): Element[] { */ function populateProcedures( procedureList: ProcedureTuple[], - templateName: string + templateName: string, ) { for (let i = 0; i < procedureList.length; i++) { const name = procedureList[i][0]; @@ -336,7 +336,7 @@ function updateMutatorFlyout(workspace: WorkspaceSvg) { nameField.setAttribute('name', 'NAME'); const argValue = Variables.generateUniqueNameFromOptions( DEFAULT_ARG, - usedNames + usedNames, ); const fieldContent = utilsXml.createTextNode(argValue); @@ -460,8 +460,8 @@ export function mutateCallers(defBlock: Block) { 'mutation', null, oldMutation, - newMutation - ) + newMutation, + ), ); eventUtils.setRecordUndo(oldRecordUndo); } @@ -477,7 +477,7 @@ export function mutateCallers(defBlock: Block) { */ export function getDefinition( name: string, - workspace: Workspace + workspace: Workspace, ): Block | null { // Do not assume procedure is a top block. Some languages allow nested // procedures. Also do not assume it is one of the built-in blocks. Only diff --git a/core/registry.ts b/core/registry.ts index 68bd53685..a20227000 100644 --- a/core/registry.ts +++ b/core/registry.ts @@ -84,7 +84,7 @@ export class Type<_T> { static FLYOUTS_VERTICAL_TOOLBOX = new Type('flyoutsVerticalToolbox'); static FLYOUTS_HORIZONTAL_TOOLBOX = new Type( - 'flyoutsHorizontalToolbox' + 'flyoutsHorizontalToolbox', ); static METRICS_MANAGER = new Type('metricsManager'); @@ -118,7 +118,7 @@ export function register( | (new (...p1: AnyDuringMigration[]) => T) | null | AnyDuringMigration, - opt_allowOverrides?: boolean + opt_allowOverrides?: boolean, ): void { if ( (!(type instanceof Type) && typeof type !== 'string') || @@ -128,14 +128,14 @@ export function register( 'Invalid type "' + type + '". The type must be a' + - ' non-empty string or a Blockly.registry.Type.' + ' non-empty string or a Blockly.registry.Type.', ); } type = `${type}`.toLowerCase(); if (typeof name !== 'string' || name.trim() === '') { throw Error( - 'Invalid name "' + name + '". The name must be a' + ' non-empty string.' + 'Invalid name "' + name + '". The name must be a' + ' non-empty string.', ); } const caselessName = name.toLowerCase(); @@ -156,7 +156,11 @@ export function register( // Don't throw an error if opt_allowOverrides is true. if (!opt_allowOverrides && typeRegistry[caselessName]) { throw Error( - 'Name "' + caselessName + '" with type "' + type + '" already registered.' + 'Name "' + + caselessName + + '" with type "' + + type + + '" already registered.', ); } typeRegistry[caselessName] = registryItem; @@ -199,7 +203,7 @@ export function unregister(type: string | Type, name: string) { '][' + type + '] from the ' + - 'registry.' + 'registry.', ); return; } @@ -222,7 +226,7 @@ export function unregister(type: string | Type, name: string) { function getItem( type: string | Type, name: string, - opt_throwIfMissing?: boolean + opt_throwIfMissing?: boolean, ): (new (...p1: AnyDuringMigration[]) => T) | null | AnyDuringMigration { type = `${type}`.toLowerCase(); name = name.toLowerCase(); @@ -231,7 +235,7 @@ function getItem( const msg = 'Unable to find [' + name + '][' + type + '] in the registry.'; if (opt_throwIfMissing) { throw new Error( - msg + ' You must require or register a ' + type + ' plugin.' + msg + ' You must require or register a ' + type + ' plugin.', ); } else { console.warn(msg); @@ -274,7 +278,7 @@ export function hasItem(type: string | Type, name: string): boolean { export function getClass( type: string | Type, name: string, - opt_throwIfMissing?: boolean + opt_throwIfMissing?: boolean, ): (new (...p1: AnyDuringMigration[]) => T) | null { return getItem(type, name, opt_throwIfMissing) as | (new (...p1: AnyDuringMigration[]) => T) @@ -294,7 +298,7 @@ export function getClass( export function getObject( type: string | Type, name: string, - opt_throwIfMissing?: boolean + opt_throwIfMissing?: boolean, ): T | null { return getItem(type, name, opt_throwIfMissing) as T; } @@ -312,7 +316,7 @@ export function getObject( export function getAllItems( type: string | Type, opt_cased?: boolean, - opt_throwIfMissing?: boolean + opt_throwIfMissing?: boolean, ): {[key: string]: T | null | (new (...p1: AnyDuringMigration[]) => T)} | null { type = `${type}`.toLowerCase(); const typeRegistry = typeMap[type]; @@ -349,7 +353,7 @@ export function getAllItems( export function getClassFromOptions( type: Type, options: Options, - opt_throwIfMissing?: boolean + opt_throwIfMissing?: boolean, ): (new (...p1: AnyDuringMigration[]) => T) | null { const plugin = options.plugins[String(type)] || DEFAULT; diff --git a/core/render_management.ts b/core/render_management.ts index 9a9a4d0cf..8adc83c20 100644 --- a/core/render_management.ts +++ b/core/render_management.ts @@ -150,7 +150,7 @@ function updateConnectionLocations(block: BlockSvg, blockOrigin: Coordinate) { if (moved || dirtyBlocks.has(target)) { updateConnectionLocations( target, - Coordinate.sum(blockOrigin, target.relativeCoords) + Coordinate.sum(blockOrigin, target.relativeCoords), ); } } @@ -170,7 +170,7 @@ function updateIconLocations(block: BlockSvg, blockOrigin: Coordinate) { for (const child of block.getChildren(false)) { updateIconLocations( child, - Coordinate.sum(blockOrigin, child.relativeCoords) + Coordinate.sum(blockOrigin, child.relativeCoords), ); } } diff --git a/core/rendered_connection.ts b/core/rendered_connection.ts index a3cd51a96..f6a606279 100644 --- a/core/rendered_connection.ts +++ b/core/rendered_connection.ts @@ -243,7 +243,7 @@ export class RenderedConnection extends Connection { moveToOffset(blockTL: Coordinate): boolean { return this.moveTo( blockTL.x + this.offsetInBlock.x, - blockTL.y + this.offsetInBlock.y + blockTL.y + this.offsetInBlock.y, ); } @@ -300,7 +300,7 @@ export class RenderedConnection extends Connection { if (!target || !block) return; const offset = Coordinate.difference( this.offsetInBlock, - target.offsetInBlock + target.offsetInBlock, ); block.translate(offset.x, offset.y); } @@ -317,7 +317,7 @@ export class RenderedConnection extends Connection { */ closest( maxLimit: number, - dxy: Coordinate + dxy: Coordinate, ): {connection: RenderedConnection | null; radius: number} { return this.dbOpposite.searchForClosest(this, maxLimit, dxy); } @@ -365,7 +365,7 @@ export class RenderedConnection extends Connection { `translate(${offset.x}, ${offset.y})` + (this.sourceBlock_.RTL ? ' scale(-1 1)' : ''), }, - this.sourceBlock_.getSvgRoot() + this.sourceBlock_.getSvgRoot(), ); } @@ -501,7 +501,7 @@ export class RenderedConnection extends Connection { eventUtils.setGroup(false); } }.bind(this), - config.bumpDelay + config.bumpDelay, ); } } @@ -616,7 +616,7 @@ export class RenderedConnection extends Connection { !this.getConnectionChecker().canConnect( this, this.targetConnection, - false + false, )) ) { const child = this.isSuperior() ? this.targetBlock() : this.sourceBlock_; diff --git a/core/renderers/common/block_rendering.ts b/core/renderers/common/block_rendering.ts index 8d93e71d3..09eef3be0 100644 --- a/core/renderers/common/block_rendering.ts +++ b/core/renderers/common/block_rendering.ts @@ -73,7 +73,7 @@ export function unregister(name: string) { export function init( name: string, theme: Theme, - opt_rendererOverrides?: {[rendererConstant: string]: any} + opt_rendererOverrides?: {[rendererConstant: string]: any}, ): Renderer { const rendererClass = registry.getClass(registry.Type.RENDERER, name); const renderer = new rendererClass!(name); diff --git a/core/renderers/common/constants.ts b/core/renderers/common/constants.ts index 1ef32a54a..27317cb54 100644 --- a/core/renderers/common/constants.ts +++ b/core/renderers/common/constants.ts @@ -551,7 +551,7 @@ export class ConstantProvider { 'Hg', this.FIELD_TEXT_FONTSIZE + 'pt', this.FIELD_TEXT_FONTWEIGHT, - this.FIELD_TEXT_FONTFAMILY + this.FIELD_TEXT_FONTFAMILY, ); this.FIELD_TEXT_HEIGHT = fontMetrics.height; @@ -633,7 +633,7 @@ export class ConstantProvider { } // Validate required properties. const parsedColour = parsing.parseBlockColour( - valid['colourPrimary'] || '#000' + valid['colourPrimary'] || '#000', ); valid.colourPrimary = parsedColour.hex; valid.colourSecondary = valid['colourSecondary'] @@ -820,14 +820,14 @@ export class ConstantProvider { 'a', '0 0,0', radius, - svgPaths.point(-radius, radius) + svgPaths.point(-radius, radius), ); const innerBottomLeftCorner = svgPaths.arc( 'a', '0 0,0', radius, - svgPaths.point(radius, radius) + svgPaths.point(radius, radius), ); return { @@ -854,7 +854,7 @@ export class ConstantProvider { 'a', '0 0,1', radius, - svgPaths.point(radius, radius) + svgPaths.point(radius, radius), ); /** SVG path for drawing the rounded bottom-left corner. */ @@ -862,7 +862,7 @@ export class ConstantProvider { 'a', '0 0,1', radius, - svgPaths.point(-radius, -radius) + svgPaths.point(-radius, -radius), ); /** SVG path for drawing the rounded bottom-right corner. */ @@ -870,7 +870,7 @@ export class ConstantProvider { 'a', '0 0,1', radius, - svgPaths.point(-radius, radius) + svgPaths.point(-radius, radius), ); return { @@ -935,12 +935,12 @@ export class ConstantProvider { const embossFilter = dom.createSvgElement( Svg.FILTER, {'id': 'blocklyEmbossFilter' + this.randomIdentifier}, - this.defs + this.defs, ); dom.createSvgElement( Svg.FEGAUSSIANBLUR, {'in': 'SourceAlpha', 'stdDeviation': 1, 'result': 'blur'}, - embossFilter + embossFilter, ); const feSpecularLighting = dom.createSvgElement( Svg.FESPECULARLIGHTING, @@ -952,12 +952,12 @@ export class ConstantProvider { 'lighting-color': 'white', 'result': 'specOut', }, - embossFilter + embossFilter, ); dom.createSvgElement( Svg.FEPOINTLIGHT, {'x': -5000, 'y': -10000, 'z': 20000}, - feSpecularLighting + feSpecularLighting, ); dom.createSvgElement( Svg.FECOMPOSITE, @@ -967,7 +967,7 @@ export class ConstantProvider { 'operator': 'in', 'result': 'specOut', }, - embossFilter + embossFilter, ); dom.createSvgElement( Svg.FECOMPOSITE, @@ -980,7 +980,7 @@ export class ConstantProvider { 'k3': 1, 'k4': 0, }, - embossFilter + embossFilter, ); this.embossFilterId = embossFilter.id; this.embossFilter = embossFilter; @@ -1000,17 +1000,17 @@ export class ConstantProvider { 'width': 10, 'height': 10, }, - this.defs + this.defs, ); dom.createSvgElement( Svg.RECT, {'width': 10, 'height': 10, 'fill': '#aaa'}, - disabledPattern + disabledPattern, ); dom.createSvgElement( Svg.PATH, {'d': 'M 0 0 L 10 10 M 10 0 L 0 10', 'stroke': '#cc0'}, - disabledPattern + disabledPattern, ); this.disabledPatternId = disabledPattern.id; this.disabledPattern = disabledPattern; @@ -1034,18 +1034,18 @@ export class ConstantProvider { 'y': '-30%', 'x': '-40%', }, - this.defs + this.defs, ); // Set all gaussian blur pixels to 1 opacity before applying flood const debugComponentTransfer = dom.createSvgElement( Svg.FECOMPONENTTRANSFER, {'result': 'outBlur'}, - debugFilter + debugFilter, ); dom.createSvgElement( Svg.FEFUNCA, {'type': 'table', 'tableValues': '0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'}, - debugComponentTransfer + debugComponentTransfer, ); // Color the highlight dom.createSvgElement( @@ -1055,7 +1055,7 @@ export class ConstantProvider { 'flood-opacity': 0.5, 'result': 'outColor', }, - debugFilter + debugFilter, ); dom.createSvgElement( Svg.FECOMPOSITE, @@ -1065,7 +1065,7 @@ export class ConstantProvider { 'operator': 'in', 'result': 'outGlow', }, - debugFilter + debugFilter, ); this.debugFilterId = debugFilter.id; this.debugFilter = debugFilter; diff --git a/core/renderers/common/drawer.ts b/core/renderers/common/drawer.ts index 8e334cca4..a2a46f287 100644 --- a/core/renderers/common/drawer.ts +++ b/core/renderers/common/drawer.ts @@ -189,7 +189,7 @@ export class Drawer { (input.shape as Notch).pathRight + svgPaths.lineOnAxis( 'h', - -(input.notchOffset - this.constants_.INSIDE_CORNERS.width) + -(input.notchOffset - this.constants_.INSIDE_CORNERS.width), ) + this.constants_.INSIDE_CORNERS.pathTop; @@ -243,7 +243,7 @@ export class Drawer { this.outlinePath_ += svgPaths.lineOnAxis( 'V', - bottomRow.baseline - rightCornerYOffset + bottomRow.baseline - rightCornerYOffset, ); this.outlinePath_ += outlinePath; } @@ -314,7 +314,7 @@ export class Drawer { const svgGroup = (fieldInfo as Field).field.getSvgRoot()!; svgGroup.setAttribute( 'transform', - 'translate(' + xPos + ',' + yPos + ')' + scale + 'translate(' + xPos + ',' + yPos + ')' + scale, ); if (this.info_.isInsertionMarker) { svgGroup.setAttribute('display', 'none'); @@ -366,7 +366,7 @@ export class Drawer { } input.connectionModel.setOffsetInBlock( connX, - yPos + input.connectionOffsetY + yPos + input.connectionOffsetY, ); } } @@ -437,7 +437,7 @@ export class Drawer { const connX = this.info_.RTL ? -x : x; this.block_.outputConnection.setOffsetInBlock( connX, - this.info_.outputConnection.connectionOffsetY + this.info_.outputConnection.connectionOffsetY, ); } } diff --git a/core/renderers/common/info.ts b/core/renderers/common/info.ts index 6b5511ad2..6818c608c 100644 --- a/core/renderers/common/info.ts +++ b/core/renderers/common/info.ts @@ -237,7 +237,7 @@ export class RenderInfo { this.topRow.hasPreviousConnection = true; this.topRow.connection = new PreviousConnection( this.constants_, - this.block_.previousConnection as RenderedConnection + this.block_.previousConnection as RenderedConnection, ); this.topRow.elements.push(this.topRow.connection); } @@ -292,7 +292,7 @@ export class RenderInfo { if (this.bottomRow.hasNextConnection) { this.bottomRow.connection = new NextConnection( this.constants_, - this.block_.nextConnection as RenderedConnection + this.block_.nextConnection as RenderedConnection, ); this.bottomRow.elements.push(this.bottomRow.connection); } @@ -320,7 +320,7 @@ export class RenderInfo { activeRow.hasInlineInput = true; } else if (input instanceof StatementInput) { activeRow.elements.push( - new StatementInputMeasurable(this.constants_, input) + new StatementInputMeasurable(this.constants_, input), ); activeRow.hasStatement = true; } else if (input instanceof ValueInput) { @@ -333,7 +333,7 @@ export class RenderInfo { activeRow.minHeight, input.getSourceBlock() && input.getSourceBlock()!.isShadow() ? this.constants_.DUMMY_INPUT_SHADOW_MIN_HEIGHT - : this.constants_.DUMMY_INPUT_MIN_HEIGHT + : this.constants_.DUMMY_INPUT_MIN_HEIGHT, ); activeRow.hasDummyInput = true; } @@ -380,8 +380,8 @@ export class RenderInfo { row.elements.push( new InRowSpacer( this.constants_, - this.getInRowSpacing_(null, oldElems[0]) - ) + this.getInRowSpacing_(null, oldElems[0]), + ), ); } if (!oldElems.length) { @@ -398,8 +398,8 @@ export class RenderInfo { row.elements.push( new InRowSpacer( this.constants_, - this.getInRowSpacing_(oldElems[oldElems.length - 1], null) - ) + this.getInRowSpacing_(oldElems[oldElems.length - 1], null), + ), ); } } @@ -416,7 +416,7 @@ export class RenderInfo { */ protected getInRowSpacing_( prev: Measurable | null, - next: Measurable | null + next: Measurable | null, ): number { if (!prev) { // Statement input padding. @@ -468,12 +468,12 @@ export class RenderInfo { const innerWidth = row.width - (statementInput?.width ?? 0); widestStatementRowFields = Math.max( widestStatementRowFields, - innerWidth + innerWidth, ); } widestRowWithConnectedBlocks = Math.max( widestRowWithConnectedBlocks, - row.widthWithConnectedBlocks + row.widthWithConnectedBlocks, ); } @@ -588,7 +588,7 @@ export class RenderInfo { row.width += desiredWidth - currentWidth; row.widthWithConnectedBlocks = Math.max( row.width, - this.statementEdge + row.connectedBlockWidths + this.statementEdge + row.connectedBlockWidths, ); } @@ -717,7 +717,7 @@ export class RenderInfo { widestRowWithConnectedBlocks = Math.max( widestRowWithConnectedBlocks, - row.widthWithConnectedBlocks + row.widthWithConnectedBlocks, ); this.recordElemPositions_(row); } @@ -727,7 +727,7 @@ export class RenderInfo { // Include width of connected block in value to stack width measurement. widestRowWithConnectedBlocks = Math.max( widestRowWithConnectedBlocks, - target.getHeightWidth().width + target.getHeightWidth().width, ); } } diff --git a/core/renderers/common/marker_svg.ts b/core/renderers/common/marker_svg.ts index 13db9ea0b..6736ab7dc 100644 --- a/core/renderers/common/marker_svg.ts +++ b/core/renderers/common/marker_svg.ts @@ -75,7 +75,7 @@ export class MarkerSvg { constructor( private readonly workspace: WorkspaceSvg, constants: ConstantProvider, - private readonly marker: Marker + private readonly marker: Marker, ) { this.constants_ = constants; @@ -228,17 +228,17 @@ export class MarkerSvg { if (block.previousConnection) { const connectionShape = this.constants_.shapeFor( - block.previousConnection + block.previousConnection, ) as Notch; this.positionPrevious_( width, markerOffset, markerHeight, - connectionShape + connectionShape, ); } else if (block.outputConnection) { const connectionShape = this.constants_.shapeFor( - block.outputConnection + block.outputConnection, ) as PuzzleTab; this.positionOutput_(width, height, connectionShape); } else { @@ -402,7 +402,7 @@ export class MarkerSvg { protected positionBlock_( width: number, markerOffset: number, - markerHeight: number + markerHeight: number, ) { const markerPath = svgPaths.moveBy(-markerOffset, markerHeight) + @@ -411,7 +411,7 @@ export class MarkerSvg { svgPaths.lineOnAxis('V', markerHeight); if (!this.markerBlock_) { throw new Error( - 'createDom should be called before positioning the marker' + 'createDom should be called before positioning the marker', ); } this.markerBlock_.setAttribute('d', markerPath); @@ -443,7 +443,7 @@ export class MarkerSvg { ',' + y + ')' + - (this.workspace.RTL ? ' scale(-1 1)' : '') + (this.workspace.RTL ? ' scale(-1 1)' : ''), ); this.currentMarkerSvg = this.markerInput_; } @@ -477,11 +477,11 @@ export class MarkerSvg { protected positionOutput_( width: number, height: number, - connectionShape: PuzzleTab + connectionShape: PuzzleTab, ) { if (!this.markerBlock_) { throw new Error( - 'createDom should be called before positioning the output' + 'createDom should be called before positioning the output', ); } const markerPath = @@ -512,11 +512,11 @@ export class MarkerSvg { width: number, markerOffset: number, markerHeight: number, - connectionShape: Notch + connectionShape: Notch, ) { if (!this.markerBlock_) { throw new Error( - 'createDom should be called before positioning the previous connection marker' + 'createDom should be called before positioning the previous connection marker', ); } const markerPath = @@ -590,7 +590,7 @@ export class MarkerSvg { curBlock, this.isCursor(), oldNode, - curNode + curNode, ); eventUtils.fire(event); } @@ -632,7 +632,7 @@ export class MarkerSvg { 'width': this.constants_.CURSOR_WS_WIDTH, 'height': this.constants_.WS_CURSOR_HEIGHT, }, - this.svgGroup_ + this.svgGroup_, ); // A horizontal line used to represent a workspace coordinate or next @@ -644,7 +644,7 @@ export class MarkerSvg { 'height': this.constants_.WS_CURSOR_HEIGHT, 'style': 'display: none', }, - this.markerSvg_ + this.markerSvg_, ); // A filled in rectangle used to represent a stack. @@ -656,14 +656,14 @@ export class MarkerSvg { 'ry': 10, 'style': 'display: none', }, - this.markerSvg_ + this.markerSvg_, ); // A filled in puzzle piece used to represent an input value. this.markerInput_ = dom.createSvgElement( Svg.PATH, {'transform': '', 'style': 'display: none'}, - this.markerSvg_ + this.markerSvg_, ); // A path used to represent a previous connection and a block, an output @@ -676,7 +676,7 @@ export class MarkerSvg { 'fill': 'none', 'stroke-width': this.constants_.CURSOR_STROKE_WIDTH, }, - this.markerSvg_ + this.markerSvg_, ); // Markers and stack markers don't blink. @@ -687,7 +687,7 @@ export class MarkerSvg { dom.createSvgElement( Svg.ANIMATE, {...blinkProperties, attributeName: 'stroke'}, - this.markerBlock_ + this.markerBlock_, ); } @@ -707,7 +707,7 @@ export class MarkerSvg { !this.markerBlock_ ) { throw new Error( - 'createDom should be called before applying color to the markerj' + 'createDom should be called before applying color to the markerj', ); } this.markerSvgLine_.setAttribute('fill', this.colour_); diff --git a/core/renderers/common/path_object.ts b/core/renderers/common/path_object.ts index eb054141f..a30ba5e63 100644 --- a/core/renderers/common/path_object.ts +++ b/core/renderers/common/path_object.ts @@ -47,7 +47,7 @@ export class PathObject implements IPathObject { constructor( root: SVGElement, style: BlockStyle, - constants: ConstantProvider + constants: ConstantProvider, ) { this.constants = constants; this.style = style; @@ -57,7 +57,7 @@ export class PathObject implements IPathObject { this.svgPath = dom.createSvgElement( Svg.PATH, {'class': 'blocklyPath'}, - this.svgRoot + this.svgRoot, ); } @@ -165,7 +165,7 @@ export class PathObject implements IPathObject { if (enable) { this.svgPath.setAttribute( 'filter', - 'url(#' + this.constants.embossFilterId + ')' + 'url(#' + this.constants.embossFilterId + ')', ); } else { this.svgPath.setAttribute('filter', 'none'); @@ -194,7 +194,7 @@ export class PathObject implements IPathObject { if (disabled) { this.svgPath.setAttribute( 'fill', - 'url(#' + this.constants.disabledPatternId + ')' + 'url(#' + this.constants.disabledPatternId + ')', ); } } diff --git a/core/renderers/common/renderer.ts b/core/renderers/common/renderer.ts index d29b61639..2dcd5c556 100644 --- a/core/renderers/common/renderer.ts +++ b/core/renderers/common/renderer.ts @@ -66,7 +66,7 @@ export class Renderer implements IRegistrable { */ init( theme: Theme, - opt_rendererOverrides?: {[rendererConstant: string]: any} + opt_rendererOverrides?: {[rendererConstant: string]: any}, ) { this.constants_ = this.makeConstants_(); if (opt_rendererOverrides) { @@ -90,7 +90,7 @@ export class Renderer implements IRegistrable { this.constants_.createDom( svg, this.name + '-' + theme.name, - '.' + this.getClassName() + '.' + theme.getClassName() + '.' + this.getClassName() + '.' + theme.getClassName(), ); } @@ -212,7 +212,7 @@ export class Renderer implements IRegistrable { protected orphanCanConnectAtEnd( topBlock: BlockSvg, orphanBlock: BlockSvg, - localType: number + localType: number, ): boolean { const orphanConnection = localType === ConnectionType.OUTPUT_VALUE @@ -220,7 +220,7 @@ export class Renderer implements IRegistrable { : orphanBlock.previousConnection; return !!Connection.getConnectionForOrphanedConnection( topBlock as Block, - orphanConnection as Connection + orphanConnection as Connection, ); } @@ -236,7 +236,7 @@ export class Renderer implements IRegistrable { getConnectionPreviewMethod( closest: RenderedConnection, local: RenderedConnection, - topBlock: BlockSvg + topBlock: BlockSvg, ): PreviewType { if ( local.type === ConnectionType.OUTPUT_VALUE || @@ -247,7 +247,7 @@ export class Renderer implements IRegistrable { this.orphanCanConnectAtEnd( topBlock, closest.targetBlock() as BlockSvg, - local.type + local.type, ) ) { return InsertionMarkerManager.PREVIEW_TYPE.INSERTION_MARKER; diff --git a/core/renderers/geras/drawer.ts b/core/renderers/geras/drawer.ts index d96933de7..5439db547 100644 --- a/core/renderers/geras/drawer.ts +++ b/core/renderers/geras/drawer.ts @@ -118,7 +118,7 @@ export class Drawer extends BaseDrawer { } input.connectionModel.setOffsetInBlock( connX, - yPos + input.connectionOffsetY + this.constants_.DARK_PATH_OFFSET + yPos + input.connectionOffsetY + this.constants_.DARK_PATH_OFFSET, ); } } @@ -134,7 +134,7 @@ export class Drawer extends BaseDrawer { } input.connectionModel.setOffsetInBlock( connX, - row.yPos + this.constants_.DARK_PATH_OFFSET + row.yPos + this.constants_.DARK_PATH_OFFSET, ); } } @@ -160,7 +160,7 @@ export class Drawer extends BaseDrawer { (this.info_.RTL ? -x : x) + this.constants_.DARK_PATH_OFFSET / 2; connInfo.connectionModel.setOffsetInBlock( connX, - bottomRow.baseline + this.constants_.DARK_PATH_OFFSET + bottomRow.baseline + this.constants_.DARK_PATH_OFFSET, ); } } diff --git a/core/renderers/geras/highlight_constants.ts b/core/renderers/geras/highlight_constants.ts index e904c5527..2f5113029 100644 --- a/core/renderers/geras/highlight_constants.ts +++ b/core/renderers/geras/highlight_constants.ts @@ -151,14 +151,14 @@ export class HighlightConstantProvider { 'a', '0 0,0', radius, - svgPaths.point(-distance45outside - offset, radius - distance45outside) + svgPaths.point(-distance45outside - offset, radius - distance45outside), ); const pathBottomRtl = svgPaths.arc( 'a', '0 0,0', radius + offset, - svgPaths.point(radius + offset, radius + offset) + svgPaths.point(radius + offset, radius + offset), ); const pathBottomLtr = @@ -167,7 +167,7 @@ export class HighlightConstantProvider { 'a', '0 0,0', radius + offset, - svgPaths.point(radius - distance45outside, distance45outside + offset) + svgPaths.point(radius - distance45outside, distance45outside + offset), ); return { @@ -204,7 +204,7 @@ export class HighlightConstantProvider { 'a', '0 0,1', radius - offset, - svgPaths.point(radius - topLeftStartX, -topLeftStartY + offset) + svgPaths.point(radius - topLeftStartX, -topLeftStartY + offset), ); /** * SVG path for drawing the highlight on the rounded top-left corner. @@ -215,7 +215,7 @@ export class HighlightConstantProvider { 'a', '0 0,1', radius - offset, - svgPaths.point(radius, -radius + offset) + svgPaths.point(radius, -radius + offset), ); const bottomLeftStartX = distance45inside; @@ -226,7 +226,7 @@ export class HighlightConstantProvider { 'a', '0 0,1', radius - offset, - svgPaths.point(-bottomLeftStartX + offset, -bottomLeftStartY - radius) + svgPaths.point(-bottomLeftStartX + offset, -bottomLeftStartY - radius), ); return { diff --git a/core/renderers/geras/highlighter.ts b/core/renderers/geras/highlighter.ts index c9aee9a2e..af468fae2 100644 --- a/core/renderers/geras/highlighter.ts +++ b/core/renderers/geras/highlighter.ts @@ -111,7 +111,7 @@ export class Highlighter { // move. this.steps_ += svgPaths.lineOnAxis( 'H', - elem.xPos + elem.width - this.highlightOffset + elem.xPos + elem.width - this.highlightOffset, ); } } @@ -147,7 +147,7 @@ export class Highlighter { this.steps_ += svgPaths.moveTo( input.xPos + input.width - this.highlightOffset, - row.yPos + row.yPos, ) + this.puzzleTabPaths_.pathDown(this.RTL_) + svgPaths.lineOnAxis('v', belowTabHeight); @@ -175,7 +175,7 @@ export class Highlighter { this.insideCornerPaths_.pathBottom(this.RTL_) + svgPaths.lineTo( row.width - input.xPos - this.insideCornerPaths_.width, - 0 + 0, ); } else { this.steps_ += @@ -183,7 +183,7 @@ export class Highlighter { this.insideCornerPaths_.pathBottom(this.RTL_) + svgPaths.lineTo( row.width - input.xPos - this.insideCornerPaths_.width, - 0 + 0, ); } } @@ -203,7 +203,7 @@ export class Highlighter { if (row.height > this.highlightOffset) { this.steps_ += svgPaths.lineOnAxis( 'V', - row.yPos + row.height - this.highlightOffset + row.yPos + row.height - this.highlightOffset, ); } } @@ -220,14 +220,14 @@ export class Highlighter { if (this.RTL_) { this.steps_ += svgPaths.lineOnAxis( 'V', - row.baseline - this.highlightOffset + row.baseline - this.highlightOffset, ); } else { const cornerElem = this.info_.bottomRow.elements[0]; if (Types.isLeftSquareCorner(cornerElem)) { this.steps_ += svgPaths.moveTo( row.xPos + this.highlightOffset, - row.baseline - this.highlightOffset + row.baseline - this.highlightOffset, ); } else if (Types.isLeftRoundedCorner(cornerElem)) { this.steps_ += svgPaths.moveTo(row.xPos, row.baseline); @@ -261,12 +261,12 @@ export class Highlighter { if (Types.isLeftRoundedCorner(topRow.elements[0])) { this.steps_ += svgPaths.lineOnAxis( 'V', - this.outsideCornerPaths_.height + this.outsideCornerPaths_.height, ); } else { this.steps_ += svgPaths.lineOnAxis( 'V', - topRow.capline + this.highlightOffset + topRow.capline + this.highlightOffset, ); } } diff --git a/core/renderers/geras/info.ts b/core/renderers/geras/info.ts index 6dc5e6675..eb22bce09 100644 --- a/core/renderers/geras/info.ts +++ b/core/renderers/geras/info.ts @@ -84,7 +84,7 @@ export class RenderInfo extends BaseRenderInfo { activeRow.hasInlineInput = true; } else if (input instanceof StatementInput) { activeRow.elements.push( - new StatementInputMeasurable(this.constants_, input) + new StatementInputMeasurable(this.constants_, input), ); activeRow.hasStatement = true; } else if (input instanceof ValueInput) { @@ -95,7 +95,7 @@ export class RenderInfo extends BaseRenderInfo { // still important. activeRow.minHeight = Math.max( activeRow.minHeight, - this.constants_.DUMMY_INPUT_MIN_HEIGHT + this.constants_.DUMMY_INPUT_MIN_HEIGHT, ); activeRow.hasDummyInput = true; } @@ -121,8 +121,8 @@ export class RenderInfo extends BaseRenderInfo { row.elements.push( new InRowSpacer( this.constants_, - this.getInRowSpacing_(null, oldElems[0]) - ) + this.getInRowSpacing_(null, oldElems[0]), + ), ); } if (!oldElems.length) { @@ -137,7 +137,7 @@ export class RenderInfo extends BaseRenderInfo { if (row.endsWithElemSpacer()) { let spacing = this.getInRowSpacing_( oldElems[oldElems.length - 1], - null + null, ); if (hasExternalInputs && row.hasDummyInput) { spacing += this.constants_.TAB_WIDTH; @@ -398,7 +398,7 @@ export class RenderInfo extends BaseRenderInfo { const currentWidth = row.width; const desiredWidth = Math.max( prevRightEdge, - rowNextRightEdges.get(row) + rowNextRightEdges.get(row), ); const missingSpace = desiredWidth - currentWidth; if (missingSpace > 0) { @@ -432,7 +432,7 @@ export class RenderInfo extends BaseRenderInfo { widestRowWithConnectedBlocks = Math.max( widestRowWithConnectedBlocks, - row.widthWithConnectedBlocks + row.widthWithConnectedBlocks, ); // Add padding to the bottom row if block height is less than minimum const heightWithoutHat = yCursor - this.topRow.ascenderHeight; @@ -457,7 +457,7 @@ export class RenderInfo extends BaseRenderInfo { // Include width of connected block in value to stack width measurement. widestRowWithConnectedBlocks = Math.max( widestRowWithConnectedBlocks, - target.getHeightWidth().width - this.constants_.DARK_PATH_OFFSET + target.getHeightWidth().width - this.constants_.DARK_PATH_OFFSET, ); } } diff --git a/core/renderers/geras/path_object.ts b/core/renderers/geras/path_object.ts index 71a8dde16..7cdc3d87c 100644 --- a/core/renderers/geras/path_object.ts +++ b/core/renderers/geras/path_object.ts @@ -37,7 +37,7 @@ export class PathObject extends BasePathObject { constructor( root: SVGElement, style: BlockStyle, - public override constants: ConstantProvider + public override constants: ConstantProvider, ) { super(root, style, constants); @@ -55,7 +55,7 @@ export class PathObject extends BasePathObject { this.svgPathLight = dom.createSvgElement( Svg.PATH, {'class': 'blocklyPathLight'}, - this.svgRoot + this.svgRoot, ); } @@ -86,7 +86,7 @@ export class PathObject extends BasePathObject { if (!this.style.colourTertiary) { throw new Error( 'The renderer did not properly initialize the tertiary colour of ' + - 'the block style' + 'the block style', ); } this.svgPathLight.setAttribute('stroke', this.style.colourTertiary); @@ -107,7 +107,7 @@ export class PathObject extends BasePathObject { if (highlighted) { this.svgPath.setAttribute( 'filter', - 'url(#' + this.constants.embossFilterId + ')' + 'url(#' + this.constants.embossFilterId + ')', ); this.svgPathLight.style.display = 'none'; } else { @@ -122,7 +122,7 @@ export class PathObject extends BasePathObject { if (!this.style.colourSecondary) { throw new Error( 'The renderer did not properly initialize the secondary colour ' + - 'of the block style block style' + 'of the block style block style', ); } this.svgPathDark.setAttribute('fill', this.style.colourSecondary); diff --git a/core/renderers/geras/renderer.ts b/core/renderers/geras/renderer.ts index ddee103b7..2a85e739e 100644 --- a/core/renderers/geras/renderer.ts +++ b/core/renderers/geras/renderer.ts @@ -44,7 +44,7 @@ export class Renderer extends BaseRenderer { */ override init( theme: Theme, - opt_rendererOverrides?: {[rendererConstant: string]: any} + opt_rendererOverrides?: {[rendererConstant: string]: any}, ) { super.init(theme, opt_rendererOverrides); this.highlightConstants = this.makeHighlightConstants_(); @@ -80,7 +80,7 @@ export class Renderer extends BaseRenderer { */ protected override makeDrawer_( block: BlockSvg, - info: BaseRenderInfo + info: BaseRenderInfo, ): Drawer { return new Drawer(block, info as RenderInfo); } @@ -115,7 +115,7 @@ export class Renderer extends BaseRenderer { if (!this.highlightConstants) { throw new Error( 'Cannot access the highlight constants because init has not ' + - 'been called' + 'been called', ); } return this.highlightConstants; diff --git a/core/renderers/measurables/connection.ts b/core/renderers/measurables/connection.ts index 788404663..a544f2a73 100644 --- a/core/renderers/measurables/connection.ts +++ b/core/renderers/measurables/connection.ts @@ -29,7 +29,7 @@ export class Connection extends Measurable { */ constructor( constants: ConstantProvider, - public connectionModel: RenderedConnection + public connectionModel: RenderedConnection, ) { super(constants); diff --git a/core/renderers/measurables/field.ts b/core/renderers/measurables/field.ts index 9cfe35035..06b465833 100644 --- a/core/renderers/measurables/field.ts +++ b/core/renderers/measurables/field.ts @@ -33,7 +33,7 @@ export class Field extends Measurable { constructor( constants: ConstantProvider, public field: BlocklyField, - public parentInput: Input + public parentInput: Input, ) { super(constants); diff --git a/core/renderers/measurables/icon.ts b/core/renderers/measurables/icon.ts index 6efb16b51..06ef5730a 100644 --- a/core/renderers/measurables/icon.ts +++ b/core/renderers/measurables/icon.ts @@ -34,7 +34,10 @@ export class Icon extends Measurable { * @param constants The rendering constants provider. * @param icon The icon to measure and store information for. */ - constructor(constants: ConstantProvider, public icon: BlocklyIcon) { + constructor( + constants: ConstantProvider, + public icon: BlocklyIcon, + ) { super(constants); this.isVisible = hasBubble(icon) && icon.bubbleIsVisible(); diff --git a/core/renderers/measurables/input_connection.ts b/core/renderers/measurables/input_connection.ts index bcd5d245f..53e93435e 100644 --- a/core/renderers/measurables/input_connection.ts +++ b/core/renderers/measurables/input_connection.ts @@ -31,7 +31,10 @@ export class InputConnection extends Connection { * @param constants The rendering constants provider. * @param input The input to measure and store information for. */ - constructor(constants: ConstantProvider, public input: Input) { + constructor( + constants: ConstantProvider, + public input: Input, + ) { super(constants, input.connection as RenderedConnection); this.type |= Types.INPUT; diff --git a/core/renderers/measurables/next_connection.ts b/core/renderers/measurables/next_connection.ts index f68ad2c7c..2da84f76e 100644 --- a/core/renderers/measurables/next_connection.ts +++ b/core/renderers/measurables/next_connection.ts @@ -25,7 +25,7 @@ export class NextConnection extends Connection { */ constructor( constants: ConstantProvider, - connectionModel: RenderedConnection + connectionModel: RenderedConnection, ) { super(constants, connectionModel); this.type |= Types.NEXT_CONNECTION; diff --git a/core/renderers/measurables/output_connection.ts b/core/renderers/measurables/output_connection.ts index 69747d313..50dd1611b 100644 --- a/core/renderers/measurables/output_connection.ts +++ b/core/renderers/measurables/output_connection.ts @@ -29,7 +29,7 @@ export class OutputConnection extends Connection { */ constructor( constants: ConstantProvider, - connectionModel: RenderedConnection + connectionModel: RenderedConnection, ) { super(constants, connectionModel); this.type |= Types.OUTPUT_CONNECTION; diff --git a/core/renderers/measurables/previous_connection.ts b/core/renderers/measurables/previous_connection.ts index d7f769d9f..f61d78531 100644 --- a/core/renderers/measurables/previous_connection.ts +++ b/core/renderers/measurables/previous_connection.ts @@ -25,7 +25,7 @@ export class PreviousConnection extends Connection { */ constructor( constants: ConstantProvider, - connectionModel: RenderedConnection + connectionModel: RenderedConnection, ) { super(constants, connectionModel); this.type |= Types.PREVIOUS_CONNECTION; diff --git a/core/renderers/measurables/spacer_row.ts b/core/renderers/measurables/spacer_row.ts index b8a237d70..cd9aac8ad 100644 --- a/core/renderers/measurables/spacer_row.ts +++ b/core/renderers/measurables/spacer_row.ts @@ -32,7 +32,7 @@ export class SpacerRow extends Row { constructor( constants: ConstantProvider, public override height: number, - public override width: number + public override width: number, ) { super(constants); this.type |= Types.SPACER | Types.BETWEEN_ROW_SPACER; diff --git a/core/renderers/minimalist/constants.ts b/core/renderers/minimalist/constants.ts index 2b40d645c..aa72ccd1f 100644 --- a/core/renderers/minimalist/constants.ts +++ b/core/renderers/minimalist/constants.ts @@ -28,7 +28,7 @@ export class ConstantProvider extends BaseConstantProvider { 'Blockly.minimalist.ConstantProvider', 'v10', 'v11', - 'Blockly.blockRendering.ConstantProvider' + 'Blockly.blockRendering.ConstantProvider', ); } } diff --git a/core/renderers/minimalist/drawer.ts b/core/renderers/minimalist/drawer.ts index 1e9ab1076..56bf06108 100644 --- a/core/renderers/minimalist/drawer.ts +++ b/core/renderers/minimalist/drawer.ts @@ -34,7 +34,7 @@ export class Drawer extends BaseDrawer { 'Blockly.minimalist.Drawer', 'v10', 'v11', - 'Blockly.blockRendering.Drawer' + 'Blockly.blockRendering.Drawer', ); } } diff --git a/core/renderers/minimalist/info.ts b/core/renderers/minimalist/info.ts index 350762fd6..6b3bd222c 100644 --- a/core/renderers/minimalist/info.ts +++ b/core/renderers/minimalist/info.ts @@ -39,7 +39,7 @@ export class RenderInfo extends BaseRenderInfo { 'Blockly.minimalist.RenderInfo', 'v10', 'v11', - 'Blockly.blockRendering.RenderInfo' + 'Blockly.blockRendering.RenderInfo', ); } diff --git a/core/renderers/minimalist/renderer.ts b/core/renderers/minimalist/renderer.ts index 93168a96e..20821f72c 100644 --- a/core/renderers/minimalist/renderer.ts +++ b/core/renderers/minimalist/renderer.ts @@ -35,7 +35,7 @@ export class Renderer extends BaseRenderer { 'Blockly.minimalist.Renderer', 'v10', 'v11', - 'Blockly.blockRendering.Renderer' + 'Blockly.blockRendering.Renderer', ); } @@ -68,7 +68,7 @@ export class Renderer extends BaseRenderer { */ protected override makeDrawer_( block: BlockSvg, - info: BaseRenderInfo + info: BaseRenderInfo, ): Drawer { return new Drawer(block, info as RenderInfo); } diff --git a/core/renderers/thrasos/info.ts b/core/renderers/thrasos/info.ts index 7c6bbb4e8..7ba4275a0 100644 --- a/core/renderers/thrasos/info.ts +++ b/core/renderers/thrasos/info.ts @@ -66,8 +66,8 @@ export class RenderInfo extends BaseRenderInfo { row.elements.push( new InRowSpacer( this.constants_, - this.getInRowSpacing_(null, oldElems[0]) - ) + this.getInRowSpacing_(null, oldElems[0]), + ), ); } if (!oldElems.length) { @@ -82,7 +82,7 @@ export class RenderInfo extends BaseRenderInfo { if (row.endsWithElemSpacer()) { let spacing = this.getInRowSpacing_( oldElems[oldElems.length - 1], - null + null, ); if (hasExternalInputs && row.hasDummyInput) { spacing += this.constants_.TAB_WIDTH; @@ -290,7 +290,7 @@ export class RenderInfo extends BaseRenderInfo { widestRowWithConnectedBlocks = Math.max( widestRowWithConnectedBlocks, - row.widthWithConnectedBlocks + row.widthWithConnectedBlocks, ); // Add padding to the bottom row if block height is less than minimum const heightWithoutHat = yCursor - this.topRow.ascenderHeight; @@ -315,7 +315,7 @@ export class RenderInfo extends BaseRenderInfo { // Include width of connected block in value to stack width measurement. widestRowWithConnectedBlocks = Math.max( widestRowWithConnectedBlocks, - target.getHeightWidth().width + target.getHeightWidth().width, ); } } diff --git a/core/renderers/zelos/constants.ts b/core/renderers/zelos/constants.ts index 8e0156455..4547778e6 100644 --- a/core/renderers/zelos/constants.ts +++ b/core/renderers/zelos/constants.ts @@ -254,7 +254,7 @@ export class ConstantProvider extends BaseConstantProvider { theme.getComponentStyle('selectedGlowColour') || this.SELECTED_GLOW_COLOUR; const selectedGlowSize = Number( - theme.getComponentStyle('selectedGlowSize') + theme.getComponentStyle('selectedGlowSize'), ); this.SELECTED_GLOW_SIZE = selectedGlowSize && !isNaN(selectedGlowSize) @@ -264,7 +264,7 @@ export class ConstantProvider extends BaseConstantProvider { theme.getComponentStyle('replacementGlowColour') || this.REPLACEMENT_GLOW_COLOUR; const replacementGlowSize = Number( - theme.getComponentStyle('replacementGlowSize') + theme.getComponentStyle('replacementGlowSize'), ); this.REPLACEMENT_GLOW_SIZE = replacementGlowSize && !isNaN(replacementGlowSize) @@ -387,7 +387,7 @@ export class ConstantProvider extends BaseConstantProvider { function makeMainPath( blockHeight: number, up: boolean, - right: boolean + right: boolean, ): string { const remainingHeight = blockHeight > maxHeight ? blockHeight - maxHeight : 0; @@ -398,14 +398,14 @@ export class ConstantProvider extends BaseConstantProvider { 'a', '0 0,1', radius, - svgPaths.point((up ? -1 : 1) * radius, (up ? -1 : 1) * radius) + svgPaths.point((up ? -1 : 1) * radius, (up ? -1 : 1) * radius), ) + svgPaths.lineOnAxis('v', (right ? 1 : -1) * remainingHeight) + svgPaths.arc( 'a', '0 0,1', radius, - svgPaths.point((up ? 1 : -1) * radius, (up ? -1 : 1) * radius) + svgPaths.point((up ? 1 : -1) * radius, (up ? -1 : 1) * radius), ) ); } @@ -471,14 +471,14 @@ export class ConstantProvider extends BaseConstantProvider { 'a', '0 0,1', radius, - svgPaths.point((up ? -1 : 1) * radius, (up ? -1 : 1) * radius) + svgPaths.point((up ? -1 : 1) * radius, (up ? -1 : 1) * radius), ) + svgPaths.lineOnAxis('v', (right ? 1 : -1) * innerHeight) + svgPaths.arc( 'a', '0 0,1', radius, - svgPaths.point((up ? 1 : -1) * radius, (up ? -1 : 1) * radius) + svgPaths.point((up ? 1 : -1) * radius, (up ? -1 : 1) * radius), ) ); } @@ -617,28 +617,28 @@ export class ConstantProvider extends BaseConstantProvider { 'a', '0 0,0', radius, - svgPaths.point(-radius, radius) + svgPaths.point(-radius, radius), ); const innerTopRightCorner = svgPaths.arc( 'a', '0 0,1', radius, - svgPaths.point(-radius, radius) + svgPaths.point(-radius, radius), ); const innerBottomLeftCorner = svgPaths.arc( 'a', '0 0,0', radius, - svgPaths.point(radius, radius) + svgPaths.point(radius, radius), ); const innerBottomRightCorner = svgPaths.arc( 'a', '0 0,1', radius, - svgPaths.point(radius, radius) + svgPaths.point(radius, radius), ); return { @@ -680,23 +680,23 @@ export class ConstantProvider extends BaseConstantProvider { 'y': '-30%', 'x': '-40%', }, - defs + defs, ); dom.createSvgElement( Svg.FEGAUSSIANBLUR, {'in': 'SourceGraphic', 'stdDeviation': this.SELECTED_GLOW_SIZE}, - selectedGlowFilter + selectedGlowFilter, ); // Set all gaussian blur pixels to 1 opacity before applying flood const selectedComponentTransfer = dom.createSvgElement( Svg.FECOMPONENTTRANSFER, {'result': 'outBlur'}, - selectedGlowFilter + selectedGlowFilter, ); dom.createSvgElement( Svg.FEFUNCA, {'type': 'table', 'tableValues': '0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'}, - selectedComponentTransfer + selectedComponentTransfer, ); // Color the highlight dom.createSvgElement( @@ -706,7 +706,7 @@ export class ConstantProvider extends BaseConstantProvider { 'flood-opacity': 1, 'result': 'outColor', }, - selectedGlowFilter + selectedGlowFilter, ); dom.createSvgElement( Svg.FECOMPOSITE, @@ -716,7 +716,7 @@ export class ConstantProvider extends BaseConstantProvider { 'operator': 'in', 'result': 'outGlow', }, - selectedGlowFilter + selectedGlowFilter, ); this.selectedGlowFilterId = selectedGlowFilter.id; this.selectedGlowFilter = selectedGlowFilter; @@ -732,23 +732,23 @@ export class ConstantProvider extends BaseConstantProvider { 'y': '-30%', 'x': '-40%', }, - defs + defs, ); dom.createSvgElement( Svg.FEGAUSSIANBLUR, {'in': 'SourceGraphic', 'stdDeviation': this.REPLACEMENT_GLOW_SIZE}, - replacementGlowFilter + replacementGlowFilter, ); // Set all gaussian blur pixels to 1 opacity before applying flood const replacementComponentTransfer = dom.createSvgElement( Svg.FECOMPONENTTRANSFER, {'result': 'outBlur'}, - replacementGlowFilter + replacementGlowFilter, ); dom.createSvgElement( Svg.FEFUNCA, {'type': 'table', 'tableValues': '0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1'}, - replacementComponentTransfer + replacementComponentTransfer, ); // Color the highlight dom.createSvgElement( @@ -758,7 +758,7 @@ export class ConstantProvider extends BaseConstantProvider { 'flood-opacity': 1, 'result': 'outColor', }, - replacementGlowFilter + replacementGlowFilter, ); dom.createSvgElement( Svg.FECOMPOSITE, @@ -768,7 +768,7 @@ export class ConstantProvider extends BaseConstantProvider { 'operator': 'in', 'result': 'outGlow', }, - replacementGlowFilter + replacementGlowFilter, ); dom.createSvgElement( Svg.FECOMPOSITE, @@ -777,7 +777,7 @@ export class ConstantProvider extends BaseConstantProvider { 'in2': 'outGlow', 'operator': 'over', }, - replacementGlowFilter + replacementGlowFilter, ); this.replacementGlowFilterId = replacementGlowFilter.id; this.replacementGlowFilter = replacementGlowFilter; diff --git a/core/renderers/zelos/drawer.ts b/core/renderers/zelos/drawer.ts index a2d615e06..de0842257 100644 --- a/core/renderers/zelos/drawer.ts +++ b/core/renderers/zelos/drawer.ts @@ -126,7 +126,7 @@ export class Drawer extends BaseDrawer { protected drawRightDynamicConnection_() { if (!this.info_.outputConnection) { throw new Error( - `Cannot draw the output connection of a block that doesn't have one` + `Cannot draw the output connection of a block that doesn't have one`, ); } this.outlinePath_ += ( @@ -140,7 +140,7 @@ export class Drawer extends BaseDrawer { protected drawLeftDynamicConnection_() { if (!this.info_.outputConnection) { throw new Error( - `Cannot draw the output connection of a block that doesn't have one` + `Cannot draw the output connection of a block that doesn't have one`, ); } this.positionOutputConnection_(); diff --git a/core/renderers/zelos/info.ts b/core/renderers/zelos/info.ts index a6a4cfe8f..d806fb0b6 100644 --- a/core/renderers/zelos/info.ts +++ b/core/renderers/zelos/info.ts @@ -149,7 +149,7 @@ export class RenderInfo extends BaseRenderInfo { override getInRowSpacing_( prev: Measurable | null, - next: Measurable | null + next: Measurable | null, ): number { if (!prev || !next) { // No need for padding at the beginning or end of the row if the @@ -205,7 +205,7 @@ export class RenderInfo extends BaseRenderInfo { (!this.outputConnection || this.hasStatementInput) ) { return Math.abs( - this.constants_.NOTCH_HEIGHT - this.constants_.CORNER_RADIUS + this.constants_.NOTCH_HEIGHT - this.constants_.CORNER_RADIUS, ); } return this.constants_.NO_PADDING; @@ -218,13 +218,13 @@ export class RenderInfo extends BaseRenderInfo { this.topRow.minHeight, Math.max( this.constants_.NOTCH_HEIGHT, - this.constants_.CORNER_RADIUS - ) + this.constants_.CORNER_RADIUS, + ), ) - this.constants_.CORNER_RADIUS; return topHeight; } else if (!bottomRow.hasNextConnection && this.hasStatementInput) { return Math.abs( - this.constants_.NOTCH_HEIGHT - this.constants_.CORNER_RADIUS + this.constants_.NOTCH_HEIGHT - this.constants_.CORNER_RADIUS, ); } return this.constants_.NO_PADDING; @@ -278,7 +278,7 @@ export class RenderInfo extends BaseRenderInfo { } else if (input instanceof StatementInput) { // Handle statements without next connections correctly. activeRow.elements.push( - new StatementInputMeasurable(this.constants_, input) + new StatementInputMeasurable(this.constants_, input), ); activeRow.hasStatement = true; diff --git a/core/renderers/zelos/marker_svg.ts b/core/renderers/zelos/marker_svg.ts index f386babe6..e4e402584 100644 --- a/core/renderers/zelos/marker_svg.ts +++ b/core/renderers/zelos/marker_svg.ts @@ -36,7 +36,7 @@ export class MarkerSvg extends BaseMarkerSvg { constructor( workspace: WorkspaceSvg, constants: BaseConstantProvider, - marker: Marker + marker: Marker, ) { super(workspace, constants, marker); } @@ -120,7 +120,7 @@ export class MarkerSvg extends BaseMarkerSvg { 'style': 'display: none', 'stroke-width': this.constants_.CURSOR_STROKE_WIDTH, }, - this.markerSvg_ + this.markerSvg_, ); // Markers and stack cursors don't blink. diff --git a/core/renderers/zelos/path_object.ts b/core/renderers/zelos/path_object.ts index 68f7ca2c1..170b95f4d 100644 --- a/core/renderers/zelos/path_object.ts +++ b/core/renderers/zelos/path_object.ts @@ -51,7 +51,7 @@ export class PathObject extends BasePathObject { constructor( root: SVGElement, style: BlockStyle, - constants: ConstantProvider + constants: ConstantProvider, ) { super(root, style, constants); @@ -95,7 +95,7 @@ export class PathObject extends BasePathObject { this.svgPathSelected.setAttribute('fill', 'none'); this.svgPathSelected.setAttribute( 'filter', - 'url(#' + this.constants.selectedGlowFilterId + ')' + 'url(#' + this.constants.selectedGlowFilterId + ')', ); this.svgRoot.appendChild(this.svgPathSelected); } @@ -112,7 +112,7 @@ export class PathObject extends BasePathObject { if (enable) { this.svgPath.setAttribute( 'filter', - 'url(#' + this.constants.replacementGlowFilterId + ')' + 'url(#' + this.constants.replacementGlowFilterId + ')', ); } else { this.svgPath.removeAttribute('filter'); @@ -128,7 +128,7 @@ export class PathObject extends BasePathObject { if (enable) { outlinePath.setAttribute( 'filter', - 'url(#' + this.constants.replacementGlowFilterId + ')' + 'url(#' + this.constants.replacementGlowFilterId + ')', ); } else { outlinePath.removeAttribute('filter'); @@ -190,8 +190,8 @@ export class PathObject extends BasePathObject { // default 'd': '', }, - this.svgRoot - ) + this.svgRoot, + ), ); } this.remainingOutlines.delete(name); diff --git a/core/renderers/zelos/renderer.ts b/core/renderers/zelos/renderer.ts index 1f2114dcc..08396bee2 100644 --- a/core/renderers/zelos/renderer.ts +++ b/core/renderers/zelos/renderer.ts @@ -70,7 +70,7 @@ export class Renderer extends BaseRenderer { */ protected override makeDrawer_( block: BlockSvg, - info: BaseRenderInfo + info: BaseRenderInfo, ): Drawer { return new Drawer(block, info as RenderInfo); } @@ -84,7 +84,7 @@ export class Renderer extends BaseRenderer { */ override makeMarkerDrawer( workspace: WorkspaceSvg, - marker: Marker + marker: Marker, ): MarkerSvg { return new MarkerSvg(workspace, this.getConstants(), marker); } @@ -120,7 +120,7 @@ export class Renderer extends BaseRenderer { override getConnectionPreviewMethod( closest: RenderedConnection, local: RenderedConnection, - topBlock: BlockSvg + topBlock: BlockSvg, ) { if (local.type === ConnectionType.OUTPUT_VALUE) { if (!closest.isConnected()) { diff --git a/core/scrollbar.ts b/core/scrollbar.ts index 68aa433c1..2a7984a72 100644 --- a/core/scrollbar.ts +++ b/core/scrollbar.ts @@ -160,7 +160,7 @@ export class Scrollbar { private readonly horizontal: boolean, opt_pair?: boolean, opt_class?: string, - opt_margin?: number + opt_margin?: number, ) { this.pair = opt_pair || false; @@ -190,14 +190,14 @@ export class Scrollbar { this.svgBackground = dom.createSvgElement( Svg.RECT, {'class': 'blocklyScrollbarBackground'}, - group + group, ); const radius = Math.floor((Scrollbar.scrollbarThickness - 5) / 2); this.svgHandle = dom.createSvgElement( Svg.RECT, {'class': 'blocklyScrollbarHandle', 'rx': radius, 'ry': radius}, - group + group, ); this.workspace @@ -224,13 +224,13 @@ export class Scrollbar { this.svgBackground, 'pointerdown', this, - this.onMouseDownBar + this.onMouseDownBar, ); this.onMouseDownHandleWrapper_ = browserEvents.conditionalBind( this.svgHandle, 'pointerdown', this, - this.onMouseDownHandle + this.onMouseDownHandle, ); } @@ -291,7 +291,7 @@ export class Scrollbar { this.handleLength = newLength; this.svgHandle.setAttribute( this.lengthAttribute_, - String(this.handleLength) + String(this.handleLength), ); } @@ -324,7 +324,7 @@ export class Scrollbar { this.handlePosition = newPosition; this.svgHandle.setAttribute( this.positionAttribute_, - String(this.handlePosition) + String(this.handlePosition), ); } @@ -338,11 +338,11 @@ export class Scrollbar { this.scrollbarLength = newSize; this.outerSvg.setAttribute( this.lengthAttribute_, - String(this.scrollbarLength) + String(this.scrollbarLength), ); this.svgBackground.setAttribute( this.lengthAttribute_, - String(this.scrollbarLength) + String(this.scrollbarLength), ); } @@ -710,7 +710,7 @@ export class Scrollbar { const mouseXY = browserEvents.mouseToSvg( e, this.workspace.getParentSvg(), - this.workspace.getInverseScreenCTM() + this.workspace.getInverseScreenCTM(), ); const mouseLocation = this.horizontal ? mouseXY.x : mouseXY.y; @@ -758,13 +758,13 @@ export class Scrollbar { document, 'pointerup', this, - this.onMouseUpHandle + this.onMouseUpHandle, ); this.onMouseMoveWrapper_ = browserEvents.conditionalBind( document, 'pointermove', this, - this.onMouseMoveHandle + this.onMouseMoveHandle, ); e.stopPropagation(); e.preventDefault(); @@ -869,7 +869,7 @@ export class Scrollbar { */ private static metricsAreEquivalent( first: Metrics, - second: Metrics + second: Metrics, ): boolean { return ( first.viewWidth === second.viewWidth && diff --git a/core/scrollbar_pair.ts b/core/scrollbar_pair.ts index 39e7bea8b..5b8ede4e7 100644 --- a/core/scrollbar_pair.ts +++ b/core/scrollbar_pair.ts @@ -43,7 +43,7 @@ export class ScrollbarPair { addHorizontal?: boolean, addVertical?: boolean, opt_class?: string, - opt_margin?: number + opt_margin?: number, ) { addHorizontal = addHorizontal === undefined ? true : addHorizontal; addVertical = addVertical === undefined ? true : addVertical; @@ -55,7 +55,7 @@ export class ScrollbarPair { true, isPair, opt_class, - opt_margin + opt_margin, ); } if (addVertical) { @@ -64,7 +64,7 @@ export class ScrollbarPair { false, isPair, opt_class, - opt_margin + opt_margin, ); } diff --git a/core/serialization/blocks.ts b/core/serialization/blocks.ts index 23de10dba..194792ff6 100644 --- a/core/serialization/blocks.ts +++ b/core/serialization/blocks.ts @@ -91,7 +91,7 @@ export function save( addInputBlocks?: boolean; addNextBlocks?: boolean; doFullSerialization?: boolean; - } = {} + } = {}, ): State | null { if (block.isInsertionMarker()) { return null; @@ -199,7 +199,7 @@ function saveExtraState(block: Block, state: State) { if (extraState !== null) { state['extraState'] = Xml.domToText(extraState).replace( ' xmlns="https://developers.google.com/blockly/xml"', - '' + '', ); } } @@ -262,7 +262,7 @@ function saveFields(block: Block, state: State, doFullSerialization: boolean) { function saveInputBlocks( block: Block, state: State, - doFullSerialization: boolean + doFullSerialization: boolean, ) { const inputs = Object.create(null); for (let i = 0; i < block.inputList.length; i++) { @@ -270,7 +270,7 @@ function saveInputBlocks( if (!input.connection) continue; const connectionState = saveConnection( input.connection as Connection, - doFullSerialization + doFullSerialization, ); if (connectionState) { inputs[input.name] = connectionState; @@ -293,14 +293,14 @@ function saveInputBlocks( function saveNextBlocks( block: Block, state: State, - doFullSerialization: boolean + doFullSerialization: boolean, ) { if (!block.nextConnection) { return; } const connectionState = saveConnection( block.nextConnection, - doFullSerialization + doFullSerialization, ); if (connectionState) { state['next'] = connectionState; @@ -318,7 +318,7 @@ function saveNextBlocks( */ function saveConnection( connection: Connection, - doFullSerialization: boolean + doFullSerialization: boolean, ): ConnectionState | null { const shadow = connection.getShadowState(true); const child = connection.targetBlock(); @@ -347,7 +347,7 @@ function saveConnection( export function append( state: State, workspace: Workspace, - {recordUndo = false}: {recordUndo?: boolean} = {} + {recordUndo = false}: {recordUndo?: boolean} = {}, ): Block { return appendInternal(state, workspace, {recordUndo}); } @@ -380,7 +380,7 @@ export function appendInternal( parentConnection?: Connection; isShadow?: boolean; recordUndo?: boolean; - } = {} + } = {}, ): Block { const prevRecordUndo = eventUtils.getRecordUndo(); eventUtils.setRecordUndo(recordUndo); @@ -431,7 +431,7 @@ function appendPrivate( { parentConnection = undefined, isShadow = false, - }: {parentConnection?: Connection; isShadow?: boolean} = {} + }: {parentConnection?: Connection; isShadow?: boolean} = {}, ): Block { if (!state['type']) { throw new MissingBlockType(state); @@ -527,7 +527,7 @@ function loadExtraState(block: Block, state: State) { function tryToConnectParent( parentConnection: Connection | undefined, child: Block, - state: State + state: State, ) { if (!parentConnection) { return; @@ -560,13 +560,13 @@ function tryToConnectParent( checker.getErrorMessage( checker.canConnectWithReason(childConnection, parentConnection, false), childConnection, - parentConnection + parentConnection, ), parentConnection.type === inputTypes.VALUE ? 'output connection' : 'previous connection', child, - state + state, ); } } @@ -589,7 +589,7 @@ function loadIcons(block: Block, state: State) { const constructor = registry.getClass( registry.Type.ICON, iconType, - false + false, ); if (!constructor) throw new UnregisteredIcon(iconType, block, state); icon = new constructor(block); @@ -616,7 +616,7 @@ function loadFields(block: Block, state: State) { const field = block.getField(fieldName); if (!field) { console.warn( - `Ignoring non-existant field ${fieldName} in block ${block.type}` + `Ignoring non-existant field ${fieldName} in block ${block.type}`, ); continue; } @@ -672,7 +672,7 @@ function loadNextBlocks(block: Block, state: State) { */ function loadConnection( connection: Connection, - connectionState: ConnectionState + connectionState: ConnectionState, ) { if (connectionState['shadow']) { connection.setShadowState(connectionState['shadow']); @@ -681,7 +681,7 @@ function loadConnection( appendPrivate( connectionState['block'], connection.getSourceBlock().workspace, - {parentConnection: connection} + {parentConnection: connection}, ); } } @@ -735,7 +735,7 @@ export class BlockSerializer implements ISerializer { * blocks. */ save( - workspace: Workspace + workspace: Workspace, ): {languageVersion: number; blocks: State[]} | null { const blockStates = []; for (const block of workspace.getTopBlocks(false)) { @@ -765,7 +765,7 @@ export class BlockSerializer implements ISerializer { */ load( state: {languageVersion: number; blocks: State[]}, - workspace: Workspace + workspace: Workspace, ) { const blockStates = state['blocks']; for (const state of blockStates) { diff --git a/core/serialization/exceptions.ts b/core/serialization/exceptions.ts index da454362f..472785898 100644 --- a/core/serialization/exceptions.ts +++ b/core/serialization/exceptions.ts @@ -39,7 +39,11 @@ export class MissingConnection extends DeserializationError { * @param state The state object containing the bad connection. * @internal */ - constructor(connection: string, public block: Block, public state: State) { + constructor( + connection: string, + public block: Block, + public state: State, + ) { super(`The block ${block.toDevString()} is missing a(n) ${connection} connection`); } @@ -62,7 +66,7 @@ export class BadConnectionCheck extends DeserializationError { reason: string, childConnection: string, public childBlock: Block, - public childState: State + public childState: State, ) { super(`The block ${childBlock.toDevString()} could not connect its ${childConnection} to its parent, because: ${reason}`); @@ -94,12 +98,16 @@ export class UnregisteredIcon extends DeserializationError { * @param block The block we are attempting to add the unregistered icon to. * @param state The state object representing the block. */ - constructor(iconType: string, public block: Block, public state: State) { + constructor( + iconType: string, + public block: Block, + public state: State, + ) { super( `Cannot add an icon of type '${iconType}' to the block ` + `${block.toDevString()}, because there is no icon registered with ` + `type '${iconType}'. Make sure that all of your icons have been ` + - `registered.` + `registered.`, ); } } diff --git a/core/serialization/procedures.ts b/core/serialization/procedures.ts index cb17fe606..34d381171 100644 --- a/core/serialization/procedures.ts +++ b/core/serialization/procedures.ts @@ -40,7 +40,7 @@ export interface ParameterState { type ProcedureModelConstructor = new ( workspace: Workspace, name: string, - id: string + id: string, ) => ProcedureModel; /** @@ -53,7 +53,7 @@ type ProcedureModelConstructor = new ( type ParameterModelConstructor = new ( workspace: Workspace, name: string, - id: string + id: string, ) => ParameterModel; /** @@ -94,23 +94,23 @@ export function saveParameter(param: IParameterModel): ParameterState { */ export function loadProcedure< ProcedureModel extends IProcedureModel, - ParameterModel extends IParameterModel + ParameterModel extends IParameterModel, >( procedureModelClass: ProcedureModelConstructor, parameterModelClass: ParameterModelConstructor, state: State, - workspace: Workspace + workspace: Workspace, ): ProcedureModel { const proc = new procedureModelClass( workspace, state.name, - state.id + state.id, ).setReturnTypes(state.returnTypes); if (!state.parameters) return proc; for (const [index, param] of state.parameters.entries()) { proc.insertParameter( loadParameter(parameterModelClass, param, workspace), - index + index, ); } return proc; @@ -124,7 +124,7 @@ export function loadProcedure< export function loadParameter( parameterModelClass: ParameterModelConstructor, state: ParameterState, - workspace: Workspace + workspace: Workspace, ): ParameterModel { const model = new parameterModelClass(workspace, state.name, state.id); if (state.types) model.setTypes(state.types); @@ -134,7 +134,7 @@ export function loadParameter( /** Serializer for saving and loading procedure state. */ export class ProcedureSerializer< ProcedureModel extends IProcedureModel, - ParameterModel extends IParameterModel + ParameterModel extends IParameterModel, > implements ISerializer { public priority = priorities.PROCEDURES; @@ -152,7 +152,7 @@ export class ProcedureSerializer< */ constructor( private readonly procedureModelClass: ProcedureModelConstructor, - private readonly parameterModelClass: ParameterModelConstructor + private readonly parameterModelClass: ParameterModelConstructor, ) {} /** Serializes the procedure models of the given workspace. */ @@ -176,8 +176,8 @@ export class ProcedureSerializer< this.procedureModelClass, this.parameterModelClass, procState, - workspace - ) + workspace, + ), ); } } diff --git a/core/serialization/variables.ts b/core/serialization/variables.ts index c07c9c0a7..3ee12210d 100644 --- a/core/serialization/variables.ts +++ b/core/serialization/variables.ts @@ -72,7 +72,7 @@ export class VariableSerializer implements ISerializer { workspace.createVariable( varState['name'], varState['type'], - varState['id'] + varState['id'], ); } } diff --git a/core/serialization/workspaces.ts b/core/serialization/workspaces.ts index 40c7204dd..1cce4e0b6 100644 --- a/core/serialization/workspaces.ts +++ b/core/serialization/workspaces.ts @@ -46,7 +46,7 @@ export function save(workspace: Workspace): { export function load( state: {[key: string]: AnyDuringMigration}, workspace: Workspace, - {recordUndo = false}: {recordUndo?: boolean} = {} + {recordUndo = false}: {recordUndo?: boolean} = {}, ) { const serializerMap = registry.getAllItems(registry.Type.SERIALIZER, true); if (!serializerMap) { @@ -54,7 +54,7 @@ export function load( } const deserializers = Object.entries(serializerMap).sort( - (a, b) => (b[1] as ISerializer)!.priority - (a[1] as ISerializer)!.priority + (a, b) => (b[1] as ISerializer)!.priority - (a[1] as ISerializer)!.priority, ); const prevRecordUndo = eventUtils.getRecordUndo(); diff --git a/core/shortcut_registry.ts b/core/shortcut_registry.ts index cb6263fea..e4d157495 100644 --- a/core/shortcut_registry.ts +++ b/core/shortcut_registry.ts @@ -63,7 +63,7 @@ export class ShortcutRegistry { this.addKeyMapping( keyCodes[i], shortcut.name, - !!shortcut.allowCollision + !!shortcut.allowCollision, ); } } @@ -105,13 +105,13 @@ export class ShortcutRegistry { addKeyMapping( keyCode: string | number | KeyCodes, shortcutName: string, - opt_allowCollision?: boolean + opt_allowCollision?: boolean, ) { keyCode = `${keyCode}`; const shortcutNames = this.keyMap.get(keyCode); if (shortcutNames && !opt_allowCollision) { throw new Error( - `Shortcut named "${shortcutName}" collides with shortcuts "${shortcutNames}"` + `Shortcut named "${shortcutName}" collides with shortcuts "${shortcutNames}"`, ); } else if (shortcutNames && opt_allowCollision) { shortcutNames.unshift(shortcutName); @@ -135,14 +135,14 @@ export class ShortcutRegistry { removeKeyMapping( keyCode: string, shortcutName: string, - opt_quiet?: boolean + opt_quiet?: boolean, ): boolean { const shortcutNames = this.keyMap.get(keyCode); if (!shortcutNames) { if (!opt_quiet) { console.warn( - `No keyboard shortcut named "${shortcutName}" registered with key code "${keyCode}"` + `No keyboard shortcut named "${shortcutName}" registered with key code "${keyCode}"`, ); } return false; @@ -158,7 +158,7 @@ export class ShortcutRegistry { } if (!opt_quiet) { console.warn( - `No keyboard shortcut named "${shortcutName}" registered with key code "${keyCode}"` + `No keyboard shortcut named "${shortcutName}" registered with key code "${keyCode}"`, ); } return false; diff --git a/core/theme.ts b/core/theme.ts index e52039031..76bd00e74 100644 --- a/core/theme.ts +++ b/core/theme.ts @@ -58,7 +58,7 @@ export class Theme implements ITheme { public name: string, opt_blockStyles?: {[key: string]: Partial}, opt_categoryStyles?: {[key: string]: CategoryStyle}, - opt_componentStyles?: ComponentStyle + opt_componentStyles?: ComponentStyle, ) { /** The block styles map. */ this.blockStyles = opt_blockStyles || Object.create(null); diff --git a/core/theme_manager.ts b/core/theme_manager.ts index 63448093f..6ac6f24fa 100644 --- a/core/theme_manager.ts +++ b/core/theme_manager.ts @@ -32,7 +32,10 @@ export class ThemeManager { * @param theme The workspace theme. * @internal */ - constructor(private readonly workspace: WorkspaceSvg, private theme: Theme) {} + constructor( + private readonly workspace: WorkspaceSvg, + private theme: Theme, + ) {} /** * Get the workspace theme. @@ -112,7 +115,7 @@ export class ThemeManager { unsubscribeWorkspace(workspace: Workspace) { if (!arrayUtils.removeElem(this.subscribedWorkspaces_, workspace)) { throw Error( - "Cannot unsubscribe a workspace that hasn't been subscribed." + "Cannot unsubscribe a workspace that hasn't been subscribed.", ); } } @@ -130,7 +133,7 @@ export class ThemeManager { subscribe( element: HTMLElement | SVGElement, componentName: string, - propertyName: string + propertyName: string, ) { if (!this.componentDB.has(componentName)) { this.componentDB.set(componentName, []); diff --git a/core/toolbox/category.ts b/core/toolbox/category.ts index 6d23d1a69..47374a5b3 100644 --- a/core/toolbox/category.ts +++ b/core/toolbox/category.ts @@ -100,7 +100,7 @@ export class ToolboxCategory constructor( categoryDef: CategoryInfo, parentToolbox: IToolbox, - opt_parent?: ICollapsibleToolboxItem + opt_parent?: ICollapsibleToolboxItem, ) { super(categoryDef, parentToolbox, opt_parent); @@ -180,7 +180,7 @@ export class ToolboxCategory this.colour_ = this.getColour_(categoryDef); Object.assign( this.cssConfig_, - categoryDef['cssconfig'] || (categoryDef as any)['cssConfig'] + categoryDef['cssconfig'] || (categoryDef as any)['cssConfig'], ); } @@ -344,7 +344,7 @@ export class ToolboxCategory console.warn( 'Toolbox category "' + this.name_ + - '" must not have both a style and a colour' + '" must not have both a style and a colour', ); } else if (styleName) { return this.getColourfromStyle_(styleName); @@ -369,7 +369,7 @@ export class ToolboxCategory return this.parseColour_(style.colour); } else { console.warn( - 'Style "' + styleName + '" must exist and contain a colour value' + 'Style "' + styleName + '" must exist and contain a colour value', ); } } @@ -415,7 +415,7 @@ export class ToolboxCategory 'Toolbox category "' + this.name_ + '" has unrecognized colour attribute: ' + - colour + colour, ); return ''; } @@ -542,7 +542,7 @@ export class ToolboxCategory const className = this.cssConfig_['selected']; if (isSelected) { const defaultColour = this.parseColour_( - ToolboxCategory.defaultBackgroundColour + ToolboxCategory.defaultBackgroundColour, ); this.rowDiv_.style.backgroundColor = this.colour_ || defaultColour; if (className) { @@ -736,5 +736,5 @@ Css.register(` registry.register( registry.Type.TOOLBOX_ITEM, ToolboxCategory.registrationName, - ToolboxCategory + ToolboxCategory, ); diff --git a/core/toolbox/collapsible_category.ts b/core/toolbox/collapsible_category.ts index fe4b7cf55..0d7d3439b 100644 --- a/core/toolbox/collapsible_category.ts +++ b/core/toolbox/collapsible_category.ts @@ -52,7 +52,7 @@ export class CollapsibleToolboxCategory constructor( categoryDef: toolbox.CategoryInfo, toolbox: IToolbox, - opt_parent?: ICollapsibleToolboxItem + opt_parent?: ICollapsibleToolboxItem, ) { super(categoryDef, toolbox, opt_parent); } @@ -110,12 +110,12 @@ export class CollapsibleToolboxCategory } const ToolboxItemClass = registry.getClass( registry.Type.TOOLBOX_ITEM, - registryName + registryName, ); const toolboxItem = new ToolboxItemClass!( itemDef, this.parentToolbox_, - this + this, ); this.toolboxItems_.push(toolboxItem); } @@ -125,7 +125,7 @@ export class CollapsibleToolboxCategory this.setExpanded( this.toolboxItemDef_['expanded'] === 'true' || - this.toolboxItemDef_['expanded'] === true + this.toolboxItemDef_['expanded'] === true, ); } @@ -163,7 +163,7 @@ export class CollapsibleToolboxCategory * @returns The div holding all the subcategories. */ protected createSubCategoriesDom_( - subcategories: IToolboxItem[] + subcategories: IToolboxItem[], ): HTMLDivElement { const contentsContainer = document.createElement('div'); contentsContainer.style.display = 'none'; @@ -204,7 +204,7 @@ export class CollapsibleToolboxCategory aria.setState( this.htmlDiv_ as HTMLDivElement, aria.State.EXPANDED, - isExpanded + isExpanded, ); this.parentToolbox_.handleToolboxItemResize(); @@ -285,5 +285,5 @@ export type CssConfig = CollapsibleToolboxCategory.CssConfig; registry.register( registry.Type.TOOLBOX_ITEM, CollapsibleToolboxCategory.registrationName, - CollapsibleToolboxCategory + CollapsibleToolboxCategory, ); diff --git a/core/toolbox/separator.ts b/core/toolbox/separator.ts index 5308268a1..3e77cbb6a 100644 --- a/core/toolbox/separator.ts +++ b/core/toolbox/separator.ts @@ -102,5 +102,5 @@ Css.register(` registry.register( registry.Type.TOOLBOX_ITEM, ToolboxSeparator.registrationName, - ToolboxSeparator + ToolboxSeparator, ); diff --git a/core/toolbox/toolbox.ts b/core/toolbox/toolbox.ts index dcea49787..f1915ba7b 100644 --- a/core/toolbox/toolbox.ts +++ b/core/toolbox/toolbox.ts @@ -153,7 +153,7 @@ export class Toolbox themeManager.subscribe( this.HtmlDiv, 'toolboxBackgroundColour', - 'background-color' + 'background-color', ); themeManager.subscribe(this.HtmlDiv, 'toolboxForegroundColour', 'color'); this.workspace_.getComponentManager().addComponent({ @@ -226,7 +226,7 @@ export class Toolbox */ protected attachEvents_( container: HTMLDivElement, - contentsContainer: HTMLDivElement + contentsContainer: HTMLDivElement, ) { // Clicking on toolbox closes popups. const clickEvent = browserEvents.conditionalBind( @@ -234,7 +234,7 @@ export class Toolbox 'pointerdown', this, this.onClick_, - /* opt_noCaptureIdentifier */ false + /* opt_noCaptureIdentifier */ false, ); this.boundEvents_.push(clickEvent); @@ -243,7 +243,7 @@ export class Toolbox 'keydown', this, this.onKeyDown_, - /* opt_noCaptureIdentifier */ false + /* opt_noCaptureIdentifier */ false, ); this.boundEvents_.push(keyDownEvent); } @@ -347,13 +347,13 @@ export class Toolbox FlyoutClass = registry.getClassFromOptions( registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX, workspace.options, - true + true, ); } else { FlyoutClass = registry.getClassFromOptions( registry.Type.FLYOUTS_VERTICAL_TOOLBOX, workspace.options, - true + true, ); } return new FlyoutClass!(workspaceOptions); @@ -406,7 +406,7 @@ export class Toolbox */ private createToolboxItem_( toolboxItemDef: toolbox.ToolboxItemInfo, - fragment: DocumentFragment + fragment: DocumentFragment, ) { let registryName = toolboxItemDef['kind']; @@ -421,7 +421,7 @@ export class Toolbox const ToolboxItemClass = registry.getClass( registry.Type.TOOLBOX_ITEM, - registryName.toLowerCase() + registryName.toLowerCase(), ); if (ToolboxItemClass) { const toolboxItem = new ToolboxItemClass(toolboxItemDef, this); @@ -853,7 +853,7 @@ export class Toolbox */ protected shouldDeselectItem_( oldItem: ISelectableToolboxItem | null, - newItem: ISelectableToolboxItem | null + newItem: ISelectableToolboxItem | null, ): boolean { // Deselect the old item unless the old item is collapsible and has been // previously clicked on. @@ -871,7 +871,7 @@ export class Toolbox */ protected shouldSelectItem_( oldItem: ISelectableToolboxItem | null, - newItem: ISelectableToolboxItem | null + newItem: ISelectableToolboxItem | null, ): boolean { // Select the new item unless the old item equals the new item. return newItem !== null && newItem !== oldItem; @@ -890,7 +890,7 @@ export class Toolbox aria.setState( this.contentsDiv_ as Element, aria.State.ACTIVEDESCENDANT, - '' + '', ); } @@ -902,7 +902,7 @@ export class Toolbox */ protected selectItem_( oldItem: ISelectableToolboxItem | null, - newItem: ISelectableToolboxItem + newItem: ISelectableToolboxItem, ) { this.selectedItem_ = newItem; this.previouslySelectedItem_ = oldItem; @@ -910,7 +910,7 @@ export class Toolbox aria.setState( this.contentsDiv_ as Element, aria.State.ACTIVEDESCENDANT, - newItem.getId() + newItem.getId(), ); } @@ -936,7 +936,7 @@ export class Toolbox */ protected updateFlyout_( oldItem: ISelectableToolboxItem | null, - newItem: ISelectableToolboxItem | null + newItem: ISelectableToolboxItem | null, ) { if ( !newItem || @@ -958,7 +958,7 @@ export class Toolbox */ private fireSelectEvent_( oldItem: ISelectableToolboxItem | null, - newItem: ISelectableToolboxItem | null + newItem: ISelectableToolboxItem | null, ) { const oldElement = oldItem && oldItem.getName(); let newElement = newItem && newItem.getName(); @@ -969,7 +969,7 @@ export class Toolbox const event = new (eventUtils.get(eventUtils.TOOLBOX_ITEM_SELECT))( oldElement, newElement, - this.workspace_.id + this.workspace_.id, ); eventUtils.fire(event); } diff --git a/core/toolbox/toolbox_item.ts b/core/toolbox/toolbox_item.ts index f17273a7a..8ca41d515 100644 --- a/core/toolbox/toolbox_item.ts +++ b/core/toolbox/toolbox_item.ts @@ -40,7 +40,7 @@ export class ToolboxItem implements IToolboxItem { constructor( toolboxItemDef: toolbox.ToolboxItemInfo, parentToolbox: IToolbox, - opt_parent?: ICollapsibleToolboxItem + opt_parent?: ICollapsibleToolboxItem, ) { /** The ID for the category. */ this.id_ = diff --git a/core/tooltip.ts b/core/tooltip.ts index 2fa428911..fd5a729c1 100644 --- a/core/tooltip.ts +++ b/core/tooltip.ts @@ -167,7 +167,7 @@ export function getTooltipOfObject(object: AnyDuringMigration | null): string { * @returns The target tooltip object. */ function getTargetObject( - obj: object | null + obj: object | null, ): {tooltip: AnyDuringMigration} | null { while (obj && (obj as any).tooltip) { if ( @@ -206,13 +206,13 @@ export function bindMouseEvents(element: Element) { element, 'pointerover', null, - onMouseOver + onMouseOver, ); (element as AnyDuringMigration).mouseOutWrapper_ = browserEvents.bind( element, 'pointerout', null, - onMouseOut + onMouseOut, ); // Don't use bindEvent_ for mousemove since that would create a diff --git a/core/trashcan.ts b/core/trashcan.ts index 0794151d8..58046f466 100644 --- a/core/trashcan.ts +++ b/core/trashcan.ts @@ -124,7 +124,7 @@ export class Trashcan const HorizontalFlyout = registry.getClassFromOptions( registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX, this.workspace.options, - true + true, ); this.flyout = new HorizontalFlyout!(flyoutWorkspaceOptions); } else { @@ -135,7 +135,7 @@ export class Trashcan const VerticalFlyout = registry.getClassFromOptions( registry.Type.FLYOUTS_VERTICAL_TOOLBOX, this.workspace.options, - true + true, ); this.flyout = new VerticalFlyout!(flyoutWorkspaceOptions); } @@ -168,12 +168,12 @@ export class Trashcan clip = dom.createSvgElement( Svg.CLIPPATH, {'id': 'blocklyTrashBodyClipPath' + rnd}, - this.svgGroup + this.svgGroup, ); dom.createSvgElement( Svg.RECT, {'width': WIDTH, 'height': BODY_HEIGHT, 'y': LID_HEIGHT}, - clip + clip, ); const body = dom.createSvgElement( Svg.IMAGE, @@ -184,23 +184,23 @@ export class Trashcan 'y': -SPRITE_TOP, 'clip-path': 'url(#blocklyTrashBodyClipPath' + rnd + ')', }, - this.svgGroup + this.svgGroup, ); body.setAttributeNS( dom.XLINK_NS, 'xlink:href', - this.workspace.options.pathToMedia + SPRITE.url + this.workspace.options.pathToMedia + SPRITE.url, ); clip = dom.createSvgElement( Svg.CLIPPATH, {'id': 'blocklyTrashLidClipPath' + rnd}, - this.svgGroup + this.svgGroup, ); dom.createSvgElement( Svg.RECT, {'width': WIDTH, 'height': LID_HEIGHT}, - clip + clip, ); this.svgLid = dom.createSvgElement( Svg.IMAGE, @@ -211,12 +211,12 @@ export class Trashcan 'y': -SPRITE_TOP, 'clip-path': 'url(#blocklyTrashLidClipPath' + rnd + ')', }, - this.svgGroup + this.svgGroup, ); this.svgLid.setAttributeNS( dom.XLINK_NS, 'xlink:href', - this.workspace.options.pathToMedia + SPRITE.url + this.workspace.options.pathToMedia + SPRITE.url, ); // bindEventWithChecks_ quashes events too aggressively. See: @@ -227,7 +227,7 @@ export class Trashcan this.svgGroup, 'pointerdown', this, - this.blockMouseDownWhenOpenable + this.blockMouseDownWhenOpenable, ); browserEvents.bind(this.svgGroup, 'pointerup', this, this.click); // Bind to body instead of this.svgGroup so that we don't get lid jitters @@ -242,7 +242,7 @@ export class Trashcan if (this.workspace.options.maxTrashcanContents > 0) { dom.insertAfter( this.flyout!.createDom(Svg.SVG)!, - this.workspace.getParentSvg() + this.workspace.getParentSvg(), ); this.flyout!.init(this.workspace); } @@ -363,7 +363,7 @@ export class Trashcan const cornerPosition = uiPosition.getCornerOppositeToolbox( this.workspace, - metrics + metrics, ); const height = BODY_HEIGHT + LID_HEIGHT; @@ -373,7 +373,7 @@ export class Trashcan MARGIN_HORIZONTAL, MARGIN_VERTICAL, metrics, - this.workspace + this.workspace, ); const verticalPosition = cornerPosition.vertical; @@ -385,14 +385,14 @@ export class Trashcan startRect, MARGIN_VERTICAL, bumpDirection, - savedPositions + savedPositions, ); this.top = positionRect.top; this.left = positionRect.left; this.svgGroup?.setAttribute( 'transform', - 'translate(' + this.left + ',' + this.top + ')' + 'translate(' + this.left + ',' + this.top + ')', ); } @@ -494,7 +494,7 @@ export class Trashcan if (this.lidOpen > this.minOpenness && this.lidOpen < 1) { this.lidTask = setTimeout( this.animateLid.bind(this), - ANIMATION_LENGTH / frames + ANIMATION_LENGTH / frames, ); } } @@ -516,7 +516,7 @@ export class Trashcan (openAtRight ? 4 : WIDTH - 4) + ',' + (LID_HEIGHT - 2) + - ')' + ')', ); } @@ -558,7 +558,7 @@ export class Trashcan private fireUiEvent(trashcanOpen: boolean) { const uiEvent = new (eventUtils.get(eventUtils.TRASHCAN_OPEN))( trashcanOpen, - this.workspace.id + this.workspace.id, ); eventUtils.fire(uiEvent); } @@ -613,7 +613,7 @@ export class Trashcan throw new Error('Encountered a delete event without proper oldJson'); } const cleanedJson = JSON.stringify( - this.cleanBlockJson(deleteEvent.oldJson) + this.cleanBlockJson(deleteEvent.oldJson), ); if (this.contents.indexOf(cleanedJson) !== -1) { return; diff --git a/core/utils/aria.ts b/core/utils/aria.ts index e71194fa7..c1c967518 100644 --- a/core/utils/aria.ts +++ b/core/utils/aria.ts @@ -135,7 +135,7 @@ export function setRole(element: Element, roleName: Role) { export function setState( element: Element, stateName: State, - value: string | boolean | number | string[] + value: string | boolean | number | string[], ) { if (Array.isArray(value)) { value = value.join(' '); diff --git a/core/utils/colour.ts b/core/utils/colour.ts index 97f195858..c30bc403f 100644 --- a/core/utils/colour.ts +++ b/core/utils/colour.ts @@ -212,7 +212,7 @@ export function hsvToHex(h: number, s: number, v: number): string { export function blend( colour1: string, colour2: string, - factor: number + factor: number, ): string | null { const hex1 = parse(colour1); if (!hex1) { diff --git a/core/utils/coordinate.ts b/core/utils/coordinate.ts index 4044a89ca..920524a93 100644 --- a/core/utils/coordinate.ts +++ b/core/utils/coordinate.ts @@ -22,7 +22,10 @@ export class Coordinate { * @param x Left. * @param y Top. */ - constructor(public x: number, public y: number) {} + constructor( + public x: number, + public y: number, + ) {} /** * Creates a new copy of this coordinate. @@ -109,7 +112,7 @@ export class Coordinate { */ static difference( a: Coordinate | SVGPoint, - b: Coordinate | SVGPoint + b: Coordinate | SVGPoint, ): Coordinate { return new Coordinate(a.x - b.x, a.y - b.y); } diff --git a/core/utils/deprecation.ts b/core/utils/deprecation.ts index 6c800d68e..25e14ead6 100644 --- a/core/utils/deprecation.ts +++ b/core/utils/deprecation.ts @@ -22,7 +22,7 @@ export function warn( name: string, deprecationDate: string, deletionDate: string, - opt_use?: string + opt_use?: string, ) { let msg = name + diff --git a/core/utils/dom.ts b/core/utils/dom.ts index 22f490189..0ebe7e99a 100644 --- a/core/utils/dom.ts +++ b/core/utils/dom.ts @@ -55,7 +55,7 @@ let canvasContext: CanvasRenderingContext2D | null = null; export function createSvgElement( name: string | Svg, attrs: {[key: string]: string | number}, - opt_parent?: Element | null + opt_parent?: Element | null, ): T { const e = document.createElementNS(SVG_NS, `${name}`) as T; for (const key in attrs) { @@ -168,7 +168,7 @@ export function containsNode(parent: Node, descendant: Node): boolean { 'Blockly.utils.dom.containsNode', 'version 10', 'version 11', - 'Use native "contains" DOM method' + 'Use native "contains" DOM method', ); return parent.contains(descendant); } @@ -183,7 +183,7 @@ export function containsNode(parent: Node, descendant: Node): boolean { */ export function setCssTransform( element: HTMLElement | SVGElement, - transform: string + transform: string, ) { element.style['transform'] = transform; element.style['-webkit-transform' as any] = transform; @@ -261,13 +261,13 @@ export function getFastTextWidth( textElement: SVGTextElement, fontSize: number, fontWeight: string, - fontFamily: string + fontFamily: string, ): number { return getFastTextWidthWithSizeString( textElement, fontSize + 'pt', fontWeight, - fontFamily + fontFamily, ); } @@ -288,7 +288,7 @@ export function getFastTextWidthWithSizeString( textElement: SVGTextElement, fontSize: string, fontWeight: string, - fontFamily: string + fontFamily: string, ): number { const text = textElement.textContent; const key = text + '\n' + textElement.className.baseVal; @@ -343,7 +343,7 @@ export function measureFontMetrics( text: string, fontSize: string, fontWeight: string, - fontFamily: string + fontFamily: string, ): {height: number; baseline: number} { const span = document.createElement('span'); span.style.font = fontWeight + ' ' + fontSize + ' ' + fontFamily; diff --git a/core/utils/math.ts b/core/utils/math.ts index da7628e18..851a170d2 100644 --- a/core/utils/math.ts +++ b/core/utils/math.ts @@ -40,7 +40,7 @@ export function toDegrees(angleRadians: number): number { export function clamp( lowerBound: number, number: number, - upperBound: number + upperBound: number, ): number { if (upperBound < lowerBound) { const temp = upperBound; diff --git a/core/utils/object.ts b/core/utils/object.ts index 2fc6330c8..8d053004c 100644 --- a/core/utils/object.ts +++ b/core/utils/object.ts @@ -16,7 +16,7 @@ goog.declareModuleId('Blockly.utils.object'); */ export function deepMerge( target: AnyDuringMigration, - source: AnyDuringMigration + source: AnyDuringMigration, ): AnyDuringMigration { for (const x in source) { if (source[x] !== null && typeof source[x] === 'object') { diff --git a/core/utils/parsing.ts b/core/utils/parsing.ts index 9f41a14df..ee6695db4 100644 --- a/core/utils/parsing.ts +++ b/core/utils/parsing.ts @@ -23,7 +23,7 @@ import * as colourUtils from './colour.js'; */ function tokenizeInterpolationInternal( message: string, - parseInterpolationTokens: boolean + parseInterpolationTokens: boolean, ): (string | number)[] { const tokens = []; const chars = message.split(''); @@ -107,8 +107,8 @@ function tokenizeInterpolationInternal( tokens, tokenizeInterpolationInternal( rawValue, - parseInterpolationTokens - ) + parseInterpolationTokens, + ), ); } else if (parseInterpolationTokens) { // When parsing interpolation tokens, numbers are special @@ -247,7 +247,7 @@ export function parseBlockColour(colour: number | string): { hex: colourUtils.hsvToHex( hue, colourUtils.getHsvSaturation(), - colourUtils.getHsvValue() * 255 + colourUtils.getHsvValue() * 255, ), }; } else { diff --git a/core/utils/rect.ts b/core/utils/rect.ts index 32d8bc692..b7a75b4cc 100644 --- a/core/utils/rect.ts +++ b/core/utils/rect.ts @@ -28,7 +28,7 @@ export class Rect { public top: number, public bottom: number, public left: number, - public right: number + public right: number, ) {} getHeight(): number { diff --git a/core/utils/size.ts b/core/utils/size.ts index 0b71b7b04..9b941face 100644 --- a/core/utils/size.ts +++ b/core/utils/size.ts @@ -22,7 +22,10 @@ export class Size { * @param width Width. * @param height Height. */ - constructor(public width: number, public height: number) {} + constructor( + public width: number, + public height: number, + ) {} /** * Compares sizes for equality. diff --git a/core/utils/string.ts b/core/utils/string.ts index 343e0e27e..c05da1fec 100644 --- a/core/utils/string.ts +++ b/core/utils/string.ts @@ -23,7 +23,7 @@ export function startsWith(str: string, prefix: string): boolean { 'Blockly.utils.string.startsWith()', 'April 2022', 'April 2023', - 'Use built-in string.startsWith' + 'Use built-in string.startsWith', ); return str.startsWith(prefix); } @@ -53,7 +53,7 @@ export function shortestStringLength(array: string[]): number { */ export function commonWordPrefix( array: string[], - opt_shortest?: number + opt_shortest?: number, ): number { if (!array.length) { return 0; @@ -93,7 +93,7 @@ export function commonWordPrefix( */ export function commonWordSuffix( array: string[], - opt_shortest?: number + opt_shortest?: number, ): number { if (!array.length) { return 0; @@ -199,7 +199,7 @@ function wrapLine(text: string, limit: number): string { function wrapScore( words: string[], wordBreaks: boolean[], - limit: number + limit: number, ): number { // If this function becomes a performance liability, add caching. // Compute the length of each line. @@ -256,7 +256,7 @@ function wrapScore( function wrapMutate( words: string[], wordBreaks: boolean[], - limit: number + limit: number, ): boolean[] { let bestScore = wrapScore(words, wordBreaks, limit); let bestBreaks; diff --git a/core/utils/style.ts b/core/utils/style.ts index 9adeadf1f..d029824a2 100644 --- a/core/utils/style.ts +++ b/core/utils/style.ts @@ -101,7 +101,7 @@ export function getPageOffset(el: Element): Coordinate { // the viewport. const scrollCoord = new Coordinate( window.pageXOffset || documentElement.scrollLeft, - window.pageYOffset || documentElement.scrollTop + window.pageYOffset || documentElement.scrollTop, ); pos.x = box.left + scrollCoord.x; pos.y = box.top + scrollCoord.y; @@ -155,7 +155,7 @@ export function getBorderBox(element: Element): Rect { export function scrollIntoContainerView( element: Element, container: Element, - opt_center?: boolean + opt_center?: boolean, ) { const offset = getContainerOffsetToScrollInto(element, container, opt_center); container.scrollLeft = offset.x; @@ -179,7 +179,7 @@ export function scrollIntoContainerView( export function getContainerOffsetToScrollInto( element: Element, container: Element, - opt_center?: boolean + opt_center?: boolean, ): Coordinate { // Absolute position of the element's border's top left corner. const elementPos = getPageOffset(element); diff --git a/core/utils/svg.ts b/core/utils/svg.ts index 21a1b7968..b2ad3dea9 100644 --- a/core/utils/svg.ts +++ b/core/utils/svg.ts @@ -29,7 +29,7 @@ export class Svg<_T> { static FECOMPOSITE = new Svg('feComposite'); /** @internal */ static FECOMPONENTTRANSFER = new Svg( - 'feComponentTransfer' + 'feComponentTransfer', ); /** @internal */ static FEFLOOD = new Svg('feFlood'); @@ -41,7 +41,7 @@ export class Svg<_T> { static FEPOINTLIGHT = new Svg('fePointLight'); /** @internal */ static FESPECULARLIGHTING = new Svg( - 'feSpecularLighting' + 'feSpecularLighting', ); /** @internal */ static FILTER = new Svg('filter'); diff --git a/core/utils/svg_math.ts b/core/utils/svg_math.ts index 1eef15db5..2c7b24d35 100644 --- a/core/utils/svg_math.ts +++ b/core/utils/svg_math.ts @@ -114,7 +114,7 @@ export function getViewportBBox(): Rect { scrollOffset.y, document.documentElement.clientHeight + scrollOffset.y, scrollOffset.x, - document.documentElement.clientWidth + scrollOffset.x + document.documentElement.clientWidth + scrollOffset.x, ); } @@ -129,7 +129,7 @@ export function getDocumentScroll(): Coordinate { const win = window; return new Coordinate( win.pageXOffset || el.scrollLeft, - win.pageYOffset || el.scrollTop + win.pageYOffset || el.scrollTop, ); } @@ -143,7 +143,7 @@ export function getDocumentScroll(): Coordinate { */ export function screenToWsCoordinates( ws: WorkspaceSvg, - screenCoordinates: Coordinate + screenCoordinates: Coordinate, ): Coordinate { const screenX = screenCoordinates.x; const screenY = screenCoordinates.y; @@ -157,7 +157,7 @@ export function screenToWsCoordinates( // The client coordinates offset by the injection div's upper left corner. const clientOffsetPixels = new Coordinate( screenX - boundingRect.left, - screenY - boundingRect.top + screenY - boundingRect.top, ); // The offset in pixels between the main workspace's origin and the upper @@ -168,7 +168,7 @@ export function screenToWsCoordinates( // main workspace. const finalOffsetPixels = Coordinate.difference( clientOffsetPixels, - mainOffsetPixels + mainOffsetPixels, ); // The position in main workspace coordinates. const finalOffsetMainWs = finalOffsetPixels.scale(1 / ws.scale); @@ -185,7 +185,7 @@ export function screenToWsCoordinates( */ export function wsToScreenCoordinates( ws: WorkspaceSvg, - workspaceCoordinates: Coordinate + workspaceCoordinates: Coordinate, ): Coordinate { // Fix workspace scale vs browser scale. const screenCoordinates = workspaceCoordinates.scale(ws.scale); @@ -199,7 +199,7 @@ export function wsToScreenCoordinates( // Fix workspace origin vs browser origin. return new Coordinate( screenX + boundingRect.left + mainOffset.x, - screenY + boundingRect.top + mainOffset.y + screenY + boundingRect.top + mainOffset.y, ); } diff --git a/core/utils/svg_paths.ts b/core/utils/svg_paths.ts index 891ba2151..38685746d 100644 --- a/core/utils/svg_paths.ts +++ b/core/utils/svg_paths.ts @@ -128,7 +128,7 @@ export function arc( command: string, flags: string, radius: number, - point: string + point: string, ): string { return command + ' ' + radius + ' ' + radius + ' ' + flags + point; } diff --git a/core/utils/toolbox.ts b/core/utils/toolbox.ts index 569731591..b2d71e3b6 100644 --- a/core/utils/toolbox.ts +++ b/core/utils/toolbox.ts @@ -177,7 +177,7 @@ export enum Position { * @internal */ export function convertToolboxDefToJson( - toolboxDef: ToolboxDefinition | null + toolboxDef: ToolboxDefinition | null, ): ToolboxInfo | null { if (!toolboxDef) { return null; @@ -217,7 +217,7 @@ function validateToolbox(toolboxJson: ToolboxInfo) { ' Please supply either ' + FLYOUT_TOOLBOX_KIND + ' or ' + - CATEGORY_TOOLBOX_KIND + CATEGORY_TOOLBOX_KIND, ); } } @@ -234,7 +234,7 @@ function validateToolbox(toolboxJson: ToolboxInfo) { * @internal */ export function convertFlyoutDefToJsonArray( - flyoutDef: FlyoutDefinition | null + flyoutDef: FlyoutDefinition | null, ): FlyoutItemInfoArray { if (!flyoutDef) { return []; @@ -306,7 +306,7 @@ export function isCategoryCollapsible(categoryInfo: CategoryInfo): boolean { const categories = (categoryInfo as AnyDuringMigration)['contents'].filter( function (item: AnyDuringMigration) { return item['kind'].toUpperCase() === 'CATEGORY'; - } + }, ); return !!categories.length; } @@ -333,7 +333,7 @@ function convertToToolboxJson(toolboxDef: Node): ToolboxInfo { * @returns A list of objects in the toolbox. */ function xmlToJsonArray( - toolboxDef: Node | Node[] | NodeList + toolboxDef: Node | Node[] | NodeList, ): FlyoutItemInfoArray | ToolboxItemInfo[] { const arr = []; // If it is a node it will have children. @@ -398,7 +398,7 @@ function addAttributes(node: Node, obj: AnyDuringMigration) { * @returns DOM tree of blocks, or null. */ export function parseToolboxTree( - toolboxDef: Element | null | string + toolboxDef: Element | null | string, ): Element | null { let parsedToolboxDef: Element | null = null; if (toolboxDef) { diff --git a/core/utils/xml.ts b/core/utils/xml.ts index 75a4d70c8..22a77634f 100644 --- a/core/utils/xml.ts +++ b/core/utils/xml.ts @@ -11,7 +11,7 @@ let domParser: DOMParser = { parseFromString: function () { throw new Error( 'DOMParser was not found in the global scope and was not properly ' + - 'injected using injectDependencies' + 'injected using injectDependencies', ); }, }; @@ -20,7 +20,7 @@ let xmlSerializer: XMLSerializer = { serializeToString: function () { throw new Error( 'XMLSerializer was not foundin the global scope and was not properly ' + - 'injected using injectDependencies' + 'injected using injectDependencies', ); }, }; @@ -161,6 +161,6 @@ export function domToText(dom: Node): string { function sanitizeText(text: string) { return text.replace( INVALID_CONTROL_CHARS, - (match) => `&#${match.charCodeAt(0)};` + (match) => `&#${match.charCodeAt(0)};`, ); } diff --git a/core/variable_map.ts b/core/variable_map.ts index b8db8a54e..66968baab 100644 --- a/core/variable_map.ts +++ b/core/variable_map.ts @@ -82,7 +82,7 @@ export class VariableMap { variable, newName, conflictVar, - blocks + blocks, ); } } finally { @@ -117,10 +117,10 @@ export class VariableMap { private renameVariableAndUses_( variable: VariableModel, newName: string, - blocks: Block[] + blocks: Block[], ) { eventUtils.fire( - new (eventUtils.get(eventUtils.VAR_RENAME))(variable, newName) + new (eventUtils.get(eventUtils.VAR_RENAME))(variable, newName), ); variable.name = newName; for (let i = 0; i < blocks.length; i++) { @@ -143,7 +143,7 @@ export class VariableMap { variable: VariableModel, newName: string, conflictVar: VariableModel, - blocks: Block[] + blocks: Block[], ) { const type = variable.type; const oldCase = conflictVar.name; @@ -179,7 +179,7 @@ export class VariableMap { createVariable( name: string, opt_type?: string | null, - opt_id?: string | null + opt_id?: string | null, ): VariableModel { let variable = this.getVariable(name, opt_type); if (variable) { @@ -192,7 +192,7 @@ export class VariableMap { '" which conflicts with the passed in ' + 'id, "' + opt_id + - '".' + '".', ); } // The variable already exists and has the same ID. @@ -234,7 +234,7 @@ export class VariableMap { if (tempVar.getId() === variableId) { variableList.splice(i, 1); eventUtils.fire( - new (eventUtils.get(eventUtils.VAR_DELETE))(variable) + new (eventUtils.get(eventUtils.VAR_DELETE))(variable), ); if (variableList.length === 0) { this.variableMap.delete(variable.type); diff --git a/core/variable_model.ts b/core/variable_model.ts index 1fe58772f..a317e02ec 100644 --- a/core/variable_model.ts +++ b/core/variable_model.ts @@ -41,7 +41,7 @@ export class VariableModel { public workspace: Workspace, public name: string, opt_type?: string, - opt_id?: string + opt_id?: string, ) { /** * The type of the variable, such as 'int' or 'sound_effect'. This may be diff --git a/core/variables.ts b/core/variables.ts index 1a871bc3f..4d8df8f94 100644 --- a/core/variables.ts +++ b/core/variables.ts @@ -136,7 +136,7 @@ export function flyoutCategoryBlocks(workspace: Workspace): Element[] { '' + '1' + '' + - '' + '', ); block.appendChild(value); xmlList.push(block); @@ -177,7 +177,7 @@ export function generateUniqueName(workspace: Workspace): string { function generateUniqueNameInternal(workspace: Workspace): string { return generateUniqueNameFromOptions( VAR_LETTER_OPTIONS.charAt(0), - workspace.getAllVariableNames() + workspace.getAllVariableNames(), ); } @@ -192,7 +192,7 @@ function generateUniqueNameInternal(workspace: Workspace): string { */ export function generateUniqueNameFromOptions( startChar: string, - usedNames: string[] + usedNames: string[], ): string { if (!usedNames.length) { return startChar; @@ -246,7 +246,7 @@ export function generateUniqueNameFromOptions( export function createVariableButtonHandler( workspace: Workspace, opt_callback?: (p1?: string | null) => void, - opt_type?: string + opt_type?: string, ) { const type = opt_type || ''; // This function needs to be named so it can be called recursively. @@ -295,13 +295,13 @@ export function createVariableButtonHandler( export function renameVariable( workspace: Workspace, variable: VariableModel, - opt_callback?: (p1?: string | null) => void + opt_callback?: (p1?: string | null) => void, ) { // This function needs to be named so it can be called recursively. function promptAndCheckWithAlert(defaultName: string) { const promptText = Msg['RENAME_VARIABLE_TITLE'].replace( '%1', - variable.name + variable.name, ); promptName(promptText, defaultName, function (newName) { if (!newName) { @@ -314,7 +314,7 @@ export function renameVariable( const procedure = nameUsedWithConflictingParam( variable.name, newName, - workspace + workspace, ); if (!existing && !procedure) { // No conflict. @@ -352,7 +352,7 @@ export function renameVariable( export function promptName( promptText: string, defaultText: string, - callback: (p1: string | null) => void + callback: (p1: string | null) => void, ) { dialog.prompt(promptText, defaultText, function (newVar) { // Merge runs of whitespace. Strip leading and trailing whitespace. @@ -380,7 +380,7 @@ export function promptName( function nameUsedWithOtherType( name: string, type: string, - workspace: Workspace + workspace: Workspace, ): VariableModel | null { const allVariables = workspace.getVariableMap().getAllVariables(); @@ -402,7 +402,7 @@ function nameUsedWithOtherType( */ export function nameUsedWithAnyType( name: string, - workspace: Workspace + workspace: Workspace, ): VariableModel | null { const allVariables = workspace.getVariableMap().getAllVariables(); @@ -430,7 +430,7 @@ export function nameUsedWithAnyType( export function nameUsedWithConflictingParam( oldName: string, newName: string, - workspace: Workspace + workspace: Workspace, ): string | null { return workspace.getProcedureMap().getProcedures().length ? checkForConflictingParamWithProcedureModels(oldName, newName, workspace) @@ -444,7 +444,7 @@ export function nameUsedWithConflictingParam( function checkForConflictingParamWithProcedureModels( oldName: string, newName: string, - workspace: Workspace + workspace: Workspace, ): string | null { oldName = oldName.toLowerCase(); newName = newName.toLowerCase(); @@ -470,7 +470,7 @@ function checkForConflictingParamWithProcedureModels( function checkForConflictingParamWithLegacyProcedures( oldName: string, newName: string, - workspace: Workspace + workspace: Workspace, ): string | null { oldName = oldName.toLowerCase(); newName = newName.toLowerCase(); @@ -494,7 +494,7 @@ function checkForConflictingParamWithLegacyProcedures( * @returns The generated DOM. */ export function generateVariableFieldDom( - variableModel: VariableModel + variableModel: VariableModel, ): Element { /* Generates the following XML: * foo @@ -524,7 +524,7 @@ export function getOrCreateVariablePackage( workspace: Workspace, id: string | null, opt_name?: string, - opt_type?: string + opt_type?: string, ): VariableModel { let variable = getVariable(workspace, id, opt_name, opt_type); if (!variable) { @@ -552,7 +552,7 @@ export function getVariable( workspace: Workspace, id: string | null, opt_name?: string, - opt_type?: string + opt_type?: string, ): VariableModel | null { const potentialVariableMap = workspace.getPotentialVariableMap(); let variable = null; @@ -597,7 +597,7 @@ function createVariable( workspace: Workspace, id: string | null, opt_name?: string, - opt_type?: string + opt_type?: string, ): VariableModel { const potentialVariableMap = workspace.getPotentialVariableMap(); // Variables without names get uniquely named for this workspace. @@ -634,7 +634,7 @@ function createVariable( */ export function getAddedVariables( workspace: Workspace, - originalVariables: VariableModel[] + originalVariables: VariableModel[], ): VariableModel[] { const allCurrentVariables = workspace.getAllVariables(); const addedVariables = []; diff --git a/core/variables_dynamic.ts b/core/variables_dynamic.ts index a143487b8..0e49ed326 100644 --- a/core/variables_dynamic.ts +++ b/core/variables_dynamic.ts @@ -34,7 +34,7 @@ function stringButtonClickHandler(button: FlyoutButton) { Variables.createVariableButtonHandler( button.getTargetWorkspace(), undefined, - 'String' + 'String', ); } // eslint-disable-next-line camelcase @@ -49,7 +49,7 @@ function numberButtonClickHandler(button: FlyoutButton) { Variables.createVariableButtonHandler( button.getTargetWorkspace(), undefined, - 'Number' + 'Number', ); } // eslint-disable-next-line camelcase @@ -64,7 +64,7 @@ function colourButtonClickHandler(button: FlyoutButton) { Variables.createVariableButtonHandler( button.getTargetWorkspace(), undefined, - 'Colour' + 'Colour', ); } // eslint-disable-next-line camelcase @@ -94,15 +94,15 @@ export function flyoutCategory(workspace: WorkspaceSvg): Element[] { workspace.registerButtonCallback( 'CREATE_VARIABLE_STRING', - stringButtonClickHandler + stringButtonClickHandler, ); workspace.registerButtonCallback( 'CREATE_VARIABLE_NUMBER', - numberButtonClickHandler + numberButtonClickHandler, ); workspace.registerButtonCallback( 'CREATE_VARIABLE_COLOUR', - colourButtonClickHandler + colourButtonClickHandler, ); const blockList = flyoutCategoryBlocks(workspace); diff --git a/core/widgetdiv.ts b/core/widgetdiv.ts index a92dd7fbe..3eb8b8e94 100644 --- a/core/widgetdiv.ts +++ b/core/widgetdiv.ts @@ -172,7 +172,7 @@ export function positionWithAnchor( viewportBBox: Rect, anchorBBox: Rect, widgetSize: Size, - rtl: boolean + rtl: boolean, ) { const y = calculateY(viewportBBox, anchorBBox, widgetSize); const x = calculateX(viewportBBox, anchorBBox, widgetSize, rtl); @@ -201,7 +201,7 @@ function calculateX( viewportBBox: Rect, anchorBBox: Rect, widgetSize: Size, - rtl: boolean + rtl: boolean, ): number { if (rtl) { // Try to align the right side of the field and the right side of widget. @@ -234,7 +234,7 @@ function calculateX( function calculateY( viewportBBox: Rect, anchorBBox: Rect, - widgetSize: Size + widgetSize: Size, ): number { // Flip the widget vertically if off the bottom. // The widget could go off the top of the window, but it would also go off diff --git a/core/workspace.ts b/core/workspace.ts index f184ce6a8..257ff08b1 100644 --- a/core/workspace.ts +++ b/core/workspace.ts @@ -133,7 +133,7 @@ export class Workspace implements IASTNodeLocation { const connectionCheckerClass = registry.getClassFromOptions( registry.Type.CONNECTION_CHECKER, this.options, - true + true, ); /** * An object that encapsulates logic for safety, type, and dragging checks. @@ -170,7 +170,7 @@ export class Workspace implements IASTNodeLocation { */ private sortObjects_( a: Block | WorkspaceComment, - b: Block | WorkspaceComment + b: Block | WorkspaceComment, ): number { const offset = Math.sin(math.toRadians(Workspace.SCAN_ANGLE)) * (this.RTL ? -1 : 1); @@ -276,7 +276,7 @@ export class Workspace implements IASTNodeLocation { console.warn( 'Overriding an existing comment on this workspace, with id "' + comment.id + - '"' + '"', ); } this.commentDB.set(comment.id, comment); @@ -291,7 +291,7 @@ export class Workspace implements IASTNodeLocation { removeTopComment(comment: WorkspaceComment) { if (!arrayUtils.removeElem(this.topComments, comment)) { throw Error( - "Comment not present in workspace's list of top-most " + 'comments.' + "Comment not present in workspace's list of top-most " + 'comments.', ); } // Note: If the comment database starts to hold block comments, this may @@ -399,7 +399,7 @@ export class Workspace implements IASTNodeLocation { createVariable( name: string, opt_type?: string | null, - opt_id?: string | null + opt_id?: string | null, ): VariableModel { return this.variableMap.createVariable(name, opt_type, opt_id); } @@ -513,7 +513,7 @@ export class Workspace implements IASTNodeLocation { newBlock(prototypeName: string, opt_id?: string): Block { throw new Error( 'The implementation of newBlock should be ' + - 'monkey-patched in by blockly.ts' + 'monkey-patched in by blockly.ts', ); } /* eslint-enable */ diff --git a/core/workspace_audio.ts b/core/workspace_audio.ts index d045ab4db..f89dac0b0 100644 --- a/core/workspace_audio.ts +++ b/core/workspace_audio.ts @@ -99,7 +99,7 @@ export class WorkspaceAudio { // https://developers.google.com/web/updates/2017/06/play-request-was-interrupted playPromise.then(sound.pause).catch( // Play without user interaction was prevented. - function () {} + function () {}, ); } else { sound.pause(); diff --git a/core/workspace_comment.ts b/core/workspace_comment.ts index ad900d23b..94864810b 100644 --- a/core/workspace_comment.ts +++ b/core/workspace_comment.ts @@ -54,7 +54,7 @@ export class WorkspaceComment { content: string, height: number, width: number, - opt_id?: string + opt_id?: string, ) { this.id = opt_id && !workspace.getCommentById(opt_id) @@ -169,7 +169,7 @@ export class WorkspaceComment { */ moveBy(dx: number, dy: number) { const event = new (eventUtils.get(eventUtils.COMMENT_MOVE))( - this + this, ) as CommentMove; this.xy_.translate(dx, dy); event.recordNew(); @@ -260,8 +260,8 @@ export class WorkspaceComment { new (eventUtils.get(eventUtils.COMMENT_CHANGE))( this, this.content_, - content - ) + content, + ), ); this.content_ = content; } @@ -316,7 +316,7 @@ export class WorkspaceComment { } try { eventUtils.fire( - new (eventUtils.get(eventUtils.COMMENT_CREATE))(comment) + new (eventUtils.get(eventUtils.COMMENT_CREATE))(comment), ); } finally { eventUtils.setGroup(existingGroup); @@ -340,7 +340,7 @@ export class WorkspaceComment { info.content, info.h, info.w, - info.id + info.id, ); const xmlX = xmlComment.getAttribute('x'); diff --git a/core/workspace_comment_svg.ts b/core/workspace_comment_svg.ts index b8f7547ec..ab57fd5ef 100644 --- a/core/workspace_comment_svg.ts +++ b/core/workspace_comment_svg.ts @@ -106,7 +106,7 @@ export class WorkspaceCommentSvg content: string, height: number, width: number, - opt_id?: string + opt_id?: string, ) { super(workspace, content, height, width, opt_id); this.svgGroup = dom.createSvgElement(Svg.G, {'class': 'blocklyComment'}); @@ -166,13 +166,13 @@ export class WorkspaceCommentSvg this.svgRectTarget as SVGRectElement, 'pointerdown', this, - this.pathMouseDown + this.pathMouseDown, ); browserEvents.conditionalBind( this.svgHandleTarget as SVGRectElement, 'pointerdown', this, - this.pathMouseDown + this.pathMouseDown, ); } this.eventsInit = true; @@ -209,7 +209,7 @@ export class WorkspaceCommentSvg showContextMenu(e: PointerEvent) { throw new Error( 'The implementation of showContextMenu should be ' + - 'monkey-patched in by blockly.ts' + 'monkey-patched in by blockly.ts', ); } @@ -236,7 +236,7 @@ export class WorkspaceCommentSvg const event = new (eventUtils.get(eventUtils.SELECTED))( oldId, this.id, - this.workspace.id + this.workspace.id, ); eventUtils.fire(event); common.setSelected(this); @@ -255,7 +255,7 @@ export class WorkspaceCommentSvg const event = new (eventUtils.get(eventUtils.SELECTED))( this.id, null, - this.workspace.id + this.workspace.id, ); eventUtils.fire(event); common.setSelected(null); @@ -342,7 +342,7 @@ export class WorkspaceCommentSvg */ override moveBy(dx: number, dy: number) { const event = new (eventUtils.get(eventUtils.COMMENT_MOVE))( - this + this, ) as CommentMove; // TODO: Do I need to look up the relative to surface XY position here? const xy = this.getRelativeToSurfaceXY(); @@ -365,7 +365,7 @@ export class WorkspaceCommentSvg this.xy_ = new Coordinate(x, y); this.getSvgRoot().setAttribute( 'transform', - 'translate(' + x + ',' + y + ')' + 'translate(' + x + ',' + y + ')', ); } @@ -554,7 +554,7 @@ export class WorkspaceCommentSvg const xy = this.getRelativeToSurfaceXY(); element.setAttribute( 'x', - String(Math.round(this.workspace.RTL ? width - xy.x : xy.x)) + String(Math.round(this.workspace.RTL ? width - xy.x : xy.x)), ); element.setAttribute('y', String(Math.round(xy.y))); element.setAttribute('h', String(this.getHeight())); @@ -636,7 +636,7 @@ export class WorkspaceCommentSvg this.resizeGroup, 'pointerdown', this, - this.resizeMouseDown + this.resizeMouseDown, ); } @@ -645,19 +645,19 @@ export class WorkspaceCommentSvg this.deleteGroup as SVGGElement, 'pointerdown', this, - this.deleteMouseDown + this.deleteMouseDown, ); browserEvents.conditionalBind( this.deleteGroup as SVGGElement, 'pointerout', this, - this.deleteMouseOut + this.deleteMouseOut, ); browserEvents.conditionalBind( this.deleteGroup as SVGGElement, 'pointerup', this, - this.deleteMouseUp + this.deleteMouseUp, ); } } @@ -687,7 +687,7 @@ export class WorkspaceCommentSvg body.className = 'blocklyMinimalBody'; const textarea = document.createElementNS( dom.HTML_NS, - 'textarea' + 'textarea', ) as HTMLTextAreaElement; textarea.className = 'blocklyCommentTextarea'; textarea.setAttribute('dir', this.RTL ? 'RTL' : 'LTR'); @@ -702,7 +702,7 @@ export class WorkspaceCommentSvg this, function (e: WheelEvent) { e.stopPropagation(); - } + }, ); browserEvents.conditionalBind( textarea, @@ -710,7 +710,7 @@ export class WorkspaceCommentSvg this, function (this: WorkspaceCommentSvg, _e: Event) { this.setContent(textarea.value); - } + }, ); return this.foreignObject; } @@ -720,14 +720,14 @@ export class WorkspaceCommentSvg this.resizeGroup = dom.createSvgElement( Svg.G, {'class': this.RTL ? 'blocklyResizeSW' : 'blocklyResizeSE'}, - this.svgGroup + this.svgGroup, ); dom.createSvgElement( Svg.POLYGON, { 'points': `0,${RESIZE_SIZE} ${RESIZE_SIZE},${RESIZE_SIZE} ${RESIZE_SIZE},0`, }, - this.resizeGroup + this.resizeGroup, ); dom.createSvgElement( Svg.LINE, @@ -738,7 +738,7 @@ export class WorkspaceCommentSvg 'x2': RESIZE_SIZE - 1, 'y2': RESIZE_SIZE / 3, }, - this.resizeGroup + this.resizeGroup, ); dom.createSvgElement( Svg.LINE, @@ -749,7 +749,7 @@ export class WorkspaceCommentSvg 'x2': RESIZE_SIZE - 1, 'y2': (RESIZE_SIZE * 2) / 3, }, - this.resizeGroup + this.resizeGroup, ); } @@ -758,12 +758,12 @@ export class WorkspaceCommentSvg this.deleteGroup = dom.createSvgElement( Svg.G, {'class': 'blocklyCommentDeleteIcon'}, - this.svgGroup + this.svgGroup, ); this.deleteIconBorder = dom.createSvgElement( Svg.CIRCLE, {'class': 'blocklyDeleteIconShape', 'r': '7', 'cx': '7.5', 'cy': '7.5'}, - this.deleteGroup + this.deleteGroup, ); // x icon. dom.createSvgElement( @@ -776,7 +776,7 @@ export class WorkspaceCommentSvg 'stroke': '#fff', 'stroke-width': '2', }, - this.deleteGroup + this.deleteGroup, ); dom.createSvgElement( Svg.LINE, @@ -788,7 +788,7 @@ export class WorkspaceCommentSvg 'stroke': '#fff', 'stroke-width': '2', }, - this.deleteGroup + this.deleteGroup, ); } @@ -809,21 +809,21 @@ export class WorkspaceCommentSvg e, new Coordinate( this.workspace.RTL ? -this.width_ : this.width_, - this.height_ - ) + this.height_, + ), ); this.onMouseUpWrapper = browserEvents.conditionalBind( document, 'pointerup', this, - this.resizeMouseUp + this.resizeMouseUp, ); this.onMouseMoveWrapper = browserEvents.conditionalBind( document, 'pointermove', this, - this.resizeMouseMove + this.resizeMouseMove, ); this.workspace.hideChaff(); // This event has been handled. No need to bubble up to the document. @@ -941,7 +941,7 @@ export class WorkspaceCommentSvg this.svgHandleTarget?.setAttribute('width', `${width}`); this.svgHandleTarget?.setAttribute( 'height', - String(WorkspaceCommentSvg.TOP_OFFSET) + String(WorkspaceCommentSvg.TOP_OFFSET), ); if (this.RTL) { this.svgRect_.setAttribute('transform', 'scale(-1 1)'); @@ -957,7 +957,7 @@ export class WorkspaceCommentSvg (-width + RESIZE_SIZE) + ',' + (height - RESIZE_SIZE) + - ') scale(-1 1)' + ') scale(-1 1)', ); this.deleteGroup?.setAttribute( 'transform', @@ -965,7 +965,7 @@ export class WorkspaceCommentSvg (-width + RESIZE_SIZE) + ',' + -RESIZE_SIZE + - ') scale(-1 1)' + ') scale(-1 1)', ); } else { this.resizeGroup.setAttribute( @@ -974,11 +974,11 @@ export class WorkspaceCommentSvg (width - RESIZE_SIZE) + ',' + (height - RESIZE_SIZE) + - ')' + ')', ); this.deleteGroup?.setAttribute( 'transform', - 'translate(' + (width - RESIZE_SIZE) + ',' + -RESIZE_SIZE + ')' + 'translate(' + (width - RESIZE_SIZE) + ',' + -RESIZE_SIZE + ')', ); } } @@ -1031,7 +1031,7 @@ export class WorkspaceCommentSvg if (this.svgHandleTarget) { dom.removeClass( this.svgHandleTarget, - 'blocklyCommentHandleTargetFocused' + 'blocklyCommentHandleTargetFocused', ); } }, 0); @@ -1050,7 +1050,7 @@ export class WorkspaceCommentSvg static fromXmlRendered( xmlComment: Element, workspace: WorkspaceSvg, - opt_wsWidth?: number + opt_wsWidth?: number, ): WorkspaceCommentSvg { eventUtils.disable(); let comment; @@ -1062,7 +1062,7 @@ export class WorkspaceCommentSvg info.content, info.h, info.w, - info.id + info.id, ); if (workspace.rendered) { comment.initSvg(true); diff --git a/core/workspace_svg.ts b/core/workspace_svg.ts index 443249c8f..0b7b7bb4a 100644 --- a/core/workspace_svg.ts +++ b/core/workspace_svg.ts @@ -323,7 +323,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { const MetricsManagerClass = registry.getClassFromOptions( registry.Type.METRICS_MANAGER, options, - true + true, ); /** Object in charge of calculating metrics for the workspace. */ this.metricsManager = new MetricsManagerClass!(this); @@ -345,7 +345,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * Object in charge of loading, storing, and playing audio for a workspace. */ this.audioManager = new WorkspaceAudio( - options.parentWorkspace as WorkspaceSvg + options.parentWorkspace as WorkspaceSvg, ); /** This workspace's grid object or null. */ @@ -359,21 +359,21 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { if (Variables && Variables.flyoutCategory) { this.registerToolboxCategoryCallback( Variables.CATEGORY_NAME, - Variables.flyoutCategory + Variables.flyoutCategory, ); } if (VariablesDynamic && VariablesDynamic.flyoutCategory) { this.registerToolboxCategoryCallback( VariablesDynamic.CATEGORY_NAME, - VariablesDynamic.flyoutCategory + VariablesDynamic.flyoutCategory, ); } if (Procedures && Procedures.flyoutCategory) { this.registerToolboxCategoryCallback( Procedures.CATEGORY_NAME, - Procedures.flyoutCategory + Procedures.flyoutCategory, ); this.addChangeListener(Procedures.mutatorOpenListener); } @@ -388,7 +388,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.renderer = blockRendering.init( this.options.renderer || 'geras', this.getTheme(), - this.options.rendererOverrides ?? undefined + this.options.rendererOverrides ?? undefined, ); /** @@ -538,7 +538,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.updateBlockStyles_( this.getAllBlocks(false).filter(function (block) { return !!block.getStyleName(); - }) + }), ); // Update current toolbox selection. @@ -554,7 +554,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { const event = new (eventUtils.get(eventUtils.THEME_CHANGE))( this.getTheme().name, - this.id + this.id, ); eventUtils.fire(event); } @@ -736,7 +736,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.svgBackground_ = dom.createSvgElement( Svg.RECT, {'height': '100%', 'width': '100%', 'class': opt_backgroundClass}, - this.svgGroup_ + this.svgGroup_, ); if (opt_backgroundClass === 'blocklyMainBackground' && this.grid) { @@ -746,19 +746,19 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.themeManager_.subscribe( this.svgBackground_, 'workspaceBackgroundColour', - 'fill' + 'fill', ); } } this.svgBlockCanvas_ = dom.createSvgElement( Svg.G, {'class': 'blocklyBlockCanvas'}, - this.svgGroup_ + this.svgGroup_, ); this.svgBubbleCanvas_ = dom.createSvgElement( Svg.G, {'class': 'blocklyBubbleCanvas'}, - this.svgGroup_ + this.svgGroup_, ); if (!this.isFlyout) { @@ -767,7 +767,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { 'pointerdown', this, this.onMouseDown_, - false + false, ); // This no-op works around https://bugs.webkit.org/show_bug.cgi?id=226683, // which otherwise prevents zoom/scroll events from being observed in @@ -777,7 +777,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.svgGroup_, 'wheel', this, - this.onMouseWheel_ + this.onMouseWheel_, ); } @@ -787,7 +787,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { const ToolboxClass = registry.getClassFromOptions( registry.Type.TOOLBOX, this.options, - true + true, ); this.toolbox_ = new ToolboxClass!(this); } @@ -797,7 +797,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.recordDragTargets(); const CursorClass = registry.getClassFromOptions( registry.Type.CURSOR, - this.options + this.options, ); CursorClass && this.markerManager.setCursor(new CursorClass()); @@ -901,7 +901,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { static newTrashcan(_workspace: WorkspaceSvg): Trashcan { throw new Error( 'The implementation of newTrashcan should be ' + - 'monkey-patched in by blockly.ts' + 'monkey-patched in by blockly.ts', ); } @@ -940,14 +940,14 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { const HorizontalFlyout = registry.getClassFromOptions( registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX, this.options, - true + true, ); this.flyout = new HorizontalFlyout!(workspaceOptions); } else { const VerticalFlyout = registry.getClassFromOptions( registry.Type.FLYOUTS_VERTICAL_TOOLBOX, this.options, - true + true, ); this.flyout = new VerticalFlyout!(workspaceOptions); } @@ -1030,7 +1030,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { const positionables = this.componentManager.getComponents( ComponentManager.Capability.POSITIONABLE, - true + true, ); const metrics = this.getMetricsManager().getUiMetrics(); const savedPositions = []; @@ -1154,7 +1154,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { left, scale, this.id, - this.oldScale + this.oldScale, ); this.oldScale = scale; this.oldTop = top; @@ -1299,7 +1299,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @returns The pasted thing, or null if the paste was not successful. */ paste( - state: AnyDuringMigration | Element | DocumentFragment + state: AnyDuringMigration | Element | DocumentFragment, ): ICopyable | null { if (!this.rendered || (!state['type'] && !state['tagName'])) { return null; @@ -1341,7 +1341,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { */ private pasteBlock_( xmlBlock: Element | null, - jsonBlock: blocks.State | null + jsonBlock: blocks.State | null, ): BlockSvg { eventUtils.disable(); let block: BlockSvg; @@ -1388,7 +1388,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { for (let i = 0, connection; (connection = connections[i]); i++) { const neighbour = connection.closest( config.snapRadius, - new Coordinate(blockX, blockY) + new Coordinate(blockX, blockY), ); if (neighbour.connection) { collide = true; @@ -1502,7 +1502,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { override createVariable( name: string, opt_type?: string | null, - opt_id?: string | null + opt_id?: string | null, ): VariableModel { const newVar = super.createVariable(name, opt_type, opt_id); this.refreshToolboxSelection(); @@ -1513,7 +1513,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { recordDragTargets() { const dragTargets = this.componentManager.getComponents( ComponentManager.Capability.DRAG_TARGET, - true + true, ); this.dragTargetAreas = []; @@ -1541,7 +1541,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { override newBlock(prototypeName: string, opt_id?: string): BlockSvg { throw new Error( 'The implementation of newBlock should be ' + - 'monkey-patched in by blockly.ts' + 'monkey-patched in by blockly.ts', ); } /* eslint-enable */ @@ -1585,7 +1585,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { const point = browserEvents.mouseToSvg( e, this.getParentSvg(), - this.getInverseScreenCTM() + this.getInverseScreenCTM(), ); // Fix scale of mouse event. point.x /= this.scale; @@ -1603,7 +1603,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { const point = browserEvents.mouseToSvg( e, this.getParentSvg(), - this.getInverseScreenCTM() + this.getInverseScreenCTM(), ); // Fix scale of mouse event. point.x /= this.scale; @@ -1716,7 +1716,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { const position = browserEvents.mouseToSvg( e, this.getParentSvg(), - this.getInverseScreenCTM() + this.getInverseScreenCTM(), ); this.zoom(position.x, position.y, delta); } else { @@ -1813,7 +1813,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { } const menuOptions = ContextMenuRegistry.registry.getContextMenuOptions( ContextMenuRegistry.ScopeType.WORKSPACE, - {workspace: this} + {workspace: this}, ); // Allow the developer to add or modify menuOptions. @@ -1955,7 +1955,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { if (!this.isMovable()) { console.warn( 'Tried to move a non-movable workspace. This could result' + - ' in blocks becoming inaccessible.' + ' in blocks becoming inaccessible.', ); return; } @@ -2025,7 +2025,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { if (!this.isMovable()) { console.warn( 'Tried to move a non-movable workspace. This could result' + - ' in blocks becoming inaccessible.' + ' in blocks becoming inaccessible.', ); return; } @@ -2052,7 +2052,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { if (!this.isMovable()) { console.warn( 'Tried to move a non-movable workspace. This could result' + - ' in blocks becoming inaccessible.' + ' in blocks becoming inaccessible.', ); return; } @@ -2187,12 +2187,12 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { y = Math.min(y, -metrics.scrollTop); const maxXDisplacement = Math.max( 0, - metrics.scrollWidth - metrics.viewWidth + metrics.scrollWidth - metrics.viewWidth, ); const maxXScroll = metrics.scrollLeft + maxXDisplacement; const maxYDisplacement = Math.max( 0, - metrics.scrollHeight - metrics.viewHeight + metrics.scrollHeight - metrics.viewHeight, ); const maxYScroll = metrics.scrollTop + maxYDisplacement; x = Math.max(x, -maxXScroll); @@ -2210,7 +2210,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.scrollbar.set( -(x + metrics.scrollLeft), -(y + metrics.scrollTop), - false + false, ); } // We have to shift the translation so that when the canvas is at 0, 0 the @@ -2400,7 +2400,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { */ registerToolboxCategoryCallback( key: string, - func: (p1: WorkspaceSvg) => toolbox.FlyoutDefinition + func: (p1: WorkspaceSvg) => toolbox.FlyoutDefinition, ) { if (typeof func !== 'function') { throw TypeError('Toolbox category callbacks must be functions.'); @@ -2417,7 +2417,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * null if no function is registered. */ getToolboxCategoryCallback( - key: string + key: string, ): ((p1: WorkspaceSvg) => toolbox.FlyoutDefinition) | null { return this.toolboxCategoryCallbacks.get(key) || null; } @@ -2528,10 +2528,10 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { hideComponents(onlyClosePopups = false) { const autoHideables = this.getComponentManager().getComponents( ComponentManager.Capability.AUTOHIDEABLE, - true + true, ); autoHideables.forEach((autoHideable) => - autoHideable.autoHide(onlyClosePopups) + autoHideable.autoHide(onlyClosePopups), ); } @@ -2543,7 +2543,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { */ private static setTopLevelWorkspaceMetrics_( this: WorkspaceSvg, - xyRatio: {x?: number; y?: number} + xyRatio: {x?: number; y?: number}, ) { const metrics = this.getMetrics(); diff --git a/core/xml.ts b/core/xml.ts index 0367e550a..1dc2d1862 100644 --- a/core/xml.ts +++ b/core/xml.ts @@ -33,11 +33,11 @@ import type {WorkspaceSvg} from './workspace_svg.js'; */ export function workspaceToDom( workspace: Workspace, - opt_noId?: boolean + opt_noId?: boolean, ): Element { const treeXml = utilsXml.createElement('xml'); const variablesElement = variablesToDom( - Variables.allUsedVarModels(workspace) + Variables.allUsedVarModels(workspace), ); if (variablesElement.hasChildNodes()) { treeXml.appendChild(variablesElement); @@ -86,7 +86,7 @@ export function variablesToDom(variableList: VariableModel[]): Element { */ export function blockToDomWithXY( block: Block, - opt_noId?: boolean + opt_noId?: boolean, ): Element | DocumentFragment { if (block.isInsertionMarker()) { // Skip over insertion markers. @@ -107,7 +107,7 @@ export function blockToDomWithXY( const xy = block.getRelativeToSurfaceXY(); element.setAttribute( 'x', - String(Math.round(block.workspace.RTL ? width - xy.x : xy.x)) + String(Math.round(block.workspace.RTL ? width - xy.x : xy.x)), ); element.setAttribute('y', String(Math.round(xy.y))); } @@ -159,7 +159,7 @@ function allFieldsToDom(block: Block, element: Element) { */ export function blockToDom( block: Block, - opt_noId?: boolean + opt_noId?: boolean, ): Element | DocumentFragment { // Skip over insertion markers. if (block.isInsertionMarker()) { @@ -385,7 +385,7 @@ export function domToPrettyText(dom: Node): string { */ export function clearWorkspaceAndLoadFromXml( xml: Element, - workspace: WorkspaceSvg + workspace: WorkspaceSvg, ): string[] { workspace.setResizesEnabled(false); workspace.clear(); @@ -447,7 +447,7 @@ export function domToWorkspace(xml: Element, workspace: Workspace): string[] { WorkspaceCommentSvg.fromXmlRendered( xmlChildElement, workspace as WorkspaceSvg, - width + width, ); } else { WorkspaceComment.fromXml(xmlChildElement, workspace); @@ -459,7 +459,7 @@ export function domToWorkspace(xml: Element, workspace: Workspace): string[] { throw Error( "'variables' tag must exist once before block and " + 'shadow tag elements in the workspace XML, but it was found in ' + - 'another location.' + 'another location.', ); } variablesFirst = false; @@ -487,7 +487,7 @@ export function domToWorkspace(xml: Element, workspace: Workspace): string[] { */ export function appendDomToWorkspace( xml: Element, - workspace: WorkspaceSvg + workspace: WorkspaceSvg, ): string[] { // First check if we have a WorkspaceSvg, otherwise the blocks have no shape // and the position does not matter. @@ -586,13 +586,13 @@ export function domToBlock(xmlBlock: Element, workspace: Workspace): Block { if (eventUtils.isEnabled()) { const newVariables = Variables.getAddedVariables( workspace, - variablesBeforeCreation + variablesBeforeCreation, ); // Fire a VarCreate event for each (if any) new variable created. for (let i = 0; i < newVariables.length; i++) { const thisVariable = newVariables[i]; eventUtils.fire( - new (eventUtils.get(eventUtils.VAR_CREATE))(thisVariable) + new (eventUtils.get(eventUtils.VAR_CREATE))(thisVariable), ); } // Block events come after var events, in case they refer to newly created @@ -800,7 +800,7 @@ function applyInputTagNodes( xmlChildren: Element[], workspace: Workspace, block: Block, - prototypeName: string + prototypeName: string, ) { for (let i = 0; i < xmlChildren.length; i++) { const xmlChild = xmlChildren[i]; @@ -808,7 +808,10 @@ function applyInputTagNodes( const input = nodeName ? block.getInput(nodeName) : null; if (!input) { console.warn( - 'Ignoring non-existent input ' + nodeName + ' in block ' + prototypeName + 'Ignoring non-existent input ' + + nodeName + + ' in block ' + + prototypeName, ); break; } @@ -821,7 +824,7 @@ function applyInputTagNodes( childBlockInfo.childBlockElement, workspace, input.connection, - false + false, ); } // Set shadow after so we don't create a shadow we delete immediately. @@ -841,7 +844,7 @@ function applyInputTagNodes( function applyNextTagNodes( xmlChildren: Element[], workspace: Workspace, - block: Block + block: Block, ) { for (let i = 0; i < xmlChildren.length; i++) { const xmlChild = xmlChildren[i]; @@ -859,7 +862,7 @@ function applyNextTagNodes( childBlockInfo.childBlockElement, workspace, block.nextConnection, - true + true, ); } // Set shadow after so we don't create a shadow we delete immediately. @@ -885,7 +888,7 @@ function domToBlockHeadless( xmlBlock: Element, workspace: Workspace, parentConnection?: Connection, - connectedToParentNext?: boolean + connectedToParentNext?: boolean, ): Block { let block = null; const prototypeName = xmlBlock.getAttribute('type'); @@ -900,7 +903,7 @@ function domToBlockHeadless( const shouldCallInitSvg = applyMutationTagNodes( xmlChildNameMap.mutation, - block + block, ); applyCommentTagNodes(xmlChildNameMap.comment, block); applyDataTagNodes(xmlChildNameMap.data, block); @@ -920,7 +923,7 @@ function domToBlockHeadless( parentConnection.connect(block.previousConnection); } else { throw TypeError( - 'Child block does not have output or previous statement.' + 'Child block does not have output or previous statement.', ); } } @@ -991,7 +994,7 @@ function domToField(block: Block, fieldName: string, xml: Element) { const field = block.getField(fieldName); if (!field) { console.warn( - 'Ignoring non-existent field ' + fieldName + ' in block ' + block.type + 'Ignoring non-existent field ' + fieldName + ' in block ' + block.type, ); return; } diff --git a/core/zoom_controls.ts b/core/zoom_controls.ts index 524eef44d..66d179dff 100644 --- a/core/zoom_controls.ts +++ b/core/zoom_controls.ts @@ -171,7 +171,7 @@ export class ZoomControls implements IPositionable { const cornerPosition = uiPosition.getCornerOppositeToolbox( this.workspace, - metrics + metrics, ); let height = this.SMALL_SPACING + 2 * this.HEIGHT; if (this.zoomResetGroup) { @@ -183,7 +183,7 @@ export class ZoomControls implements IPositionable { this.MARGIN_HORIZONTAL, this.MARGIN_VERTICAL, metrics, - this.workspace + this.workspace, ); const verticalPosition = cornerPosition.vertical; @@ -195,21 +195,21 @@ export class ZoomControls implements IPositionable { startRect, this.MARGIN_VERTICAL, bumpDirection, - savedPositions + savedPositions, ); if (verticalPosition === uiPosition.verticalPosition.TOP) { const zoomInTranslateY = this.SMALL_SPACING + this.HEIGHT; this.zoomInGroup?.setAttribute( 'transform', - 'translate(0, ' + zoomInTranslateY + ')' + 'translate(0, ' + zoomInTranslateY + ')', ); if (this.zoomResetGroup) { const zoomResetTranslateY = zoomInTranslateY + this.LARGE_SPACING + this.HEIGHT; this.zoomResetGroup.setAttribute( 'transform', - 'translate(0, ' + zoomResetTranslateY + ')' + 'translate(0, ' + zoomResetTranslateY + ')', ); } } else { @@ -218,13 +218,13 @@ export class ZoomControls implements IPositionable { : 0; this.zoomInGroup?.setAttribute( 'transform', - 'translate(0, ' + zoomInTranslateY + ')' + 'translate(0, ' + zoomInTranslateY + ')', ); const zoomOutTranslateY = zoomInTranslateY + this.SMALL_SPACING + this.HEIGHT; this.zoomOutGroup?.setAttribute( 'transform', - 'translate(0, ' + zoomOutTranslateY + ')' + 'translate(0, ' + zoomOutTranslateY + ')', ); } @@ -232,7 +232,7 @@ export class ZoomControls implements IPositionable { this.left = positionRect.left; this.svgGroup?.setAttribute( 'transform', - 'translate(' + this.left + ',' + this.top + ')' + 'translate(' + this.left + ',' + this.top + ')', ); } @@ -257,12 +257,12 @@ export class ZoomControls implements IPositionable { this.zoomOutGroup = dom.createSvgElement( Svg.G, {'class': 'blocklyZoom blocklyZoomOut'}, - this.svgGroup + this.svgGroup, ); const clip = dom.createSvgElement( Svg.CLIPPATH, {'id': 'blocklyZoomoutClipPath' + rnd}, - this.zoomOutGroup + this.zoomOutGroup, ); dom.createSvgElement( Svg.RECT, @@ -270,7 +270,7 @@ export class ZoomControls implements IPositionable { 'width': 32, 'height': 32, }, - clip + clip, ); const zoomoutSvg = dom.createSvgElement( Svg.IMAGE, @@ -281,12 +281,12 @@ export class ZoomControls implements IPositionable { 'y': -92, 'clip-path': 'url(#blocklyZoomoutClipPath' + rnd + ')', }, - this.zoomOutGroup + this.zoomOutGroup, ); zoomoutSvg.setAttributeNS( dom.XLINK_NS, 'xlink:href', - this.workspace.options.pathToMedia + SPRITE.url + this.workspace.options.pathToMedia + SPRITE.url, ); // Attach listener. @@ -295,8 +295,8 @@ export class ZoomControls implements IPositionable { this.zoomOutGroup, 'pointerdown', null, - this.zoom.bind(this, -1) - ) + this.zoom.bind(this, -1), + ), ); } @@ -321,12 +321,12 @@ export class ZoomControls implements IPositionable { this.zoomInGroup = dom.createSvgElement( Svg.G, {'class': 'blocklyZoom blocklyZoomIn'}, - this.svgGroup + this.svgGroup, ); const clip = dom.createSvgElement( Svg.CLIPPATH, {'id': 'blocklyZoominClipPath' + rnd}, - this.zoomInGroup + this.zoomInGroup, ); dom.createSvgElement( Svg.RECT, @@ -334,7 +334,7 @@ export class ZoomControls implements IPositionable { 'width': 32, 'height': 32, }, - clip + clip, ); const zoominSvg = dom.createSvgElement( Svg.IMAGE, @@ -345,12 +345,12 @@ export class ZoomControls implements IPositionable { 'y': -92, 'clip-path': 'url(#blocklyZoominClipPath' + rnd + ')', }, - this.zoomInGroup + this.zoomInGroup, ); zoominSvg.setAttributeNS( dom.XLINK_NS, 'xlink:href', - this.workspace.options.pathToMedia + SPRITE.url + this.workspace.options.pathToMedia + SPRITE.url, ); // Attach listener. @@ -359,8 +359,8 @@ export class ZoomControls implements IPositionable { this.zoomInGroup, 'pointerdown', null, - this.zoom.bind(this, 1) - ) + this.zoom.bind(this, 1), + ), ); } @@ -402,12 +402,12 @@ export class ZoomControls implements IPositionable { this.zoomResetGroup = dom.createSvgElement( Svg.G, {'class': 'blocklyZoom blocklyZoomReset'}, - this.svgGroup + this.svgGroup, ); const clip = dom.createSvgElement( Svg.CLIPPATH, {'id': 'blocklyZoomresetClipPath' + rnd}, - this.zoomResetGroup + this.zoomResetGroup, ); dom.createSvgElement(Svg.RECT, {'width': 32, 'height': 32}, clip); const zoomresetSvg = dom.createSvgElement( @@ -418,12 +418,12 @@ export class ZoomControls implements IPositionable { 'y': -92, 'clip-path': 'url(#blocklyZoomresetClipPath' + rnd + ')', }, - this.zoomResetGroup + this.zoomResetGroup, ); zoomresetSvg.setAttributeNS( dom.XLINK_NS, 'xlink:href', - this.workspace.options.pathToMedia + SPRITE.url + this.workspace.options.pathToMedia + SPRITE.url, ); // Attach event listeners. @@ -432,8 +432,8 @@ export class ZoomControls implements IPositionable { this.zoomResetGroup, 'pointerdown', null, - this.resetZoom.bind(this) - ) + this.resetZoom.bind(this), + ), ); } @@ -471,7 +471,7 @@ export class ZoomControls implements IPositionable { const uiEvent = new (eventUtils.get(eventUtils.CLICK))( null, this.workspace.id, - 'zoom_controls' + 'zoom_controls', ); eventUtils.fire(uiEvent); } diff --git a/package-lock.json b/package-lock.json index 39d30de5b..08466c940 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,7 @@ "markdown-tables-to-json": "^0.1.7", "mocha": "^10.0.0", "patch-package": "^7.0.0", - "prettier": "2.8.8", + "prettier": "3.0.0", "readline-sync": "^1.4.10", "rimraf": "^5.0.0", "selenium-standalone": "^8.0.3", @@ -8927,15 +8927,15 @@ } }, "node_modules/prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.0.tgz", + "integrity": "sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==", "dev": true, "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" }, "funding": { "url": "https://github.com/prettier/prettier?sponsor=1" @@ -18878,9 +18878,9 @@ "dev": true }, "prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.0.tgz", + "integrity": "sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==", "dev": true }, "pretty-hrtime": { diff --git a/package.json b/package.json index 876b2a755..d0788e79c 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "markdown-tables-to-json": "^0.1.7", "mocha": "^10.0.0", "patch-package": "^7.0.0", - "prettier": "2.8.8", + "prettier": "3.0.0", "readline-sync": "^1.4.10", "rimraf": "^5.0.0", "selenium-standalone": "^8.0.3", diff --git a/scripts/tsick.js b/scripts/tsick.js index e78a7e348..ac0d56e8e 100644 --- a/scripts/tsick.js +++ b/scripts/tsick.js @@ -62,7 +62,7 @@ function rewriteEnum(code) { // })(names || (names = {})); const enumDefs = code.match( - /\s+\(function \((\w+)\) \{\n[^}]*\}\)\(\1 [^)]+\1 = \{\}\)\);/g + /\s+\(function \((\w+)\) \{\n[^}]*\}\)\(\1 [^)]+\1 = \{\}\)\);/g, ) || []; for (const oldEnumDef of enumDefs) { // enumDef looks like a bunch of lines in one of these two formats: diff --git a/tests/bootstrap.js b/tests/bootstrap.js index cc05e037a..dace6e3a1 100644 --- a/tests/bootstrap.js +++ b/tests/bootstrap.js @@ -156,7 +156,7 @@ // library we use, mainly for goog.require / goog.provide / // goog.module). document.write( - `` + ``, ); // Prevent spurious transpilation warnings. @@ -198,7 +198,7 @@ scriptDeps.push( `goog.addDependency(${quote('../../../../' + script)}, ` + `[${quote(fakeModuleName)}], [${requires.map(quote).join()}], ` + - `{'lang': 'es6'});` + `{'lang': 'es6'});`, ); requires = [fakeModuleName]; } diff --git a/tests/bootstrap_done.mjs b/tests/bootstrap_done.mjs index 18df496d1..86ebcb4ad 100644 --- a/tests/bootstrap_done.mjs +++ b/tests/bootstrap_done.mjs @@ -23,7 +23,7 @@ if (!window.bootstrapInfo) { throw new Error( 'window.bootstrapInfo not found. ' + - 'Make sure to load bootstrap.js before importing bootstrap_done.mjs.' + 'Make sure to load bootstrap.js before importing bootstrap_done.mjs.', ); } diff --git a/tests/browser/test/basic_block_factory_test.js b/tests/browser/test/basic_block_factory_test.js index def7ef0ef..84069f5df 100644 --- a/tests/browser/test/basic_block_factory_test.js +++ b/tests/browser/test/basic_block_factory_test.js @@ -23,10 +23,10 @@ suite('Testing Connecting Blocks', function (done) { test('Testing Block Drag', async function () { const startingBlock = await browser.$( - '#blockly > div > svg.blocklySvg > g > g.blocklyBlockCanvas > g:nth-child(2)' + '#blockly > div > svg.blocklySvg > g > g.blocklyBlockCanvas > g:nth-child(2)', ); const blocklyCanvas = await browser.$( - '#blockly > div > svg.blocklySvg > g > g.blocklyBlockCanvas' + '#blockly > div > svg.blocklySvg > g > g.blocklyBlockCanvas', ); const firstPostion = await blocklyCanvas.getAttribute('transform'); await startingBlock.dragAndDrop({x: 20, y: 20}); diff --git a/tests/browser/test/basic_block_test.js b/tests/browser/test/basic_block_test.js index 47f9007b8..31fea8fd9 100644 --- a/tests/browser/test/basic_block_test.js +++ b/tests/browser/test/basic_block_test.js @@ -28,7 +28,7 @@ suite('Basic block tests', function (done) { // Setup Selenium for all of the tests suiteSetup(async function () { browser = await testSetup( - testFileLocations.PLAYGROUND + '?toolbox=test-blocks' + testFileLocations.PLAYGROUND + '?toolbox=test-blocks', ); }); diff --git a/tests/browser/test/basic_playground_test.js b/tests/browser/test/basic_playground_test.js index 8f9507996..e3a746f21 100644 --- a/tests/browser/test/basic_playground_test.js +++ b/tests/browser/test/basic_playground_test.js @@ -51,7 +51,7 @@ suite('Testing Connecting Blocks', function () { const logicButton = await browser.$('#blockly-0'); logicButton.click(); const ifDoBlock = await browser.$( - '#blocklyDiv > div > svg:nth-child(7) > g > g.blocklyBlockCanvas > g:nth-child(3)' + '#blocklyDiv > div > svg:nth-child(7) > g > g.blocklyBlockCanvas > g:nth-child(3)', ); await ifDoBlock.dragAndDrop({x: 20, y: 20}); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec @@ -147,21 +147,21 @@ suite('Disabling', function () { 'Logic', 'controls_if', 10, - 10 + 10, ); const child = await dragBlockTypeFromFlyout( browser, 'Logic', 'logic_boolean', 110, - 110 + 110, ); await connect(browser, child, 'OUTPUT', parent, 'IF0'); await contextMenuSelect(browser, parent, 'Disable Block'); chai.assert.isTrue(await getIsDisabled(browser, child.id)); - } + }, ); test( @@ -173,21 +173,21 @@ suite('Disabling', function () { 'Logic', 'controls_if', 10, - 10 + 10, ); const child = await dragBlockTypeFromFlyout( browser, 'Logic', 'controls_if', 110, - 110 + 110, ); await connect(browser, child, 'PREVIOUS', parent, 'DO0'); await contextMenuSelect(browser, parent, 'Disable Block'); chai.assert.isTrue(await getIsDisabled(browser, child.id)); - } + }, ); test( @@ -199,21 +199,21 @@ suite('Disabling', function () { 'Logic', 'controls_if', 10, - 10 + 10, ); const child = await dragBlockTypeFromFlyout( browser, 'Logic', 'controls_if', 110, - 110 + 110, ); await connect(browser, child, 'PREVIOUS', parent, 'NEXT'); await contextMenuSelect(browser, parent, 'Disable Block'); chai.assert.isFalse(await getIsDisabled(browser, child.id)); - } + }, ); suiteTeardown(async function () { diff --git a/tests/browser/test/block_undo_test.js b/tests/browser/test/block_undo_test.js index 1acfbd6f9..2f057d26f 100644 --- a/tests/browser/test/block_undo_test.js +++ b/tests/browser/test/block_undo_test.js @@ -50,7 +50,7 @@ async function testUndoBlock(delta) { 'Functions', 'procedures_defreturn', 50 * delta, - 20 + 20, ); await browser.keys([Key.Ctrl, 'z']); diff --git a/tests/browser/test/extensive_test.js b/tests/browser/test/extensive_test.js index 015877400..ed218a632 100644 --- a/tests/browser/test/extensive_test.js +++ b/tests/browser/test/extensive_test.js @@ -34,7 +34,7 @@ suite('This tests loading Large Configuration and Deletion', function (done) { test('This test deleting block results in the correct number of blocks', async function () { const fourthRepeatDo = await getBlockElementById( browser, - 'E8bF[-r:B~cabGLP#QYd' + 'E8bF[-r:B~cabGLP#QYd', ); await fourthRepeatDo.click({x: -100, y: -40}); await browser.keys([Key.Delete]); diff --git a/tests/browser/test/field_edits_test.js b/tests/browser/test/field_edits_test.js index 5a88b7b8f..a507d860e 100644 --- a/tests/browser/test/field_edits_test.js +++ b/tests/browser/test/field_edits_test.js @@ -50,7 +50,7 @@ async function testFieldEdits(delta) { 'Math', 'math_number', 50 * delta, - 20 + 20, ); await browser.pause(2000); @@ -67,7 +67,7 @@ async function testFieldEdits(delta) { // Get value of the number const numericText = await browser .$( - '#blocklyDiv > div > svg.blocklySvg > g > g.blocklyBlockCanvas > g.blocklyDraggable > g > text' + '#blocklyDiv > div > svg.blocklySvg > g > g.blocklyBlockCanvas > g.blocklyDraggable > g > text', ) .getHTML(); diff --git a/tests/browser/test/procedure_test.js b/tests/browser/test/procedure_test.js index 0a675a836..8438fba21 100644 --- a/tests/browser/test/procedure_test.js +++ b/tests/browser/test/procedure_test.js @@ -34,7 +34,7 @@ suite('Testing Connecting Blocks', function (done) { let proceduresDefReturn = await getBlockTypeFromCategory( browser, 'Functions', - 'procedures_defreturn' + 'procedures_defreturn', ); await proceduresDefReturn.dragAndDrop({x: 50, y: 20}); const doSomething = await getSelectedBlockElement(browser); @@ -43,7 +43,7 @@ suite('Testing Connecting Blocks', function (done) { proceduresDefReturn = await getBlockTypeFromCategory( browser, 'Functions', - 'procedures_defreturn' + 'procedures_defreturn', ); await proceduresDefReturn.dragAndDrop({x: 300, y: 200}); const doSomething2 = await getSelectedBlockElement(browser); @@ -52,7 +52,7 @@ suite('Testing Connecting Blocks', function (done) { const mathNumeric = await getBlockTypeFromCategory( browser, 'Math', - 'math_number' + 'math_number', ); await mathNumeric.dragAndDrop({x: 50, y: 20}); const numeric = await getSelectedBlockElement(browser); @@ -64,7 +64,7 @@ suite('Testing Connecting Blocks', function (done) { const doSomethingFlyout = await getNthBlockOfCategory( browser, 'Functions', - 3 + 3, ); await doSomethingFlyout.dragAndDrop({x: 50, y: 20}); const doSomethingCaller = await getSelectedBlockElement(browser); @@ -76,7 +76,7 @@ suite('Testing Connecting Blocks', function (done) { const printFlyout = await getBlockTypeFromCategory( browser, 'Text', - 'text_print' + 'text_print', ); await printFlyout.dragAndDrop({x: 50, y: 20}); const print = await getSelectedBlockElement(browser); @@ -85,7 +85,7 @@ suite('Testing Connecting Blocks', function (done) { const doSomething2Flyout = await getNthBlockOfCategory( browser, 'Functions', - 4 + 4, ); await doSomething2Flyout.dragAndDrop({x: 130, y: 20}); const doSomething2Caller = await getSelectedBlockElement(browser); diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index 35cf841e3..cfc051371 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -38,7 +38,7 @@ async function testSetup(url) { options.capabilities['goog:chromeOptions'].args.push( '--headless', '--no-sandbox', - '--disable-dev-shm-usage' + '--disable-dev-shm-usage', ); } else { // --disable-gpu is needed to prevent Chrome from hanging on Linux with @@ -147,7 +147,7 @@ async function getNthBlockOfCategory(browser, categoryName, n) { category.click(); await browser.pause(100); const block = await browser.$( - `.blocklyFlyout .blocklyBlockCanvas > g:nth-child(${3 + n * 2})` + `.blocklyFlyout .blocklyBlockCanvas > g:nth-child(${3 + n * 2})`, ); return block; } @@ -191,7 +191,7 @@ async function getBlockTypeFromWorkspace(browser, blockType, position) { ].id; }, blockType, - position + position, ); return getBlockElementById(browser, id); } @@ -228,15 +228,15 @@ async function getLocationOfBlockConnection(browser, id, connectionName) { const loc = Blockly.utils.Coordinate.sum( block.getRelativeToSurfaceXY(), - connection.getOffsetInBlock() + connection.getOffsetInBlock(), ); return Blockly.utils.svgMath.wsToScreenCoordinates( Blockly.getMainWorkspace(), - loc + loc, ); }, id, - connectionName + connectionName, ); } @@ -255,17 +255,17 @@ async function connect( draggedBlock, draggedConnection, targetBlock, - targetConnection + targetConnection, ) { const draggedLocation = await getLocationOfBlockConnection( browser, draggedBlock.id, - draggedConnection + draggedConnection, ); const targetLocation = await getLocationOfBlockConnection( browser, targetBlock.id, - targetConnection + targetConnection, ); const delta = { @@ -326,7 +326,7 @@ async function dragBlockTypeFromFlyout(browser, categoryName, type, x, y) { const flyoutBlock = await getBlockTypeFromCategory( browser, categoryName, - type + type, ); await flyoutBlock.dragAndDrop({x: x, y: y}); return await getSelectedBlockElement(browser); diff --git a/tests/migration/validate-renamings.mjs b/tests/migration/validate-renamings.mjs index 5ea838b3a..b0f0e6f7f 100755 --- a/tests/migration/validate-renamings.mjs +++ b/tests/migration/validate-renamings.mjs @@ -23,7 +23,7 @@ const SCHEMA_URL = new URL('renamings.schema.json', import.meta.url); /** @type {URL} Renamings filename. */ const RENAMINGS_URL = new URL( '../../scripts/migration/renamings.json5', - import.meta.url + import.meta.url, ); const renamingsJson5 = await readFile(RENAMINGS_URL); @@ -46,7 +46,7 @@ Object.entries(renamings).forEach(([version, modules]) => { for (const {oldName} of modules) { if (seen.has(oldName)) { console.log( - `Duplicate entry for module ${oldName} ` + `in version ${version}.` + `Duplicate entry for module ${oldName} ` + `in version ${version}.`, ); ok = false; } diff --git a/tests/mocha/astnode_test.js b/tests/mocha/astnode_test.js index 5295a7abc..a91119261 100644 --- a/tests/mocha/astnode_test.js +++ b/tests/mocha/astnode_test.js @@ -86,10 +86,10 @@ suite('ASTNode', function () { statementInput1.nextConnection.connect(statementInput2.previousConnection); statementInput1.inputList[0].connection.connect( - fieldWithOutput.outputConnection + fieldWithOutput.outputConnection, ); statementInput2.inputList[1].connection.connect( - statementInput3.previousConnection + statementInput3.previousConnection, ); this.blocks = { @@ -143,7 +143,7 @@ suite('ASTNode', function () { test('navigateBetweenStacks_Forward', function () { const node = new ASTNode( ASTNode.types.NEXT, - this.blocks.statementInput1.nextConnection + this.blocks.statementInput1.nextConnection, ); const newASTNode = node.navigateBetweenStacks(true); chai.assert.equal(newASTNode.getLocation(), this.blocks.statementInput4); @@ -152,7 +152,7 @@ suite('ASTNode', function () { test('navigateBetweenStacks_Backward', function () { const node = new ASTNode( ASTNode.types.BLOCK, - this.blocks.statementInput4 + this.blocks.statementInput4, ); const newASTNode = node.navigateBetweenStacks(false); chai.assert.equal(newASTNode.getLocation(), this.blocks.statementInput1); @@ -160,31 +160,31 @@ suite('ASTNode', function () { test('getOutAstNodeForBlock', function () { const node = new ASTNode( ASTNode.types.BLOCK, - this.blocks.statementInput2 + this.blocks.statementInput2, ); const newASTNode = node.getOutAstNodeForBlock( - this.blocks.statementInput2 + this.blocks.statementInput2, ); chai.assert.equal(newASTNode.getLocation(), this.blocks.statementInput1); }); test('getOutAstNodeForBlock_OneBlock', function () { const node = new ASTNode( ASTNode.types.BLOCK, - this.blocks.statementInput4 + this.blocks.statementInput4, ); const newASTNode = node.getOutAstNodeForBlock( - this.blocks.statementInput4 + this.blocks.statementInput4, ); chai.assert.equal(newASTNode.getLocation(), this.blocks.statementInput4); }); test('findFirstFieldOrInput_', function () { const node = new ASTNode( ASTNode.types.BLOCK, - this.blocks.statementInput4 + this.blocks.statementInput4, ); const field = this.blocks.statementInput4.inputList[0].fieldRow[0]; const newASTNode = node.findFirstFieldOrInput( - this.blocks.statementInput4 + this.blocks.statementInput4, ); chai.assert.equal(newASTNode.getLocation(), field); }); @@ -618,7 +618,7 @@ suite('ASTNode', function () { const inNode = node.in(); chai.assert.equal( inNode.getLocation(), - this.workspace.getTopBlocks()[0] + this.workspace.getTopBlocks()[0], ); chai.assert.equal(inNode.getType(), ASTNode.types.STACK); }); @@ -626,7 +626,7 @@ suite('ASTNode', function () { const coordinate = new Blockly.utils.Coordinate(100, 100); const node = ASTNode.createWorkspaceNode( this.emptyWorkspace, - coordinate + coordinate, ); const inNode = node.in(); chai.assert.isNull(inNode); @@ -658,10 +658,10 @@ suite('ASTNode', function () { const secondBlock = this.blocks.secondBlock; const outputNextBlock = this.blocks.outputNextBlock; this.blocks.noPrevConnection.nextConnection.connect( - secondBlock.previousConnection + secondBlock.previousConnection, ); secondBlock.inputList[0].connection.connect( - outputNextBlock.outputConnection + outputNextBlock.outputConnection, ); }); @@ -679,7 +679,7 @@ suite('ASTNode', function () { chai.assert.equal(outNode.getType(), ASTNode.types.INPUT); chai.assert.equal( outNode.getLocation(), - this.blocks.statementInput1.inputList[0].connection + this.blocks.statementInput1.inputList[0].connection, ); }); test('fromOutputToStack', function () { @@ -757,7 +757,7 @@ suite('ASTNode', function () { chai.assert.equal(outNode.getType(), ASTNode.types.INPUT); chai.assert.equal( outNode.getLocation(), - this.blocks.secondBlock.inputList[0].connection + this.blocks.secondBlock.inputList[0].connection, ); }); test('fromBlockToStack', function () { diff --git a/tests/mocha/block_json_test.js b/tests/mocha/block_json_test.js index 4f678b5b1..538995f0b 100644 --- a/tests/mocha/block_json_test.js +++ b/tests/mocha/block_json_test.js @@ -53,7 +53,7 @@ suite('Block JSON initialization', function () { this.assertError( ['test', 1, 'test'], 0, - 'Block "test": Message index %1 out of range.' + 'Block "test": Message index %1 out of range.', ); }); @@ -61,7 +61,7 @@ suite('Block JSON initialization', function () { this.assertError( ['test', 'test'], 1, - 'Block "test": Message does not reference all 1 arg(s).' + 'Block "test": Message does not reference all 1 arg(s).', ); }); @@ -73,7 +73,7 @@ suite('Block JSON initialization', function () { this.assertError( ['test', 1, 1, 'test'], 1, - 'Block "test": Message index %1 duplicated.' + 'Block "test": Message index %1 duplicated.', ); }); @@ -81,7 +81,7 @@ suite('Block JSON initialization', function () { this.assertError( ['test', 0, 'test'], 1, - 'Block "test": Message index %0 out of range.' + 'Block "test": Message index %0 out of range.', ); }); @@ -89,7 +89,7 @@ suite('Block JSON initialization', function () { this.assertError( ['test', 2, 'test'], 1, - 'Block "test": Message index %2 out of range.' + 'Block "test": Message index %2 out of range.', ); }); }); @@ -105,7 +105,7 @@ suite('Block JSON initialization', function () { }; chai.assert.deepEqual( block.interpolateArguments_(tokens, args, lastAlign), - elements + elements, ); }; }); @@ -131,7 +131,7 @@ suite('Block JSON initialization', function () { { 'type': 'input_dummy', }, - ] + ], ); }); @@ -148,7 +148,7 @@ suite('Block JSON initialization', function () { { 'type': 'input_dummy', }, - ] + ], ); }); @@ -186,7 +186,7 @@ suite('Block JSON initialization', function () { { 'type': 'input_dummy', }, - ] + ], ); }); @@ -211,7 +211,7 @@ suite('Block JSON initialization', function () { { 'type': 'input_dummy', }, - ] + ], ); }); @@ -228,7 +228,7 @@ suite('Block JSON initialization', function () { { 'type': 'input_dummy', }, - ] + ], ); }); @@ -268,7 +268,7 @@ suite('Block JSON initialization', function () { { 'type': 'input_dummy', }, - ] + ], ); }); @@ -288,7 +288,7 @@ suite('Block JSON initialization', function () { { 'type': 'input_dummy', }, - ] + ], ); }); @@ -353,7 +353,7 @@ suite('Block JSON initialization', function () { 'type': 'field_label', 'text': 'text', }, - 'field_label' + 'field_label', ); }); @@ -362,7 +362,7 @@ suite('Block JSON initialization', function () { { 'type': 'field_bad', }, - null + null, ); }); @@ -371,7 +371,7 @@ suite('Block JSON initialization', function () { { 'type': 'no_field_prefix_field', }, - 'no_field_prefix_field' + 'no_field_prefix_field', ); }); @@ -380,7 +380,7 @@ suite('Block JSON initialization', function () { { 'type': 'input_prefix_field', }, - 'input_prefix_field' + 'input_prefix_field', ); }); @@ -390,7 +390,7 @@ suite('Block JSON initialization', function () { 'type': 'field_undefined', 'alt': 'alt text', }, - 'field_label' + 'field_label', ); }); @@ -400,7 +400,7 @@ suite('Block JSON initialization', function () { 'type': 'input_prefix_bad', 'alt': 'alt string', }, - 'field_label' + 'field_label', ); }); @@ -413,7 +413,7 @@ suite('Block JSON initialization', function () { 'name': 'FIELDNAME', }, }, - 'field_number' + 'field_number', ); }); @@ -435,7 +435,7 @@ suite('Block JSON initialization', function () { }, }, }, - 'field_label' + 'field_label', ); }); @@ -460,7 +460,7 @@ suite('Block JSON initialization', function () { }, }, }, - 'field_number' + 'field_number', ); }); @@ -469,7 +469,7 @@ suite('Block JSON initialization', function () { { 'type': 'field_undefined', }, - null + null, ); }); @@ -481,7 +481,7 @@ suite('Block JSON initialization', function () { 'type': 'field_undefined', }, }, - null + null, ); }); @@ -491,7 +491,7 @@ suite('Block JSON initialization', function () { 'type': 'field_undefined', 'alt': ' ', }, - null + null, ); }); }); @@ -509,34 +509,34 @@ suite('Block JSON initialization', function () { case 'input_dummy': chai.assert.isTrue( block.appendDummyInput.calledOnce, - 'Expected a dummy input to be created.' + 'Expected a dummy input to be created.', ); break; case 'input_value': chai.assert.isTrue( block.appendValueInput.calledOnce, - 'Expected a value input to be created.' + 'Expected a value input to be created.', ); break; case 'input_statement': chai.assert.isTrue( block.appendStatementInput.calledOnce, - 'Expected a statement input to be created.' + 'Expected a statement input to be created.', ); break; default: chai.assert.isNull(input, 'Expected input to be null'); chai.assert.isTrue( block.appendDummyInput.notCalled, - 'Expected no input to be created' + 'Expected no input to be created', ); chai.assert.isTrue( block.appendValueInput.notCalled, - 'Expected no input to be created' + 'Expected no input to be created', ); chai.assert.isTrue( block.appendStatementInput.notCalled, - 'Expected no input to be created' + 'Expected no input to be created', ); return; } @@ -559,7 +559,7 @@ suite('Block JSON initialization', function () { { 'type': 'input_dummy', }, - 'input_dummy' + 'input_dummy', ); }); @@ -569,7 +569,7 @@ suite('Block JSON initialization', function () { 'type': 'input_value', 'name': 'NAME', }, - 'input_value' + 'input_value', ); }); @@ -579,7 +579,7 @@ suite('Block JSON initialization', function () { 'type': 'input_statement', 'name': 'NAME', }, - 'input_statement' + 'input_statement', ); }); @@ -588,7 +588,7 @@ suite('Block JSON initialization', function () { { 'type': 'input_bad', }, - 'input_bad' + 'input_bad', ); }); @@ -597,14 +597,14 @@ suite('Block JSON initialization', function () { Blockly.registry.register( Blockly.registry.Type.INPUT, 'custom', - CustomInput + CustomInput, ); const block = this.workspace.newBlock('test_basic_empty'); block.inputFromJson_({'type': 'custom'}); chai.assert.instanceOf( block.inputList[0], CustomInput, - 'Expected the registered input to be constructed' + 'Expected the registered input to be constructed', ); }); }); @@ -618,7 +618,7 @@ suite('Block JSON initialization', function () { 'check': 'Integer', }, 'input_value', - 'Integer' + 'Integer', ); }); @@ -630,7 +630,7 @@ suite('Block JSON initialization', function () { 'check': ['Integer', 'Number'], }, 'input_value', - ['Integer', 'Number'] + ['Integer', 'Number'], ); }); @@ -641,7 +641,7 @@ suite('Block JSON initialization', function () { 'name': 'NAME', 'check': '', }, - 'input_value' + 'input_value', ); }); @@ -652,7 +652,7 @@ suite('Block JSON initialization', function () { 'name': 'NAME', 'check': null, }, - 'input_value' + 'input_value', ); }); }); @@ -666,7 +666,7 @@ suite('Block JSON initialization', function () { }, 'input_dummy', undefined, - Align.LEFT + Align.LEFT, ); }); @@ -678,7 +678,7 @@ suite('Block JSON initialization', function () { }, 'input_dummy', undefined, - Align.RIGHT + Align.RIGHT, ); }); @@ -690,7 +690,7 @@ suite('Block JSON initialization', function () { }, 'input_dummy', undefined, - Align.CENTRE + Align.CENTRE, ); }); @@ -702,7 +702,7 @@ suite('Block JSON initialization', function () { }, 'input_dummy', undefined, - Align.CENTRE + Align.CENTRE, ); }); }); diff --git a/tests/mocha/block_test.js b/tests/mocha/block_test.js index fd640ddbb..3d038e608 100644 --- a/tests/mocha/block_test.js +++ b/tests/mocha/block_test.js @@ -245,7 +245,7 @@ suite('Blocks', function () { chai.assert.isTrue( disposing, - 'Expected disposing to be set to true before destroy is called.' + 'Expected disposing to be set to true before destroy is called.', ); }); @@ -259,7 +259,7 @@ suite('Blocks', function () { chai.assert.isFalse( disposed, - 'Expected disposed to be false when destroy is called' + 'Expected disposed to be false when destroy is called', ); }); @@ -275,7 +275,7 @@ suite('Blocks', function () { chai.assert.isTrue( spy.calledWith(mockEvent), - 'Expected to be able to fire events from destroy' + 'Expected to be able to fire events from destroy', ); }); @@ -295,7 +295,7 @@ suite('Blocks', function () { chai.assert.isTrue( spy.calledWith(mockEvent), - 'Expected to be able to fire events from destroy' + 'Expected to be able to fire events from destroy', ); }); }); @@ -558,7 +558,7 @@ suite('Blocks', function () { }); test('Stack', function () { this.deserializationHelper( - '' + ' ' + '' + '' + ' ' + '', ); chai.assert.equal(this.getPrevious().length, 1); chai.assert.equal(this.getNext().length, 1); @@ -575,14 +575,14 @@ suite('Blocks', function () { ' ' + ' ' + ' ' + - '' + '', ); chai.assert.equal(this.getPrevious().length, 3); chai.assert.equal(this.getNext().length, 3); }); test('Collapsed Stack', function () { this.deserializationHelper( - '' + ' ' + '' + '' + ' ' + '', ); chai.assert.equal(this.getPrevious().length, 1); chai.assert.equal(this.getNext().length, 1); @@ -599,14 +599,14 @@ suite('Blocks', function () { ' ' + ' ' + ' ' + - '' + '', ); chai.assert.equal(this.getPrevious().length, 3); chai.assert.equal(this.getNext().length, 3); }); test('Row', function () { this.deserializationHelper( - '' + ' ' + '' + '' + ' ' + '', ); chai.assert.equal(this.getOutputs().length, 1); chai.assert.equal(this.getInputs().length, 1); @@ -623,14 +623,14 @@ suite('Blocks', function () { ' ' + ' ' + ' ' + - '' + '', ); chai.assert.equal(this.getOutputs().length, 3); chai.assert.equal(this.getInputs().length, 3); }); test('Collapsed Row', function () { this.deserializationHelper( - '' + ' ' + '' + '' + ' ' + '', ); chai.assert.equal(this.getOutputs().length, 1); chai.assert.equal(this.getInputs().length, 0); @@ -647,7 +647,7 @@ suite('Blocks', function () { ' ' + ' ' + ' ' + - '' + '', ); chai.assert.equal(this.getOutputs().length, 1); chai.assert.equal(this.getInputs().length, 0); @@ -665,9 +665,9 @@ suite('Blocks', function () { ' ' + ' ' + ' ' + - '' + '', ), - this.workspace + this.workspace, ); this.assertConnectionsEmpty(); this.clock.runAll(); @@ -676,7 +676,7 @@ suite('Blocks', function () { }); test('Statement', function () { this.deserializationHelper( - '' + ' ' + '' + '' + ' ' + '', ); chai.assert.equal(this.getPrevious().length, 1); chai.assert.equal(this.getNext().length, 2); @@ -693,7 +693,7 @@ suite('Blocks', function () { ' ' + ' ' + ' ' + - '' + '', ); chai.assert.equal(this.getPrevious().length, 3); chai.assert.equal(this.getNext().length, 6); @@ -702,7 +702,7 @@ suite('Blocks', function () { this.deserializationHelper( '' + ' ' + - '' + '', ); chai.assert.equal(this.getPrevious().length, 1); chai.assert.equal(this.getNext().length, 1); @@ -719,7 +719,7 @@ suite('Blocks', function () { ' ' + ' ' + ' ' + - '' + '', ); chai.assert.equal(this.getPrevious().length, 1); chai.assert.equal(this.getNext().length, 1); @@ -736,7 +736,7 @@ suite('Blocks', function () { ' ' + ' ' + ' ' + - '' + '', ); chai.assert.equal(this.getPrevious().length, 2); chai.assert.equal(this.getNext().length, 3); @@ -775,7 +775,7 @@ suite('Blocks', function () { test('Stack', function () { const block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(''), - this.workspace + this.workspace, ); this.clock.runAll(); chai.assert.equal(this.getPrevious().length, 1); @@ -800,9 +800,9 @@ suite('Blocks', function () { ' ' + ' ' + ' ' + - '' + '', ), - this.workspace + this.workspace, ); this.assertConnectionsEmpty(); this.clock.runAll(); @@ -820,7 +820,7 @@ suite('Blocks', function () { test('Row', function () { const block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(''), - this.workspace + this.workspace, ); this.clock.runAll(); chai.assert.equal(this.getOutputs().length, 1); @@ -845,9 +845,9 @@ suite('Blocks', function () { ' ' + ' ' + ' ' + - '' + '', ), - this.workspace + this.workspace, ); this.clock.runAll(); chai.assert.equal(this.getOutputs().length, 3); @@ -872,9 +872,9 @@ suite('Blocks', function () { ' ' + ' ' + ' ' + - '' + '', ), - this.workspace + this.workspace, ); this.clock.runAll(); chai.assert.equal(this.getOutputs().length, 3); @@ -902,9 +902,9 @@ suite('Blocks', function () { ' ' + ' ' + ' ' + - '' + '', ), - this.workspace + this.workspace, ); this.clock.runAll(); chai.assert.equal(this.getOutputs().length, 3); @@ -930,7 +930,7 @@ suite('Blocks', function () { test('Statement', function () { const block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(''), - this.workspace + this.workspace, ); this.clock.runAll(); chai.assert.equal(this.getPrevious().length, 1); @@ -955,9 +955,9 @@ suite('Blocks', function () { ' ' + ' ' + ' ' + - '' + '', ), - this.workspace + this.workspace, ); this.assertConnectionsEmpty(); this.clock.runAll(); @@ -983,9 +983,9 @@ suite('Blocks', function () { ' ' + ' ' + ' ' + - '' + '', ), - this.workspace + this.workspace, ); this.assertConnectionsEmpty(); this.clock.runAll(); @@ -1012,9 +1012,9 @@ suite('Blocks', function () { ' ' + ' ' + ' ' + - '' + '', ), - this.workspace + this.workspace, ); this.assertConnectionsEmpty(); this.clock.runAll(); @@ -1053,9 +1053,9 @@ suite('Blocks', function () { ' ' + ' ' + ' ' + - '' + '', ), - this.workspace + this.workspace, ); this.textJoinBlock = this.printBlock.getInputTargetBlock('TEXT'); this.textBlock = this.textJoinBlock.getInputTargetBlock('ADD0'); @@ -1078,29 +1078,32 @@ suite('Blocks', function () { test('Setting to connected parent', function () { chai.assert.doesNotThrow( - this.textJoinBlock.setParent.bind(this.textJoinBlock, this.printBlock) + this.textJoinBlock.setParent.bind( + this.textJoinBlock, + this.printBlock, + ), ); assertOriginalSetup.call(this); }); test('Setting to new parent after connecting to it', function () { this.textJoinBlock.outputConnection.disconnect(); this.textBlock.outputConnection.connect( - this.printBlock.getInput('TEXT').connection + this.printBlock.getInput('TEXT').connection, ); chai.assert.doesNotThrow( - this.textBlock.setParent.bind(this.textBlock, this.printBlock) + this.textBlock.setParent.bind(this.textBlock, this.printBlock), ); assertBlockIsOnlyChild(this.printBlock, this.textBlock, 'TEXT'); }); test('Setting to new parent while connected to other block', function () { // Setting to grandparent with no available input connection. chai.assert.throws( - this.textBlock.setParent.bind(this.textBlock, this.printBlock) + this.textBlock.setParent.bind(this.textBlock, this.printBlock), ); this.textJoinBlock.outputConnection.disconnect(); // Setting to block with available input connection. chai.assert.throws( - this.textBlock.setParent.bind(this.textBlock, this.printBlock) + this.textBlock.setParent.bind(this.textBlock, this.printBlock), ); assertNonParentAndOrphan(this.printBlock, this.textJoinBlock, 'TEXT'); assertBlockIsOnlyChild(this.textJoinBlock, this.textBlock, 'ADD0'); @@ -1108,7 +1111,10 @@ suite('Blocks', function () { test('Setting to same parent after disconnecting from it', function () { this.textJoinBlock.outputConnection.disconnect(); chai.assert.throws( - this.textJoinBlock.setParent.bind(this.textJoinBlock, this.printBlock) + this.textJoinBlock.setParent.bind( + this.textJoinBlock, + this.printBlock, + ), ); assertNonParentAndOrphan(this.printBlock, this.textJoinBlock, 'TEXT'); }); @@ -1116,12 +1122,12 @@ suite('Blocks', function () { this.textBlock.outputConnection.disconnect(); // When new parent has no available input connection. chai.assert.throws( - this.textBlock.setParent.bind(this.textBlock, this.printBlock) + this.textBlock.setParent.bind(this.textBlock, this.printBlock), ); this.textJoinBlock.outputConnection.disconnect(); // When new parent has available input connection. chai.assert.throws( - this.textBlock.setParent.bind(this.textBlock, this.printBlock) + this.textBlock.setParent.bind(this.textBlock, this.printBlock), ); assertNonParentAndOrphan(this.printBlock, this.textJoinBlock, 'TEXT'); @@ -1131,7 +1137,7 @@ suite('Blocks', function () { test('Setting parent to null after disconnecting', function () { this.textBlock.outputConnection.disconnect(); chai.assert.doesNotThrow( - this.textBlock.setParent.bind(this.textBlock, null) + this.textBlock.setParent.bind(this.textBlock, null), ); assertNonParentAndOrphan(this.textJoinBlock, this.textBlock, 'ADD0'); }); @@ -1238,17 +1244,17 @@ suite('Blocks', function () { chai.assert.equal( event.element, 'comment', - 'Expected the element to be a comment' + 'Expected the element to be a comment', ); chai.assert.equal( event.oldValue, oldValue, - 'Expected the old values to match' + 'Expected the old values to match', ); chai.assert.equal( event.newValue, newValue, - 'Expected the new values to match' + 'Expected the new values to match', ); } function assertNoCommentEvent(eventSpy) { @@ -1266,7 +1272,7 @@ suite('Blocks', function () { setup(function () { this.block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(''), - this.workspace + this.workspace, ); }); test('Text', function () { @@ -1300,7 +1306,7 @@ suite('Blocks', function () { }); this.block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(''), - this.workspace + this.workspace, ); }); teardown(function () { @@ -1357,9 +1363,9 @@ suite('Blocks', function () { this.workspace = Blockly.inject('blocklyDiv'); this.block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom( - 'test' + 'test', ), - this.workspace + this.workspace, ); }); @@ -1390,7 +1396,7 @@ suite('Blocks', function () { for (let i = 0; i < inputs.length; i++) { chai.assert.throws( this.block.getField.bind(this.block, inputs[i]), - TypeError + TypeError, ); } }); @@ -1408,7 +1414,7 @@ suite('Blocks', function () { for (let i = 0; i < inputs.length; i++) { chai.assert.throws( this.block.getFieldValue.bind(this.block, inputs[i]), - TypeError + TypeError, ); } }); @@ -1434,7 +1440,7 @@ suite('Blocks', function () { for (let i = 0; i < inputs.length; i++) { chai.assert.throws( this.block.setFieldValue.bind(this.block, 'test', inputs[i]), - TypeError + TypeError, ); } }); @@ -1480,7 +1486,7 @@ suite('Blocks', function () { this.block.addIcon(new MockIconA()); chai.assert.isTrue( this.block.hasIcon('A'), - 'Expected the icon to be added' + 'Expected the icon to be added', ); }); @@ -1492,7 +1498,7 @@ suite('Blocks', function () { }, Blockly.icons.DuplicateIconType, '', - 'Expected adding an icon of the same type to throw' + 'Expected adding an icon of the same type to throw', ); }); @@ -1501,7 +1507,7 @@ suite('Blocks', function () { this.block.addIcon(new MockIconA()); chai.assert.isTrue( this.renderSpy.calledOnce, - 'Expected adding an icon to trigger a render' + 'Expected adding an icon to trigger a render', ); }); }); @@ -1525,18 +1531,18 @@ suite('Blocks', function () { this.block.addIcon(new MockIconA()); chai.assert.isTrue( this.block.removeIcon(new Blockly.icons.IconType('A')), - 'Expected removeIcon to return true' + 'Expected removeIcon to return true', ); chai.assert.isFalse( this.block.hasIcon('A'), - 'Expected the icon to be removed' + 'Expected the icon to be removed', ); }); test('removing an icon that does not exist returns false', function () { chai.assert.isFalse( this.block.removeIcon(new Blockly.icons.IconType('B')), - 'Expected removeIcon to return false' + 'Expected removeIcon to return false', ); }); @@ -1546,7 +1552,7 @@ suite('Blocks', function () { this.block.removeIcon(new Blockly.icons.IconType('A')); chai.assert.isTrue( this.renderSpy.calledOnce, - 'Expected removing an icon to trigger a render' + 'Expected removing an icon to trigger a render', ); }); }); @@ -1564,7 +1570,7 @@ suite('Blocks', function () { chai.assert.sameOrderedMembers( this.block.getIcons(), [iconA, iconB], - 'Expected getIcon to return both icons in order of weight' + 'Expected getIcon to return both icons in order of weight', ); }); @@ -1572,7 +1578,7 @@ suite('Blocks', function () { chai.assert.isEmpty( this.block.getIcons(), 'Expected getIcons to return an empty array ' + - 'for a block with no icons' + 'for a block with no icons', ); }); @@ -1580,7 +1586,7 @@ suite('Blocks', function () { chai.assert.isEmpty( this.block.getIcons(), 'Expected getIcons to return an empty array ' + - 'for a block with no icons' + 'for a block with no icons', ); }); @@ -1592,7 +1598,7 @@ suite('Blocks', function () { chai.assert.equal( this.block.getIcon('B'), iconB, - 'Expected getIcon to return the icon with the given type' + 'Expected getIcon to return the icon with the given type', ); }); @@ -1601,7 +1607,7 @@ suite('Blocks', function () { chai.assert.isUndefined( this.block.getIcon('B'), 'Expected getIcon to return null if there is no ' + - 'icon with a matching type' + 'icon with a matching type', ); }); }); @@ -1627,7 +1633,7 @@ suite('Blocks', function () { }, }, }, - this.workspace + this.workspace, ); const childBlock = parentBlock.getInputTargetBlock('STATEMENT'); const icon = new MockBubbleIcon(); @@ -1639,7 +1645,7 @@ suite('Blocks', function () { chai.assert.isFalse( icon.bubbleIsVisible(), "Expected collapsing the parent block to hide the child block's " + - "icon's bubble" + "icon's bubble", ); }); @@ -1653,7 +1659,7 @@ suite('Blocks', function () { }, }, }, - this.workspace + this.workspace, ); const nextBlock = parentBlock.getNextBlock(); const icon = new MockBubbleIcon(); @@ -1665,7 +1671,7 @@ suite('Blocks', function () { chai.assert.isTrue( icon.bubbleIsVisible(), 'Expected collapsing the parent block to not hide the next ' + - "block's bubble" + "block's bubble", ); }); }); @@ -2120,7 +2126,7 @@ suite('Blocks', function () { // The child blocks should be enabled. chai.assert.isFalse(blockB.disabled); chai.assert.isFalse( - blockB.getSvgRoot().classList.contains('blocklyDisabled') + blockB.getSvgRoot().classList.contains('blocklyDisabled'), ); }); test('Disabled Children of Collapsed Blocks Should Stay Disabled', function () { @@ -2153,11 +2159,11 @@ suite('Blocks', function () { const block = this.workspace.getTopBlocks(false)[0]; chai.assert.isTrue( block.visuallyDisabled, - 'block should have visuallyDisabled set because it is disabled' + 'block should have visuallyDisabled set because it is disabled', ); chai.assert.isFalse( block.isEnabled(), - 'block should be marked disabled because enabled json property was set to false' + 'block should be marked disabled because enabled json property was set to false', ); }); }); @@ -2168,7 +2174,7 @@ suite('Blocks', function () { setup(function () { this.block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(''), - this.workspace + this.workspace, ); }); test('Set colour', function () { @@ -2190,7 +2196,7 @@ suite('Blocks', function () { this.workspace = Blockly.inject('blocklyDiv', {}); this.block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(''), - this.workspace + this.workspace, ); this.workspace.setTheme( new Blockly.Theme('test', { @@ -2201,7 +2207,7 @@ suite('Blocks', function () { 'hat': '', }, }), - {} + {}, ); }); teardown(function () { @@ -2354,7 +2360,7 @@ suite('Blocks', function () { test(t.name, function () { const block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(t.xml), - this.workspace + this.workspace, ); chai.assert.equal(block.toString(), t.toString); }); @@ -2383,15 +2389,15 @@ suite('Blocks', function () { chai.assert.throws( function () { this.workspace.newBlock('init_test_block'); - }.bind(this) + }.bind(this), ); chai.assert.isFalse( recordUndoDuringInit, - 'recordUndo should be false during block init function' + 'recordUndo should be false during block init function', ); chai.assert.isTrue( eventUtils.getRecordUndo(), - 'recordUndo should be reset to true after init' + 'recordUndo should be reset to true after init', ); chai.assert.isTrue(initCalled, 'expected init function to be called'); }); diff --git a/tests/mocha/blocks/lists_test.js b/tests/mocha/blocks/lists_test.js index c2060a25a..e4875225a 100644 --- a/tests/mocha/blocks/lists_test.js +++ b/tests/mocha/blocks/lists_test.js @@ -55,7 +55,7 @@ suite('Lists', function () { chai.assert.equal(block.type, 'lists_getIndex'); chai.assert.isNotTrue(block.outputConnection); chai.assert.isTrue( - block.getInput('AT').type === ConnectionType.INPUT_VALUE + block.getInput('AT').type === ConnectionType.INPUT_VALUE, ); }, }, @@ -117,7 +117,7 @@ suite('Lists', function () { */ function makeTestCasesForBlockNotNeedingExtraState_( serializedJson, - xmlMutation + xmlMutation, ) { return [ { @@ -153,7 +153,7 @@ suite('Lists', function () { 'WHERE': 'FROM_START', }, }, - '' + '', ); runSerializationTestSuite(testCases); }); @@ -172,7 +172,7 @@ suite('Lists', function () { 'WHERE2': 'FROM_START', }, }, - '' + '', ); runSerializationTestSuite(testCases); }); @@ -190,7 +190,7 @@ suite('Lists', function () { 'MODE': 'SPLIT', }, }, - '' + '', ); runSerializationTestSuite(testCases); }); diff --git a/tests/mocha/blocks/logic_ternary_test.js b/tests/mocha/blocks/logic_ternary_test.js index 5dd684109..9a1e3be48 100644 --- a/tests/mocha/blocks/logic_ternary_test.js +++ b/tests/mocha/blocks/logic_ternary_test.js @@ -86,7 +86,7 @@ suite('Logic ternary', function () { parent, parentInputName, opt_thenInput, - opt_elseInput + opt_elseInput, ) { parent .getInput(parentInputName) @@ -95,20 +95,20 @@ suite('Logic ternary', function () { chai.assert.equal( block.getParent(), parent, - 'Successful connection to parent' + 'Successful connection to parent', ); if (opt_thenInput) { chai.assert.equal( opt_thenInput.getParent(), block, - 'Input THEN still connected after connecting parent' + 'Input THEN still connected after connecting parent', ); } if (opt_elseInput) { chai.assert.equal( opt_elseInput.getParent(), block, - 'Input ELSE still connected after connecting parent' + 'Input ELSE still connected after connecting parent', ); } } @@ -116,7 +116,7 @@ suite('Logic ternary', function () { block, thenInput, opt_elseInput, - opt_parent + opt_parent, ) { block.getInput('THEN').connection.connect(thenInput.outputConnection); eventUtils.TEST_ONLY.fireNow(); // Force synchronous onchange() call. @@ -125,14 +125,14 @@ suite('Logic ternary', function () { chai.assert.equal( block.getParent(), opt_parent, - 'Still connected to parent after connecting THEN' + 'Still connected to parent after connecting THEN', ); } if (opt_elseInput) { chai.assert.equal( opt_elseInput.getParent(), block, - 'Input ELSE still connected after connecting THEN' + 'Input ELSE still connected after connecting THEN', ); } } @@ -140,7 +140,7 @@ suite('Logic ternary', function () { block, elseInput, opt_thenInput, - opt_parent + opt_parent, ) { block.getInput('ELSE').connection.connect(elseInput.outputConnection); eventUtils.TEST_ONLY.fireNow(); // Force synchronous onchange() call. @@ -149,14 +149,14 @@ suite('Logic ternary', function () { chai.assert.equal( block.getParent(), opt_parent, - 'Still connected to parent after connecting ELSE' + 'Still connected to parent after connecting ELSE', ); } if (opt_thenInput) { chai.assert.equal( opt_thenInput.getParent(), block, - 'Input THEN still connected after connecting ELSE' + 'Input THEN still connected after connecting ELSE', ); } } @@ -164,14 +164,14 @@ suite('Logic ternary', function () { block, thenInput, elseInput, - opt_parent + opt_parent, ) { connectThenInputAndCheckConnections(block, thenInput, null, opt_parent); connectElseInputAndCheckConnections( block, elseInput, thenInput, - opt_parent + opt_parent, ); } setup(function () { @@ -237,7 +237,7 @@ suite('Logic ternary', function () { chai.assert.equal( this.block.getRootBlock(), this.block, - 'Disconnected from parent' + 'Disconnected from parent', ); }); test('Attach mismatch type to else causes break with parent', function () { @@ -255,7 +255,7 @@ suite('Logic ternary', function () { chai.assert.equal( this.block.getRootBlock(), this.block, - 'Disconnected from parent' + 'Disconnected from parent', ); }); }); @@ -272,7 +272,7 @@ suite('Logic ternary', function () { parent, 'TEXT', string, - number + number, ); }); test('Permissive parent with inputs different types', function () { @@ -287,7 +287,7 @@ suite('Logic ternary', function () { parent, 'TEXT', string, - array + array, ); }); test('Mismatch with then causes break with then', function () { @@ -302,12 +302,12 @@ suite('Logic ternary', function () { parent, 'TEXT', null, - string + string, ); chai.assert.equal( number.getRootBlock(), number, - 'Input THEN disconnected' + 'Input THEN disconnected', ); }); test('Mismatch with else causes break with else', function () { @@ -321,7 +321,7 @@ suite('Logic ternary', function () { chai.assert.equal( number.getRootBlock(), number, - 'Input ELSE disconnected' + 'Input ELSE disconnected', ); }); }); diff --git a/tests/mocha/blocks/procedures_test.js b/tests/mocha/blocks/procedures_test.js index 6eb686cb3..5163e715d 100644 --- a/tests/mocha/blocks/procedures_test.js +++ b/tests/mocha/blocks/procedures_test.js @@ -31,7 +31,7 @@ suite('Procedures', function () { this.workspace.createVariable( 'preCreatedTypedVar', 'type', - 'preCreatedTypedVarId' + 'preCreatedTypedVarId', ); defineRowBlock(); }); @@ -50,7 +50,7 @@ suite('Procedures', function () { chai.assert.equal( callBlock.getFieldValue('NAME'), 'new name', - 'Expected the procedure block to be renamed' + 'Expected the procedure block to be renamed', ); }); @@ -63,12 +63,12 @@ suite('Procedures', function () { this.workspace, undefined, undefined, - 'procB' + 'procB', ); const callBlockB = createProcCallBlock( this.workspace, undefined, - 'procB' + 'procB', ); defBlockB.setFieldValue('procA', 'NAME'); @@ -76,14 +76,14 @@ suite('Procedures', function () { chai.assert.notEqual( defBlockB.getFieldValue('NAME'), 'procA', - 'Expected the procedure def block to have a legal name' + 'Expected the procedure def block to have a legal name', ); chai.assert.notEqual( callBlockB.getFieldValue('NAME'), 'procA', - 'Expected the procedure call block to have a legal name' + 'Expected the procedure call block to have a legal name', ); - } + }, ); }); @@ -105,7 +105,7 @@ suite('Procedures', function () { 'NAME': origFlyoutParamName, }, }, - mutatorWorkspace + mutatorWorkspace, ); this.clock.runAll(); @@ -117,7 +117,7 @@ suite('Procedures', function () { chai.assert.notEqual( newFlyoutParamName, origFlyoutParamName, - 'Expected the flyout param to have updated to not conflict' + 'Expected the flyout param to have updated to not conflict', ); }); @@ -137,11 +137,11 @@ suite('Procedures', function () { chai.assert.isNotNull( defBlock.getField('PARAMS'), - 'Expected the params field to exist' + 'Expected the params field to exist', ); chai.assert.isTrue( defBlock.getFieldValue('PARAMS').includes('param1'), - 'Expected the params field to contain the name of the new param' + 'Expected the params field to contain the name of the new param', ); }); @@ -162,12 +162,12 @@ suite('Procedures', function () { chai.assert.isNotNull( callBlock.getInput('ARG0'), - 'Expected the param input to exist' + 'Expected the param input to exist', ); chai.assert.equal( callBlock.getFieldValue('ARGNAME0'), 'param1', - 'Expected the params field to match the name of the new param' + 'Expected the params field to match the name of the new param', ); }); @@ -189,7 +189,7 @@ suite('Procedures', function () { chai.assert.isFalse( defBlock.getFieldValue('PARAMS').includes('param1'), - 'Expected the params field to not contain the name of the new param' + 'Expected the params field to not contain the name of the new param', ); }); @@ -215,13 +215,13 @@ suite('Procedures', function () { chai.assert.isNotNull( defBlock.getField('PARAMS'), - 'Expected the params field to exist' + 'Expected the params field to exist', ); chai.assert.isTrue( defBlock.getFieldValue('PARAMS').includes('param1'), - 'Expected the params field to contain the name of the new param' + 'Expected the params field to contain the name of the new param', ); - } + }, ); }); @@ -245,7 +245,7 @@ suite('Procedures', function () { chai.assert.isFalse( defBlock.getFieldValue('PARAMS').includes('param1'), - 'Expected the params field to not contain the name of the new param' + 'Expected the params field to not contain the name of the new param', ); }); @@ -269,7 +269,7 @@ suite('Procedures', function () { chai.assert.isNull( callBlock.getInput('ARG0'), - 'Expected the param input to not exist' + 'Expected the param input to not exist', ); }); @@ -293,7 +293,7 @@ suite('Procedures', function () { chai.assert.isTrue( defBlock.getFieldValue('PARAMS').includes('param1'), - 'Expected the params field to contain the name of the new param' + 'Expected the params field to contain the name of the new param', ); }); @@ -321,9 +321,9 @@ suite('Procedures', function () { chai.assert.isFalse( defBlock.getFieldValue('PARAMS').includes('param1'), - 'Expected the params field to not contain the name of the new param' + 'Expected the params field to not contain the name of the new param', ); - } + }, ); }); @@ -347,11 +347,11 @@ suite('Procedures', function () { chai.assert.isNotNull( defBlock.getField('PARAMS'), - 'Expected the params field to exist' + 'Expected the params field to exist', ); chai.assert.isTrue( defBlock.getFieldValue('PARAMS').includes('new name'), - 'Expected the params field to contain the new name of the param' + 'Expected the params field to contain the new name of the param', ); }); @@ -377,11 +377,11 @@ suite('Procedures', function () { chai.assert.isNotNull( defBlock.getField('PARAMS'), - 'Expected the params field to exist' + 'Expected the params field to exist', ); chai.assert.isTrue( defBlock.getFieldValue('PARAMS').includes('new name'), - 'Expected the params field to contain the new name of the param' + 'Expected the params field to contain the new name of the param', ); }); @@ -405,12 +405,12 @@ suite('Procedures', function () { chai.assert.isNotNull( callBlock.getInput('ARG0'), - 'Expected the param input to exist' + 'Expected the param input to exist', ); chai.assert.equal( callBlock.getFieldValue('ARGNAME0'), 'new name', - 'Expected the params field to match the name of the new param' + 'Expected the params field to match the name of the new param', ); }); @@ -434,7 +434,7 @@ suite('Procedures', function () { chai.assert.isNotNull( this.workspace.getVariable('param1', ''), - 'Expected the old variable to continue to exist' + 'Expected the old variable to continue to exist', ); }); @@ -458,11 +458,11 @@ suite('Procedures', function () { chai.assert.isNotNull( defBlock.getField('PARAMS'), - 'Expected the params field to exist' + 'Expected the params field to exist', ); chai.assert.isTrue( defBlock.getFieldValue('PARAMS').includes('new name'), - 'Expected the params field to contain the new name of the param' + 'Expected the params field to contain the new name of the param', ); }); @@ -486,7 +486,7 @@ suite('Procedures', function () { chai.assert.equal( paramBlock.getFieldValue('NAME'), 'new name', - 'Expected the params field to contain the new name of the param' + 'Expected the params field to contain the new name of the param', ); }); @@ -511,12 +511,12 @@ suite('Procedures', function () { chai.assert.isNotNull( callBlock.getInput('ARG0'), - 'Expected the param input to exist' + 'Expected the param input to exist', ); chai.assert.equal( callBlock.getFieldValue('ARGNAME0'), 'new name', - 'Expected the params field to match the name of the new param' + 'Expected the params field to match the name of the new param', ); }); @@ -540,11 +540,11 @@ suite('Procedures', function () { chai.assert.isNotNull( defBlock.getField('PARAMS'), - 'Expected the params field to exist' + 'Expected the params field to exist', ); chai.assert.isTrue( defBlock.getFieldValue('PARAMS').includes('preCreatedVar'), - 'Expected the params field to contain the new name of the param' + 'Expected the params field to contain the new name of the param', ); }); @@ -568,7 +568,7 @@ suite('Procedures', function () { chai.assert.equal( paramBlock.getFieldValue('NAME'), 'preCreatedVar', - 'Expected the params field to contain the new name of the param' + 'Expected the params field to contain the new name of the param', ); }); @@ -593,19 +593,19 @@ suite('Procedures', function () { chai.assert.isNotNull( callBlock.getInput('ARG0'), - 'Expected the param input to exist' + 'Expected the param input to exist', ); chai.assert.equal( callBlock.getFieldValue('ARGNAME0'), 'preCreatedVar', - 'Expected the params field to match the name of the new param' + 'Expected the params field to match the name of the new param', ); }); test.skip( 'renaming a variable such that you get a parameter ' + 'conflict does... something!', - function () {} + function () {}, ); test('undoing renaming a procedure parameter reverts the change', function () { @@ -635,7 +635,7 @@ suite('Procedures', function () { chai.assert.isTrue( defBlock.getFieldValue('PARAMS').includes('param1'), - 'Expected the params field to contain the old name of the param' + 'Expected the params field to contain the old name of the param', ); }); @@ -666,7 +666,7 @@ suite('Procedures', function () { chai.assert.isTrue( defBlock.getFieldValue('PARAMS').includes('new'), - 'Expected the params field to contain the new name of the param' + 'Expected the params field to contain the new name of the param', ); }); }); @@ -700,11 +700,11 @@ suite('Procedures', function () { chai.assert.isNotNull( defBlock.getField('PARAMS'), - 'Expected the params field to exist' + 'Expected the params field to exist', ); chai.assert.isTrue( defBlock.getFieldValue('PARAMS').includes('param2, param1'), - 'Expected the params field order to match the parameter order' + 'Expected the params field order to match the parameter order', ); }); @@ -737,21 +737,21 @@ suite('Procedures', function () { chai.assert.isNotNull( callBlock.getInput('ARG0'), - 'Expected the param input to exist' + 'Expected the param input to exist', ); chai.assert.equal( callBlock.getFieldValue('ARGNAME0'), 'param2', - 'Expected the params field to match the name of the second param' + 'Expected the params field to match the name of the second param', ); chai.assert.isNotNull( callBlock.getInput('ARG1'), - 'Expected the param input to exist' + 'Expected the param input to exist', ); chai.assert.equal( callBlock.getFieldValue('ARGNAME1'), 'param1', - 'Expected the params field to match the name of the first param' + 'Expected the params field to match the name of the first param', ); }); @@ -794,14 +794,14 @@ suite('Procedures', function () { chai.assert.equal( callBlock.getInputTargetBlock('ARG0'), block2, - 'Expected the second block to be in the first slot' + 'Expected the second block to be in the first slot', ); chai.assert.equal( callBlock.getInputTargetBlock('ARG1'), block1, - 'Expected the first block to be in the second slot' + 'Expected the first block to be in the second slot', ); - } + }, ); }); @@ -818,9 +818,9 @@ suite('Procedures', function () { chai.assert.isFalse( callBlock.isEnabled(), - 'Expected the caller block to be disabled' + 'Expected the caller block to be disabled', ); - } + }, ); test( @@ -837,9 +837,9 @@ suite('Procedures', function () { chai.assert.isTrue( callBlock.isEnabled(), - 'Expected the caller block to be enabled' + 'Expected the caller block to be enabled', ); - } + }, ); test( @@ -859,9 +859,9 @@ suite('Procedures', function () { chai.assert.isFalse( callBlock.isEnabled(), - 'Expected the caller block to continue to be disabled' + 'Expected the caller block to continue to be disabled', ); - } + }, ); }); @@ -880,13 +880,13 @@ suite('Procedures', function () { chai.assert.isTrue( callBlock1.disposed, - 'Expected the first caller to be disposed' + 'Expected the first caller to be disposed', ); chai.assert.isTrue( callBlock2.disposed, - 'Expected the second caller to be disposed' + 'Expected the second caller to be disposed', ); - } + }, ); }); @@ -903,12 +903,12 @@ suite('Procedures', function () { `), - this.workspace + this.workspace, ); this.clock.runAll(); assertDefBlockStructure( this.workspace.getBlocksByType('procedures_defreturn')[0], - true + true, ); assertCallBlockStructure(callBlock, [], [], 'do something'); }); @@ -916,14 +916,14 @@ suite('Procedures', function () { test('callers without mutations create unnamed defs', function () { const callBlock = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom( - '' + '', ), - this.workspace + this.workspace, ); this.clock.runAll(); assertDefBlockStructure( this.workspace.getBlocksByType('procedures_defreturn')[0], - true + true, ); assertCallBlockStructure(callBlock, [], [], 'unnamed'); }); @@ -938,15 +938,15 @@ suite('Procedures', function () { `), - this.workspace + this.workspace, ); const callBlock = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom( '' + ' ' + - '' + '', ), - this.workspace + this.workspace, ); this.clock.runAll(); assertDefBlockStructure(defBlock, true, ['x'], ['arg']); @@ -963,7 +963,7 @@ suite('Procedures', function () { `), - this.workspace + this.workspace, ); const callBlock = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(` @@ -973,7 +973,7 @@ suite('Procedures', function () { `), - this.workspace + this.workspace, ); this.clock.runAll(); assertDefBlockStructure(defBlock, true, ['x'], ['arg']); @@ -981,7 +981,7 @@ suite('Procedures', function () { callBlock, ['y'], [this.TEST_VAR_ID], - 'do something2' + 'do something2', ); }); @@ -1002,14 +1002,14 @@ suite('Procedures', function () { `), - this.workspace + this.workspace, ); this.clock.runAll(); const defBlock = this.workspace.getBlocksByType( - 'procedures_defreturn' + 'procedures_defreturn', )[0]; const callBlock = this.workspace.getBlocksByType( - 'procedures_callreturn' + 'procedures_callreturn', )[0]; // TODO: Currently the callers are creating variables with different // IDs than those serialized to XML, so these assertions fail. @@ -1028,12 +1028,12 @@ suite('Procedures', function () { }, }, this.workspace, - {recordUndo: true} + {recordUndo: true}, ); this.clock.runAll(); assertDefBlockStructure( this.workspace.getBlocksByType('procedures_defreturn')[0], - true + true, ); assertCallBlockStructure(callBlock, [], [], 'do something'); }); @@ -1045,12 +1045,12 @@ suite('Procedures', function () { 'type': 'procedures_callreturn', }, this.workspace, - {recordUndo: true} + {recordUndo: true}, ); this.clock.runAll(); assertDefBlockStructure( this.workspace.getBlocksByType('procedures_defreturn')[0], - true + true, ); assertCallBlockStructure(callBlock, [], [], 'unnamed'); }); @@ -1071,7 +1071,7 @@ suite('Procedures', function () { ], }, }, - this.workspace + this.workspace, ); const callBlock = Blockly.serialization.blocks.append( { @@ -1081,7 +1081,7 @@ suite('Procedures', function () { }, }, this.workspace, - {recordUndo: true} + {recordUndo: true}, ); this.clock.runAll(); assertDefBlockStructure(defBlock, true, ['x'], ['arg']); @@ -1104,7 +1104,7 @@ suite('Procedures', function () { ], }, }, - this.workspace + this.workspace, ); const callBlock = Blockly.serialization.blocks.append( { @@ -1115,7 +1115,7 @@ suite('Procedures', function () { }, }, this.workspace, - {recordUndo: true} + {recordUndo: true}, ); this.clock.runAll(); assertDefBlockStructure(defBlock, true, ['x'], ['arg']); @@ -1123,7 +1123,7 @@ suite('Procedures', function () { callBlock, ['y'], [this.TEST_VAR_ID], - 'do something2' + 'do something2', ); }); @@ -1156,14 +1156,14 @@ suite('Procedures', function () { ], }, }, - this.workspace + this.workspace, ); this.clock.runAll(); const defBlock = this.workspace.getBlocksByType( - 'procedures_defreturn' + 'procedures_defreturn', )[0]; const callBlock = this.workspace.getBlocksByType( - 'procedures_callreturn' + 'procedures_callreturn', )[0]; // TODO: Currently the callers are creating variables with different // IDs than those serialized to JSON, so these assertions fail. @@ -1182,7 +1182,7 @@ suite('Procedures', function () { 'NAME': 'test name', }, }, - this.workspace + this.workspace, ); const options = []; @@ -1190,7 +1190,7 @@ suite('Procedures', function () { chai.assert.isTrue( options[0].text.includes('test name'), - 'Expected the context menu to have an option to create the caller' + 'Expected the context menu to have an option to create the caller', ); }); @@ -1216,7 +1216,7 @@ suite('Procedures', function () { ], }, }, - this.workspace + this.workspace, ); const options = []; @@ -1224,11 +1224,11 @@ suite('Procedures', function () { chai.assert.isTrue( options[1].text.includes('testParam1'), - 'Expected the context menu to have an option to create the first param' + 'Expected the context menu to have an option to create the first param', ); chai.assert.isTrue( options[2].text.includes('testParam2'), - 'Expected the context menu to have an option to create the second param' + 'Expected the context menu to have an option to create the second param', ); }); }); @@ -1277,12 +1277,12 @@ suite('Procedures', function () { chai.assert.lengthOf( allProcedures[0], 0, - 'No procedures_defnoreturn blocks expected' + 'No procedures_defnoreturn blocks expected', ); chai.assert.lengthOf( allProcedures[1], 0, - 'No procedures_defreturn blocks expected' + 'No procedures_defreturn blocks expected', ); }); }); @@ -1290,21 +1290,21 @@ suite('Procedures', function () { suite('isNameUsed', function () { test('returns false if no blocks or models exists', function () { chai.assert.isFalse( - Blockly.Procedures.isNameUsed('proc name', this.workspace) + Blockly.Procedures.isNameUsed('proc name', this.workspace), ); }); test('returns true if an associated block exists', function () { createProcDefBlock(this.workspace, false, [], 'proc name'); chai.assert.isTrue( - Blockly.Procedures.isNameUsed('proc name', this.workspace) + Blockly.Procedures.isNameUsed('proc name', this.workspace), ); }); test('return false if an associated block does not exist', function () { createProcDefBlock(this.workspace, false, [], 'proc name'); chai.assert.isFalse( - Blockly.Procedures.isNameUsed('other proc name', this.workspace) + Blockly.Procedures.isNameUsed('other proc name', this.workspace), ); }); @@ -1313,7 +1313,7 @@ suite('Procedures', function () { .getProcedureMap() .add(new MockProcedureModel().setName('proc name')); chai.assert.isTrue( - Blockly.Procedures.isNameUsed('proc name', this.workspace) + Blockly.Procedures.isNameUsed('proc name', this.workspace), ); }); @@ -1322,7 +1322,7 @@ suite('Procedures', function () { .getProcedureMap() .add(new MockProcedureModel().setName('proc name')); chai.assert.isFalse( - Blockly.Procedures.isNameUsed('other proc name', this.workspace) + Blockly.Procedures.isNameUsed('other proc name', this.workspace), ); }); }); @@ -1332,14 +1332,14 @@ suite('Procedures', function () { workspace, noReturnNames, returnNames, - hasCallers + hasCallers, ) { const allProcedures = Blockly.Procedures.allProcedures(workspace); const defNoReturnBlocks = allProcedures[0]; chai.assert.lengthOf( defNoReturnBlocks, noReturnNames.length, - `Expected the number of no return blocks to be ${noReturnNames.length}` + `Expected the number of no return blocks to be ${noReturnNames.length}`, ); for (let i = 0; i < noReturnNames.length; i++) { const expectedName = noReturnNames[i]; @@ -1347,12 +1347,12 @@ suite('Procedures', function () { if (hasCallers) { const callers = Blockly.Procedures.getCallers( expectedName, - workspace + workspace, ); chai.assert.lengthOf( callers, 1, - `Expected there to be one caller of the ${expectedName} block` + `Expected there to be one caller of the ${expectedName} block`, ); } } @@ -1360,7 +1360,7 @@ suite('Procedures', function () { chai.assert.lengthOf( defReturnBlocks, returnNames.length, - `Expected the number of return blocks to be ${returnNames.length}` + `Expected the number of return blocks to be ${returnNames.length}`, ); for (let i = 0; i < returnNames.length; i++) { const expectedName = returnNames[i]; @@ -1368,12 +1368,12 @@ suite('Procedures', function () { if (hasCallers) { const callers = Blockly.Procedures.getCallers( expectedName, - workspace + workspace, ); chai.assert.lengthOf( callers, 1, - `Expected there to be one caller of the ${expectedName} block` + `Expected there to be one caller of the ${expectedName} block`, ); } } @@ -1401,7 +1401,7 @@ suite('Procedures', function () { this.workspace, ['unnamed'], ['unnamed2'], - false + false, ); }); @@ -1418,7 +1418,7 @@ suite('Procedures', function () { this.workspace, ['unnamed2'], ['unnamed'], - false + false, ); }); @@ -1533,7 +1533,7 @@ suite('Procedures', function () { 'type': testSuite.callType, }, this.workspace, - {recordUndo: true} + {recordUndo: true}, ); this.callBlock.setFieldValue('proc name', 'NAME'); this.clock.runAll(); @@ -1549,7 +1549,7 @@ suite('Procedures', function () { 'NAME': 'proc name', }, }, - this.workspace + this.workspace, ); this.callBlock = Blockly.serialization.blocks.append( { @@ -1558,14 +1558,14 @@ suite('Procedures', function () { 'NAME': 'proc name', }, }, - this.workspace + this.workspace, ); sinon.stub(this.defBlock.getField('NAME'), 'resizeEditor_'); }); test('Simple, Programmatic', function () { this.defBlock.setFieldValue( this.defBlock.getFieldValue('NAME') + '2', - 'NAME' + 'NAME', ); chai.assert.equal(this.defBlock.getFieldValue('NAME'), 'proc name2'); chai.assert.equal(this.callBlock.getFieldValue('NAME'), 'proc name2'); @@ -1575,7 +1575,7 @@ suite('Procedures', function () { defInput.htmlInput_ = document.createElement('input'); defInput.htmlInput_.setAttribute( 'data-untyped-default-value', - 'proc name' + 'proc name', ); defInput.htmlInput_.value = 'proc name2'; @@ -1588,7 +1588,7 @@ suite('Procedures', function () { defInput.htmlInput_ = document.createElement('input'); defInput.htmlInput_.setAttribute( 'data-untyped-default-value', - 'proc name' + 'proc name', ); defInput.htmlInput_.value = 'PROC NAME'; @@ -1603,7 +1603,7 @@ suite('Procedures', function () { defInput.htmlInput_ = document.createElement('input'); defInput.htmlInput_.setAttribute( 'data-untyped-default-value', - 'PROC NAME' + 'PROC NAME', ); defInput.htmlInput_.value = 'proc name'; @@ -1616,7 +1616,7 @@ suite('Procedures', function () { defInput.htmlInput_ = document.createElement('input'); defInput.htmlInput_.setAttribute( 'data-untyped-default-value', - 'proc name' + 'proc name', ); defInput.htmlInput_.value = 'proc name '; @@ -1629,7 +1629,7 @@ suite('Procedures', function () { defInput.htmlInput_ = document.createElement('input'); defInput.htmlInput_.setAttribute( 'data-untyped-default-value', - 'proc name' + 'proc name', ); defInput.htmlInput_.value = 'proc name '; @@ -1639,7 +1639,7 @@ suite('Procedures', function () { chai.assert.equal(this.defBlock.getFieldValue('NAME'), 'proc name 2'); chai.assert.equal( this.callBlock.getFieldValue('NAME'), - 'proc name 2' + 'proc name 2', ); }); test('Set Empty', function () { @@ -1647,18 +1647,18 @@ suite('Procedures', function () { defInput.htmlInput_ = document.createElement('input'); defInput.htmlInput_.setAttribute( 'data-untyped-default-value', - 'proc name' + 'proc name', ); defInput.htmlInput_.value = ''; defInput.onHtmlInputChange_(null); chai.assert.equal( this.defBlock.getFieldValue('NAME'), - Blockly.Msg['UNNAMED_KEY'] + Blockly.Msg['UNNAMED_KEY'], ); chai.assert.equal( this.callBlock.getFieldValue('NAME'), - Blockly.Msg['UNNAMED_KEY'] + Blockly.Msg['UNNAMED_KEY'], ); }); test('Set Empty, and Create New', function () { @@ -1666,7 +1666,7 @@ suite('Procedures', function () { defInput.htmlInput_ = document.createElement('input'); defInput.htmlInput_.setAttribute( 'data-untyped-default-value', - 'proc name' + 'proc name', ); defInput.htmlInput_.value = ''; @@ -1675,11 +1675,11 @@ suite('Procedures', function () { newDefBlock.setFieldValue('new name', 'NAME'); chai.assert.equal( this.defBlock.getFieldValue('NAME'), - Blockly.Msg['UNNAMED_KEY'] + Blockly.Msg['UNNAMED_KEY'], ); chai.assert.equal( this.callBlock.getFieldValue('NAME'), - Blockly.Msg['UNNAMED_KEY'] + Blockly.Msg['UNNAMED_KEY'], ); }); }); @@ -1692,7 +1692,7 @@ suite('Procedures', function () { 'NAME': 'proc name', }, }, - this.workspace + this.workspace, ); this.callBlock = Blockly.serialization.blocks.append( { @@ -1701,13 +1701,13 @@ suite('Procedures', function () { 'NAME': 'proc name', }, }, - this.workspace + this.workspace, ); }); test('Simple', function () { const callers = Blockly.Procedures.getCallers( 'proc name', - this.workspace + this.workspace, ); chai.assert.equal(callers.length, 1); chai.assert.equal(callers[0], this.callBlock); @@ -1720,7 +1720,7 @@ suite('Procedures', function () { const callers = Blockly.Procedures.getCallers( 'proc name', - this.workspace + this.workspace, ); chai.assert.equal(callers.length, 3); chai.assert.equal(callers[0], this.callBlock); @@ -1735,7 +1735,7 @@ suite('Procedures', function () { const callers = Blockly.Procedures.getCallers( 'proc name', - this.workspace + this.workspace, ); chai.assert.equal(callers.length, 1); chai.assert.equal(callers[0], this.callBlock); @@ -1752,7 +1752,7 @@ suite('Procedures', function () { this.callBlock.setFieldValue('PROC NAME', 'NAME'); const callers = Blockly.Procedures.getCallers( 'proc name', - this.workspace + this.workspace, ); chai.assert.equal(callers.length, 1); chai.assert.equal(callers[0], this.callBlock); @@ -1767,7 +1767,7 @@ suite('Procedures', function () { let callers = Blockly.Procedures.getCallers( 'proc name', - this.workspace + this.workspace, ); chai.assert.equal(callers.length, 1); chai.assert.equal(callers[0], this.callBlock); @@ -1789,7 +1789,7 @@ suite('Procedures', function () { 'NAME': 'proc name', }, }, - this.workspace + this.workspace, ); this.callBlock = Blockly.serialization.blocks.append( { @@ -1798,13 +1798,13 @@ suite('Procedures', function () { 'NAME': 'proc name', }, }, - this.workspace + this.workspace, ); }); test('Simple', function () { const def = Blockly.Procedures.getDefinition( 'proc name', - this.workspace + this.workspace, ); chai.assert.equal(def, this.defBlock); }); @@ -1816,7 +1816,7 @@ suite('Procedures', function () { const def = Blockly.Procedures.getDefinition( 'proc name', - this.workspace + this.workspace, ); chai.assert.equal(def, this.defBlock); }); @@ -1830,7 +1830,7 @@ suite('Procedures', function () { let def = Blockly.Procedures.getDefinition( 'proc name', - this.workspace + this.workspace, ); chai.assert.equal(def, this.defBlock); @@ -1851,7 +1851,7 @@ suite('Procedures', function () { 'NAME': 'proc name', }, }, - this.workspace + this.workspace, ); this.callBlock = Blockly.serialization.blocks.append( { @@ -1860,7 +1860,7 @@ suite('Procedures', function () { 'name': 'proc name', }, }, - this.workspace + this.workspace, ); }); suite('Composition', function () { @@ -1869,7 +1869,7 @@ suite('Procedures', function () { const mutatorWorkspace = new Blockly.Workspace( new Blockly.Options({ parentWorkspace: mainWorkspace, - }) + }), ); defBlock.decompose(mutatorWorkspace); const containerBlock = mutatorWorkspace.getTopBlocks()[0]; @@ -1892,11 +1892,11 @@ suite('Procedures', function () { ' ' + ' ' + ' ' + - '' + '', ); const defBlock = Blockly.Xml.domToBlock( blockXml, - this.workspace + this.workspace, ); setStatementValue(this.workspace, defBlock, false); chai.assert.isNull(defBlock.getInput('STACK')); @@ -1913,7 +1913,7 @@ suite('Procedures', function () { suite('Untyped Arguments', function () { function createMutator(argArray) { const mutatorIcon = this.defBlock.getIcon( - Blockly.icons.MutatorIcon.TYPE + Blockly.icons.MutatorIcon.TYPE, ); mutatorIcon.setBubbleVisible(true); this.mutatorWorkspace = mutatorIcon.getWorkspace(); @@ -1922,7 +1922,7 @@ suite('Procedures', function () { this.containerBlock.getInput('STACK').connection; for (let i = 0; i < argArray.length; i++) { this.argBlock = this.mutatorWorkspace.newBlock( - 'procedures_mutatorarg' + 'procedures_mutatorarg', ); this.argBlock.setFieldValue(argArray[i], 'NAME'); this.connection.connect(this.argBlock.previousConnection); @@ -1934,7 +1934,7 @@ suite('Procedures', function () { chai.assert.equal( this.defBlock.getVars().length, argArray.length, - 'Expected the def to have the right number of arguments' + 'Expected the def to have the right number of arguments', ); for (let i = 0; i < argArray.length; i++) { chai.assert.equal(this.defBlock.getVars()[i], argArray[i]); @@ -1942,7 +1942,7 @@ suite('Procedures', function () { chai.assert.equal( this.callBlock.getVars().length, argArray.length, - 'Expected the call to have the right number of arguments' + 'Expected the call to have the right number of arguments', ); for (let i = 0; i < argArray.length; i++) { chai.assert.equal(this.callBlock.getVars()[i], argArray[i]); @@ -2011,7 +2011,7 @@ suite('Procedures', function () { const mutatorWorkspace = new Blockly.Workspace( new Blockly.Options({ parentWorkspace: this.workspace, - }) + }), ); this.defBlock.decompose(mutatorWorkspace); const statementInput = mutatorWorkspace @@ -2024,7 +2024,7 @@ suite('Procedures', function () { const mutatorWorkspace = new Blockly.Workspace( new Blockly.Options({ parentWorkspace: this.workspace, - }) + }), ); this.defBlock.decompose(mutatorWorkspace); const statementValue = mutatorWorkspace @@ -2038,7 +2038,7 @@ suite('Procedures', function () { const mutatorWorkspace = new Blockly.Workspace( new Blockly.Options({ parentWorkspace: this.workspace, - }) + }), ); this.defBlock.decompose(mutatorWorkspace); const statementValue = mutatorWorkspace @@ -2052,7 +2052,7 @@ suite('Procedures', function () { const mutatorWorkspace = new Blockly.Workspace( new Blockly.Options({ parentWorkspace: this.workspace, - }) + }), ); this.defBlock.decompose(mutatorWorkspace); const statementInput = mutatorWorkspace @@ -2130,7 +2130,7 @@ suite('Procedures', function () { block, testSuite.hasReturn, ['x', 'y'], - ['arg1', 'arg2'] + ['arg1', 'arg2'], ); }, }, @@ -2160,7 +2160,7 @@ suite('Procedures', function () { block, testSuite.hasReturn, ['preCreatedVar'], - ['preCreatedVarId'] + ['preCreatedVarId'], ); }, }, @@ -2237,7 +2237,7 @@ suite('Procedures', function () { assertCallBlockStructure( block, ['preCreatedVar'], - ['preCreatedVarId'] + ['preCreatedVarId'], ); }, }, @@ -2320,7 +2320,7 @@ suite('Procedures', function () { block, testSuite.hasReturn, ['x', 'y'], - ['arg1', 'arg2'] + ['arg1', 'arg2'], ); }, }, @@ -2360,7 +2360,7 @@ suite('Procedures', function () { block, testSuite.hasReturn, ['preCreatedVar'], - ['preCreatedVarId'] + ['preCreatedVarId'], ); }, }, @@ -2445,7 +2445,7 @@ suite('Procedures', function () { assertCallBlockStructure( block, ['preCreatedVar'], - ['preCreatedVarId'] + ['preCreatedVarId'], ); }, }, diff --git a/tests/mocha/blocks/variables_test.js b/tests/mocha/blocks/variables_test.js index ce3a55ace..75afa9d56 100644 --- a/tests/mocha/blocks/variables_test.js +++ b/tests/mocha/blocks/variables_test.js @@ -69,7 +69,7 @@ suite('Variables', function () { chai.assert.equal( result.length, 3, - 'Expected three variables in the list of used variables' + 'Expected three variables in the list of used variables', ); }); @@ -80,12 +80,12 @@ suite('Variables', function () { chai.assert.equal( result.length, 1, - 'Expected one variable in the list of used variables' + 'Expected one variable in the list of used variables', ); chai.assert.equal( result[0].getId(), '2', - 'Expected variable with ID 2 in the list of used variables' + 'Expected variable with ID 2 in the list of used variables', ); }); @@ -99,12 +99,12 @@ suite('Variables', function () { chai.assert.equal( result.length, 1, - 'Expected one variable in the list of used variables' + 'Expected one variable in the list of used variables', ); chai.assert.equal( result[0].getId(), '2', - 'Expected variable with ID 2 in the list of used variables' + 'Expected variable with ID 2 in the list of used variables', ); }); @@ -113,7 +113,7 @@ suite('Variables', function () { chai.assert.equal( result.length, 0, - 'Expected no variables in the list of used variables' + 'Expected no variables in the list of used variables', ); }); }); @@ -140,19 +140,19 @@ suite('Variables', function () { this.workspace, null, 'name1', - 'type1' + 'type1', ); const result2 = Blockly.Variables.getVariable( this.workspace, null, 'name2', - 'type1' + 'type1', ); const result3 = Blockly.Variables.getVariable( this.workspace, null, 'name3', - 'type2' + 'type2', ); // Searching by name + type is correct. @@ -169,19 +169,19 @@ suite('Variables', function () { this.workspace, 'badId', 'name1', - 'type1' + 'type1', ); const result2 = Blockly.Variables.getVariable( this.workspace, 'badId', 'name2', - 'type1' + 'type1', ); const result3 = Blockly.Variables.getVariable( this.workspace, 'badId', 'name3', - 'type2' + 'type2', ); // Searching by ID failed, but falling back onto name + type is correct. @@ -213,14 +213,14 @@ suite('Variables', function () { 'NAME': 'test name', }, }, - this.workspace + this.workspace, ); chai.assert.equal( 'test name', nameUsedWithConflictingParam('x', 'y', this.workspace), 'Expected the name of the procedure with the conflicting ' + - 'param to be returned' + 'param to be returned', ); }); @@ -247,14 +247,14 @@ suite('Variables', function () { 'NAME': 'test name', }, }, - this.workspace + this.workspace, ); chai.assert.isNull( nameUsedWithConflictingParam('x', 'y', this.workspace), - 'Expected there to be no conflict' + 'Expected there to be no conflict', ); - } + }, ); test('conflicts within procedure models return the procedure name', function () { @@ -264,19 +264,19 @@ suite('Variables', function () { new MockProcedureModel('test name') .insertParameter( new MockParameterModelWithVar('x', this.workspace), - 0 + 0, ) .insertParameter( new MockParameterModelWithVar('y', this.workspace), - 0 - ) + 0, + ), ); chai.assert.equal( 'test name', nameUsedWithConflictingParam('x', 'y', this.workspace), 'Expected the name of the procedure with the conflicting ' + - 'param to be returned' + 'param to be returned', ); }); @@ -291,21 +291,21 @@ suite('Variables', function () { .insertParameter( new MockParameterModelWithVar( 'definitely not x', - this.workspace + this.workspace, ), - 0 + 0, ) .insertParameter( new MockParameterModelWithVar('y', this.workspace), - 0 - ) + 0, + ), ); chai.assert.isNull( nameUsedWithConflictingParam('x', 'y', this.workspace), - 'Expected there to be no conflict' + 'Expected there to be no conflict', ); - } + }, ); }); }); diff --git a/tests/mocha/comment_deserialization_test.js b/tests/mocha/comment_deserialization_test.js index 4adba246f..c7398bbe0 100644 --- a/tests/mocha/comment_deserialization_test.js +++ b/tests/mocha/comment_deserialization_test.js @@ -50,7 +50,7 @@ suite('Comment Deserialization', function () { function createBlock(workspace) { const block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(''), - workspace + workspace, ); block.setCommentText('test text'); return block; @@ -77,8 +77,8 @@ suite('Comment Deserialization', function () { // Place from trashcan. simulateClick( this.workspace.trashcan.flyout.svgGroup_.querySelector( - '.blocklyDraggable' - ) + '.blocklyDraggable', + ), ); chai.assert.equal(this.workspace.getAllBlocks().length, 1); // Check comment. @@ -115,7 +115,7 @@ suite('Comment Deserialization', function () { const toolbox = this.workspace.getToolbox(); simulateClick(toolbox.HtmlDiv.querySelector('.blocklyTreeRow')); simulateClick( - toolbox.getFlyout().svgGroup_.querySelector('.blocklyDraggable') + toolbox.getFlyout().svgGroup_.querySelector('.blocklyDraggable'), ); chai.assert.equal(this.workspace.getAllBlocks().length, 1); // Check comment. diff --git a/tests/mocha/comment_test.js b/tests/mocha/comment_test.js index 1aa05d92b..fa3190d95 100644 --- a/tests/mocha/comment_test.js +++ b/tests/mocha/comment_test.js @@ -29,7 +29,7 @@ suite('Comments', function () { }); this.block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(''), - this.workspace + this.workspace, ); this.comment = new Blockly.icons.CommentIcon(this.block); }); @@ -58,7 +58,7 @@ suite('Comments', function () { Blockly.Events.BubbleOpen, {bubbleType: 'comment', isOpen: true, type: eventUtils.BUBBLE_OPEN}, this.workspace.id, - this.block.id + this.block.id, ); }); test('Not Editable', function () { @@ -73,7 +73,7 @@ suite('Comments', function () { Blockly.Events.BubbleOpen, {bubbleType: 'comment', isOpen: true, type: eventUtils.BUBBLE_OPEN}, this.workspace.id, - this.block.id + this.block.id, ); }); test('Editable -> Not Editable', function () { @@ -89,7 +89,7 @@ suite('Comments', function () { Blockly.Events.BubbleOpen, {bubbleType: 'comment', isOpen: true, type: eventUtils.BUBBLE_OPEN}, this.workspace.id, - this.block.id + this.block.id, ); }); test('Not Editable -> Editable', function () { @@ -107,7 +107,7 @@ suite('Comments', function () { Blockly.Events.BubbleOpen, {bubbleType: 'comment', isOpen: true, type: eventUtils.BUBBLE_OPEN}, this.workspace.id, - this.block.id + this.block.id, ); }); }); diff --git a/tests/mocha/connection_checker_test.js b/tests/mocha/connection_checker_test.js index 8b14aa995..908adf8fb 100644 --- a/tests/mocha/connection_checker_test.js +++ b/tests/mocha/connection_checker_test.js @@ -35,42 +35,42 @@ suite('Connection checker', function () { this.checker, connection, null, - Blockly.Connection.REASON_TARGET_NULL + Blockly.Connection.REASON_TARGET_NULL, ); }); test('Target Self', function () { const block = {workspace: 1}; const connection1 = new Blockly.Connection( block, - ConnectionType.INPUT_VALUE + ConnectionType.INPUT_VALUE, ); const connection2 = new Blockly.Connection( block, - ConnectionType.OUTPUT_VALUE + ConnectionType.OUTPUT_VALUE, ); assertReasonHelper( this.checker, connection1, connection2, - Blockly.Connection.REASON_SELF_CONNECTION + Blockly.Connection.REASON_SELF_CONNECTION, ); }); test('Different Workspaces', function () { const connection1 = new Blockly.Connection( {workspace: 1}, - ConnectionType.INPUT_VALUE + ConnectionType.INPUT_VALUE, ); const connection2 = new Blockly.Connection( {workspace: 2}, - ConnectionType.OUTPUT_VALUE + ConnectionType.OUTPUT_VALUE, ); assertReasonHelper( this.checker, connection1, connection2, - Blockly.Connection.REASON_DIFFERENT_WORKSPACES + Blockly.Connection.REASON_DIFFERENT_WORKSPACES, ); }); suite('Types', function () { @@ -83,19 +83,19 @@ suite('Connection checker', function () { const inBlock = {isShadow: function () {}}; this.previous = new Blockly.Connection( prevBlock, - ConnectionType.PREVIOUS_STATEMENT + ConnectionType.PREVIOUS_STATEMENT, ); this.next = new Blockly.Connection( nextBlock, - ConnectionType.NEXT_STATEMENT + ConnectionType.NEXT_STATEMENT, ); this.output = new Blockly.Connection( outBlock, - ConnectionType.OUTPUT_VALUE + ConnectionType.OUTPUT_VALUE, ); this.input = new Blockly.Connection( inBlock, - ConnectionType.INPUT_VALUE + ConnectionType.INPUT_VALUE, ); }); test('Previous, Next', function () { @@ -103,7 +103,7 @@ suite('Connection checker', function () { this.checker, this.previous, this.next, - Blockly.Connection.CAN_CONNECT + Blockly.Connection.CAN_CONNECT, ); }); test('Previous, Output', function () { @@ -111,7 +111,7 @@ suite('Connection checker', function () { this.checker, this.previous, this.output, - Blockly.Connection.REASON_WRONG_TYPE + Blockly.Connection.REASON_WRONG_TYPE, ); }); test('Previous, Input', function () { @@ -119,7 +119,7 @@ suite('Connection checker', function () { this.checker, this.previous, this.input, - Blockly.Connection.REASON_WRONG_TYPE + Blockly.Connection.REASON_WRONG_TYPE, ); }); test('Next, Previous', function () { @@ -127,7 +127,7 @@ suite('Connection checker', function () { this.checker, this.next, this.previous, - Blockly.Connection.CAN_CONNECT + Blockly.Connection.CAN_CONNECT, ); }); test('Next, Output', function () { @@ -135,7 +135,7 @@ suite('Connection checker', function () { this.checker, this.next, this.output, - Blockly.Connection.REASON_WRONG_TYPE + Blockly.Connection.REASON_WRONG_TYPE, ); }); test('Next, Input', function () { @@ -143,7 +143,7 @@ suite('Connection checker', function () { this.checker, this.next, this.input, - Blockly.Connection.REASON_WRONG_TYPE + Blockly.Connection.REASON_WRONG_TYPE, ); }); test('Output, Previous', function () { @@ -151,7 +151,7 @@ suite('Connection checker', function () { this.checker, this.previous, this.output, - Blockly.Connection.REASON_WRONG_TYPE + Blockly.Connection.REASON_WRONG_TYPE, ); }); test('Output, Next', function () { @@ -159,7 +159,7 @@ suite('Connection checker', function () { this.checker, this.output, this.next, - Blockly.Connection.REASON_WRONG_TYPE + Blockly.Connection.REASON_WRONG_TYPE, ); }); test('Output, Input', function () { @@ -167,7 +167,7 @@ suite('Connection checker', function () { this.checker, this.output, this.input, - Blockly.Connection.CAN_CONNECT + Blockly.Connection.CAN_CONNECT, ); }); test('Input, Previous', function () { @@ -175,7 +175,7 @@ suite('Connection checker', function () { this.checker, this.previous, this.input, - Blockly.Connection.REASON_WRONG_TYPE + Blockly.Connection.REASON_WRONG_TYPE, ); }); test('Input, Next', function () { @@ -183,7 +183,7 @@ suite('Connection checker', function () { this.checker, this.input, this.next, - Blockly.Connection.REASON_WRONG_TYPE + Blockly.Connection.REASON_WRONG_TYPE, ); }); test('Input, Output', function () { @@ -191,7 +191,7 @@ suite('Connection checker', function () { this.checker, this.input, this.output, - Blockly.Connection.CAN_CONNECT + Blockly.Connection.CAN_CONNECT, ); }); }); @@ -209,18 +209,18 @@ suite('Connection checker', function () { }; const prev = new Blockly.Connection( prevBlock, - ConnectionType.PREVIOUS_STATEMENT + ConnectionType.PREVIOUS_STATEMENT, ); const next = new Blockly.Connection( nextBlock, - ConnectionType.NEXT_STATEMENT + ConnectionType.NEXT_STATEMENT, ); assertReasonHelper( this.checker, prev, next, - Blockly.Connection.CAN_CONNECT + Blockly.Connection.CAN_CONNECT, ); }); test('Next Shadow', function () { @@ -236,18 +236,18 @@ suite('Connection checker', function () { }; const prev = new Blockly.Connection( prevBlock, - ConnectionType.PREVIOUS_STATEMENT + ConnectionType.PREVIOUS_STATEMENT, ); const next = new Blockly.Connection( nextBlock, - ConnectionType.NEXT_STATEMENT + ConnectionType.NEXT_STATEMENT, ); assertReasonHelper( this.checker, prev, next, - Blockly.Connection.REASON_SHADOW_PARENT + Blockly.Connection.REASON_SHADOW_PARENT, ); }); test('Prev and Next Shadow', function () { @@ -263,18 +263,18 @@ suite('Connection checker', function () { }; const prev = new Blockly.Connection( prevBlock, - ConnectionType.PREVIOUS_STATEMENT + ConnectionType.PREVIOUS_STATEMENT, ); const next = new Blockly.Connection( nextBlock, - ConnectionType.NEXT_STATEMENT + ConnectionType.NEXT_STATEMENT, ); assertReasonHelper( this.checker, prev, next, - Blockly.Connection.CAN_CONNECT + Blockly.Connection.CAN_CONNECT, ); }); test('Output Shadow', function () { @@ -290,18 +290,18 @@ suite('Connection checker', function () { }; const outCon = new Blockly.Connection( outBlock, - ConnectionType.OUTPUT_VALUE + ConnectionType.OUTPUT_VALUE, ); const inCon = new Blockly.Connection( inBlock, - ConnectionType.INPUT_VALUE + ConnectionType.INPUT_VALUE, ); assertReasonHelper( this.checker, outCon, inCon, - Blockly.Connection.CAN_CONNECT + Blockly.Connection.CAN_CONNECT, ); }); test('Input Shadow', function () { @@ -317,18 +317,18 @@ suite('Connection checker', function () { }; const outCon = new Blockly.Connection( outBlock, - ConnectionType.OUTPUT_VALUE + ConnectionType.OUTPUT_VALUE, ); const inCon = new Blockly.Connection( inBlock, - ConnectionType.INPUT_VALUE + ConnectionType.INPUT_VALUE, ); assertReasonHelper( this.checker, outCon, inCon, - Blockly.Connection.REASON_SHADOW_PARENT + Blockly.Connection.REASON_SHADOW_PARENT, ); }); test('Output and Input Shadow', function () { @@ -344,18 +344,18 @@ suite('Connection checker', function () { }; const outCon = new Blockly.Connection( outBlock, - ConnectionType.OUTPUT_VALUE + ConnectionType.OUTPUT_VALUE, ); const inCon = new Blockly.Connection( inBlock, - ConnectionType.INPUT_VALUE + ConnectionType.INPUT_VALUE, ); assertReasonHelper( this.checker, outCon, inCon, - Blockly.Connection.CAN_CONNECT + Blockly.Connection.CAN_CONNECT, ); }); }); @@ -381,32 +381,32 @@ suite('Connection checker', function () { }; const outCon = new Blockly.Connection( outBlock, - ConnectionType.OUTPUT_VALUE + ConnectionType.OUTPUT_VALUE, ); const inCon = new Blockly.Connection( inBlock, - ConnectionType.INPUT_VALUE + ConnectionType.INPUT_VALUE, ); outBlock.outputConnection = outCon; inBlock.inputConnection = inCon; connectReciprocally(inCon, outCon); const prevCon = new Blockly.Connection( outBlock, - ConnectionType.PREVIOUS_STATEMENT + ConnectionType.PREVIOUS_STATEMENT, ); const nextBlock = { isShadow: function () {}, }; const nextCon = new Blockly.Connection( nextBlock, - ConnectionType.NEXT_STATEMENT + ConnectionType.NEXT_STATEMENT, ); assertReasonHelper( this.checker, prevCon, nextCon, - Blockly.Connection.REASON_PREVIOUS_AND_OUTPUT + Blockly.Connection.REASON_PREVIOUS_AND_OUTPUT, ); }); test('Previous connected, adding output', function () { @@ -418,32 +418,32 @@ suite('Connection checker', function () { }; const prevCon = new Blockly.Connection( prevBlock, - ConnectionType.PREVIOUS_STATEMENT + ConnectionType.PREVIOUS_STATEMENT, ); const nextCon = new Blockly.Connection( nextBlock, - ConnectionType.NEXT_STATEMENT + ConnectionType.NEXT_STATEMENT, ); prevBlock.previousConnection = prevCon; nextBlock.nextConnection = nextCon; connectReciprocally(prevCon, nextCon); const outCon = new Blockly.Connection( prevBlock, - ConnectionType.OUTPUT_VALUE + ConnectionType.OUTPUT_VALUE, ); const inBlock = { isShadow: function () {}, }; const inCon = new Blockly.Connection( inBlock, - ConnectionType.INPUT_VALUE + ConnectionType.INPUT_VALUE, ); assertReasonHelper( this.checker, outCon, inCon, - Blockly.Connection.REASON_PREVIOUS_AND_OUTPUT + Blockly.Connection.REASON_PREVIOUS_AND_OUTPUT, ); }); }); @@ -502,7 +502,7 @@ suite('Connection checker', function () { `), - this.workspace + this.workspace, ); [this.blockA, this.blockB, this.blockC] = this.workspace.getAllBlocks(true); @@ -515,9 +515,9 @@ suite('Connection checker', function () { this.checker.doDragChecks( this.blockC.nextConnection, this.blockA.previousConnection, - 9000 + 9000, ), - 'Should connect two compatible stack blocks' + 'Should connect two compatible stack blocks', ); }); @@ -537,7 +537,7 @@ suite('Connection checker', function () { `), - this.workspace + this.workspace, ); [this.blockA, this.blockB, this.blockC] = this.workspace.getAllBlocks(true); @@ -549,9 +549,9 @@ suite('Connection checker', function () { this.checker.doDragChecks( this.blockC.previousConnection, this.blockA.nextConnection, - 9000 + 9000, ), - 'Should connect in place of a shadow block' + 'Should connect in place of a shadow block', ); }); @@ -562,9 +562,9 @@ suite('Connection checker', function () { this.checker.doDragChecks( this.blockC.previousConnection, this.blockA.nextConnection, - 9000 + 9000, ), - 'Should not splice in a block above an unmovable block' + 'Should not splice in a block above an unmovable block', ); }); @@ -575,9 +575,9 @@ suite('Connection checker', function () { this.checker.doDragChecks( this.blockC.previousConnection, this.blockB.nextConnection, - 9000 + 9000, ), - 'Should connect below an unmovable stack block' + 'Should connect below an unmovable stack block', ); }); @@ -591,9 +591,9 @@ suite('Connection checker', function () { this.checker.doDragChecks( this.blockC.nextConnection, this.blockB.previousConnection, - 9000 + 9000, ), - 'Should connect above an unconnected unmovable block' + 'Should connect above an unconnected unmovable block', ); }); }); @@ -611,7 +611,7 @@ suite('Connection checker', function () { `), - this.workspace + this.workspace, ); [this.blockA, this.blockB, this.blockC] = this.workspace.getAllBlocks(true); @@ -626,9 +626,9 @@ suite('Connection checker', function () { this.checker.doDragChecks( this.blockC.outputConnection, inputConnection, - 9000 + 9000, ), - 'Should not splice in a block before an unmovable block' + 'Should not splice in a block before an unmovable block', ); }); @@ -641,9 +641,9 @@ suite('Connection checker', function () { this.checker.doDragChecks( this.blockA.outputConnection, inputConnection, - 9000 + 9000, ), - 'Should connect to end of unmovable block' + 'Should connect to end of unmovable block', ); }); @@ -657,9 +657,9 @@ suite('Connection checker', function () { this.checker.doDragChecks( inputConnection, this.blockB.outputConnection, - 9000 + 9000, ), - 'Should connect to unconnected unmovable block' + 'Should connect to unconnected unmovable block', ); }); }); diff --git a/tests/mocha/connection_db_test.js b/tests/mocha/connection_db_test.js index b2d139871..7f3219fa2 100644 --- a/tests/mocha/connection_db_test.js +++ b/tests/mocha/connection_db_test.js @@ -22,7 +22,7 @@ suite('Connection Database', function () { for (let i = 1; i < length; i++) { chai.assert.isAtMost( this.database.connections[i - 1].y, - this.database.connections[i].y + this.database.connections[i].y, ); } }; @@ -33,7 +33,7 @@ suite('Connection Database', function () { workspace.connectionDBList[type] = opt_database || this.database; const connection = new Blockly.RenderedConnection( {workspace: workspace}, - type + type, ); connection.x = x; connection.y = y; @@ -44,7 +44,7 @@ suite('Connection Database', function () { const connection = this.createConnection( 0, i, - ConnectionType.PREVIOUS_STATEMENT + ConnectionType.PREVIOUS_STATEMENT, ); this.database.addConnection(connection, i); } @@ -145,7 +145,7 @@ suite('Connection Database', function () { 0, 0, ConnectionType.NEXT_STATEMENT, - new Blockly.ConnectionDB() + new Blockly.ConnectionDB(), ); chai.assert.isEmpty(this.database.getNeighbours(connection), 100); }); @@ -156,7 +156,7 @@ suite('Connection Database', function () { 0, 0, ConnectionType.NEXT_STATEMENT, - new Blockly.ConnectionDB() + new Blockly.ConnectionDB(), ); const neighbors = this.database.getNeighbours(checkConnection, 4); chai.assert.sameMembers(neighbors, this.database.connections.slice(0, 5)); @@ -168,7 +168,7 @@ suite('Connection Database', function () { 0, 4, ConnectionType.NEXT_STATEMENT, - new Blockly.ConnectionDB() + new Blockly.ConnectionDB(), ); const neighbors = this.database.getNeighbours(checkConnection, 2); chai.assert.sameMembers(neighbors, this.database.connections.slice(2, 7)); @@ -180,12 +180,12 @@ suite('Connection Database', function () { 0, 9, ConnectionType.NEXT_STATEMENT, - new Blockly.ConnectionDB() + new Blockly.ConnectionDB(), ); const neighbors = this.database.getNeighbours(checkConnection, 4); chai.assert.sameMembers( neighbors, - this.database.connections.slice(5, 10) + this.database.connections.slice(5, 10), ); }); test('Out of Range X', function () { @@ -195,7 +195,7 @@ suite('Connection Database', function () { 10, 9, ConnectionType.NEXT_STATEMENT, - new Blockly.ConnectionDB() + new Blockly.ConnectionDB(), ); const neighbors = this.database.getNeighbours(checkConnection, 4); chai.assert.isEmpty(neighbors); @@ -207,7 +207,7 @@ suite('Connection Database', function () { 0, 19, ConnectionType.NEXT_STATEMENT, - new Blockly.ConnectionDB() + new Blockly.ConnectionDB(), ); const neighbors = this.database.getNeighbours(checkConnection, 4); chai.assert.isEmpty(neighbors); @@ -219,7 +219,7 @@ suite('Connection Database', function () { -2, -2, ConnectionType.NEXT_STATEMENT, - new Blockly.ConnectionDB() + new Blockly.ConnectionDB(), ); const neighbors = this.database.getNeighbours(checkConnection, 2); chai.assert.isEmpty(neighbors); @@ -231,7 +231,7 @@ suite('Connection Database', function () { const connection = this.createConnection( 0, i, - ConnectionType.NEXT_STATEMENT + ConnectionType.NEXT_STATEMENT, ); this.database.addConnection(connection, i); } @@ -262,7 +262,7 @@ suite('Connection Database', function () { const connection = this.createConnection( xCoords[i], yCoords[i], - ConnectionType.NEXT_STATEMENT + ConnectionType.NEXT_STATEMENT, ); this.database.addConnection(connection, yCoords[i]); } @@ -290,7 +290,7 @@ suite('Connection Database', function () { x, y, ConnectionType.NEXT_STATEMENT, - new Blockly.ConnectionDB() + new Blockly.ConnectionDB(), ); return checkConnection; }; @@ -300,18 +300,18 @@ suite('Connection Database', function () { 0, 0, ConnectionType.NEXT_STATEMENT, - new Blockly.ConnectionDB() + new Blockly.ConnectionDB(), ); chai.assert.isNull( this.database.searchForClosest(checkConnection, 100, {x: 0, y: 0}) - .connection + .connection, ); }); test('Too Far', function () { const connection = this.createConnection( 0, 100, - ConnectionType.PREVIOUS_STATEMENT + ConnectionType.PREVIOUS_STATEMENT, ); this.database.addConnection(connection, 100); @@ -319,11 +319,11 @@ suite('Connection Database', function () { 0, 0, ConnectionType.NEXT_STATEMENT, - new Blockly.ConnectionDB() + new Blockly.ConnectionDB(), ); chai.assert.isNull( this.database.searchForClosest(checkConnection, 50, {x: 0, y: 0}) - .connection + .connection, ); }); test('Single in Range', function () { @@ -354,13 +354,13 @@ suite('Connection Database', function () { const connection1 = this.createConnection( 6, 6, - ConnectionType.PREVIOUS_STATEMENT + ConnectionType.PREVIOUS_STATEMENT, ); this.database.addConnection(connection1, 6); const connection2 = this.createConnection( 5, 5, - ConnectionType.PREVIOUS_STATEMENT + ConnectionType.PREVIOUS_STATEMENT, ); this.database.addConnection(connection2, 5); diff --git a/tests/mocha/connection_test.js b/tests/mocha/connection_test.js index ce7833bd1..0646458b8 100644 --- a/tests/mocha/connection_test.js +++ b/tests/mocha/connection_test.js @@ -44,7 +44,7 @@ suite('Connection', function () { chai.assert.equal( block.isShadow(), isShadow, - `expected block ${block.id} to ${isShadow ? '' : 'not'} be a shadow` + `expected block ${block.id} to ${isShadow ? '' : 'not'} be a shadow`, ); if (opt_id) { chai.assert.equal(block.id, opt_id); @@ -55,7 +55,7 @@ suite('Connection', function () { const block = parent.getInputTargetBlock(inputName); chai.assert.exists( block, - `expected block ${opt_name || ''} to be attached to ${inputName}` + `expected block ${opt_name || ''} to be attached to ${inputName}`, ); assertBlockMatches(block, isShadow, opt_name); } @@ -64,7 +64,7 @@ suite('Connection', function () { const block = parent.getNextBlock(); chai.assert.exists( block, - `expected block ${opt_name || ''} to be attached to next connection` + `expected block ${opt_name || ''} to be attached to next connection`, ); assertBlockMatches(block, isShadow, opt_name); } @@ -73,7 +73,9 @@ suite('Connection', function () { const block = parent.getInputTargetBlock(inputName); chai.assert.notExists( block, - `expected block ${block && block.id} to not be attached to ${inputName}` + `expected block ${ + block && block.id + } to not be attached to ${inputName}`, ); } @@ -83,7 +85,7 @@ suite('Connection', function () { block, `expected block ${ block && block.id - } to not be attached to next connection` + } to not be attached to next connection`, ); } @@ -122,7 +124,7 @@ suite('Connection', function () { defineStackBlock(); createGenUidStubWithReturns( - new Array(30).fill().map((_, i) => 'id' + i) + new Array(30).fill().map((_, i) => 'id' + i), ); }); @@ -136,9 +138,9 @@ suite('Connection', function () { function createRowBlock(workspace) { const block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom( - '' + '', ), - workspace + workspace, ); return block; } @@ -146,9 +148,9 @@ suite('Connection', function () { function createStatementBlock(workspace) { const block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom( - '' + '', ), - workspace + workspace, ); return block; } @@ -156,9 +158,9 @@ suite('Connection', function () { function createStackBlock(workspace) { const block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom( - '' + '', ), - workspace + workspace, ); return block; } @@ -166,7 +168,7 @@ suite('Connection', function () { test('Value', function () { const parent = createRowBlock(this.workspace); const xml = Blockly.utils.xml.textToDom( - '' + '', ); parent.getInput('INPUT').connection.setShadowDom(xml); assertInputHasBlock(parent, 'INPUT', true); @@ -189,7 +191,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -200,14 +202,14 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ); parent.getInput('INPUT').connection.setShadowDom(xml); assertInputHasBlock(parent, 'INPUT', true); assertInputHasBlock( parent.getInputTargetBlock('INPUT'), 'INPUT', - true + true, ); assertSerialization( parent, @@ -240,14 +242,14 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); test('Statement', function () { const parent = createStatementBlock(this.workspace); const xml = Blockly.utils.xml.textToDom( - '' + '', ); parent.getInput('NAME').connection.setShadowDom(xml); assertInputHasBlock(parent, 'NAME', true); @@ -270,7 +272,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -281,14 +283,14 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ); parent.getInput('NAME').connection.setShadowDom(xml); assertInputHasBlock(parent, 'NAME', true); assertInputHasBlock( parent.getInputTargetBlock('NAME'), 'NAME', - true + true, ); assertSerialization( parent, @@ -321,14 +323,14 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); test('Next', function () { const parent = createStackBlock(this.workspace); const xml = Blockly.utils.xml.textToDom( - '' + '', ); parent.nextConnection.setShadowDom(xml); assertNextHasBlock(parent, true); @@ -349,7 +351,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -360,7 +362,7 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ); parent.nextConnection.setShadowDom(xml); assertNextHasBlock(parent, true); @@ -392,7 +394,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); }); @@ -406,9 +408,9 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ), - workspace + workspace, ); return block; } @@ -420,9 +422,9 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ), - workspace + workspace, ); return block; } @@ -434,9 +436,9 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ), - workspace + workspace, ); return block; } @@ -444,7 +446,7 @@ suite('Connection', function () { test('Value', function () { const parent = createRowBlocks(this.workspace); const xml = Blockly.utils.xml.textToDom( - '' + '', ); parent.getInput('INPUT').connection.setShadowDom(xml); assertInputHasBlock(parent, 'INPUT', false); @@ -469,7 +471,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -480,20 +482,20 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ); parent.getInput('INPUT').connection.setShadowDom(xml); assertInputHasBlock(parent, 'INPUT', false); assertInputNotHasBlock( parent.getInputTargetBlock('INPUT'), - 'INPUT' + 'INPUT', ); parent.getInput('INPUT').connection.disconnect(); assertInputHasBlock(parent, 'INPUT', true); assertInputHasBlock( parent.getInputTargetBlock('INPUT'), 'INPUT', - true + true, ); assertSerialization( parent, @@ -526,14 +528,14 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); test('Statement', function () { const parent = createStatementBlocks(this.workspace); const xml = Blockly.utils.xml.textToDom( - '' + '', ); parent.getInput('NAME').connection.setShadowDom(xml); assertInputHasBlock(parent, 'NAME', false); @@ -558,7 +560,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -569,20 +571,20 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ); parent.getInput('NAME').connection.setShadowDom(xml); assertInputHasBlock(parent, 'NAME', false); assertInputNotHasBlock( parent.getInputTargetBlock('NAME'), - 'NAME' + 'NAME', ); parent.getInput('NAME').connection.disconnect(); assertInputHasBlock(parent, 'NAME', true); assertInputHasBlock( parent.getInputTargetBlock('NAME'), 'NAME', - true + true, ); assertSerialization( parent, @@ -615,14 +617,14 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); test('Next', function () { const parent = createStackBlocks(this.workspace); const xml = Blockly.utils.xml.textToDom( - '' + '', ); parent.nextConnection.setShadowDom(xml); assertNextHasBlock(parent, false); @@ -645,7 +647,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -656,7 +658,7 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ); parent.nextConnection.setShadowDom(xml); assertNextHasBlock(parent, false); @@ -691,7 +693,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); }); @@ -701,9 +703,9 @@ suite('Connection', function () { function createRowBlock(workspace) { const block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom( - '' + '', ), - workspace + workspace, ); return block; } @@ -711,9 +713,9 @@ suite('Connection', function () { function createStatementBlock(workspace) { const block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom( - '' + '', ), - workspace + workspace, ); return block; } @@ -721,9 +723,9 @@ suite('Connection', function () { function createStackBlock(workspace) { const block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom( - '' + '', ), - workspace + workspace, ); return block; } @@ -731,12 +733,12 @@ suite('Connection', function () { test('Value', function () { const parent = createRowBlock(this.workspace); const xml1 = Blockly.utils.xml.textToDom( - '' + '', ); parent.getInput('INPUT').connection.setShadowDom(xml1); assertInputHasBlock(parent, 'INPUT', true, '1'); const xml2 = Blockly.utils.xml.textToDom( - '' + '', ); parent.getInput('INPUT').connection.setShadowDom(xml2); assertInputHasBlock(parent, 'INPUT', true, '2'); @@ -759,7 +761,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -770,7 +772,7 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ); parent.getInput('INPUT').connection.setShadowDom(xml1); assertInputHasBlock(parent, 'INPUT', true, '1'); @@ -778,14 +780,14 @@ suite('Connection', function () { parent.getInputTargetBlock('INPUT'), 'INPUT', true, - 'a' + 'a', ); const xml2 = Blockly.utils.xml.textToDom( '' + ' ' + ' ' + ' ' + - '' + '', ); parent.getInput('INPUT').connection.setShadowDom(xml2); assertInputHasBlock(parent, 'INPUT', true, '2'); @@ -793,7 +795,7 @@ suite('Connection', function () { parent.getInputTargetBlock('INPUT'), 'INPUT', true, - 'b' + 'b', ); assertSerialization( parent, @@ -826,19 +828,19 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); test('Statement', function () { const parent = createStatementBlock(this.workspace); const xml1 = Blockly.utils.xml.textToDom( - '' + '', ); parent.getInput('NAME').connection.setShadowDom(xml1); assertInputHasBlock(parent, 'NAME', true, '1'); const xml2 = Blockly.utils.xml.textToDom( - '' + '', ); parent.getInput('NAME').connection.setShadowDom(xml2); assertInputHasBlock(parent, 'NAME', true, '2'); @@ -861,7 +863,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -872,7 +874,7 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ); parent.getInput('NAME').connection.setShadowDom(xml1); assertInputHasBlock(parent, 'NAME', true, '1'); @@ -880,14 +882,14 @@ suite('Connection', function () { parent.getInputTargetBlock('NAME'), 'NAME', true, - 'a' + 'a', ); const xml2 = Blockly.utils.xml.textToDom( '' + ' ' + ' ' + ' ' + - '' + '', ); parent.getInput('NAME').connection.setShadowDom(xml2); assertInputHasBlock(parent, 'NAME', true, '2'); @@ -895,7 +897,7 @@ suite('Connection', function () { parent.getInputTargetBlock('NAME'), 'NAME', true, - 'b' + 'b', ); assertSerialization( parent, @@ -928,19 +930,19 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); test('Next', function () { const parent = createStackBlock(this.workspace); const xml1 = Blockly.utils.xml.textToDom( - '' + '', ); parent.nextConnection.setShadowDom(xml1); assertNextHasBlock(parent, true, '1'); const xml2 = Blockly.utils.xml.textToDom( - '' + '', ); parent.nextConnection.setShadowDom(xml2); assertNextHasBlock(parent, true, '2'); @@ -961,7 +963,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -972,7 +974,7 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ); parent.nextConnection.setShadowDom(xml1); assertNextHasBlock(parent, true, '1'); @@ -982,7 +984,7 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ); parent.nextConnection.setShadowDom(xml2); assertNextHasBlock(parent, true, '2'); @@ -1014,7 +1016,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); }); @@ -1028,9 +1030,9 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ), - workspace + workspace, ); return block; } @@ -1042,9 +1044,9 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ), - workspace + workspace, ); return block; } @@ -1056,9 +1058,9 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ), - workspace + workspace, ); return block; } @@ -1075,7 +1077,7 @@ suite('Connection', function () { }, '' + - '' + '', ); }); @@ -1091,7 +1093,7 @@ suite('Connection', function () { }, '' + - '' + '', ); }); @@ -1107,7 +1109,7 @@ suite('Connection', function () { }, '' + - '' + '', ); }); }); @@ -1122,9 +1124,9 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ), - workspace + workspace, ); return block; } @@ -1137,9 +1139,9 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ), - workspace + workspace, ); return block; } @@ -1152,9 +1154,9 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ), - workspace + workspace, ); return block; } @@ -1173,7 +1175,7 @@ suite('Connection', function () { }, '' + - '' + '', ); }); @@ -1191,7 +1193,7 @@ suite('Connection', function () { }, '' + - '' + '', ); }); @@ -1209,7 +1211,7 @@ suite('Connection', function () { }, '' + - '' + '', ); }); }); @@ -1219,7 +1221,7 @@ suite('Connection', function () { function createRowBlock(workspace) { const block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(''), - workspace + workspace, ); return block; } @@ -1227,7 +1229,7 @@ suite('Connection', function () { function createStatementBlock(workspace) { const block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(''), - workspace + workspace, ); return block; } @@ -1235,7 +1237,7 @@ suite('Connection', function () { function createStackBlock(workspace) { const block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(''), - workspace + workspace, ); return block; } @@ -1243,7 +1245,7 @@ suite('Connection', function () { test('Value', function () { const parent = createRowBlock(this.workspace); const xml = Blockly.utils.xml.textToDom( - '' + '', ); parent.getInput('INPUT').connection.setShadowDom(xml); assertInputHasBlock(parent, 'INPUT', true); @@ -1265,14 +1267,14 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ); parent.getInput('INPUT').connection.setShadowDom(xml); assertInputHasBlock(parent, 'INPUT', true); assertInputHasBlock( parent.getInputTargetBlock('INPUT'), 'INPUT', - true + true, ); const child = createRowBlock(this.workspace); parent @@ -1284,7 +1286,7 @@ suite('Connection', function () { assertInputHasBlock( parent.getInputTargetBlock('INPUT'), 'INPUT', - true + true, ); parent.getInput('INPUT').connection.setShadowDom(null); assertInputNotHasBlock(parent, 'INPUT'); @@ -1293,7 +1295,7 @@ suite('Connection', function () { test('Statement', function () { const parent = createStatementBlock(this.workspace); const xml = Blockly.utils.xml.textToDom( - '' + '', ); parent.getInput('NAME').connection.setShadowDom(xml); assertInputHasBlock(parent, 'NAME', true); @@ -1315,14 +1317,14 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ); parent.getInput('NAME').connection.setShadowDom(xml); assertInputHasBlock(parent, 'NAME', true); assertInputHasBlock( parent.getInputTargetBlock('NAME'), 'NAME', - true + true, ); const child = createStatementBlock(this.workspace); parent @@ -1334,7 +1336,7 @@ suite('Connection', function () { assertInputHasBlock( parent.getInputTargetBlock('NAME'), 'NAME', - true + true, ); parent.getInput('NAME').connection.setShadowDom(null); assertInputNotHasBlock(parent, 'NAME'); @@ -1343,7 +1345,7 @@ suite('Connection', function () { test('Next', function () { const parent = createStackBlock(this.workspace); const xml = Blockly.utils.xml.textToDom( - '' + '', ); parent.nextConnection.setShadowDom(xml); assertNextHasBlock(parent, true); @@ -1363,7 +1365,7 @@ suite('Connection', function () { ' ' + ' ' + ' ' + - '' + '', ); parent.nextConnection.setShadowDom(xml); assertNextHasBlock(parent, true); @@ -1384,8 +1386,8 @@ suite('Connection', function () { const block = this.workspace.newBlock('row_block'); chai.assert.throws(() => block.outputConnection.setShadowDom( - Blockly.utils.xml.textToDom('') - ) + Blockly.utils.xml.textToDom(''), + ), ); }); @@ -1393,8 +1395,8 @@ suite('Connection', function () { const block = this.workspace.newBlock('stack_block'); chai.assert.throws(() => block.previousConnection.setShadowDom( - Blockly.utils.xml.textToDom('') - ) + Blockly.utils.xml.textToDom(''), + ), ); }); @@ -1402,8 +1404,8 @@ suite('Connection', function () { const block = this.workspace.newBlock('row_block'); chai.assert.throws(() => block.outputConnection.setShadowDom( - Blockly.utils.xml.textToDom('') - ) + Blockly.utils.xml.textToDom(''), + ), ); }); @@ -1411,8 +1413,8 @@ suite('Connection', function () { const block = this.workspace.newBlock('stack_block'); chai.assert.throws(() => block.previousConnection.setShadowDom( - Blockly.utils.xml.textToDom('') - ) + Blockly.utils.xml.textToDom(''), + ), ); }); @@ -1422,8 +1424,8 @@ suite('Connection', function () { block .getInput('A') .connection.setShadowDom( - Blockly.utils.xml.textToDom('') - ) + Blockly.utils.xml.textToDom(''), + ), ); }); @@ -1440,9 +1442,9 @@ suite('Connection', function () { chai.assert.throws(() => block.nextConnection.setShadowDom( Blockly.utils.xml.textToDom( - '' - ) - ) + '', + ), + ), ); }); }); @@ -1454,21 +1456,21 @@ suite('Connection', function () { function createRowBlock(workspace) { return Blockly.serialization.blocks.append( {'type': 'row_block', 'id': 'id0'}, - workspace + workspace, ); } function createStatementBlock(workspace) { return Blockly.serialization.blocks.append( {'type': 'statement_block', 'id': 'id0'}, - workspace + workspace, ); } function createStackBlock(workspace) { return Blockly.serialization.blocks.append( {'type': 'stack_block', 'id': 'id0'}, - workspace + workspace, ); } @@ -1497,7 +1499,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -1519,7 +1521,7 @@ suite('Connection', function () { assertInputHasBlock( parent.getInputTargetBlock('INPUT'), 'INPUT', - true + true, ); assertSerialization( parent, @@ -1552,7 +1554,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -1582,7 +1584,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -1604,7 +1606,7 @@ suite('Connection', function () { assertInputHasBlock( parent.getInputTargetBlock('NAME'), 'NAME', - true + true, ); assertSerialization( parent, @@ -1637,7 +1639,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -1665,7 +1667,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); test('Multiple Next', function () { @@ -1709,7 +1711,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); }); @@ -1730,7 +1732,7 @@ suite('Connection', function () { }, }, }, - workspace + workspace, ); } @@ -1748,7 +1750,7 @@ suite('Connection', function () { }, }, }, - workspace + workspace, ); } @@ -1764,7 +1766,7 @@ suite('Connection', function () { }, }, }, - workspace + workspace, ); } @@ -1795,7 +1797,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -1816,14 +1818,14 @@ suite('Connection', function () { assertInputHasBlock(parent, 'INPUT', false); assertInputNotHasBlock( parent.getInputTargetBlock('INPUT'), - 'INPUT' + 'INPUT', ); parent.getInput('INPUT').connection.disconnect(); assertInputHasBlock(parent, 'INPUT', true); assertInputHasBlock( parent.getInputTargetBlock('INPUT'), 'INPUT', - true + true, ); assertSerialization( parent, @@ -1856,7 +1858,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -1888,7 +1890,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -1909,14 +1911,14 @@ suite('Connection', function () { assertInputHasBlock(parent, 'NAME', false); assertInputNotHasBlock( parent.getInputTargetBlock('NAME'), - 'NAME' + 'NAME', ); parent.getInput('NAME').connection.disconnect(); assertInputHasBlock(parent, 'NAME', true); assertInputHasBlock( parent.getInputTargetBlock('NAME'), 'NAME', - true + true, ); assertSerialization( parent, @@ -1949,7 +1951,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -1979,7 +1981,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -2027,7 +2029,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); }); @@ -2037,21 +2039,21 @@ suite('Connection', function () { function createRowBlock(workspace) { return Blockly.serialization.blocks.append( {'type': 'row_block', 'id': 'id0'}, - workspace + workspace, ); } function createStatementBlock(workspace) { return Blockly.serialization.blocks.append( {'type': 'statement_block', 'id': 'id0'}, - workspace + workspace, ); } function createStackBlock(workspace) { return Blockly.serialization.blocks.append( {'type': 'stack_block', 'id': 'id0'}, - workspace + workspace, ); } @@ -2084,7 +2086,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -2107,7 +2109,7 @@ suite('Connection', function () { parent.getInputTargetBlock('INPUT'), 'INPUT', true, - 'a' + 'a', ); parent.getInput('INPUT').connection.setShadowState({ 'type': 'row_block', @@ -2126,7 +2128,7 @@ suite('Connection', function () { parent.getInputTargetBlock('INPUT'), 'INPUT', true, - 'b' + 'b', ); assertSerialization( parent, @@ -2159,7 +2161,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -2194,7 +2196,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -2217,7 +2219,7 @@ suite('Connection', function () { parent.getInputTargetBlock('NAME'), 'NAME', true, - 'a' + 'a', ); parent.getInput('NAME').connection.setShadowState({ 'type': 'statement_block', @@ -2236,7 +2238,7 @@ suite('Connection', function () { parent.getInputTargetBlock('NAME'), 'NAME', true, - 'b' + 'b', ); assertSerialization( parent, @@ -2269,7 +2271,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -2302,7 +2304,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); @@ -2359,7 +2361,7 @@ suite('Connection', function () { '' + '' + '' + - '' + '', ); }); }); @@ -2380,7 +2382,7 @@ suite('Connection', function () { }, }, }, - workspace + workspace, ); } @@ -2398,7 +2400,7 @@ suite('Connection', function () { }, }, }, - workspace + workspace, ); } @@ -2414,7 +2416,7 @@ suite('Connection', function () { }, }, }, - workspace + workspace, ); } @@ -2430,7 +2432,7 @@ suite('Connection', function () { }, '' + - '' + '', ); }); @@ -2446,7 +2448,7 @@ suite('Connection', function () { }, '' + - '' + '', ); }); @@ -2462,7 +2464,7 @@ suite('Connection', function () { }, '' + - '' + '', ); }); }); @@ -2487,7 +2489,7 @@ suite('Connection', function () { }, }, }, - workspace + workspace, ); } @@ -2509,7 +2511,7 @@ suite('Connection', function () { }, }, }, - workspace + workspace, ); } @@ -2529,7 +2531,7 @@ suite('Connection', function () { }, }, }, - workspace + workspace, ); } @@ -2547,7 +2549,7 @@ suite('Connection', function () { }, '' + - '' + '', ); }); @@ -2565,7 +2567,7 @@ suite('Connection', function () { }, '' + - '' + '', ); }); @@ -2583,7 +2585,7 @@ suite('Connection', function () { }, '' + - '' + '', ); }); }); @@ -2593,21 +2595,21 @@ suite('Connection', function () { function createRowBlock(workspace) { return Blockly.serialization.blocks.append( {'type': 'row_block'}, - workspace + workspace, ); } function createStatementBlock(workspace) { return Blockly.serialization.blocks.append( {'type': 'statement_block'}, - workspace + workspace, ); } function createStackBlock(workspace) { return Blockly.serialization.blocks.append( {'type': 'stack_block'}, - workspace + workspace, ); } @@ -2644,7 +2646,7 @@ suite('Connection', function () { assertInputHasBlock( parent.getInputTargetBlock('INPUT'), 'INPUT', - true + true, ); const child = createRowBlock(this.workspace); parent @@ -2656,7 +2658,7 @@ suite('Connection', function () { assertInputHasBlock( parent.getInputTargetBlock('INPUT'), 'INPUT', - true + true, ); parent.getInput('INPUT').connection.setShadowState(null); assertInputNotHasBlock(parent, 'INPUT'); @@ -2695,7 +2697,7 @@ suite('Connection', function () { assertInputHasBlock( parent.getInputTargetBlock('NAME'), 'NAME', - true + true, ); const child = createStatementBlock(this.workspace); parent @@ -2707,7 +2709,7 @@ suite('Connection', function () { assertInputHasBlock( parent.getInputTargetBlock('NAME'), 'NAME', - true + true, ); parent.getInput('NAME').connection.setShadowState(null); assertInputNotHasBlock(parent, 'NAME'); @@ -2752,28 +2754,30 @@ suite('Connection', function () { test('Attach to output', function () { const block = this.workspace.newBlock('row_block'); chai.assert.throws(() => - block.outputConnection.setShadowState({'type': 'row_block'}) + block.outputConnection.setShadowState({'type': 'row_block'}), ); }); test('Attach to previous', function () { const block = this.workspace.newBlock('stack_block'); chai.assert.throws(() => - block.previousConnection.setShadowState({'type': 'stack_block'}) + block.previousConnection.setShadowState({ + 'type': 'stack_block', + }), ); }); test('Missing output', function () { const block = this.workspace.newBlock('row_block'); chai.assert.throws(() => - block.outputConnection.setShadowState({'type': 'stack_block'}) + block.outputConnection.setShadowState({'type': 'stack_block'}), ); }); test('Missing previous', function () { const block = this.workspace.newBlock('stack_block'); chai.assert.throws(() => - block.previousConnection.setShadowState({'type': 'row_block'}) + block.previousConnection.setShadowState({'type': 'row_block'}), ); }); @@ -2782,7 +2786,7 @@ suite('Connection', function () { chai.assert.throws(() => block .getInput('A') - .connection.setShadowState({'type': 'math_number'}) + .connection.setShadowState({'type': 'math_number'}), ); }); @@ -2799,7 +2803,7 @@ suite('Connection', function () { chai.assert.throws(() => block.nextConnection.setShadowState({ 'type': 'stack_checks_block', - }) + }), ); }); }); @@ -2996,7 +3000,7 @@ suite('Connection', function () { newParent.getInput('INPUT').connection.connect(child.outputConnection); chai.assert.isFalse( - oldParent.getInput('INPUT').connection.isConnected() + oldParent.getInput('INPUT').connection.isConnected(), ); this.assertBlockCount(3); }); @@ -3010,7 +3014,7 @@ suite('Connection', function () { newParent.getInput('NAME').connection.connect(child.previousConnection); chai.assert.isFalse( - oldParent.getInput('NAME').connection.isConnected() + oldParent.getInput('NAME').connection.isConnected(), ); this.assertBlockCount(3); }); @@ -3135,7 +3139,7 @@ suite('Connection', function () { .connection.connect(newChild.outputConnection); chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected() + parent.getInput('INPUT').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); chai.assert.isFalse(oldChild.outputConnection.isConnected()); @@ -3154,7 +3158,7 @@ suite('Connection', function () { .connection.connect(newChild.outputConnection); chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected() + parent.getInput('INPUT').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); chai.assert.isFalse(oldChild.outputConnection.isConnected()); @@ -3173,7 +3177,7 @@ suite('Connection', function () { .connection.connect(newChild.outputConnection); chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected() + parent.getInput('INPUT').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); chai.assert.isFalse(oldChild.outputConnection.isConnected()); @@ -3197,7 +3201,7 @@ suite('Connection', function () { .connection.connect(newChild.outputConnection); chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected() + parent.getInput('INPUT').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); chai.assert.isFalse(oldChild.outputConnection.isConnected()); @@ -3210,7 +3214,7 @@ suite('Connection', function () { const parent = this.workspace.newBlock('row_block'); const oldChild = this.workspace.newBlock('row_block'); const newChild = this.workspace.newBlock( - 'row_block_multiple_inputs' + 'row_block_multiple_inputs', ); parent @@ -3222,7 +3226,7 @@ suite('Connection', function () { .connection.connect(newChild.outputConnection); chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected() + parent.getInput('INPUT').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); chai.assert.isFalse(oldChild.outputConnection.isConnected()); @@ -3232,7 +3236,7 @@ suite('Connection', function () { const parent = this.workspace.newBlock('row_block'); const oldChild = this.workspace.newBlock('row_block'); const newChild = this.workspace.newBlock( - 'row_block_multiple_inputs' + 'row_block_multiple_inputs', ); const childX = this.workspace.newBlock('row_block'); const childY = this.workspace.newBlock('row_block'); @@ -3252,7 +3256,7 @@ suite('Connection', function () { .connection.connect(newChild.outputConnection); chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected() + parent.getInput('INPUT').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); chai.assert.isFalse(oldChild.outputConnection.isConnected()); @@ -3262,7 +3266,7 @@ suite('Connection', function () { const parent = this.workspace.newBlock('row_block'); const oldChild = this.workspace.newBlock('row_block'); const newChild = this.workspace.newBlock( - 'row_block_multiple_inputs' + 'row_block_multiple_inputs', ); const otherChild = this.workspace.newBlock('row_block_noend'); @@ -3278,7 +3282,7 @@ suite('Connection', function () { .connection.connect(newChild.outputConnection); chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected() + parent.getInput('INPUT').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); chai.assert.isFalse(oldChild.outputConnection.isConnected()); @@ -3290,7 +3294,7 @@ suite('Connection', function () { const parent = this.workspace.newBlock('row_block'); const oldChild = this.workspace.newBlock('row_block'); const newChild = this.workspace.newBlock( - 'row_block_multiple_inputs' + 'row_block_multiple_inputs', ); parent @@ -3300,15 +3304,15 @@ suite('Connection', function () { .getInput('INPUT') .connection.setShadowDom( Blockly.utils.xml.textToDom( - '' - ).firstChild + '', + ).firstChild, ); newChild .getInput('INPUT2') .connection.setShadowDom( Blockly.utils.xml.textToDom( - '' - ).firstChild + '', + ).firstChild, ); parent @@ -3316,7 +3320,7 @@ suite('Connection', function () { .connection.connect(newChild.outputConnection); chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected() + parent.getInput('INPUT').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); chai.assert.isFalse(oldChild.outputConnection.isConnected()); @@ -3326,7 +3330,7 @@ suite('Connection', function () { const parent = this.workspace.newBlock('row_block'); const oldChild = this.workspace.newBlock('row_block'); const newChild = this.workspace.newBlock( - 'row_block_multiple_inputs' + 'row_block_multiple_inputs', ); const childX = this.workspace.newBlock('row_block'); const childY = this.workspace.newBlock('row_block'); @@ -3344,15 +3348,15 @@ suite('Connection', function () { .getInput('INPUT') .connection.setShadowDom( Blockly.utils.xml.textToDom( - '' - ).firstChild + '', + ).firstChild, ); childY .getInput('INPUT') .connection.setShadowDom( Blockly.utils.xml.textToDom( - '' - ).firstChild + '', + ).firstChild, ); parent @@ -3360,7 +3364,7 @@ suite('Connection', function () { .connection.connect(newChild.outputConnection); chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected() + parent.getInput('INPUT').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); chai.assert.isFalse(oldChild.outputConnection.isConnected()); @@ -3370,7 +3374,7 @@ suite('Connection', function () { const parent = this.workspace.newBlock('row_block'); const oldChild = this.workspace.newBlock('row_block'); const newChild = this.workspace.newBlock( - 'row_block_multiple_inputs' + 'row_block_multiple_inputs', ); const otherChild = this.workspace.newBlock('row_block_noend'); @@ -3384,8 +3388,8 @@ suite('Connection', function () { .getInput('INPUT2') .connection.setShadowDom( Blockly.utils.xml.textToDom( - '' - ).firstChild + '', + ).firstChild, ); parent @@ -3393,7 +3397,7 @@ suite('Connection', function () { .connection.connect(newChild.outputConnection); chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected() + parent.getInput('INPUT').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); chai.assert.isFalse(oldChild.outputConnection.isConnected()); @@ -3416,11 +3420,11 @@ suite('Connection', function () { .connection.connect(newChild.outputConnection); chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected() + parent.getInput('INPUT').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); chai.assert.isTrue( - newChild.getInput('INPUT').connection.isConnected() + newChild.getInput('INPUT').connection.isConnected(), ); chai.assert.equal(newChild.getInputTargetBlock('INPUT'), oldChild); }); @@ -3437,8 +3441,8 @@ suite('Connection', function () { .getInput('INPUT') .connection.setShadowDom( Blockly.utils.xml.textToDom( - '' - ).firstChild + '', + ).firstChild, ); parent @@ -3446,11 +3450,11 @@ suite('Connection', function () { .connection.connect(newChild.outputConnection); chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected() + parent.getInput('INPUT').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); chai.assert.isTrue( - newChild.getInput('INPUT').connection.isConnected() + newChild.getInput('INPUT').connection.isConnected(), ); chai.assert.equal(newChild.getInputTargetBlock('INPUT'), oldChild); }); @@ -3472,7 +3476,7 @@ suite('Connection', function () { .connection.connect(newChild.previousConnection); chai.assert.isTrue( - parent.getInput('NAME').connection.isConnected() + parent.getInput('NAME').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('NAME'), newChild); chai.assert.isTrue(newChild.nextConnection.isConnected()); @@ -3495,7 +3499,7 @@ suite('Connection', function () { .connection.connect(newChild1.previousConnection); chai.assert.isTrue( - parent.getInput('NAME').connection.isConnected() + parent.getInput('NAME').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('NAME'), newChild1); chai.assert.isTrue(newChild2.nextConnection.isConnected()); @@ -3512,7 +3516,7 @@ suite('Connection', function () { .connection.connect(oldChild.previousConnection); const spy = sinon.spy( oldChild.previousConnection, - 'onFailedConnect' + 'onFailedConnect', ); parent @@ -3520,7 +3524,7 @@ suite('Connection', function () { .connection.connect(newChild.previousConnection); chai.assert.isTrue( - parent.getInput('NAME').connection.isConnected() + parent.getInput('NAME').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('NAME'), newChild); chai.assert.isFalse(newChild.nextConnection.isConnected()); @@ -3537,7 +3541,7 @@ suite('Connection', function () { .connection.connect(oldChild.previousConnection); const spy = sinon.spy( oldChild.previousConnection, - 'onFailedConnect' + 'onFailedConnect', ); parent @@ -3545,7 +3549,7 @@ suite('Connection', function () { .connection.connect(newChild.previousConnection); chai.assert.isTrue( - parent.getInput('NAME').connection.isConnected() + parent.getInput('NAME').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('NAME'), newChild); chai.assert.isTrue(spy.calledOnce); @@ -3562,7 +3566,7 @@ suite('Connection', function () { .getInput('NAME') .connection.connect(oldChild.previousConnection); const xml = Blockly.utils.xml.textToDom( - '' + '', ); newChild.nextConnection.setShadowDom(xml); @@ -3571,7 +3575,7 @@ suite('Connection', function () { .connection.connect(newChild.previousConnection); chai.assert.isTrue( - parent.getInput('NAME').connection.isConnected() + parent.getInput('NAME').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('NAME'), newChild); chai.assert.isTrue(newChild.nextConnection.isConnected()); @@ -3589,7 +3593,7 @@ suite('Connection', function () { .connection.connect(oldChild.previousConnection); newChild1.nextConnection.connect(newChild2.previousConnection); const xml = Blockly.utils.xml.textToDom( - '' + '', ); newChild2.nextConnection.setShadowDom(xml); @@ -3598,7 +3602,7 @@ suite('Connection', function () { .connection.connect(newChild1.previousConnection); chai.assert.isTrue( - parent.getInput('NAME').connection.isConnected() + parent.getInput('NAME').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('NAME'), newChild1); chai.assert.isTrue(newChild2.nextConnection.isConnected()); @@ -3614,12 +3618,12 @@ suite('Connection', function () { .getInput('NAME') .connection.connect(oldChild.previousConnection); const xml = Blockly.utils.xml.textToDom( - '' + '', ); newChild.nextConnection.setShadowDom(xml); const spy = sinon.spy( oldChild.previousConnection, - 'onFailedConnect' + 'onFailedConnect', ); parent @@ -3627,7 +3631,7 @@ suite('Connection', function () { .connection.connect(newChild.previousConnection); chai.assert.isTrue( - parent.getInput('NAME').connection.isConnected() + parent.getInput('NAME').connection.isConnected(), ); chai.assert.equal(parent.getInputTargetBlock('NAME'), newChild); chai.assert.isTrue(newChild.nextConnection.isConnected()); @@ -3679,7 +3683,7 @@ suite('Connection', function () { parent.nextConnection.connect(oldChild.previousConnection); const spy = sinon.spy( oldChild.previousConnection, - 'onFailedConnect' + 'onFailedConnect', ); parent.nextConnection.connect(newChild.previousConnection); @@ -3698,7 +3702,7 @@ suite('Connection', function () { parent.nextConnection.connect(oldChild.previousConnection); const spy = sinon.spy( oldChild.previousConnection, - 'onFailedConnect' + 'onFailedConnect', ); parent.nextConnection.connect(newChild.previousConnection); @@ -3717,7 +3721,7 @@ suite('Connection', function () { const newChild = this.workspace.newBlock('stack_block'); parent.nextConnection.connect(oldChild.previousConnection); const xml = Blockly.utils.xml.textToDom( - '' + '', ); newChild.nextConnection.setShadowDom(xml); @@ -3738,7 +3742,7 @@ suite('Connection', function () { parent.nextConnection.connect(oldChild.previousConnection); newChild1.nextConnection.connect(newChild2.previousConnection); const xml = Blockly.utils.xml.textToDom( - '' + '', ); newChild2.nextConnection.setShadowDom(xml); @@ -3757,12 +3761,12 @@ suite('Connection', function () { const newChild = this.workspace.newBlock('stack_block_1to2'); parent.nextConnection.connect(oldChild.previousConnection); const xml = Blockly.utils.xml.textToDom( - '' + '', ); newChild.nextConnection.setShadowDom(xml); const spy = sinon.spy( oldChild.previousConnection, - 'onFailedConnect' + 'onFailedConnect', ); parent.nextConnection.connect(newChild.previousConnection); diff --git a/tests/mocha/contextmenu_items_test.js b/tests/mocha/contextmenu_items_test.js index 566b33748..4e18a6801 100644 --- a/tests/mocha/contextmenu_items_test.js +++ b/tests/mocha/contextmenu_items_test.js @@ -44,7 +44,7 @@ suite('Context Menu Items', function () { chai.assert.equal( precondition, 'disabled', - 'Should be disabled when there is nothing to undo' + 'Should be disabled when there is nothing to undo', ); }); @@ -55,7 +55,7 @@ suite('Context Menu Items', function () { chai.assert.equal( precondition, 'enabled', - 'Should be enabled when there are actions to undo' + 'Should be enabled when there are actions to undo', ); }); @@ -66,7 +66,7 @@ suite('Context Menu Items', function () { chai.assert.equal( this.workspace.getTopBlocks(false).length, 0, - 'Should be no blocks after undo' + 'Should be no blocks after undo', ); }); @@ -87,7 +87,7 @@ suite('Context Menu Items', function () { chai.assert.equal( precondition, 'disabled', - 'Should be disabled when there is nothing to redo' + 'Should be disabled when there is nothing to redo', ); }); @@ -99,7 +99,7 @@ suite('Context Menu Items', function () { chai.assert.equal( precondition, 'enabled', - 'Should be enabled when there are actions to redo' + 'Should be enabled when there are actions to redo', ); }); @@ -112,7 +112,7 @@ suite('Context Menu Items', function () { chai.assert.equal( this.workspace.getTopBlocks(false).length, 1, - 'Should be 1 block after redo' + 'Should be 1 block after redo', ); }); @@ -133,7 +133,7 @@ suite('Context Menu Items', function () { chai.assert.equal( this.cleanupOption.preconditionFn(this.scope), 'enabled', - 'Should be enabled if there are multiple blocks' + 'Should be enabled if there are multiple blocks', ); }); @@ -141,7 +141,7 @@ suite('Context Menu Items', function () { chai.assert.equal( this.cleanupOption.preconditionFn(this.scope), 'disabled', - 'Should be disabled if there are no blocks' + 'Should be disabled if there are no blocks', ); }); @@ -150,7 +150,7 @@ suite('Context Menu Items', function () { chai.assert.equal( this.cleanupOption.preconditionFn(this.scope), 'hidden', - 'Should be hidden if the workspace is not movable' + 'Should be hidden if the workspace is not movable', ); }); @@ -176,7 +176,7 @@ suite('Context Menu Items', function () { chai.assert.equal( this.collapseOption.preconditionFn(this.scope), 'enabled', - 'Should be enabled when any blocks are expanded' + 'Should be enabled when any blocks are expanded', ); }); @@ -185,13 +185,13 @@ suite('Context Menu Items', function () { chai.assert.equal( this.collapseOption.preconditionFn(this.scope), 'disabled', - 'Should be disabled when no blocks are expanded' + 'Should be disabled when no blocks are expanded', ); }); test('Hidden when no collapse option', function () { const workspaceWithOptions = new Blockly.Workspace( - new Blockly.Options({collapse: false}) + new Blockly.Options({collapse: false}), ); this.scope.workspace = workspaceWithOptions; @@ -199,7 +199,7 @@ suite('Context Menu Items', function () { chai.assert.equal( this.collapseOption.preconditionFn(this.scope), 'hidden', - 'Should be hidden if collapse is disabled in options' + 'Should be hidden if collapse is disabled in options', ); } finally { workspaceTeardown.call(this, workspaceWithOptions); @@ -220,11 +220,11 @@ suite('Context Menu Items', function () { chai.assert.isTrue( block1.isCollapsed(), - 'Previously collapsed block should still be collapsed' + 'Previously collapsed block should still be collapsed', ); chai.assert.isTrue( block2.isCollapsed(), - 'Previously expanded block should now be collapsed' + 'Previously expanded block should now be collapsed', ); }); @@ -246,7 +246,7 @@ suite('Context Menu Items', function () { chai.assert.equal( this.expandOption.preconditionFn(this.scope), 'enabled', - 'Should be enabled when any blocks are collapsed' + 'Should be enabled when any blocks are collapsed', ); }); @@ -255,13 +255,13 @@ suite('Context Menu Items', function () { chai.assert.equal( this.expandOption.preconditionFn(this.scope), 'disabled', - 'Should be disabled when no blocks are collapsed' + 'Should be disabled when no blocks are collapsed', ); }); test('Hidden when no collapse option', function () { const workspaceWithOptions = new Blockly.Workspace( - new Blockly.Options({collapse: false}) + new Blockly.Options({collapse: false}), ); this.scope.workspace = workspaceWithOptions; @@ -269,7 +269,7 @@ suite('Context Menu Items', function () { chai.assert.equal( this.expandOption.preconditionFn(this.scope), 'hidden', - 'Should be hidden if collapse is disabled in options' + 'Should be hidden if collapse is disabled in options', ); } finally { workspaceTeardown.call(this, workspaceWithOptions); @@ -290,11 +290,11 @@ suite('Context Menu Items', function () { chai.assert.isFalse( block1.isCollapsed(), - 'Previously expanded block should still be expanded' + 'Previously expanded block should still be expanded', ); chai.assert.isFalse( block2.isCollapsed(), - 'Previously collapsed block should now be expanded' + 'Previously collapsed block should now be expanded', ); }); @@ -312,14 +312,14 @@ suite('Context Menu Items', function () { this.workspace.newBlock('text'); chai.assert.equal( this.deleteOption.preconditionFn(this.scope), - 'enabled' + 'enabled', ); }); test('Disabled when no blocks to delete', function () { chai.assert.equal( this.deleteOption.preconditionFn(this.scope), - 'disabled' + 'disabled', ); }); @@ -354,7 +354,7 @@ suite('Context Menu Items', function () { test('No dialog for single block', function () { const confirmStub = sinon.stub( Blockly.dialog.TEST_ONLY, - 'confirmInternal' + 'confirmInternal', ); this.workspace.newBlock('text'); this.deleteOption.callback(this.scope); @@ -370,7 +370,7 @@ suite('Context Menu Items', function () { chai.assert.equal( this.deleteOption.displayText(this.scope), - 'Delete 2 Blocks' + 'Delete 2 Blocks', ); }); @@ -378,7 +378,7 @@ suite('Context Menu Items', function () { this.workspace.newBlock('text'); chai.assert.equal( this.deleteOption.displayText(this.scope), - 'Delete Block' + 'Delete Block', ); }); }); @@ -399,7 +399,7 @@ suite('Context Menu Items', function () { // Block is duplicatable by default chai.assert.equal( this.duplicateOption.preconditionFn(this.scope), - 'enabled' + 'enabled', ); }); @@ -407,7 +407,7 @@ suite('Context Menu Items', function () { sinon.stub(this.block, 'isDuplicatable').returns(false); chai.assert.equal( this.duplicateOption.preconditionFn(this.scope), - 'disabled' + 'disabled', ); }); @@ -415,7 +415,7 @@ suite('Context Menu Items', function () { this.block.isInFlyout = true; chai.assert.equal( this.duplicateOption.preconditionFn(this.scope), - 'hidden' + 'hidden', ); }); @@ -441,7 +441,7 @@ suite('Context Menu Items', function () { test('Enabled for normal block', function () { chai.assert.equal( this.commentOption.preconditionFn(this.scope), - 'enabled' + 'enabled', ); }); @@ -453,20 +453,20 @@ suite('Context Menu Items', function () { chai.assert.equal( this.commentOption.preconditionFn(this.scope), - 'hidden' + 'hidden', ); }); test('Creates comment if one did not exist', function () { chai.assert.isUndefined( this.block.getIcon(Blockly.icons.CommentIcon.TYPE), - 'New block should not have a comment' + 'New block should not have a comment', ); this.commentOption.callback(this.scope); chai.assert.exists(this.block.getIcon(Blockly.icons.CommentIcon.TYPE)); chai.assert.isEmpty( this.block.getCommentText(), - 'Block should have empty comment text' + 'Block should have empty comment text', ); }); @@ -475,14 +475,14 @@ suite('Context Menu Items', function () { this.commentOption.callback(this.scope); chai.assert.isNull( this.block.getCommentText(), - 'Block should not have comment after removal' + 'Block should not have comment after removal', ); }); test('Has correct label for add comment', function () { chai.assert.equal( this.commentOption.displayText(this.scope), - 'Add Comment' + 'Add Comment', ); }); @@ -490,7 +490,7 @@ suite('Context Menu Items', function () { this.block.setCommentText('Test comment'); chai.assert.equal( this.commentOption.displayText(this.scope), - 'Remove Comment' + 'Remove Comment', ); }); }); @@ -505,7 +505,7 @@ suite('Context Menu Items', function () { this.block.appendValueInput('test2'); chai.assert.equal( this.inlineOption.preconditionFn(this.scope), - 'enabled' + 'enabled', ); }); }); diff --git a/tests/mocha/cursor_test.js b/tests/mocha/cursor_test.js index 56ad69d21..c435a1e5e 100644 --- a/tests/mocha/cursor_test.js +++ b/tests/mocha/cursor_test.js @@ -87,7 +87,7 @@ suite('Cursor', function () { test('Next - From a Previous skip over next connection and block', function () { const prevNode = ASTNode.createConnectionNode( - this.blocks.A.previousConnection + this.blocks.A.previousConnection, ); this.cursor.setCurNode(prevNode); this.cursor.next(); @@ -96,7 +96,7 @@ suite('Cursor', function () { }); test('Next - From last block in a stack go to next connection', function () { const prevNode = ASTNode.createConnectionNode( - this.blocks.B.previousConnection + this.blocks.B.previousConnection, ); this.cursor.setCurNode(prevNode); this.cursor.next(); @@ -107,14 +107,14 @@ suite('Cursor', function () { test('In - From output connection', function () { const fieldBlock = this.blocks.E; const outputNode = ASTNode.createConnectionNode( - fieldBlock.outputConnection + fieldBlock.outputConnection, ); this.cursor.setCurNode(outputNode); this.cursor.in(); const curNode = this.cursor.getCurNode(); chai.assert.equal( curNode.getLocation(), - fieldBlock.inputList[0].fieldRow[0] + fieldBlock.inputList[0].fieldRow[0], ); }); diff --git a/tests/mocha/dropdowndiv_test.js b/tests/mocha/dropdowndiv_test.js index 345be60df..a2e08e4d1 100644 --- a/tests/mocha/dropdowndiv_test.js +++ b/tests/mocha/dropdowndiv_test.js @@ -50,7 +50,7 @@ suite('DropDownDiv', function () { 50, 0, 50, - -10 + -10, ); // "Above" in value actually means below in render. chai.assert.isAtLeast(metrics.initialY, 0); @@ -63,7 +63,7 @@ suite('DropDownDiv', function () { 50, 100, 50, - 90 + 90, ); // "Below" in value actually means above in render. chai.assert.isAtMost(metrics.initialY, 100); @@ -76,7 +76,7 @@ suite('DropDownDiv', function () { 50, 60, 50, - 50 + 50, ); // "Above" in value actually means below in render. chai.assert.isAtLeast(metrics.initialY, 60); @@ -89,7 +89,7 @@ suite('DropDownDiv', function () { 50, 100, 50, - 90 + 90, ); // "Below" in value actually means above in render. chai.assert.isAtMost(metrics.initialY, 100); @@ -105,7 +105,7 @@ suite('DropDownDiv', function () { 50, 60, 50, - 50 + 50, ); // "Above" in value actually means below in render. chai.assert.equal(metrics.initialY, 0); diff --git a/tests/mocha/event_block_change_test.js b/tests/mocha/event_block_change_test.js index 98a8b8b40..398238527 100644 --- a/tests/mocha/event_block_change_test.js +++ b/tests/mocha/event_block_change_test.js @@ -37,14 +37,14 @@ suite('Block Change Event', function () { test('Undo', function () { const block = this.workspace.newBlock('xml_block', 'block_id'); block.domToMutation( - Blockly.utils.xml.textToDom('') + Blockly.utils.xml.textToDom(''), ); const blockChange = new Blockly.Events.BlockChange( block, 'mutation', null, '', - '' + '', ); blockChange.run(false); chai.assert.isFalse(block.hasInput); @@ -57,7 +57,7 @@ suite('Block Change Event', function () { 'mutation', null, '', - '' + '', ); blockChange.run(true); chai.assert.isTrue(block.hasInput); @@ -73,7 +73,7 @@ suite('Block Change Event', function () { 'mutation', null, '', - '{"hasInput":true}' + '{"hasInput":true}', ); blockChange.run(false); chai.assert.isFalse(block.hasInput); @@ -86,7 +86,7 @@ suite('Block Change Event', function () { 'mutation', null, '', - '{"hasInput":true}' + '{"hasInput":true}', ); blockChange.run(true); chai.assert.isTrue(block.hasInput); @@ -108,14 +108,14 @@ suite('Block Change Event', function () { test('events round-trip through JSON', function () { const block = this.workspace.newBlock('xml_block', 'block_id'); block.domToMutation( - Blockly.utils.xml.textToDom('') + Blockly.utils.xml.textToDom(''), ); const origEvent = new Blockly.Events.BlockChange( block, 'mutation', null, '', - '' + '', ); const json = origEvent.toJson(); diff --git a/tests/mocha/event_block_create_test.js b/tests/mocha/event_block_create_test.js index 7a28979e3..1469df4bb 100644 --- a/tests/mocha/event_block_create_test.js +++ b/tests/mocha/event_block_create_test.js @@ -42,7 +42,7 @@ suite('Block Create Event', function () { }, }, }, - this.workspace + this.workspace, ); Blockly.Events.enable(); block.getInput('INPUT').connection.disconnect(); @@ -51,7 +51,7 @@ suite('Block Create Event', function () { Blockly.Events.BlockCreate, {'recordUndo': false, 'type': eventUtils.BLOCK_CREATE}, this.workspace.id, - 'shadowId' + 'shadowId', ); const calls = this.eventsFireStub.getCalls(); const event = calls[calls.length - 1].args[0]; diff --git a/tests/mocha/event_block_field_intermediate_change_test.js b/tests/mocha/event_block_field_intermediate_change_test.js index 7fc9581f3..6990eda19 100644 --- a/tests/mocha/event_block_field_intermediate_change_test.js +++ b/tests/mocha/event_block_field_intermediate_change_test.js @@ -28,7 +28,7 @@ suite('Field Intermediate Change Event', function () { block, 'TEXT', 'old value', - 'new value' + 'new value', ); const json = origEvent.toJson(); diff --git a/tests/mocha/event_bubble_open_test.js b/tests/mocha/event_bubble_open_test.js index c5d4acade..910030b9d 100644 --- a/tests/mocha/event_bubble_open_test.js +++ b/tests/mocha/event_bubble_open_test.js @@ -31,7 +31,7 @@ suite('Bubble Open Event', function () { const origEvent = new Blockly.Events.BubbleOpen( block, true, - Blockly.Events.BubbleType.MUTATOR + Blockly.Events.BubbleType.MUTATOR, ); const json = origEvent.toJson(); diff --git a/tests/mocha/event_click_test.js b/tests/mocha/event_click_test.js index d6a998b43..47ee96edf 100644 --- a/tests/mocha/event_click_test.js +++ b/tests/mocha/event_click_test.js @@ -29,7 +29,7 @@ suite('Click Event', function () { const origEvent = new Blockly.Events.Click( block, undefined, - Blockly.Events.ClickTarget.BLOCK + Blockly.Events.ClickTarget.BLOCK, ); const json = origEvent.toJson(); diff --git a/tests/mocha/event_comment_change_test.js b/tests/mocha/event_comment_change_test.js index 2d0523bac..fd9827ac6 100644 --- a/tests/mocha/event_comment_change_test.js +++ b/tests/mocha/event_comment_change_test.js @@ -27,12 +27,12 @@ suite('Comment Change Event', function () { this.workspace, 'old text', 10, - 10 + 10, ); const origEvent = new Blockly.Events.CommentChange( comment, 'old text', - 'new text' + 'new text', ); const json = origEvent.toJson(); diff --git a/tests/mocha/event_comment_create_test.js b/tests/mocha/event_comment_create_test.js index a25e88153..31ebd2e94 100644 --- a/tests/mocha/event_comment_create_test.js +++ b/tests/mocha/event_comment_create_test.js @@ -27,7 +27,7 @@ suite('Comment Create Event', function () { this.workspace, 'test text', 10, - 10 + 10, ); const origEvent = new Blockly.Events.CommentCreate(comment); diff --git a/tests/mocha/event_comment_delete_test.js b/tests/mocha/event_comment_delete_test.js index bc5db9d91..ae9c016b6 100644 --- a/tests/mocha/event_comment_delete_test.js +++ b/tests/mocha/event_comment_delete_test.js @@ -27,7 +27,7 @@ suite('Comment Delete Event', function () { this.workspace, 'test text', 10, - 10 + 10, ); const origEvent = new Blockly.Events.CommentDelete(comment); diff --git a/tests/mocha/event_comment_move_test.js b/tests/mocha/event_comment_move_test.js index 53f6ce411..d192053f0 100644 --- a/tests/mocha/event_comment_move_test.js +++ b/tests/mocha/event_comment_move_test.js @@ -27,7 +27,7 @@ suite('Comment Move Event', function () { this.workspace, 'test text', 10, - 10 + 10, ); const origEvent = new Blockly.Events.CommentMove(comment); comment.moveBy(10, 10); diff --git a/tests/mocha/event_marker_move_test.js b/tests/mocha/event_marker_move_test.js index 5b8606136..df8fa544a 100644 --- a/tests/mocha/event_marker_move_test.js +++ b/tests/mocha/event_marker_move_test.js @@ -33,7 +33,7 @@ suite('Marker Move Event', function () { block2, false, node1, - node2 + node2, ); const json = origEvent.toJson(); diff --git a/tests/mocha/event_selected_test.js b/tests/mocha/event_selected_test.js index 12b0ba6d8..83a64a566 100644 --- a/tests/mocha/event_selected_test.js +++ b/tests/mocha/event_selected_test.js @@ -30,7 +30,7 @@ suite('Selected Event', function () { const origEvent = new Blockly.Events.Selected( block1.id, block2.id, - this.workspace.id + this.workspace.id, ); const json = origEvent.toJson(); diff --git a/tests/mocha/event_test.js b/tests/mocha/event_test.js index 4d47306f5..1fd7addb1 100644 --- a/tests/mocha/event_test.js +++ b/tests/mocha/event_test.js @@ -87,7 +87,7 @@ suite('Events', function () { 'recordUndo': false, 'group': '', }, - true + true, ); }); @@ -95,7 +95,7 @@ suite('Events', function () { const event = new Blockly.Events.Click( null, this.workspace.id, - 'workspace' + 'workspace', ); assertEventEquals( event, @@ -107,7 +107,7 @@ suite('Events', function () { 'recordUndo': false, 'group': '', }, - true + true, ); }); @@ -143,7 +143,7 @@ suite('Events', function () { { 'recordUndo': true, 'group': '', - } + }, ); }); @@ -158,7 +158,7 @@ suite('Events', function () { { 'recordUndo': true, 'group': '', - } + }, ); }); @@ -176,7 +176,7 @@ suite('Events', function () { 'recordUndo': false, 'group': TEST_GROUP_ID, }, - true + true, ); }); @@ -198,7 +198,7 @@ suite('Events', function () { 'oldCoordinate': coordinate, 'recordUndo': true, 'group': '', - } + }, ); }); @@ -220,7 +220,7 @@ suite('Events', function () { 'oldCoordinate': undefined, 'recordUndo': true, 'group': '', - } + }, ); } finally { // This needs to be cleared, otherwise workspace.dispose will fail. @@ -259,7 +259,7 @@ suite('Events', function () { 'field', 'FIELD_NAME', 'old', - 'new' + 'new', ); sinon.assert.calledOnce(this.genUidStub); assertEventEquals( @@ -275,7 +275,7 @@ suite('Events', function () { 'newValue': 'new', 'recordUndo': true, 'group': '', - } + }, ); }); @@ -290,7 +290,7 @@ suite('Events', function () { { 'recordUndo': false, 'group': '', - } + }, ); }); @@ -305,7 +305,7 @@ suite('Events', function () { { 'recordUndo': false, 'group': '', - } + }, ); }); @@ -327,7 +327,7 @@ suite('Events', function () { 'oldCoordinate': undefined, 'recordUndo': false, 'group': '', - } + }, ); } finally { // This needs to be cleared, otherwise workspace.dispose will fail. @@ -347,7 +347,7 @@ suite('Events', function () { // at workspace dispose. this.block = new Blockly.Block( this.workspace, - 'field_variable_test_block' + 'field_variable_test_block', ); }); @@ -357,7 +357,7 @@ suite('Events', function () { 'field', 'VAR', 'id1', - 'id2' + 'id2', ); assertEventEquals( event, @@ -371,7 +371,7 @@ suite('Events', function () { 'newValue': 'id2', 'recordUndo': true, 'group': '', - } + }, ); }); }); @@ -528,7 +528,7 @@ suite('Events', function () { null, ASTNode.createWorkspaceNode( thisObj.workspace, - new Blockly.utils.Coordinate(0, 0) + new Blockly.utils.Coordinate(0, 0), ), ], getExpectedJson: (thisObj) => ({ @@ -539,7 +539,7 @@ suite('Events', function () { oldNode: undefined, newNode: ASTNode.createWorkspaceNode( thisObj.workspace, - new Blockly.utils.Coordinate(0, 0) + new Blockly.utils.Coordinate(0, 0), ), }), }, @@ -551,7 +551,7 @@ suite('Events', function () { true, ASTNode.createWorkspaceNode( thisObj.workspace, - new Blockly.utils.Coordinate(0, 0) + new Blockly.utils.Coordinate(0, 0), ), new ASTNode(ASTNode.types.BLOCK, thisObj.block), ], @@ -562,7 +562,7 @@ suite('Events', function () { blockId: thisObj.block.id, oldNode: ASTNode.createWorkspaceNode( thisObj.workspace, - new Blockly.utils.Coordinate(0, 0) + new Blockly.utils.Coordinate(0, 0), ), newNode: new ASTNode(ASTNode.types.BLOCK, thisObj.block), }), @@ -576,7 +576,7 @@ suite('Events', function () { new ASTNode(ASTNode.types.BLOCK, thisObj.block), ASTNode.createWorkspaceNode( thisObj.workspace, - new Blockly.utils.Coordinate(0, 0) + new Blockly.utils.Coordinate(0, 0), ), ], }, @@ -850,7 +850,7 @@ suite('Events', function () { thisObj.variable = thisObj.workspace.createVariable( 'name1', 'type1', - 'id1' + 'id1', ); }, }, @@ -880,7 +880,7 @@ suite('Events', function () { 'comment text', 0, 0, - 'comment id' + 'comment id', ); }, }, @@ -899,7 +899,7 @@ suite('Events', function () { chai.assert.equal( safeStringify(event2.toJson()), - safeStringify(json) + safeStringify(json), ); }); }); @@ -914,7 +914,7 @@ suite('Events', function () { chai.assert.equal( safeStringify(json), - safeStringify(expectedJson) + safeStringify(expectedJson), ); }); } @@ -968,7 +968,7 @@ suite('Events', function () { 'varName': 'name1', 'recordUndo': true, 'group': '', - } + }, ); }); @@ -985,7 +985,7 @@ suite('Events', function () { 'varName': 'name1', 'recordUndo': true, 'group': '', - } + }, ); }); @@ -1002,7 +1002,7 @@ suite('Events', function () { 'newName': 'name2', 'recordUndo': true, 'group': '', - } + }, ); }); }); @@ -1090,11 +1090,11 @@ suite('Events', function () { chai.assert.equal(filteredEvents.length, 4); // no event should have been removed. // test that the order hasn't changed chai.assert.isTrue( - filteredEvents[0] instanceof Blockly.Events.BlockCreate + filteredEvents[0] instanceof Blockly.Events.BlockCreate, ); chai.assert.isTrue(filteredEvents[1] instanceof Blockly.Events.BlockMove); chai.assert.isTrue( - filteredEvents[2] instanceof Blockly.Events.BlockChange + filteredEvents[2] instanceof Blockly.Events.BlockChange, ); chai.assert.isTrue(filteredEvents[3] instanceof Blockly.Events.Click); }); @@ -1122,7 +1122,7 @@ suite('Events', function () { chai.assert.equal(filteredEvents.length, 2); // duplicate moves should have been removed. // test that the order hasn't changed chai.assert.isTrue( - filteredEvents[0] instanceof Blockly.Events.BlockCreate + filteredEvents[0] instanceof Blockly.Events.BlockCreate, ); chai.assert.isTrue(filteredEvents[1] instanceof Blockly.Events.BlockMove); chai.assert.equal(filteredEvents[1].newCoordinate.x, 3); @@ -1139,7 +1139,7 @@ suite('Events', function () { chai.assert.equal(filteredEvents.length, 2); // duplicate event should have been removed. // test that the order hasn't changed chai.assert.isTrue( - filteredEvents[0] instanceof Blockly.Events.BlockCreate + filteredEvents[0] instanceof Blockly.Events.BlockCreate, ); chai.assert.isTrue(filteredEvents[1] instanceof Blockly.Events.BlockMove); chai.assert.equal(filteredEvents[1].newCoordinate.x, 1); @@ -1166,7 +1166,7 @@ suite('Events', function () { 'field', 'VAR', 'item1', - 'item2' + 'item2', ), ]; const filteredEvents = eventUtils.filter(events, true); @@ -1204,13 +1204,13 @@ suite('Events', function () { // click event merged into corresponding *Open event chai.assert.equal(filteredEvents.length, 3); chai.assert.isTrue( - filteredEvents[0] instanceof Blockly.Events.BubbleOpen + filteredEvents[0] instanceof Blockly.Events.BubbleOpen, ); chai.assert.isTrue( - filteredEvents[1] instanceof Blockly.Events.BubbleOpen + filteredEvents[1] instanceof Blockly.Events.BubbleOpen, ); chai.assert.isTrue( - filteredEvents[2] instanceof Blockly.Events.BubbleOpen + filteredEvents[2] instanceof Blockly.Events.BubbleOpen, ); chai.assert.equal(filteredEvents[0].bubbleType, 'comment'); chai.assert.equal(filteredEvents[1].bubbleType, 'mutator'); @@ -1273,7 +1273,7 @@ suite('Events', function () { chai.assert.isTrue(filteredEvents[0] instanceof Blockly.Events.BlockMove); chai.assert.isTrue(filteredEvents[1] instanceof Blockly.Events.BlockMove); chai.assert.isTrue( - filteredEvents[2] instanceof Blockly.Events.BlockDelete + filteredEvents[2] instanceof Blockly.Events.BlockDelete, ); chai.assert.isTrue(filteredEvents[3] instanceof Blockly.Events.BlockMove); }); @@ -1321,7 +1321,7 @@ suite('Events', function () { Blockly.Events.BlockDelete, {oldXml: expectedOldXml, group: ''}, workspaceSvg.id, - expectedId + expectedId, ); // Expect the workspace to not have a variable with ID 'test_block_id'. @@ -1358,7 +1358,7 @@ suite('Events', function () { chai.assert.equal( this.workspace.undoStack_.length, 2, - 'Undo stack length' + 'Undo stack length', ); assertNthCallEventArgEquals( @@ -1367,7 +1367,7 @@ suite('Events', function () { Blockly.Events.VarCreate, {group: TEST_GROUP_ID, varId: TEST_VAR_ID, varName: TEST_VAR_NAME}, this.workspace.id, - undefined + undefined, ); assertNthCallEventArgEquals( this.changeListenerSpy, @@ -1375,7 +1375,7 @@ suite('Events', function () { Blockly.Events.BlockCreate, {group: TEST_GROUP_ID}, this.workspace.id, - TEST_BLOCK_ID + TEST_BLOCK_ID, ); // Expect the workspace to have a variable with ID 'test_var_id'. @@ -1390,7 +1390,7 @@ suite('Events', function () { ' ' + ' name1' + ' ' + - '' + '', ); Blockly.Xml.domToWorkspace(dom, this.workspace); const TEST_BLOCK_ID = 'test_block_id'; @@ -1416,7 +1416,7 @@ suite('Events', function () { chai.assert.equal( this.workspace.undoStack_.length, 2, - 'Undo stack length' + 'Undo stack length', ); assertNthCallEventArgEquals( @@ -1425,7 +1425,7 @@ suite('Events', function () { Blockly.Events.VarCreate, {group: TEST_GROUP_ID, varId: TEST_VAR_ID, varName: TEST_VAR_NAME}, this.workspace.id, - undefined + undefined, ); assertNthCallEventArgEquals( this.changeListenerSpy, @@ -1433,7 +1433,7 @@ suite('Events', function () { Blockly.Events.BlockCreate, {group: TEST_GROUP_ID}, this.workspace.id, - TEST_BLOCK_ID + TEST_BLOCK_ID, ); // Finished loading event should not be part of event group. @@ -1443,7 +1443,7 @@ suite('Events', function () { Blockly.Events.FinishedLoading, {group: ''}, this.workspace.id, - undefined + undefined, ); // Expect the workspace to have a variable with ID 'test_var_id'. @@ -1470,7 +1470,7 @@ suite('Events', function () { chai.assert.isFalse( block.isEnabled(), - 'Expected orphan block to be disabled after creation' + 'Expected orphan block to be disabled after creation', ); }); test('Created procedure block is enabled', function () { @@ -1486,7 +1486,7 @@ suite('Events', function () { chai.assert.isTrue( functionBlock.isEnabled(), - 'Expected top-level procedure block to be enabled' + 'Expected top-level procedure block to be enabled', ); }); test('Moving a block to top-level disables it', function () { @@ -1510,7 +1510,7 @@ suite('Events', function () { chai.assert.isFalse( block.isEnabled(), - 'Expected disconnected block to be disabled' + 'Expected disconnected block to be disabled', ); }); test('Giving block a parent enables it', function () { @@ -1531,7 +1531,7 @@ suite('Events', function () { chai.assert.isTrue( block.isEnabled(), - 'Expected block to be enabled after connecting to parent' + 'Expected block to be enabled after connecting to parent', ); }); test('disableOrphans events are not undoable', function () { @@ -1558,7 +1558,7 @@ suite('Events', function () { }); chai.assert.isEmpty( disabledEvents, - 'Undo stack should not contain any disabled events' + 'Undo stack should not contain any disabled events', ); }); }); diff --git a/tests/mocha/event_theme_change_test.js b/tests/mocha/event_theme_change_test.js index f729bbdb1..1e3fa2c88 100644 --- a/tests/mocha/event_theme_change_test.js +++ b/tests/mocha/event_theme_change_test.js @@ -25,7 +25,7 @@ suite('Theme Change Event', function () { test('events round-trip through JSON', function () { const origEvent = new Blockly.Events.ThemeChange( 'new theme name', - this.workspace.id + this.workspace.id, ); const json = origEvent.toJson(); diff --git a/tests/mocha/event_toolbox_item_select_test.js b/tests/mocha/event_toolbox_item_select_test.js index 942a028d4..32b085781 100644 --- a/tests/mocha/event_toolbox_item_select_test.js +++ b/tests/mocha/event_toolbox_item_select_test.js @@ -53,7 +53,7 @@ suite('Toolbox Item Select Event', function () { const origEvent = new Blockly.Events.ToolboxItemSelect( items[0].getName(), items[1].getName(), - this.workspace.id + this.workspace.id, ); const json = origEvent.toJson(); diff --git a/tests/mocha/event_trashcan_open_test.js b/tests/mocha/event_trashcan_open_test.js index 2418bdb64..c85dbd3d1 100644 --- a/tests/mocha/event_trashcan_open_test.js +++ b/tests/mocha/event_trashcan_open_test.js @@ -25,7 +25,7 @@ suite('Trashcan Open Event', function () { test('events round-trip through JSON', function () { const origEvent = new Blockly.Events.TrashcanOpen( true, - this.workspace.id + this.workspace.id, ); const json = origEvent.toJson(); diff --git a/tests/mocha/event_var_create_test.js b/tests/mocha/event_var_create_test.js index c18977aae..433d5d4ae 100644 --- a/tests/mocha/event_var_create_test.js +++ b/tests/mocha/event_var_create_test.js @@ -27,7 +27,7 @@ suite('Var Create Event', function () { this.workspace, 'name', '', - 'id' + 'id', ); const origEvent = new Blockly.Events.VarCreate(varModel); @@ -42,7 +42,7 @@ suite('Var Create Event', function () { this.workspace, 'name', 'type', - 'id' + 'id', ); const origEvent = new Blockly.Events.VarCreate(varModel); diff --git a/tests/mocha/event_var_delete_test.js b/tests/mocha/event_var_delete_test.js index 9d962eec2..2619a8db0 100644 --- a/tests/mocha/event_var_delete_test.js +++ b/tests/mocha/event_var_delete_test.js @@ -27,7 +27,7 @@ suite('Var Delete Event', function () { this.workspace, 'name', '', - 'id' + 'id', ); const origEvent = new Blockly.Events.VarDelete(varModel); @@ -42,7 +42,7 @@ suite('Var Delete Event', function () { this.workspace, 'name', 'type', - 'id' + 'id', ); const origEvent = new Blockly.Events.VarDelete(varModel); diff --git a/tests/mocha/event_var_rename_test.js b/tests/mocha/event_var_rename_test.js index 73a142b39..8f9d63d88 100644 --- a/tests/mocha/event_var_rename_test.js +++ b/tests/mocha/event_var_rename_test.js @@ -27,7 +27,7 @@ suite('Var Rename Event', function () { this.workspace, 'old name', 'type', - 'id' + 'id', ); const origEvent = new Blockly.Events.VarRename(varModel, 'new name'); diff --git a/tests/mocha/event_viewport_test.js b/tests/mocha/event_viewport_test.js index 9a0ed2163..275d6854b 100644 --- a/tests/mocha/event_viewport_test.js +++ b/tests/mocha/event_viewport_test.js @@ -28,7 +28,7 @@ suite('Viewport Change Event', function () { 10, 1, this.workspace.id, - 0.8 + 0.8, ); const json = origEvent.toJson(); diff --git a/tests/mocha/extensions_test.js b/tests/mocha/extensions_test.js index ba30f5cfd..f918b935c 100644 --- a/tests/mocha/extensions_test.js +++ b/tests/mocha/extensions_test.js @@ -30,7 +30,7 @@ suite('Extensions', function () { this.extensionsCleanup_.push('extensions_test_after'); chai.assert.isUndefined( - Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test_before'] + Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test_before'], ); const beforeCallback = sinon.spy(); // Extension defined before the block type is defined. @@ -45,7 +45,7 @@ suite('Extensions', function () { ]); chai.assert.isUndefined( - Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test_after'] + Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test_after'], ); const afterCallback = sinon.spy(); // Extension defined after the block type (but before instantiation). @@ -53,11 +53,11 @@ suite('Extensions', function () { chai.assert.typeOf( Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test_before'], - 'function' + 'function', ); chai.assert.typeOf( Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test_after'], - 'function' + 'function', ); sinon.assert.notCalled(beforeCallback); sinon.assert.notCalled(afterCallback); @@ -96,7 +96,7 @@ suite('Extensions', function () { const block = new Blockly.Block( this.workspace, - 'test_parent_tooltip_when_inline' + 'test_parent_tooltip_when_inline', ); // Tooltip is dynamic after extension initialization. @@ -135,14 +135,14 @@ suite('Extensions', function () { }; chai.assert.isUndefined( - Blockly.Extensions.TEST_ONLY.allExtensions['mixin_test'] + Blockly.Extensions.TEST_ONLY.allExtensions['mixin_test'], ); // Extension defined before the block type is defined. Blockly.Extensions.registerMixin('mixin_test', testMixin); chai.assert.typeOf( Blockly.Extensions.TEST_ONLY.allExtensions['mixin_test'], - 'function' + 'function', ); Blockly.defineBlocksWithJsonArray([ @@ -213,7 +213,7 @@ suite('Extensions', function () { // meaningful value. Blockly.Events.disable(); chai.assert.isUndefined( - Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test'] + Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test'], ); const helperFunctionSpy = sinon.spy(); Blockly.Extensions.registerMutator( @@ -226,7 +226,7 @@ suite('Extensions', function () { return 'mutationToDomFn'; }, }, - helperFunctionSpy + helperFunctionSpy, ); const _ = new Blockly.Block(this.workspace, 'mutator_test_block'); @@ -249,7 +249,7 @@ suite('Extensions', function () { // meaningful value. Blockly.Events.disable(); chai.assert.isUndefined( - Blockly.Extensions.TEST_ONLY.allExtensions['mutator_test'] + Blockly.Extensions.TEST_ONLY.allExtensions['mutator_test'], ); Blockly.Extensions.registerMutator('mutator_test', { domToMutation: function () { @@ -282,7 +282,7 @@ suite('Extensions', function () { ]); chai.assert.isUndefined( - Blockly.Extensions.TEST_ONLY.allExtensions['missing_extension'] + Blockly.Extensions.TEST_ONLY.allExtensions['missing_extension'], ); const workspace = this.workspace; chai.assert.throws(function () { @@ -298,16 +298,16 @@ suite('Extensions', function () { }; chai.assert.isUndefined( - Blockly.Extensions.TEST_ONLY.allExtensions['mixin_bad_inputList'] + Blockly.Extensions.TEST_ONLY.allExtensions['mixin_bad_inputList'], ); // Extension defined before the block type is defined. Blockly.Extensions.registerMixin( 'mixin_bad_inputList', - TEST_MIXIN_BAD_INPUTLIST + TEST_MIXIN_BAD_INPUTLIST, ); chai.assert.typeOf( Blockly.Extensions.TEST_ONLY.allExtensions['mixin_bad_inputList'], - 'function' + 'function', ); Blockly.defineBlocksWithJsonArray([ @@ -332,16 +332,16 @@ suite('Extensions', function () { }; chai.assert.isUndefined( - Blockly.Extensions.TEST_ONLY.allExtensions['mixin_bad_colour_'] + Blockly.Extensions.TEST_ONLY.allExtensions['mixin_bad_colour_'], ); // Extension defined before the block type is defined. Blockly.Extensions.registerMixin( 'mixin_bad_colour_', - TEST_MIXIN_BAD_COLOUR + TEST_MIXIN_BAD_COLOUR, ); chai.assert.typeOf( Blockly.Extensions.TEST_ONLY.allExtensions['mixin_bad_colour_'], - 'function' + 'function', ); Blockly.defineBlocksWithJsonArray([ @@ -373,7 +373,7 @@ suite('Extensions', function () { // meaningful value. Blockly.Events.disable(); chai.assert.isUndefined( - Blockly.Extensions.TEST_ONLY.allExtensions['mutator_test'] + Blockly.Extensions.TEST_ONLY.allExtensions['mutator_test'], ); Blockly.Extensions.registerMutator('mutator_test', { domToMutation: function () { @@ -390,7 +390,7 @@ suite('Extensions', function () { }); // Should have failed on apply, not on register. chai.assert.isNotNull( - Blockly.Extensions.TEST_ONLY.allExtensions['mutator_test'] + Blockly.Extensions.TEST_ONLY.allExtensions['mutator_test'], ); }); @@ -409,7 +409,7 @@ suite('Extensions', function () { // meaningful value. Blockly.Events.disable(); chai.assert.isUndefined( - Blockly.Extensions.TEST_ONLY.allExtensions['mutator_test'] + Blockly.Extensions.TEST_ONLY.allExtensions['mutator_test'], ); Blockly.Extensions.registerMixin('mutator_test', { domToMutation: function () { @@ -426,7 +426,7 @@ suite('Extensions', function () { }); // Should have failed on apply, not on register. chai.assert.isNotNull( - Blockly.Extensions.TEST_ONLY.allExtensions['mutator_test'] + Blockly.Extensions.TEST_ONLY.allExtensions['mutator_test'], ); }); @@ -445,7 +445,7 @@ suite('Extensions', function () { // meaningful value. Blockly.Events.disable(); chai.assert.isUndefined( - Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test'] + Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test'], ); Blockly.Extensions.register('extensions_test', function () { return 'extensions_test_fn'; @@ -457,7 +457,7 @@ suite('Extensions', function () { }); // Should have failed on apply, not on register. chai.assert.isNotNull( - Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test'] + Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test'], ); }); @@ -465,7 +465,7 @@ suite('Extensions', function () { test('Just a string', function () { this.extensionsCleanup_.push('extension_just_a_string'); chai.assert.isUndefined( - Blockly.Extensions.TEST_ONLY.allExtensions['extension_just_a_string'] + Blockly.Extensions.TEST_ONLY.allExtensions['extension_just_a_string'], ); chai.assert.throws(function () { Blockly.Extensions.register('extension_just_a_string', null); @@ -475,7 +475,7 @@ suite('Extensions', function () { test('Null', function () { this.extensionsCleanup_.push('extension_is_null'); chai.assert.isUndefined( - Blockly.Extensions.TEST_ONLY.allExtensions['extension_is_null'] + Blockly.Extensions.TEST_ONLY.allExtensions['extension_is_null'], ); chai.assert.throws(function () { Blockly.Extensions.register('extension_is_null', null); @@ -485,7 +485,7 @@ suite('Extensions', function () { test('Undefined', function () { this.extensionsCleanup_.push('extension_is_undefined'); chai.assert.isUndefined( - Blockly.Extensions.TEST_ONLY.allExtensions['extension_is_undefined'] + Blockly.Extensions.TEST_ONLY.allExtensions['extension_is_undefined'], ); chai.assert.throws(function () { Blockly.Extensions.register('extension_is_undefined', null); diff --git a/tests/mocha/field_angle_test.js b/tests/mocha/field_angle_test.js index 067a91c3c..6ab130842 100644 --- a/tests/mocha/field_angle_test.js +++ b/tests/mocha/field_angle_test.js @@ -93,7 +93,7 @@ suite('Angle Fields', function () { validValueTestCases, invalidValueTestCases, validTestCaseAssertField, - assertFieldDefault + assertFieldDefault, ); runFromJsonSuiteTests( @@ -101,7 +101,7 @@ suite('Angle Fields', function () { validValueTestCases, invalidValueTestCases, validTestCaseAssertField, - assertFieldDefault + assertFieldDefault, ); suite('setValue', function () { @@ -112,7 +112,7 @@ suite('Angle Fields', function () { runSetValueTests( validValueTestCases, invalidValueTestCases, - defaultFieldValue + defaultFieldValue, ); test('With source block', function () { this.field.setSourceBlock(createTestBlock()); @@ -128,7 +128,7 @@ suite('Angle Fields', function () { runSetValueTests( validValueTestCases, invalidValueTestCases, - initialValue + initialValue, ); test('With source block', function () { this.field.setSourceBlock(createTestBlock()); @@ -184,7 +184,7 @@ suite('Angle Fields', function () { assertFieldValue( this.field, suiteInfo.expectedValue, - String(suiteInfo.value) + String(suiteInfo.value), ); }); test('When Not Editing', function () { diff --git a/tests/mocha/field_checkbox_test.js b/tests/mocha/field_checkbox_test.js index 6394a7f91..5e971cd0c 100644 --- a/tests/mocha/field_checkbox_test.js +++ b/tests/mocha/field_checkbox_test.js @@ -99,7 +99,7 @@ suite('Checkbox Fields', function () { assertFieldValue( field, testCase.expectedValue, - testCase.expectedValue.toLowerCase() + testCase.expectedValue.toLowerCase(), ); }; @@ -108,7 +108,7 @@ suite('Checkbox Fields', function () { validValueTestCases, invalidValueTestCases, validTestCaseAssertField, - assertFieldDefault + assertFieldDefault, ); runFromJsonSuiteTests( @@ -116,7 +116,7 @@ suite('Checkbox Fields', function () { validValueTestCases, invalidValueTestCases, validTestCaseAssertField, - assertFieldDefault + assertFieldDefault, ); suite('setValue', function () { @@ -128,7 +128,7 @@ suite('Checkbox Fields', function () { validValueTestCases, invalidValueTestCases, 'TRUE', - 'true' + 'true', ); }); suite('False -> New Value', function () { @@ -139,7 +139,7 @@ suite('Checkbox Fields', function () { validValueTestCases, invalidValueTestCases, 'FALSE', - 'false' + 'false', ); }); }); @@ -189,7 +189,7 @@ suite('Checkbox Fields', function () { assertFieldValue( this.field, suiteInfo.expectedValue, - String(suiteInfo.expectedValue).toLowerCase() + String(suiteInfo.expectedValue).toLowerCase(), ); }); }); @@ -201,7 +201,7 @@ suite('Checkbox Fields', function () { field.fieldGroup_ = Blockly.utils.dom.createSvgElement( Blockly.utils.Svg.G, {}, - null + null, ); field.sourceBlock_ = { RTL: false, @@ -268,7 +268,7 @@ suite('Checkbox Fields', function () { field.setCheckCharacter(null); chai.assert( field.textContent_.nodeValue, - Blockly.FieldCheckbox.CHECK_CHAR + Blockly.FieldCheckbox.CHECK_CHAR, ); }); }); diff --git a/tests/mocha/field_colour_test.js b/tests/mocha/field_colour_test.js index 11bbd4244..97aba7d95 100644 --- a/tests/mocha/field_colour_test.js +++ b/tests/mocha/field_colour_test.js @@ -156,7 +156,7 @@ suite('Colour Fields', function () { validValueTestCases, invalidValueTestCases, validTestCaseAssertField, - assertFieldDefault + assertFieldDefault, ); runFromJsonSuiteTests( @@ -164,7 +164,7 @@ suite('Colour Fields', function () { validValueTestCases, invalidValueTestCases, validTestCaseAssertField, - assertFieldDefault + assertFieldDefault, ); suite('setValue', function () { @@ -176,7 +176,7 @@ suite('Colour Fields', function () { validValueTestCases, invalidValueTestCases, defaultFieldValue, - defaultTextValue + defaultTextValue, ); test('With source block', function () { this.field.setSourceBlock(createTestBlock()); @@ -192,7 +192,7 @@ suite('Colour Fields', function () { validValueTestCases, invalidValueTestCases, '#aaaaaa', - '#aaa' + '#aaa', ); test('With source block', function () { this.field.setSourceBlock(createTestBlock()); @@ -242,7 +242,7 @@ suite('Colour Fields', function () { assertFieldValue( this.field, suiteInfo.expectedValue, - suiteInfo.expectedText + suiteInfo.expectedText, ); }); }); @@ -258,7 +258,7 @@ suite('Colour Fields', function () { chai.assert.equal(node.getAttribute('title'), titles[index]); chai.assert.equal( Blockly.utils.colour.parse(node.style.backgroundColor), - colours[index] + colours[index], ); let nextNode = node.nextSibling; @@ -319,7 +319,7 @@ suite('Colour Fields', function () { assertColoursAndTitles( field, ['#aaaaaa', '#ff0000'], - ['grey', '#ff0000'] + ['grey', '#ff0000'], ); }); // This is kinda derpy behavior, but I wanted to document it. diff --git a/tests/mocha/field_dropdown_test.js b/tests/mocha/field_dropdown_test.js index d9083fdfe..26820230e 100644 --- a/tests/mocha/field_dropdown_test.js +++ b/tests/mocha/field_dropdown_test.js @@ -149,14 +149,14 @@ suite('Dropdown Fields', function () { Blockly.FieldDropdown, validValueCreationTestCases, invalidValueCreationTestCases, - validTestCaseAssertField + validTestCaseAssertField, ); runFromJsonSuiteTests( Blockly.FieldDropdown, validValueCreationTestCases, invalidValueCreationTestCases, - validTestCaseAssertField + validTestCaseAssertField, ); /** @@ -188,7 +188,7 @@ suite('Dropdown Fields', function () { validValueSetValueTestCases, invalidValueSetValueTestCases, 'A', - 'a' + 'a', ); test('With source block', function () { this.field.setSourceBlock(createTestBlock()); diff --git a/tests/mocha/field_image_test.js b/tests/mocha/field_image_test.js index 12c2cae84..6911d8679 100644 --- a/tests/mocha/field_image_test.js +++ b/tests/mocha/field_image_test.js @@ -92,14 +92,14 @@ suite('Image Fields', function () { Blockly.FieldImage, validValueCreationTestCases, invalidValueTestCases, - validTestCaseAssertField + validTestCaseAssertField, ); runFromJsonSuiteTests( Blockly.FieldImage, validValueCreationTestCases, invalidValueTestCases, - validTestCaseAssertField + validTestCaseAssertField, ); /** @@ -123,7 +123,7 @@ suite('Image Fields', function () { validValueSetValueTestCases, invalidValueTestCases, 'src', - 'alt' + 'alt', ); }); diff --git a/tests/mocha/field_label_serializable_test.js b/tests/mocha/field_label_serializable_test.js index 3a1d4208e..61c6d72c7 100644 --- a/tests/mocha/field_label_serializable_test.js +++ b/tests/mocha/field_label_serializable_test.js @@ -83,7 +83,7 @@ suite('Label Serializable Fields', function () { validValueTestCases, invalidValueTestCases, validTestCaseAssertField, - assertFieldDefault + assertFieldDefault, ); runFromJsonSuiteTests( @@ -91,7 +91,7 @@ suite('Label Serializable Fields', function () { validValueTestCases, invalidValueTestCases, validTestCaseAssertField, - assertFieldDefault + assertFieldDefault, ); suite('setValue', function () { @@ -102,7 +102,7 @@ suite('Label Serializable Fields', function () { runSetValueTests( validValueTestCases, invalidValueTestCases, - defaultFieldValue + defaultFieldValue, ); test('With source block', function () { this.field.setSourceBlock(createTestBlock()); @@ -118,7 +118,7 @@ suite('Label Serializable Fields', function () { runSetValueTests( validValueTestCases, invalidValueTestCases, - initialValue + initialValue, ); test('With source block', function () { this.field.setSourceBlock(createTestBlock()); @@ -133,28 +133,28 @@ suite('Label Serializable Fields', function () { labelField.fieldGroup_ = Blockly.utils.dom.createSvgElement( Blockly.utils.Svg.G, {}, - null + null, ); labelField.constants_ = { FIELD_TEXT_BASELINE_Y: 13, }; labelField.initView(); chai.assert.isTrue( - Blockly.utils.dom.hasClass(labelField.textElement_, cssClass) + Blockly.utils.dom.hasClass(labelField.textElement_, cssClass), ); } function assertDoesNotHaveClass(labelField, cssClass) { labelField.fieldGroup_ = Blockly.utils.dom.createSvgElement( Blockly.utils.Svg.G, {}, - null + null, ); labelField.constants_ = { FIELD_TEXT_BASELINE_Y: 13, }; labelField.initView(); chai.assert.isFalse( - Blockly.utils.dom.hasClass(labelField.textElement_, cssClass) + Blockly.utils.dom.hasClass(labelField.textElement_, cssClass), ); } test('JS Constructor', function () { @@ -198,7 +198,7 @@ suite('Label Serializable Fields', function () { field.fieldGroup_ = Blockly.utils.dom.createSvgElement( Blockly.utils.Svg.G, {}, - null + null, ); field.constants_ = { FIELD_TEXT_BASELINE_Y: 13, @@ -207,7 +207,7 @@ suite('Label Serializable Fields', function () { field.setClass('testClass'); // Don't call assertHasClass b/c we don't want to re-initialize. chai.assert.isTrue( - Blockly.utils.dom.hasClass(field.textElement_, 'testClass') + Blockly.utils.dom.hasClass(field.textElement_, 'testClass'), ); }); test('setClass Before Initialization', function () { @@ -222,7 +222,7 @@ suite('Label Serializable Fields', function () { assertHasClass(field, 'testClass'); field.setClass(null); chai.assert.isFalse( - Blockly.utils.dom.hasClass(field.textElement_, 'testClass') + Blockly.utils.dom.hasClass(field.textElement_, 'testClass'), ); }); }); diff --git a/tests/mocha/field_label_test.js b/tests/mocha/field_label_test.js index 08aaeef45..a378334a2 100644 --- a/tests/mocha/field_label_test.js +++ b/tests/mocha/field_label_test.js @@ -79,7 +79,7 @@ suite('Label Fields', function () { validValueTestCases, invalidValueTestCases, validTestCaseAssertField, - assertFieldDefault + assertFieldDefault, ); runFromJsonSuiteTests( @@ -87,7 +87,7 @@ suite('Label Fields', function () { validValueTestCases, invalidValueTestCases, validTestCaseAssertField, - assertFieldDefault + assertFieldDefault, ); suite('setValue', function () { @@ -98,7 +98,7 @@ suite('Label Fields', function () { runSetValueTests( validValueTestCases, invalidValueTestCases, - defaultFieldValue + defaultFieldValue, ); test('With source block', function () { this.field.setSourceBlock(createTestBlock()); @@ -114,7 +114,7 @@ suite('Label Fields', function () { runSetValueTests( validValueTestCases, invalidValueTestCases, - initialValue + initialValue, ); test('With source block', function () { this.field.setSourceBlock(createTestBlock()); @@ -129,28 +129,28 @@ suite('Label Fields', function () { labelField.fieldGroup_ = Blockly.utils.dom.createSvgElement( Blockly.utils.Svg.G, {}, - null + null, ); labelField.constants_ = { FIELD_TEXT_BASELINE_Y: 13, }; labelField.initView(); chai.assert.isTrue( - Blockly.utils.dom.hasClass(labelField.textElement_, cssClass) + Blockly.utils.dom.hasClass(labelField.textElement_, cssClass), ); } function assertDoesNotHaveClass(labelField, cssClass) { labelField.fieldGroup_ = Blockly.utils.dom.createSvgElement( Blockly.utils.Svg.G, {}, - null + null, ); labelField.constants_ = { FIELD_TEXT_BASELINE_Y: 13, }; labelField.initView(); chai.assert.isFalse( - Blockly.utils.dom.hasClass(labelField.textElement_, cssClass) + Blockly.utils.dom.hasClass(labelField.textElement_, cssClass), ); } @@ -195,7 +195,7 @@ suite('Label Fields', function () { field.fieldGroup_ = Blockly.utils.dom.createSvgElement( Blockly.utils.Svg.G, {}, - null + null, ); field.constants_ = { FIELD_TEXT_BASELINE_Y: 13, @@ -204,7 +204,7 @@ suite('Label Fields', function () { field.setClass('testClass'); // Don't call assertHasClass b/c we don't want to re-initialize. chai.assert.isTrue( - Blockly.utils.dom.hasClass(field.textElement_, 'testClass') + Blockly.utils.dom.hasClass(field.textElement_, 'testClass'), ); }); test('setClass Before Initialization', function () { @@ -219,7 +219,7 @@ suite('Label Fields', function () { assertHasClass(field, 'testClass'); field.setClass(null); chai.assert.isFalse( - Blockly.utils.dom.hasClass(field.textElement_, 'testClass') + Blockly.utils.dom.hasClass(field.textElement_, 'testClass'), ); }); }); diff --git a/tests/mocha/field_multilineinput_test.js b/tests/mocha/field_multilineinput_test.js index 8daaad828..de2a8189f 100644 --- a/tests/mocha/field_multilineinput_test.js +++ b/tests/mocha/field_multilineinput_test.js @@ -95,7 +95,7 @@ suite('Multiline Input Fields', function () { validValueTestCases, invalidValueTestCases, validTestCaseAssertField, - assertFieldDefault + assertFieldDefault, ); runFromJsonSuiteTests( @@ -103,7 +103,7 @@ suite('Multiline Input Fields', function () { validValueTestCases, invalidValueTestCases, validTestCaseAssertField, - assertFieldDefault + assertFieldDefault, ); suite('setValue', function () { @@ -114,7 +114,7 @@ suite('Multiline Input Fields', function () { runSetValueTests( validValueTestCases, invalidValueTestCases, - defaultFieldValue + defaultFieldValue, ); test('With source block', function () { this.field.setSourceBlock(createTestBlock()); @@ -130,7 +130,7 @@ suite('Multiline Input Fields', function () { runSetValueTests( validValueTestCases, invalidValueTestCases, - initialValue + initialValue, ); test('With source block', function () { this.field.setSourceBlock(createTestBlock()); @@ -172,7 +172,7 @@ suite('Multiline Input Fields', function () { expectedCode: "'bark bark' + '\\n' + \n' bark bark bark' + '\\n' + \n' bark bar bark bark' + '\\n' + \n''", createBlock: createBlockFn( - 'bark bark\n bark bark bark\n bark bar bark bark\n' + 'bark bark\n bark bark bark\n bark bar bark bark\n', ), }, ], @@ -191,7 +191,7 @@ suite('Multiline Input Fields', function () { expectedCode: "'bark bark' + '\\n' +\n' bark bark bark' + '\\n' +\n' bark bar bark bark' + '\\n' +\n''", createBlock: createBlockFn( - 'bark bark\n bark bark bark\n bark bar bark bark\n' + 'bark bark\n bark bark bark\n bark bar bark bark\n', ), }, ], @@ -210,7 +210,7 @@ suite('Multiline Input Fields', function () { expectedCode: "'bark bark' .. '\\n' ..\n' bark bark bark' .. '\\n' ..\n' bark bar bark bark' .. '\\n' ..\n''", createBlock: createBlockFn( - 'bark bark\n bark bark bark\n bark bar bark bark\n' + 'bark bark\n bark bark bark\n bark bar bark bark\n', ), }, ], @@ -229,7 +229,7 @@ suite('Multiline Input Fields', function () { expectedCode: "'bark bark' . \"\\n\" .\n' bark bark bark' . \"\\n\" .\n' bark bar bark bark' . \"\\n\" .\n''", createBlock: createBlockFn( - 'bark bark\n bark bark bark\n bark bar bark bark\n' + 'bark bark\n bark bark bark\n bark bar bark bark\n', ), }, ], @@ -248,7 +248,7 @@ suite('Multiline Input Fields', function () { expectedCode: "'bark bark' + '\\n' + \n' bark bark bark' + '\\n' + \n' bark bar bark bark' + '\\n' + \n''", createBlock: createBlockFn( - 'bark bark\n bark bark bark\n bark bar bark bark\n' + 'bark bark\n bark bark bark\n bark bar bark bark\n', ), }, ], diff --git a/tests/mocha/field_number_test.js b/tests/mocha/field_number_test.js index f77f9ca13..3b03a5135 100644 --- a/tests/mocha/field_number_test.js +++ b/tests/mocha/field_number_test.js @@ -86,7 +86,7 @@ suite('Number Fields', function () { expectedMin, expectedMax, expectedPrecision, - expectedValue + expectedValue, ) { assertFieldValue(field, expectedValue); chai.assert.equal(field.getMin(), expectedMin, 'Min'); @@ -111,7 +111,7 @@ suite('Number Fields', function () { testCase.expectedValue, testCase.expectedValue, testCase.expectedValue, - testCase.expectedValue + testCase.expectedValue, ); }; @@ -120,7 +120,7 @@ suite('Number Fields', function () { validValueTestCases, invalidValueTestCases, validTestCaseAssertField, - assertFieldDefault + assertFieldDefault, ); runFromJsonSuiteTests( @@ -128,7 +128,7 @@ suite('Number Fields', function () { validValueTestCases, invalidValueTestCases, validTestCaseAssertField, - assertFieldDefault + assertFieldDefault, ); suite('setValue', function () { @@ -139,7 +139,7 @@ suite('Number Fields', function () { runSetValueTests( validValueTestCases, invalidValueTestCases, - defaultFieldValue + defaultFieldValue, ); }); suite('Value -> New Value', function () { @@ -150,7 +150,7 @@ suite('Number Fields', function () { runSetValueTests( validValueTestCases, invalidValueTestCases, - initialValue + initialValue, ); }); suite('Constraints', function () { @@ -307,7 +307,7 @@ suite('Number Fields', function () { assertFieldValue( this.field, suiteInfo.expectedValue, - String(suiteInfo.value) + String(suiteInfo.value), ); }); test('When Not Editing', function () { @@ -348,7 +348,7 @@ suite('Number Fields', function () { undefined, { min: -10, - } + }, ); assertNumberField(field, -10, Infinity, 0, 0); }); @@ -361,7 +361,7 @@ suite('Number Fields', function () { undefined, { min: -10, - } + }, ); assertNumberField(field, -10, Infinity, 0, 0); }); @@ -396,7 +396,7 @@ suite('Number Fields', function () { undefined, { max: 10, - } + }, ); assertNumberField(field, -Infinity, 10, 0, 0); }); @@ -409,7 +409,7 @@ suite('Number Fields', function () { undefined, { max: 10, - } + }, ); assertNumberField(field, -Infinity, 10, 0, 0); }); @@ -444,7 +444,7 @@ suite('Number Fields', function () { undefined, { precision: 1, - } + }, ); assertNumberField(field, -Infinity, Infinity, 1, 0); }); @@ -457,7 +457,7 @@ suite('Number Fields', function () { undefined, { precision: 1, - } + }, ); assertNumberField(field, -Infinity, Infinity, 1, 0); }); diff --git a/tests/mocha/field_test.js b/tests/mocha/field_test.js index e6cefcaed..c8e73e29d 100644 --- a/tests/mocha/field_test.js +++ b/tests/mocha/field_test.js @@ -209,7 +209,7 @@ suite('Abstract Fields', function () { const value = field.saveState(); chai.assert.equal( value, - 'test value' + 'test value', ); }); @@ -242,7 +242,7 @@ suite('Abstract Fields', function () { const value = Blockly.Xml.domToText(field.toXml(element)); chai.assert.equal( value, - 'test value' + 'test value', ); }); @@ -252,7 +252,7 @@ suite('Abstract Fields', function () { const value = Blockly.Xml.domToText(field.toXml(element)); chai.assert.equal( value, - 'custom value' + 'custom value', ); }); @@ -263,7 +263,7 @@ suite('Abstract Fields', function () { chai.assert.equal( value, 'test value' + 'attribute="custom value">test value', ); }); @@ -273,7 +273,7 @@ suite('Abstract Fields', function () { const value = Blockly.Xml.domToText(field.toXml(element)); chai.assert.equal( value, - 'custom value' + 'custom value', ); }); }); @@ -296,7 +296,7 @@ suite('Abstract Fields', function () { test('Xml super implementation', function () { const field = new CustomXmlCallSuperField(''); field.loadState( - 'test value' + 'test value', ); chai.assert.equal(field.getValue(), 'test value'); chai.assert.equal(field.someProperty, 'custom value'); @@ -326,7 +326,7 @@ suite('Abstract Fields', function () { test('No implementations', function () { const field = new DefaultSerializationField(''); field.fromXml( - Blockly.utils.xml.textToDom('test value') + Blockly.utils.xml.textToDom('test value'), ); chai.assert.equal(field.getValue(), 'test value'); }); @@ -334,7 +334,7 @@ suite('Abstract Fields', function () { test('Xml implementations', function () { const field = new CustomXmlField(''); field.fromXml( - Blockly.utils.xml.textToDom('custom value') + Blockly.utils.xml.textToDom('custom value'), ); chai.assert.equal(field.someProperty, 'custom value'); }); @@ -343,8 +343,8 @@ suite('Abstract Fields', function () { const field = new CustomXmlCallSuperField(''); field.fromXml( Blockly.utils.xml.textToDom( - 'test value' - ) + 'test value', + ), ); chai.assert.equal(field.getValue(), 'test value'); chai.assert.equal(field.someProperty, 'custom value'); @@ -353,7 +353,7 @@ suite('Abstract Fields', function () { test('XML andd JSO implementations', function () { const field = new CustomXmlAndJsoField(''); field.fromXml( - Blockly.utils.xml.textToDom('custom value') + Blockly.utils.xml.textToDom('custom value'), ); chai.assert.equal(field.someProperty, 'custom value'); }); @@ -684,9 +684,9 @@ suite('Abstract Fields', function () { Blockly.utils.xml.textToDom( '' + ' ' + - '' + '', ).children[0], - this.workspace + this.workspace, ); const field = block.getField('TOOLTIP'); chai.assert.equal(field.getClickTarget_().tooltip, 'tooltip'); @@ -704,9 +704,9 @@ suite('Abstract Fields', function () { Blockly.utils.xml.textToDom( '' + ' ' + - '' + '', ).children[0], - this.workspace + this.workspace, ); const field = block.getField('TOOLTIP'); chai.assert.equal(field.getClickTarget_().tooltip, 'tooltip'); @@ -723,9 +723,9 @@ suite('Abstract Fields', function () { Blockly.utils.xml.textToDom( '' + ' ' + - '' + '', ).children[0], - this.workspace + this.workspace, ); const field = block.getField('TOOLTIP'); field.setTooltip('tooltip'); @@ -748,9 +748,9 @@ suite('Abstract Fields', function () { Blockly.utils.xml.textToDom( '' + ' ' + - '' + '', ).children[0], - this.workspace + this.workspace, ); const field = block.getField('TOOLTIP'); chai.assert.equal(field.getClickTarget_().tooltip, block.tooltipFunc); @@ -771,9 +771,9 @@ suite('Abstract Fields', function () { Blockly.utils.xml.textToDom( '' + ' ' + - '' + '', ).children[0], - this.workspace + this.workspace, ); const field = block.getField('TOOLTIP'); chai.assert.equal(field.getClickTarget_().tooltip, block.element); @@ -791,9 +791,9 @@ suite('Abstract Fields', function () { Blockly.utils.xml.textToDom( '' + ' ' + - '' + '', ).children[0], - this.workspace + this.workspace, ); const field = block.getField('TOOLTIP'); chai.assert.equal(field.getClickTarget_().tooltip, block); @@ -810,9 +810,9 @@ suite('Abstract Fields', function () { Blockly.utils.xml.textToDom( '' + ' ' + - '' + '', ).children[0], - this.workspace + this.workspace, ); const field = block.getField('TOOLTIP'); chai.assert.equal(field.getClickTarget_().tooltip, block); diff --git a/tests/mocha/field_textinput_test.js b/tests/mocha/field_textinput_test.js index 2250429d0..27d950789 100644 --- a/tests/mocha/field_textinput_test.js +++ b/tests/mocha/field_textinput_test.js @@ -83,7 +83,7 @@ suite('Text Input Fields', function () { validValueTestCases, invalidValueTestCases, validTestCaseAssertField, - assertFieldDefault + assertFieldDefault, ); runFromJsonSuiteTests( @@ -91,7 +91,7 @@ suite('Text Input Fields', function () { validValueTestCases, invalidValueTestCases, validTestCaseAssertField, - assertFieldDefault + assertFieldDefault, ); suite('setValue', function () { @@ -102,7 +102,7 @@ suite('Text Input Fields', function () { runSetValueTests( validValueTestCases, invalidValueTestCases, - defaultFieldValue + defaultFieldValue, ); test('With source block', function () { this.field.setSourceBlock(createTestBlock()); @@ -118,7 +118,7 @@ suite('Text Input Fields', function () { runSetValueTests( validValueTestCases, invalidValueTestCases, - initialValue + initialValue, ); test('With source block', function () { this.field.setSourceBlock(createTestBlock()); @@ -176,7 +176,7 @@ suite('Text Input Fields', function () { assertFieldValue( this.field, suiteInfo.expectedValue, - suiteInfo.value + suiteInfo.value, ); }); test('When Not Editing', function () { @@ -231,7 +231,7 @@ suite('Text Input Fields', function () { field.showEditor_(); chai.assert.equal( field.htmlInput_.getAttribute('spellcheck'), - value.toString() + value.toString(), ); }; }); diff --git a/tests/mocha/field_variable_test.js b/tests/mocha/field_variable_test.js index 621b9c570..011c44dbc 100644 --- a/tests/mocha/field_variable_test.js +++ b/tests/mocha/field_variable_test.js @@ -122,7 +122,7 @@ suite('Variable Fields', function () { invalidValueCreationTestCases, validTestCaseAssertField, assertFieldDefault, - customCreateWithJs + customCreateWithJs, ); runFromJsonSuiteTests( @@ -131,7 +131,7 @@ suite('Variable Fields', function () { invalidValueCreationTestCases, validTestCaseAssertField, assertFieldDefault, - customCreateWithJson + customCreateWithJson, ); suite('initModel', function () { @@ -192,7 +192,7 @@ suite('Variable Fields', function () { validValueTestCases, invalidValueTestCases, FAKE_ID, - defaultFieldName + defaultFieldName, ); }); @@ -207,12 +207,12 @@ suite('Variable Fields', function () { } chai.assert.include( dropdownOptions[dropdownOptions.length - 2][0], - 'Rename' + 'Rename', ); chai.assert.include( dropdownOptions[dropdownOptions.length - 1][0], - 'Delete' + 'Delete', ); }; test('Contains variables created before field', function () { @@ -221,7 +221,7 @@ suite('Variable Fields', function () { // Expect that the dropdown options will contain the variables that exist const fieldVariable = initVariableField( this.workspace, - new Blockly.FieldVariable('name2') + new Blockly.FieldVariable('name2'), ); assertDropdownContents(fieldVariable, [ ['name1', 'id1'], @@ -232,7 +232,7 @@ suite('Variable Fields', function () { // Expect that the dropdown options will contain the variables that exist const fieldVariable = initVariableField( this.workspace, - new Blockly.FieldVariable('name1') + new Blockly.FieldVariable('name1'), ); // Expect that variables created after field creation will show up too. this.workspace.createVariable('name2', '', 'id2'); @@ -247,7 +247,7 @@ suite('Variable Fields', function () { // Expect that the dropdown options will contain the variables that exist const fieldVariable = initVariableField( this.workspace, - new Blockly.FieldVariable('name1') + new Blockly.FieldVariable('name1'), ); // Expect that variables created after field creation will show up too. this.workspace.createVariable('name3', '', 'id3'); @@ -266,7 +266,7 @@ suite('Variable Fields', function () { this.workspace.createVariable('name3', null, 'id3'); this.variableField = initVariableField( this.workspace, - new Blockly.FieldVariable('name1') + new Blockly.FieldVariable('name1'), ); }); suite('Null Validator', function () { @@ -311,7 +311,7 @@ suite('Variable Fields', function () { 'test', undefined, ['Type1'], - 'Type1' + 'Type1', ); chai.assert.deepEqual(field.variableTypes, ['Type1']); chai.assert.equal(field.defaultType, 'Type1'); @@ -334,7 +334,7 @@ suite('Variable Fields', function () { { variableTypes: ['Type1'], defaultType: 'Type1', - } + }, ); chai.assert.deepEqual(field.variableTypes, ['Type1']); chai.assert.equal(field.defaultType, 'Type1'); @@ -348,7 +348,7 @@ suite('Variable Fields', function () { { variableTypes: ['Type1'], defaultType: 'Type1', - } + }, ); chai.assert.deepEqual(field.variableTypes, ['Type1']); chai.assert.equal(field.defaultType, 'Type1'); @@ -374,14 +374,14 @@ suite('Variable Fields', function () { 'name1', null, ['type1', 'type2'], - 'type1' + 'type1', ); const resultTypes = fieldVariable.getVariableTypes(); chai.assert.deepEqual(resultTypes, ['type1', 'type2']); chai.assert.equal( fieldVariable.defaultType, 'type1', - 'Default type was wrong' + 'Default type was wrong', ); }); test('variableTypes is null', function () { @@ -416,7 +416,7 @@ suite('Variable Fields', function () { chai.assert.equal( fieldVariable.defaultType, 'b', - 'The variable field\'s default type should be "b"' + 'The variable field\'s default type should be "b"', ); }); test('No default type', function () { @@ -424,11 +424,11 @@ suite('Variable Fields', function () { chai.assert.equal( fieldVariable.defaultType, '', - "The variable field's default type should be the empty string" + "The variable field's default type should be the empty string", ); chai.assert.isNull( fieldVariable.variableTypes, - "The variable field's allowed types should be null" + "The variable field's allowed types should be null", ); }); test('Default type mismatch', function () { @@ -462,7 +462,7 @@ suite('Variable Fields', function () { ]); this.variableBlock = new Blockly.Block( this.workspace, - 'field_variable_test_block' + 'field_variable_test_block', ); this.variableField = this.variableBlock.getField('VAR'); }); @@ -507,7 +507,7 @@ suite('Variable Fields', function () { 'x', undefined, undefined, - 'String' + 'String', ); block.getInput('INPUT').appendField(field, 'VAR'); const jso = Blockly.serialization.blocks.save(block); @@ -536,7 +536,7 @@ suite('Variable Fields', function () { 'x', undefined, undefined, - 'String' + 'String', ); block.getInput('INPUT').appendField(field, 'VAR'); const jso = Blockly.serialization.blocks.save(block, { @@ -571,7 +571,7 @@ suite('Variable Fields', function () { }, }, }, - this.workspace + this.workspace, ); const variable = block.getField('VAR').getVariable(); chai.assert.equal(variable.name, 'test'); @@ -589,7 +589,7 @@ suite('Variable Fields', function () { }, }, }, - this.workspace + this.workspace, ); const variable = block.getField('VAR').getVariable(); chai.assert.equal(variable.name, 'test'); @@ -608,7 +608,7 @@ suite('Variable Fields', function () { }, }, }, - this.workspace + this.workspace, ); const variable = block.getField('VAR').getVariable(); chai.assert.equal(variable.name, 'test'); diff --git a/tests/mocha/flyout_test.js b/tests/mocha/flyout_test.js index 0e6686b29..18b512b5d 100644 --- a/tests/mocha/flyout_test.js +++ b/tests/mocha/flyout_test.js @@ -63,7 +63,7 @@ suite('Flyout', function () { chai.assert.equal( this.flyout.getY(), 0, - 'y coordinate in vertical flyout should be 0' + 'y coordinate in vertical flyout should be 0', ); }); test('x is right of workspace if flyout at right', function () { @@ -76,7 +76,7 @@ suite('Flyout', function () { chai.assert.equal( this.flyout.getX(), 100, - 'x should be right of workspace' + 'x should be right of workspace', ); }); test('x is 0 if flyout at left', function () { @@ -86,7 +86,7 @@ suite('Flyout', function () { chai.assert.equal( this.flyout.getX(), 0, - 'x should be 0 if the flyout is on the left' + 'x should be 0 if the flyout is on the left', ); }); }); @@ -114,7 +114,7 @@ suite('Flyout', function () { chai.assert.equal( this.flyout.getX(), 20, - 'x should be aligned with toolbox' + 'x should be aligned with toolbox', ); }); test('x is aligned with toolbox at right', function () { @@ -132,7 +132,7 @@ suite('Flyout', function () { chai.assert.equal( this.flyout.getX(), 90, - 'x + width should be aligned with toolbox' + 'x + width should be aligned with toolbox', ); }); }); @@ -154,7 +154,7 @@ suite('Flyout', function () { chai.assert.equal( this.flyout.getX(), 0, - 'x should be aligned with left edge' + 'x should be aligned with left edge', ); }); test('trashcan on right covers right edge of workspace', function () { @@ -173,7 +173,7 @@ suite('Flyout', function () { chai.assert.equal( this.flyout.getX(), 90, - 'x + width should be aligned with right edge' + 'x + width should be aligned with right edge', ); }); }); @@ -199,7 +199,7 @@ suite('Flyout', function () { chai.assert.equal( this.flyout.getX(), 0, - 'x coordinate in horizontal flyout should be 0' + 'x coordinate in horizontal flyout should be 0', ); }); test('y is 0 if flyout at top', function () { @@ -209,7 +209,7 @@ suite('Flyout', function () { chai.assert.equal( this.flyout.getY(), 0, - 'y should be 0 if flyout is at the top' + 'y should be 0 if flyout is at the top', ); }); test('y is below workspace if flyout at bottom', function () { @@ -222,7 +222,7 @@ suite('Flyout', function () { chai.assert.equal( this.flyout.getY(), 50, - 'y should be below the workspace' + 'y should be below the workspace', ); }); }); @@ -251,7 +251,7 @@ suite('Flyout', function () { chai.assert.equal( this.flyout.getY(), 20, - 'y should be aligned with toolbox' + 'y should be aligned with toolbox', ); }); test('y is aligned with toolbox at bottom', function () { @@ -269,7 +269,7 @@ suite('Flyout', function () { chai.assert.equal( this.flyout.getY(), 70, - 'y + height should be aligned with toolbox' + 'y + height should be aligned with toolbox', ); }); }); @@ -288,7 +288,7 @@ suite('Flyout', function () { chai.assert.equal( this.flyout.getY(), 0, - 'y should be aligned with top' + 'y should be aligned with top', ); }); test('trashcan on bottom covers bottom of workspace', function () { @@ -306,7 +306,7 @@ suite('Flyout', function () { chai.assert.equal( this.flyout.getY(), 40, - 'y + height should be aligned with bottom' + 'y + height should be aligned with bottom', ); }); }); @@ -381,7 +381,7 @@ suite('Flyout', function () { sinon .stub( this.flyout.workspace_.targetWorkspace, - 'getToolboxCategoryCallback' + 'getToolboxCategoryCallback', ) .returns(function () { return val; @@ -397,7 +397,7 @@ suite('Flyout', function () { this.flyout.show('someString'); }.bind(this), "Couldn't find a callback function when opening " + - 'a toolbox category.' + 'a toolbox category.', ); }); @@ -407,7 +407,7 @@ suite('Flyout', function () { test('NodeList', function () { this.stubAndAssert( - document.getElementById('toolbox-simple').childNodes + document.getElementById('toolbox-simple').childNodes, ); }); @@ -441,7 +441,7 @@ suite('Flyout', function () { const xml = Blockly.utils.xml.textToDom( '' + '' + - '' + '', ); this.flyout.show(xml); this.assertDisabled(true); @@ -451,7 +451,7 @@ suite('Flyout', function () { const xml = Blockly.utils.xml.textToDom( '' + '' + - '' + '', ); this.flyout.show(xml); this.assertDisabled(false); @@ -462,7 +462,7 @@ suite('Flyout', function () { const xml = Blockly.utils.xml.textToDom( '' + '' + - '' + '', ); this.flyout.show(xml); this.assertDisabled(true); @@ -472,7 +472,7 @@ suite('Flyout', function () { const xml = Blockly.utils.xml.textToDom( '' + '' + - '' + '', ); this.flyout.show(xml); this.assertDisabled(false); diff --git a/tests/mocha/generator_test.js b/tests/mocha/generator_test.js index a60c0cd86..7d1415874 100644 --- a/tests/mocha/generator_test.js +++ b/tests/mocha/generator_test.js @@ -43,14 +43,14 @@ suite('Generator', function () { test('One line', function () { chai.assert.equal( this.generator.prefixLines('Hello\n', '12'), - '12Hello\n' + '12Hello\n', ); }); test('Two lines', function () { chai.assert.equal( this.generator.prefixLines('Hello\nWorld\n', '***'), - '***Hello\n***World\n' + '***Hello\n***World\n', ); }); }); @@ -85,7 +85,7 @@ suite('Generator', function () { blockDisabled, opt_thisOnly, expectedCode, - opt_message + opt_message, ) { generator.forBlock['row_block'] = function (_) { return 'row_block'; @@ -123,7 +123,7 @@ suite('Generator', function () { false, false, 'row_blockstack_block', - 'thisOnly=false' + 'thisOnly=false', ); }); }); @@ -140,7 +140,7 @@ suite('Generator', function () { true, false, 'stack_block', - 'thisOnly=false' + 'thisOnly=false', ); }); }); @@ -170,7 +170,7 @@ suite('Generator', function () { generator, opt_thisOnly, expectedCode, - opt_message + opt_message, ) { generator.forBlock['test_loop_block'] = function (block) { return '{' + generator.statementToCode(block, 'DO') + '}'; diff --git a/tests/mocha/gesture_test.js b/tests/mocha/gesture_test.js index e4dabc338..01885427b 100644 --- a/tests/mocha/gesture_test.js +++ b/tests/mocha/gesture_test.js @@ -21,7 +21,7 @@ suite('Gesture', function () { const eventTarget = field.getClickTarget_(); chai.assert.exists( eventTarget, - 'Precondition: missing click target for field' + 'Precondition: missing click target for field', ); eventsFireStub.resetHistory(); @@ -44,7 +44,7 @@ suite('Gesture', function () { eventsFireStub, Blockly.Events.Selected, {newElementId: block.id, type: eventUtils.SELECTED}, - fieldWorkspace.id + fieldWorkspace.id, ); assertEventNotFired(eventsFireStub, Blockly.Events.Click, { type: eventUtils.CLICK, diff --git a/tests/mocha/icon_test.js b/tests/mocha/icon_test.js index 452295e9a..4c3d20492 100644 --- a/tests/mocha/icon_test.js +++ b/tests/mocha/icon_test.js @@ -66,7 +66,7 @@ suite('Icon', function () { chai.assert.isFalse( initViewSpy.called, - 'Expected initView to not be called' + 'Expected initView to not be called', ); }); @@ -79,12 +79,12 @@ suite('Icon', function () { block.addIcon(icon); chai.assert.isFalse( initViewSpy.called, - 'Expected initView to not be called before initing svg' + 'Expected initView to not be called before initing svg', ); block.initSvg(); chai.assert.isTrue( initViewSpy.calledOnce, - 'Expected initView to be called' + 'Expected initView to be called', ); }); @@ -101,9 +101,9 @@ suite('Icon', function () { block.addIcon(icon); chai.assert.isTrue( initViewSpy.calledOnce, - 'Expected initView to be called' + 'Expected initView to be called', ); - } + }, ); }); @@ -118,7 +118,7 @@ suite('Icon', function () { chai.assert.isFalse( applyColourSpy.called, - 'Expected applyColour to not be called' + 'Expected applyColour to not be called', ); }); @@ -131,12 +131,12 @@ suite('Icon', function () { block.addIcon(icon); chai.assert.isFalse( applyColourSpy.called, - 'Expected applyCOlour to not be called before initing svg' + 'Expected applyCOlour to not be called before initing svg', ); block.initSvg(); chai.assert.isTrue( applyColourSpy.calledOnce, - 'Expected applyColour to be called' + 'Expected applyColour to be called', ); }); @@ -152,9 +152,9 @@ suite('Icon', function () { block.addIcon(icon); chai.assert.isTrue( applyColourSpy.calledOnce, - 'Expected applyColour to be called' + 'Expected applyColour to be called', ); - } + }, ); test("applyColour is called when the block's color changes", function () { @@ -168,7 +168,7 @@ suite('Icon', function () { block.setColour('#cccccc'); chai.assert.isTrue( applyColourSpy.calledOnce, - 'Expected applyColour to be called' + 'Expected applyColour to be called', ); }); @@ -183,7 +183,7 @@ suite('Icon', function () { block.setStyle('logic_block'); chai.assert.isTrue( applyColourSpy.calledOnce, - 'Expected applyColour to be called' + 'Expected applyColour to be called', ); }); @@ -198,7 +198,7 @@ suite('Icon', function () { block.setEnabled(false); chai.assert.isTrue( applyColourSpy.calledOnce, - 'Expected applyColour to be called' + 'Expected applyColour to be called', ); }); @@ -213,7 +213,7 @@ suite('Icon', function () { block.setShadow(true); chai.assert.isTrue( applyColourSpy.calledOnce, - 'Expected applyColour to be called' + 'Expected applyColour to be called', ); }); }); @@ -229,7 +229,7 @@ suite('Icon', function () { chai.assert.isFalse( updateEditableSpy.called, - 'Expected updateEditable to not be called' + 'Expected updateEditable to not be called', ); }); @@ -242,12 +242,12 @@ suite('Icon', function () { block.addIcon(icon); chai.assert.isFalse( updateEditableSpy.called, - 'Expected updateEditable to not be called before initing svg' + 'Expected updateEditable to not be called before initing svg', ); block.initSvg(); chai.assert.isTrue( updateEditableSpy.calledOnce, - 'Expected updateEditable to be called' + 'Expected updateEditable to be called', ); }); @@ -263,9 +263,9 @@ suite('Icon', function () { block.addIcon(icon); chai.assert.isTrue( updateEditableSpy.calledOnce, - 'Expected updateEditable to be called' + 'Expected updateEditable to be called', ); - } + }, ); test('updateEditable is called when the block is made ineditable', function () { @@ -279,7 +279,7 @@ suite('Icon', function () { block.setEditable(false); chai.assert.isTrue( updateEditableSpy.calledOnce, - 'Expected updateEditable to be called' + 'Expected updateEditable to be called', ); }); @@ -295,7 +295,7 @@ suite('Icon', function () { block.setEditable(true); chai.assert.isTrue( updateEditableSpy.calledOnce, - 'Expected updateEditable to be called' + 'Expected updateEditable to be called', ); }); }); @@ -313,7 +313,7 @@ suite('Icon', function () { chai.assert.isFalse( updateCollapsedSpy.called, - 'Expected updateCollapsed to not be called' + 'Expected updateCollapsed to not be called', ); }); @@ -330,7 +330,7 @@ suite('Icon', function () { chai.assert.isTrue( updateCollapsedSpy.called, - 'Expected updateCollapsed to be called' + 'Expected updateCollapsed to be called', ); }); @@ -347,7 +347,7 @@ suite('Icon', function () { chai.assert.isTrue( updateCollapsedSpy.called, - 'Expected updateCollapsed to be called' + 'Expected updateCollapsed to be called', ); }); }); @@ -362,7 +362,7 @@ suite('Icon', function () { json, {'icons': {'serializable icon': 'some state'}}, 'Expected the JSON to include the saved state of the ' + - 'serializable icon.' + 'serializable icon.', ); }); @@ -373,7 +373,7 @@ suite('Icon', function () { chai.assert.notProperty( json, 'icons', - 'Expected the JSON to not include any saved state for icons' + 'Expected the JSON to not include any saved state for icons', ); }); }); @@ -382,7 +382,7 @@ suite('Icon', function () { test('registered icons are instantiated and added to the block', function () { Blockly.icons.registry.register( 'serializable icon', - MockSerializableIcon + MockSerializableIcon, ); const workspace = createHeadlessWorkspace(); @@ -397,7 +397,7 @@ suite('Icon', function () { block.getIcon('serializable icon').state, 'some state', 'Expected the icon to have been properly instantiated and ' + - 'deserialized' + 'deserialized', ); Blockly.icons.registry.unregister('serializable icon'); @@ -417,7 +417,7 @@ suite('Icon', function () { }, Blockly.serialization.exceptions.UnregisteredIcon, '', - 'Expected deserializing an unregistered icon to throw' + 'Expected deserializing an unregistered icon to throw', ); }); }); diff --git a/tests/mocha/index.html b/tests/mocha/index.html index e05169b07..a38e08517 100644 --- a/tests/mocha/index.html +++ b/tests/mocha/index.html @@ -1,4 +1,4 @@ - + diff --git a/tests/mocha/input_test.js b/tests/mocha/input_test.js index 65df41542..0d7abe6bd 100644 --- a/tests/mocha/input_test.js +++ b/tests/mocha/input_test.js @@ -25,7 +25,7 @@ suite('Inputs', function () { this.workspace = Blockly.inject('blocklyDiv'); this.block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(''), - this.workspace + this.workspace, ); this.renderStub = sinon.stub(this.block, 'queueRender'); diff --git a/tests/mocha/insertion_marker_manager_test.js b/tests/mocha/insertion_marker_manager_test.js index 96575c86c..1eeb8cac8 100644 --- a/tests/mocha/insertion_marker_manager_test.js +++ b/tests/mocha/insertion_marker_manager_test.js @@ -206,7 +206,7 @@ suite('Insertion marker manager', function () { this.stub .withArgs( 'fakeDragTarget', - Blockly.ComponentManager.Capability.DELETE_AREA + Blockly.ComponentManager.Capability.DELETE_AREA, ) .returns(true); const fakeDragTarget = { @@ -221,7 +221,7 @@ suite('Insertion marker manager', function () { this.stub .withArgs( 'fakeDragTarget', - Blockly.ComponentManager.Capability.DELETE_AREA + Blockly.ComponentManager.Capability.DELETE_AREA, ) .returns(true); const fakeDragTarget = { @@ -236,7 +236,7 @@ suite('Insertion marker manager', function () { this.stub .withArgs( 'fakeDragTarget', - Blockly.ComponentManager.Capability.DELETE_AREA + Blockly.ComponentManager.Capability.DELETE_AREA, ) .returns(false); const fakeDragTarget = { diff --git a/tests/mocha/insertion_marker_test.js b/tests/mocha/insertion_marker_test.js index f59c735df..b63452fae 100644 --- a/tests/mocha/insertion_marker_test.js +++ b/tests/mocha/insertion_marker_test.js @@ -59,7 +59,7 @@ suite('InsertionMarkers', function () { const value = javascriptGenerator.valueToCode( block, 'INPUT', - javascriptGenerator.ORDER_NONE + javascriptGenerator.ORDER_NONE, ); const code = 'row[' + block.id + '](' + value + ')'; return [code, javascriptGenerator.ORDER_NONE]; @@ -95,7 +95,7 @@ suite('InsertionMarkers', function () { ' ' + ' ' + ' ' + - '' + '', ); this.assertGen(xml, 'statement[a]{\n};\n'); }); @@ -107,7 +107,7 @@ suite('InsertionMarkers', function () { ' ' + ' ' + ' ' + - '' + '', ); this.assertGen(xml, 'statement[a]{\n};\n'); }); @@ -123,11 +123,11 @@ suite('InsertionMarkers', function () { ' ' + ' ' + ' ' + - '' + '', ); this.assertGen( xml, - 'statement[a]{\n' + ' statement[b]{\n' + ' };\n' + '};\n' + 'statement[a]{\n' + ' statement[b]{\n' + ' };\n' + '};\n', ); }); test('Marker Prev', function () { @@ -138,7 +138,7 @@ suite('InsertionMarkers', function () { ' ' + ' ' + ' ' + - '' + '', ); this.assertGen(xml, 'stack[a];\n'); }); @@ -150,7 +150,7 @@ suite('InsertionMarkers', function () { ' ' + ' ' + ' ' + - '' + '', ); this.assertGen(xml, 'stack[a];\n'); }); @@ -166,7 +166,7 @@ suite('InsertionMarkers', function () { ' ' + ' ' + ' ' + - '' + '', ); this.assertGen(xml, 'stack[a];\n' + 'stack[b];\n'); }); @@ -178,7 +178,7 @@ suite('InsertionMarkers', function () { ' ' + ' ' + ' ' + - '' + '', ); this.assertGen(xml, 'row[a]();\n'); }); @@ -190,7 +190,7 @@ suite('InsertionMarkers', function () { ' ' + ' ' + ' ' + - '' + '', ); this.assertGen(xml, 'row[a]();\n'); }); @@ -206,7 +206,7 @@ suite('InsertionMarkers', function () { ' ' + ' ' + ' ' + - '' + '', ); this.assertGen(xml, 'row[a](row[b]());\n'); }); @@ -215,7 +215,7 @@ suite('InsertionMarkers', function () { '' + ' ' + ' ' + - '' + '', ); this.assertGen(xml, 'stack[a];\n'); }); @@ -240,7 +240,7 @@ suite('InsertionMarkers', function () { ' ' + ' ' + ' ' + - '' + '', ); // Note how the x and y are not 20, they are slightly lower and end-er // because these are the coords of the wrapped block. @@ -248,7 +248,7 @@ suite('InsertionMarkers', function () { xml, '' + '' + - '' + '', ); }); test('Marker Enclosed', function () { @@ -259,13 +259,13 @@ suite('InsertionMarkers', function () { ' ' + ' ' + ' ' + - '' + '', ); this.assertXml( xml, '' + '' + - '' + '', ); }); test('Marker Enclosed and Surrounds', function () { @@ -280,7 +280,7 @@ suite('InsertionMarkers', function () { ' ' + ' ' + ' ' + - '' + '', ); this.assertXml( xml, @@ -290,7 +290,7 @@ suite('InsertionMarkers', function () { '' + '' + '' + - '' + '', ); }); test('Marker Prev', function () { @@ -301,7 +301,7 @@ suite('InsertionMarkers', function () { ' ' + ' ' + ' ' + - '' + '', ); // Note how the y coord is not at 20, it is lower. This is because these // are the coords of the next block. @@ -309,7 +309,7 @@ suite('InsertionMarkers', function () { xml, '' + '' + - '' + '', ); }); test('Marker Next', function () { @@ -320,13 +320,13 @@ suite('InsertionMarkers', function () { ' ' + ' ' + ' ' + - '' + '', ); this.assertXml( xml, '' + '' + - '' + '', ); }); test('Marker Middle of Stack', function () { @@ -341,7 +341,7 @@ suite('InsertionMarkers', function () { ' ' + ' ' + ' ' + - '' + '', ); this.assertXml( xml, @@ -351,7 +351,7 @@ suite('InsertionMarkers', function () { '' + '' + '' + - '' + '', ); }); test('Marker On Output', function () { @@ -362,7 +362,7 @@ suite('InsertionMarkers', function () { ' ' + ' ' + ' ' + - '' + '', ); // Note how the x value is not at 20. This is because these are the coords // of the wrapped block. @@ -370,7 +370,7 @@ suite('InsertionMarkers', function () { xml, '' + '' + - '' + '', ); }); test('Marker On Input', function () { @@ -381,13 +381,13 @@ suite('InsertionMarkers', function () { ' ' + ' ' + ' ' + - '' + '', ); this.assertXml( xml, '' + '' + - '' + '', ); }); test('Marker Middle of Row', function () { @@ -402,7 +402,7 @@ suite('InsertionMarkers', function () { ' ' + ' ' + ' ' + - '' + '', ); this.assertXml( xml, @@ -412,7 +412,7 @@ suite('InsertionMarkers', function () { '' + '' + '' + - '' + '', ); }); test('Marker Detatched', function () { @@ -420,13 +420,13 @@ suite('InsertionMarkers', function () { '' + ' ' + ' ' + - '' + '', ); this.assertXml( xml, '' + '' + - '' + '', ); }); }); diff --git a/tests/mocha/jso_deserialization_test.js b/tests/mocha/jso_deserialization_test.js index 34b5fead7..cadcc1374 100644 --- a/tests/mocha/jso_deserialization_test.js +++ b/tests/mocha/jso_deserialization_test.js @@ -44,7 +44,7 @@ suite('JSO Deserialization', function () { this.eventsFireStub, Blockly.Events.FinishedLoading, {type: eventUtils.FINISHED_LOADING}, - this.workspace.id + this.workspace.id, ); }); @@ -67,7 +67,7 @@ suite('JSO Deserialization', function () { this.eventsFireStub, Blockly.Events.FinishedLoading, {'group': 'my group', 'type': eventUtils.FINISHED_LOADING}, - this.workspace.id + this.workspace.id, ); }); @@ -123,7 +123,7 @@ suite('JSO Deserialization', function () { 'recordUndo': false, 'type': eventUtils.VAR_CREATE, }, - this.workspace.id + this.workspace.id, ); }); @@ -149,7 +149,7 @@ suite('JSO Deserialization', function () { 'recordUndo': true, 'type': eventUtils.VAR_CREATE, }, - this.workspace.id + this.workspace.id, ); }); @@ -174,7 +174,7 @@ suite('JSO Deserialization', function () { 'group': 'my group', 'type': eventUtils.VAR_CREATE, }, - this.workspace.id + this.workspace.id, ); }); @@ -239,7 +239,7 @@ suite('JSO Deserialization', function () { 'varType': '', 'type': eventUtils.VAR_CREATE, }, - this.workspace.id + this.workspace.id, ); }); }); @@ -265,7 +265,7 @@ suite('JSO Deserialization', function () { Blockly.Events.BlockCreate, {'recordUndo': false, 'type': eventUtils.BLOCK_CREATE}, this.workspace.id, - 'testId' + 'testId', ); }); @@ -290,7 +290,7 @@ suite('JSO Deserialization', function () { Blockly.Events.BlockCreate, {'recordUndo': true, 'type': eventUtils.BLOCK_CREATE}, this.workspace.id, - 'testId' + 'testId', ); }); @@ -314,7 +314,7 @@ suite('JSO Deserialization', function () { Blockly.Events.BlockCreate, {'group': 'my group', 'type': eventUtils.BLOCK_CREATE}, this.workspace.id, - 'testId' + 'testId', ); }); @@ -341,7 +341,7 @@ suite('JSO Deserialization', function () { const calls = this.eventsFireStub.getCalls(); const group = calls[0].args[0].group; chai.assert.isTrue( - calls.every((call) => call.args[0].group == group) + calls.every((call) => call.args[0].group == group), ); }); @@ -378,7 +378,7 @@ suite('JSO Deserialization', function () { Blockly.Events.BlockCreate, {type: eventUtils.BLOCK_CREATE}, this.workspace.id, - 'id1' + 'id1', ); }); }); @@ -397,7 +397,7 @@ suite('JSO Deserialization', function () { Blockly.Events.BlockCreate, {'recordUndo': false}, this.workspace.id, - 'testId' + 'testId', ); }); @@ -416,7 +416,7 @@ suite('JSO Deserialization', function () { Blockly.Events.BlockCreate, {'recordUndo': true, 'type': eventUtils.BLOCK_CREATE}, this.workspace.id, - 'testId' + 'testId', ); }); @@ -434,7 +434,7 @@ suite('JSO Deserialization', function () { Blockly.Events.BlockCreate, {'group': 'my group', 'type': eventUtils.BLOCK_CREATE}, this.workspace.id, - 'testId' + 'testId', ); }); }); @@ -498,7 +498,7 @@ suite('JSO Deserialization', function () { }; this.assertThrows( state, - Blockly.serialization.exceptions.MissingConnection + Blockly.serialization.exceptions.MissingConnection, ); }); @@ -521,7 +521,7 @@ suite('JSO Deserialization', function () { }; this.assertThrows( state, - Blockly.serialization.exceptions.MissingConnection + Blockly.serialization.exceptions.MissingConnection, ); }); @@ -542,7 +542,7 @@ suite('JSO Deserialization', function () { }; this.assertThrows( state, - Blockly.serialization.exceptions.MissingConnection + Blockly.serialization.exceptions.MissingConnection, ); }); @@ -563,7 +563,7 @@ suite('JSO Deserialization', function () { }; this.assertThrows( state, - Blockly.serialization.exceptions.MissingConnection + Blockly.serialization.exceptions.MissingConnection, ); }); @@ -586,7 +586,7 @@ suite('JSO Deserialization', function () { }; this.assertThrows( state, - Blockly.serialization.exceptions.MissingConnection + Blockly.serialization.exceptions.MissingConnection, ); }); }); @@ -611,7 +611,7 @@ suite('JSO Deserialization', function () { }; this.assertThrows( state, - Blockly.serialization.exceptions.BadConnectionCheck + Blockly.serialization.exceptions.BadConnectionCheck, ); }); }); @@ -643,7 +643,7 @@ suite('JSO Deserialization', function () { }; this.assertThrows( state, - Blockly.serialization.exceptions.RealChildOfShadow + Blockly.serialization.exceptions.RealChildOfShadow, ); }); @@ -669,7 +669,7 @@ suite('JSO Deserialization', function () { }; this.assertThrows( state, - Blockly.serialization.exceptions.RealChildOfShadow + Blockly.serialization.exceptions.RealChildOfShadow, ); }); }); @@ -678,11 +678,11 @@ suite('JSO Deserialization', function () { test('Priority', function () { const blocksSerializer = Blockly.registry.getClass( Blockly.registry.Type.SERIALIZER, - 'blocks' + 'blocks', ); const variablesSerializer = Blockly.registry.getClass( Blockly.registry.Type.SERIALIZER, - 'variables' + 'variables', ); Blockly.serialization.registry.unregister('blocks'); @@ -715,7 +715,7 @@ suite('JSO Deserialization', function () { Blockly.serialization.workspaces.load( {'first': {}, 'third': {}, 'second': {}}, - this.workspace + this.workspace, ); Blockly.serialization.registry.unregister('first'); @@ -758,7 +758,7 @@ suite('JSO Deserialization', function () { 'type': 'test_block', 'extraState': '', }, - this.workspace + this.workspace, ); delete Blockly.Blocks['test_block']; @@ -861,7 +861,7 @@ suite('JSO Deserialization', function () { this.procedureSerializer = new Blockly.serialization.procedures.ProcedureSerializer( MockProcedureModel, - MockParameterModel + MockParameterModel, ); this.procedureMap = this.workspace.getProcedureMap(); }); @@ -884,12 +884,12 @@ suite('JSO Deserialization', function () { const procedureModel = this.procedureMap.getProcedures()[0]; chai.assert.isNotNull( procedureModel, - 'Expected a procedure model to exist' + 'Expected a procedure model to exist', ); chai.assert.equal( procedureModel.getId(), 'test id', - 'Expected the procedure model ID to match the serialized ID' + 'Expected the procedure model ID to match the serialized ID', ); }); @@ -905,12 +905,12 @@ suite('JSO Deserialization', function () { const procedureModel = this.procedureMap.getProcedures()[0]; chai.assert.isNotNull( procedureModel, - 'Expected a procedure model to exist' + 'Expected a procedure model to exist', ); chai.assert.equal( procedureModel.getName(), 'test name', - 'Expected the procedure model name to match the serialized name' + 'Expected the procedure model name to match the serialized name', ); }); }); @@ -928,11 +928,11 @@ suite('JSO Deserialization', function () { const procedureModel = this.procedureMap.getProcedures()[0]; chai.assert.isNotNull( procedureModel, - 'Expected a procedure model to exist' + 'Expected a procedure model to exist', ); chai.assert.isNull( procedureModel.getReturnTypes(), - 'Expected the procedure model types to be null' + 'Expected the procedure model types to be null', ); }); @@ -948,15 +948,15 @@ suite('JSO Deserialization', function () { const procedureModel = this.procedureMap.getProcedures()[0]; chai.assert.isNotNull( procedureModel, - 'Expected a procedure model to exist' + 'Expected a procedure model to exist', ); chai.assert.isArray( procedureModel.getReturnTypes(), - 'Expected the procedure model types to be an array' + 'Expected the procedure model types to be an array', ); chai.assert.isEmpty( procedureModel.getReturnTypes(), - 'Expected the procedure model types array to be empty' + 'Expected the procedure model types array to be empty', ); }); @@ -972,17 +972,17 @@ suite('JSO Deserialization', function () { const procedureModel = this.procedureMap.getProcedures()[0]; chai.assert.isNotNull( procedureModel, - 'Expected a procedure model to exist' + 'Expected a procedure model to exist', ); chai.assert.isArray( procedureModel.getReturnTypes(), - 'Expected the procedure model types to be an array' + 'Expected the procedure model types to be an array', ); chai.assert.deepEqual( procedureModel.getReturnTypes(), ['test type 1', 'test type 2'], 'Expected the procedure model types array to be match the ' + - 'serialized array' + 'serialized array', ); }); }); @@ -1009,12 +1009,12 @@ suite('JSO Deserialization', function () { .getParameters()[0]; chai.assert.isNotNull( parameterModel, - 'Expected a parameter model to exist' + 'Expected a parameter model to exist', ); chai.assert.equal( parameterModel.getId(), 'test id', - 'Expected the parameter model ID to match the serialized ID' + 'Expected the parameter model ID to match the serialized ID', ); }); @@ -1038,12 +1038,12 @@ suite('JSO Deserialization', function () { .getParameters()[0]; chai.assert.isNotNull( parameterModel, - 'Expected a parameter model to exist' + 'Expected a parameter model to exist', ); chai.assert.equal( parameterModel.getName(), 'test name', - 'Expected the parameter model name to match the serialized name' + 'Expected the parameter model name to match the serialized name', ); }); }); @@ -1088,12 +1088,12 @@ suite('JSO Deserialization', function () { .getParameters()[0]; chai.assert.isNotNull( parameterModel, - 'Expected a parameter model to exist' + 'Expected a parameter model to exist', ); chai.assert.deepEqual( parameterModel.getTypes(), ['test type 1', 'test type 2'], - 'Expected the parameter model types to match the serialized types' + 'Expected the parameter model types to match the serialized types', ); }); }); diff --git a/tests/mocha/jso_serialization_test.js b/tests/mocha/jso_serialization_test.js index 36583611f..b8b28b170 100644 --- a/tests/mocha/jso_serialization_test.js +++ b/tests/mocha/jso_serialization_test.js @@ -236,7 +236,7 @@ suite('JSO Serialization', function () { assertProperty( jso, 'extraState', - '' + '', ); }); }); @@ -376,7 +376,7 @@ suite('JSO Serialization', function () { block .getInput(inputName) .connection.connect( - childBlock.outputConnection || childBlock.previousConnection + childBlock.outputConnection || childBlock.previousConnection, ); return block; }; @@ -387,8 +387,8 @@ suite('JSO Serialization', function () { .getInput(inputName) .connection.setShadowDom( Blockly.utils.xml.textToDom( - '' - ) + '', + ), ); return block; }; @@ -399,14 +399,14 @@ suite('JSO Serialization', function () { block .getInput(inputName) .connection.connect( - childBlock.outputConnection || childBlock.previousConnection + childBlock.outputConnection || childBlock.previousConnection, ); block .getInput(inputName) .connection.setShadowDom( Blockly.utils.xml.textToDom( - '' - ) + '', + ), ); return block; }; @@ -430,7 +430,7 @@ suite('JSO Serialization', function () { this.assertOverwrittenShadow = function (blockType, inputName) { const block = this.createBlockWithShadowAndChild( blockType, - inputName + inputName, ); const jso = Blockly.serialization.blocks.save(block); this.assertInput(jso, inputName, { @@ -464,7 +464,7 @@ suite('JSO Serialization', function () { this.assertNoOverwrittenShadow = function (blockType, inputName) { const block = this.createBlockWithShadowAndChild( blockType, - inputName + inputName, ); const jso = Blockly.serialization.blocks.save(block, { addInputBlocks: false, @@ -576,7 +576,7 @@ suite('JSO Serialization', function () { .getInput('NAME') .connection.connect(childBlock.previousConnection); childBlock.nextConnection.connect( - grandChildBlock.previousConnection + grandChildBlock.previousConnection, ); const jso = Blockly.serialization.blocks.save(block); this.assertInput(jso, 'NAME', { @@ -622,8 +622,8 @@ suite('JSO Serialization', function () { const block = this.workspace.newBlock('stack_block'); block.nextConnection.setShadowDom( Blockly.utils.xml.textToDom( - '' - ) + '', + ), ); return block; }; @@ -634,8 +634,8 @@ suite('JSO Serialization', function () { block.nextConnection.connect(childBlock.previousConnection); block.nextConnection.setShadowDom( Blockly.utils.xml.textToDom( - '' - ) + '', + ), ); return block; }; @@ -748,7 +748,7 @@ suite('JSO Serialization', function () { const jso = Blockly.serialization.blocks.save(block); chai.assert.deepEqual( jso['inputs']['INPUT']['block']['fields']['VAR'], - {'id': 'id4', 'name': 'item', 'type': ''} + {'id': 'id4', 'name': 'item', 'type': ''}, ); }); @@ -787,13 +787,13 @@ suite('JSO Serialization', function () { }); chai.assert.deepEqual( jso['inputs']['INPUT']['block']['fields']['VAR'], - {'id': 'id4'} + {'id': 'id4'}, ); chai.assert.isUndefined( - jso['inputs']['INPUT']['block']['fields']['VAR']['name'] + jso['inputs']['INPUT']['block']['fields']['VAR']['name'], ); chai.assert.isUndefined( - jso['inputs']['INPUT']['block']['fields']['VAR']['type'] + jso['inputs']['INPUT']['block']['fields']['VAR']['type'], ); }); @@ -808,10 +808,10 @@ suite('JSO Serialization', function () { 'id': 'id4', }); chai.assert.isUndefined( - jso['next']['block']['fields']['VAR']['name'] + jso['next']['block']['fields']['VAR']['name'], ); chai.assert.isUndefined( - jso['next']['block']['fields']['VAR']['type'] + jso['next']['block']['fields']['VAR']['type'], ); }); }); @@ -844,7 +844,7 @@ suite('JSO Serialization', function () { this.serializer = new Blockly.serialization.procedures.ProcedureSerializer( MockProcedureModel, - MockParameterModel + MockParameterModel, ); }); @@ -912,7 +912,7 @@ suite('JSO Serialization', function () { test('the state always has an id property', function () { const parameterModel = new MockParameterModel('testparam'); this.procedureMap.add( - new MockProcedureModel().insertParameter(parameterModel, 0) + new MockProcedureModel().insertParameter(parameterModel, 0), ); const jso = this.serializer.save(this.workspace); const parameter = jso[0]['parameters'][0]; @@ -922,7 +922,7 @@ suite('JSO Serialization', function () { test('the state always has a name property', function () { const parameterModel = new MockParameterModel('testparam'); this.procedureMap.add( - new MockProcedureModel().insertParameter(parameterModel, 0) + new MockProcedureModel().insertParameter(parameterModel, 0), ); const jso = this.serializer.save(this.workspace); const parameter = jso[0]['parameters'][0]; @@ -934,7 +934,7 @@ suite('JSO Serialization', function () { test('if the parameter has no type, there is no type property', function () { const parameterModel = new MockParameterModel('testparam'); this.procedureMap.add( - new MockProcedureModel().insertParameter(parameterModel, 0) + new MockProcedureModel().insertParameter(parameterModel, 0), ); const jso = this.serializer.save(this.workspace); const parameter = jso[0]['parameters'][0]; @@ -946,7 +946,7 @@ suite('JSO Serialization', function () { 'a type', ]); this.procedureMap.add( - new MockProcedureModel().insertParameter(parameterModel, 0) + new MockProcedureModel().insertParameter(parameterModel, 0), ); const jso = this.serializer.save(this.workspace); const parameter = jso[0]['parameters'][0]; diff --git a/tests/mocha/json_test.js b/tests/mocha/json_test.js index 214118a59..d8a139eed 100644 --- a/tests/mocha/json_test.js +++ b/tests/mocha/json_test.js @@ -59,11 +59,11 @@ suite('JSON Block Definitions', function () { }, [/missing a type attribute/, /missing a type attribute/]); chai.assert.isNotNull( Blockly.Blocks[BLOCK_TYPE1], - 'Block before bad blocks should be defined.' + 'Block before bad blocks should be defined.', ); chai.assert.isNotNull( Blockly.Blocks[BLOCK_TYPE2], - 'Block after bad blocks should be defined.' + 'Block after bad blocks should be defined.', ); chai.assert.equal(Object.keys(Blockly.Blocks).length, blockTypeCount + 2); }); @@ -91,11 +91,11 @@ suite('JSON Block Definitions', function () { }, /is null/); chai.assert.isNotNull( Blockly.Blocks[BLOCK_TYPE1], - 'Block before null in array should be defined.' + 'Block before null in array should be defined.', ); chai.assert.isNotNull( Blockly.Blocks[BLOCK_TYPE2], - 'Block after null in array should be defined.' + 'Block after null in array should be defined.', ); chai.assert.equal(Object.keys(Blockly.Blocks).length, blockTypeCount + 2); }); @@ -122,11 +122,11 @@ suite('JSON Block Definitions', function () { }, /is undefined/); chai.assert.isNotNull( Blockly.Blocks[BLOCK_TYPE1], - 'Block before undefined in array should be defined.' + 'Block before undefined in array should be defined.', ); chai.assert.isNotNull( Blockly.Blocks[BLOCK_TYPE2], - 'Block after undefined in array should be defined.' + 'Block after undefined in array should be defined.', ); chai.assert.equal(Object.keys(Blockly.Blocks).length, blockTypeCount + 2); }); diff --git a/tests/mocha/keydown_test.js b/tests/mocha/keydown_test.js index 4809330b3..e33f3c39d 100644 --- a/tests/mocha/keydown_test.js +++ b/tests/mocha/keydown_test.js @@ -51,7 +51,7 @@ suite('Key Down', function () { this.event = createKeyDownEvent(Blockly.utils.KeyCodes.ESC); this.hideChaffSpy = sinon.spy( Blockly.WorkspaceSvg.prototype, - 'hideChaff' + 'hideChaff', ); }); test('Simple', function () { @@ -76,7 +76,7 @@ suite('Key Down', function () { setup(function () { this.hideChaffSpy = sinon.spy( Blockly.WorkspaceSvg.prototype, - 'hideChaff' + 'hideChaff', ); setSelectedBlock(this.workspace); this.deleteSpy = sinon.spy(Blockly.common.getSelected(), 'dispose'); @@ -113,7 +113,7 @@ suite('Key Down', function () { this.copySpy = sinon.spy(Blockly.clipboard.TEST_ONLY, 'copyInternal'); this.hideChaffSpy = sinon.spy( Blockly.WorkspaceSvg.prototype, - 'hideChaff' + 'hideChaff', ); }); const testCases = [ @@ -204,7 +204,7 @@ suite('Key Down', function () { this.undoSpy = sinon.spy(this.workspace, 'undo'); this.hideChaffSpy = sinon.spy( Blockly.WorkspaceSvg.prototype, - 'hideChaff' + 'hideChaff', ); }); const testCases = [ @@ -268,7 +268,7 @@ suite('Key Down', function () { this.redoSpy = sinon.spy(this.workspace, 'undo'); this.hideChaffSpy = sinon.spy( Blockly.WorkspaceSvg.prototype, - 'hideChaff' + 'hideChaff', ); }); const testCases = [ @@ -338,7 +338,7 @@ suite('Key Down', function () { this.undoSpy = sinon.spy(this.workspace, 'undo'); this.hideChaffSpy = sinon.spy( Blockly.WorkspaceSvg.prototype, - 'hideChaff' + 'hideChaff', ); }); test('Simple', function () { @@ -356,7 +356,7 @@ suite('Key Down', function () { runReadOnlyTest( createKeyDownEvent(Blockly.utils.KeyCodes.Y, [ Blockly.utils.KeyCodes.CTRL, - ]) + ]), ); }); }); diff --git a/tests/mocha/metrics_test.js b/tests/mocha/metrics_test.js index de3c19d8a..7c551435f 100644 --- a/tests/mocha/metrics_test.js +++ b/tests/mocha/metrics_test.js @@ -55,19 +55,19 @@ suite('Metrics', function () { this.metricsManager = new Blockly.MetricsManager(this.ws); this.toolboxMetricsStub = sinon.stub( this.metricsManager, - 'getToolboxMetrics' + 'getToolboxMetrics', ); this.flyoutMetricsStub = sinon.stub( this.metricsManager, - 'getFlyoutMetrics' + 'getFlyoutMetrics', ); this.getToolboxStub = sinon.stub( this.metricsManager.workspace_, - 'getToolbox' + 'getToolbox', ); this.getFlyoutStub = sinon.stub( this.metricsManager.workspace_, - 'getFlyout' + 'getFlyout', ); }); test('Toolbox at left', function () { @@ -118,19 +118,19 @@ suite('Metrics', function () { this.metricsManager = new Blockly.MetricsManager(this.ws); this.toolboxMetricsStub = sinon.stub( this.metricsManager, - 'getToolboxMetrics' + 'getToolboxMetrics', ); this.flyoutMetricsStub = sinon.stub( this.metricsManager, - 'getFlyoutMetrics' + 'getFlyoutMetrics', ); this.getToolboxStub = sinon.stub( this.metricsManager.workspace_, - 'getToolbox' + 'getToolbox', ); this.getFlyoutStub = sinon.stub( this.metricsManager.workspace_, - 'getFlyout' + 'getFlyout', ); this.svgMetricsStub = sinon.stub(this.metricsManager, 'getSvgMetrics'); }); @@ -190,7 +190,7 @@ suite('Metrics', function () { this.getFlyoutStub.returns(true); const viewMetrics = this.metricsManager.getViewMetrics( - getWorkspaceCoordinates + getWorkspaceCoordinates, ); assertDimensionsMatch( @@ -198,7 +198,7 @@ suite('Metrics', function () { -SCROLL_X / scale, -SCROLL_Y / scale, 500 / scale, - 393 / scale + 393 / scale, ); }); }); @@ -374,7 +374,7 @@ suite('Metrics', function () { const contentMetrics = metricsManager.getScrollMetrics( true, mockViewMetrics, - mockContentMetrics + mockContentMetrics, ); // Should add half the view width to all sides. @@ -391,7 +391,7 @@ suite('Metrics', function () { const contentMetrics = metricsManager.getScrollMetrics( true, mockViewMetrics, - mockContentMetrics + mockContentMetrics, ); // Should add half the view width to all sides. @@ -408,7 +408,7 @@ suite('Metrics', function () { const contentMetrics = metricsManager.getScrollMetrics( true, mockViewMetrics, - mockContentMetrics + mockContentMetrics, ); // Should add half the view width to all sides. @@ -425,7 +425,7 @@ suite('Metrics', function () { const contentMetrics = metricsManager.getScrollMetrics( true, mockViewMetrics, - mockContentMetrics + mockContentMetrics, ); // Should add half of the view width to all sides. @@ -442,7 +442,7 @@ suite('Metrics', function () { const contentMetrics = metricsManager.getScrollMetrics( true, mockViewMetrics, - mockContentMetrics + mockContentMetrics, ); // Should add half of the view width to all sides. @@ -459,7 +459,7 @@ suite('Metrics', function () { const contentMetrics = metricsManager.getScrollMetrics( true, mockViewMetrics, - mockContentMetrics + mockContentMetrics, ); // Should add half of the view width to all sides. @@ -476,7 +476,7 @@ suite('Metrics', function () { const contentMetrics = metricsManager.getScrollMetrics( false, mockViewMetrics, - mockContentMetrics + mockContentMetrics, ); // Should add half the view width to all sides. @@ -493,7 +493,7 @@ suite('Metrics', function () { const contentMetrics = metricsManager.getScrollMetrics( false, mockViewMetrics, - mockContentMetrics + mockContentMetrics, ); // Should add half the view width to all sides. @@ -510,7 +510,7 @@ suite('Metrics', function () { const contentMetrics = metricsManager.getScrollMetrics( false, mockViewMetrics, - mockContentMetrics + mockContentMetrics, ); // Should add half the view width to all sides. @@ -527,7 +527,7 @@ suite('Metrics', function () { const contentMetrics = metricsManager.getScrollMetrics( false, mockViewMetrics, - mockContentMetrics + mockContentMetrics, ); // Should add half of the view width to all sides. @@ -544,7 +544,7 @@ suite('Metrics', function () { const contentMetrics = metricsManager.getScrollMetrics( false, mockViewMetrics, - mockContentMetrics + mockContentMetrics, ); // Should add half of the view width to all sides. @@ -561,7 +561,7 @@ suite('Metrics', function () { const contentMetrics = metricsManager.getScrollMetrics( false, mockViewMetrics, - mockContentMetrics + mockContentMetrics, ); // Should add half of the view width to all sides. diff --git a/tests/mocha/mutator_test.js b/tests/mocha/mutator_test.js index e10caa576..9a1c61698 100644 --- a/tests/mocha/mutator_test.js +++ b/tests/mocha/mutator_test.js @@ -60,8 +60,8 @@ suite('Mutator', function () { ({args}) => args[0].type === Blockly.Events.BLOCK_CHANGE && args[0].element === 'mutation' && - /<\/mutation>/.test(args[0].newValue) - ) + /<\/mutation>/.test(args[0].newValue), + ), ); }); @@ -81,7 +81,7 @@ suite('Mutator', function () { newValue: '{"hasInput":true}', }, this.workspace.id, - block.id + block.id, ); }); }); diff --git a/tests/mocha/names_test.js b/tests/mocha/names_test.js index 79da40189..093e4e132 100644 --- a/tests/mocha/names_test.js +++ b/tests/mocha/names_test.js @@ -26,17 +26,17 @@ suite('Names', function () { chai.assert.equal( varDB.safeName('9lives'), 'my_9lives', - 'SafeName number start.' + 'SafeName number start.', ); chai.assert.equal( varDB.safeName('lives9'), 'lives9', - 'SafeName number end.' + 'SafeName number end.', ); chai.assert.equal( varDB.safeName('!@#$'), '____', - 'SafeName special chars.' + 'SafeName special chars.', ); chai.assert.equal(varDB.safeName('door'), 'door', 'SafeName reserved.'); }); @@ -46,49 +46,49 @@ suite('Names', function () { chai.assert.equal( varDB.getName('Foo.bar', 'var'), 'Foo_bar', - 'Name add #1.' + 'Name add #1.', ); chai.assert.equal( varDB.getName('Foo.bar', 'var'), 'Foo_bar', - 'Name get #1.' + 'Name get #1.', ); chai.assert.equal( varDB.getName('Foo bar', 'var'), 'Foo_bar2', - 'Name add #2.' + 'Name add #2.', ); chai.assert.equal( varDB.getName('foo BAR', 'var'), 'Foo_bar2', - 'Name get #2.' + 'Name get #2.', ); chai.assert.equal(varDB.getName('door', 'var'), 'door2', 'Name add #3.'); chai.assert.equal( varDB.getName('Foo.bar', 'proc'), 'Foo_bar3', - 'Name add #4.' + 'Name add #4.', ); chai.assert.equal( varDB.getName('Foo.bar', 'var'), 'Foo_bar', - 'Name get #1b.' + 'Name get #1b.', ); chai.assert.equal( varDB.getName('Foo.bar', 'proc'), 'Foo_bar3', - 'Name get #4.' + 'Name get #4.', ); chai.assert.equal( String(varDB.getUserNames('var')), 'foo.bar,foo bar,door', - 'Get var names.' + 'Get var names.', ); chai.assert.equal( String(varDB.getUserNames('proc')), 'foo.bar', - 'Get proc names.' + 'Get proc names.', ); }); @@ -97,38 +97,38 @@ suite('Names', function () { chai.assert.equal( varDB.getDistinctName('Foo.bar', 'var'), 'Foo_bar', - 'Name distinct #1.' + 'Name distinct #1.', ); chai.assert.equal( varDB.getDistinctName('Foo.bar', 'var'), 'Foo_bar2', - 'Name distinct #2.' + 'Name distinct #2.', ); chai.assert.equal( varDB.getDistinctName('Foo.bar', 'proc'), 'Foo_bar3', - 'Name distinct #3.' + 'Name distinct #3.', ); varDB.reset(); chai.assert.equal( varDB.getDistinctName('Foo.bar', 'var'), 'Foo_bar', - 'Name distinct #4.' + 'Name distinct #4.', ); }); test('name equals', function () { chai.assert.isTrue( Blockly.Names.equals('Foo.bar', 'Foo.bar'), - 'Name equals #1.' + 'Name equals #1.', ); chai.assert.isFalse( Blockly.Names.equals('Foo.bar', 'Foo_bar'), - 'Name equals #2.' + 'Name equals #2.', ); chai.assert.isTrue( Blockly.Names.equals('Foo.bar', 'FOO.BAR'), - 'Name equals #3.' + 'Name equals #3.', ); }); }); diff --git a/tests/mocha/registry_test.js b/tests/mocha/registry_test.js index 66ba9fac9..ca7d3fca6 100644 --- a/tests/mocha/registry_test.js +++ b/tests/mocha/registry_test.js @@ -103,7 +103,7 @@ suite('Registry', function () { test('Type', function () { assertWarnings(() => { chai.assert.isNull( - Blockly.registry.getClass('bad_type', 'test_name') + Blockly.registry.getClass('bad_type', 'test_name'), ); }, /Unable to find/); }); @@ -145,7 +145,7 @@ suite('Registry', function () { test('Type', function () { assertWarnings(() => { chai.assert.isNull( - Blockly.registry.getObject('bad_type', 'test_name') + Blockly.registry.getObject('bad_type', 'test_name'), ); }, /Unable to find/); }); @@ -242,7 +242,7 @@ suite('Registry', function () { test('Simple - Plugin name given', function () { const testClass = Blockly.registry.getClassFromOptions( 'test', - this.options + this.options, ); chai.assert.instanceOf(new testClass(), TestClass); }); @@ -251,7 +251,7 @@ suite('Registry', function () { this.options.plugins['test'] = TestClass; const testClass = Blockly.registry.getClassFromOptions( 'test', - this.options + this.options, ); chai.assert.instanceOf(new testClass(), TestClass); }); @@ -260,7 +260,7 @@ suite('Registry', function () { delete this.options['plugins']['test']; const testClass = Blockly.registry.getClassFromOptions( 'test', - this.options + this.options, ); chai.assert.instanceOf(new testClass(), this.defaultClass); }); diff --git a/tests/mocha/serializer_test.js b/tests/mocha/serializer_test.js index 9f9f545fe..10cf210ba 100644 --- a/tests/mocha/serializer_test.js +++ b/tests/mocha/serializer_test.js @@ -55,7 +55,7 @@ const Serializer = new SerializerTestSuite('Serializer'); // TODO: Make sure all of these properties are documented ad exported properly. Serializer.Empty = new SerializerTestCase( 'Empty', - '' + '', ); Serializer.Data = new SerializerTestCase( 'Data', @@ -63,7 +63,7 @@ Serializer.Data = new SerializerTestCase( '' + 'test data' + '' + - '' + '', ); Serializer.testCases = [Serializer.Empty, Serializer.Data]; @@ -72,37 +72,37 @@ Serializer.Attributes.Basic = new SerializerTestCase( 'Basic', '' + '' + - '' + '', ); Serializer.Attributes.Collapsed = new SerializerTestCase( 'Collapsed', '' + '' + - '' + '', ); Serializer.Attributes.Disabled = new SerializerTestCase( 'Disabled', '' + '' + - '' + '', ); Serializer.Attributes.NotDeletable = new SerializerTestCase( 'Deletable', '' + '' + - '' + '', ); Serializer.Attributes.NotMovable = new SerializerTestCase( 'Movable', '' + '' + - '' + '', ); Serializer.Attributes.NotEditable = new SerializerTestCase( 'Editable', '' + '' + - '' + '', ); Serializer.Attributes.testCases = [ Serializer.Attributes.Basic, @@ -118,13 +118,13 @@ Serializer.Attributes.Inline.True = new SerializerTestCase( 'True', '' + '' + - '' + '', ); Serializer.Attributes.Inline.False = new SerializerTestCase( 'False', '' + '' + - '' + '', ); Serializer.Attributes.Inline.testCases = [ Serializer.Attributes.Inline.True, @@ -136,19 +136,19 @@ Serializer.Attributes.Coordinates.Simple = new SerializerTestCase( 'Simple', '' + '' + - '' + '', ); Serializer.Attributes.Coordinates.Negative = new SerializerTestCase( 'Negative', '' + '' + - '' + '', ); Serializer.Attributes.Coordinates.Zero = new SerializerTestCase( 'Zero', '' + '' + - '' + '', ); Serializer.Attributes.Coordinates.testCases = [ Serializer.Attributes.Coordinates.Simple, @@ -163,14 +163,14 @@ Serializer.Attributes.Id.Length.Short = new SerializerTestCase( 'Short', '' + '' + - '' + '', ); Serializer.Attributes.Id.Length.Long = new SerializerTestCase( 'Long', '' + '' + '' + - '' + '', ); Serializer.Attributes.Id.Length.testCases = [ Serializer.Attributes.Id.Length.Short, @@ -183,27 +183,27 @@ Serializer.Attributes.Id.Chars.Symbols = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Attributes.Id.Chars.Uppercase = new SerializerTestCase( 'Uppercase', '' + '' + '' + - '' + '', ); Serializer.Attributes.Id.Chars.Lowercase = new SerializerTestCase( 'Lowercase', '' + '' + '' + - '' + '', ); Serializer.Attributes.Id.Chars.Numbers = new SerializerTestCase( 'Numbers', '' + '' + - '' + '', ); Serializer.Attributes.Id.Chars.testCases = [ Serializer.Attributes.Id.Chars.Symbols, @@ -232,7 +232,7 @@ Serializer.Fields.Angle.Simple = new SerializerTestCase( '' + '90' + '' + - '' + '', ); Serializer.Fields.Angle.Negative = new SerializerTestCase( 'Negative', @@ -240,7 +240,7 @@ Serializer.Fields.Angle.Negative = new SerializerTestCase( '' + '-90' + '' + - '' + '', ); Serializer.Fields.Angle.Decimals = new SerializerTestCase( 'Decimals', @@ -248,7 +248,7 @@ Serializer.Fields.Angle.Decimals = new SerializerTestCase( '' + '1.5' + '' + - '' + '', ); Serializer.Fields.Angle.MaxPrecision = new SerializerTestCase( 'MaxPrecision', @@ -256,7 +256,7 @@ Serializer.Fields.Angle.MaxPrecision = new SerializerTestCase( '' + '1.000000000000001' + '' + - '' + '', ); Serializer.Fields.Angle.SmallestNumber = new SerializerTestCase( 'SmallestNumber', @@ -264,7 +264,7 @@ Serializer.Fields.Angle.SmallestNumber = new SerializerTestCase( '' + '5e-324' + '' + - '' + '', ); Serializer.Fields.Angle.testCases = [ Serializer.Fields.Angle.Simple, @@ -281,7 +281,7 @@ Serializer.Fields.Checkbox.True = new SerializerTestCase( '' + 'TRUE' + '' + - '' + '', ); Serializer.Fields.Checkbox.False = new SerializerTestCase( 'False', @@ -289,7 +289,7 @@ Serializer.Fields.Checkbox.False = new SerializerTestCase( '' + 'FALSE' + '' + - '' + '', ); Serializer.Fields.Checkbox.testCases = [ Serializer.Fields.Checkbox.True, @@ -303,7 +303,7 @@ Serializer.Fields.Colour.ThreeChar = new SerializerTestCase( '' + '#ffcc00' + // Could use a 3 char code. '' + - '' + '', ); Serializer.Fields.Colour.SixChar = new SerializerTestCase( 'SixChar', @@ -311,7 +311,7 @@ Serializer.Fields.Colour.SixChar = new SerializerTestCase( '' + '#f1c101' + '' + - '' + '', ); Serializer.Fields.Colour.Black = new SerializerTestCase( 'Black', @@ -319,7 +319,7 @@ Serializer.Fields.Colour.Black = new SerializerTestCase( '' + '#000000' + '' + - '' + '', ); Serializer.Fields.Colour.testCases = [ Serializer.Fields.Colour.ThreeChar, @@ -334,7 +334,7 @@ Serializer.Fields.Dropdown.Default = new SerializerTestCase( '' + 'ITEM1' + '' + - '' + '', ); Serializer.Fields.Dropdown.NotDefault = new SerializerTestCase( 'NotDefault', @@ -342,7 +342,7 @@ Serializer.Fields.Dropdown.NotDefault = new SerializerTestCase( '' + 'ITEM32' + '' + - '' + '', ); Serializer.Fields.Dropdown.Dynamic = new SerializerTestCase( 'Dynamic', @@ -350,7 +350,7 @@ Serializer.Fields.Dropdown.Dynamic = new SerializerTestCase( '' + '0' + '' + - '' + '', ); Serializer.Fields.Dropdown.testCases = [ Serializer.Fields.Dropdown.Default, @@ -359,7 +359,7 @@ Serializer.Fields.Dropdown.testCases = [ ]; Serializer.Fields.LabelSerializable = new SerializerTestSuite( - 'LabelSerializable' + 'LabelSerializable', ); Serializer.Fields.LabelSerializable.Simple = new SerializerTestCase( 'Simple', @@ -367,7 +367,7 @@ Serializer.Fields.LabelSerializable.Simple = new SerializerTestCase( '' + 'test' + '' + - '' + '', ); Serializer.Fields.LabelSerializable.Symbols = new SerializerTestCase( 'Symbols', @@ -375,7 +375,7 @@ Serializer.Fields.LabelSerializable.Symbols = new SerializerTestCase( '' + '~`!@#$%^*()_+-={[}]|\\:;,.?/' + '' + - '' + '', ); Serializer.Fields.LabelSerializable.EscapedSymbols = new SerializerTestCase( 'EscapedSymbols', @@ -383,7 +383,7 @@ Serializer.Fields.LabelSerializable.EscapedSymbols = new SerializerTestCase( '' + '&<>' + '' + - '' + '', ); Serializer.Fields.LabelSerializable.SingleQuotes = new SerializerTestCase( 'SingleQuotes', @@ -391,7 +391,7 @@ Serializer.Fields.LabelSerializable.SingleQuotes = new SerializerTestCase( '' + '\'test\'' + '' + - '' + '', ); Serializer.Fields.LabelSerializable.DoubleQuotes = new SerializerTestCase( 'DoubleQuotes', @@ -399,7 +399,7 @@ Serializer.Fields.LabelSerializable.DoubleQuotes = new SerializerTestCase( '' + '"test"' + '' + - '' + '', ); Serializer.Fields.LabelSerializable.Numbers = new SerializerTestCase( 'Numbers', @@ -407,7 +407,7 @@ Serializer.Fields.LabelSerializable.Numbers = new SerializerTestCase( '' + '1234567890a123a123a' + '' + - '' + '', ); Serializer.Fields.LabelSerializable.Emoji = new SerializerTestCase( 'Emoji', @@ -415,7 +415,7 @@ Serializer.Fields.LabelSerializable.Emoji = new SerializerTestCase( '' + '😀👋🏿👋🏾👋🏽👋🏼👋🏻😀❤❤❤' + '' + - '' + '', ); Serializer.Fields.LabelSerializable.Russian = new SerializerTestCase( 'Russian', @@ -423,7 +423,7 @@ Serializer.Fields.LabelSerializable.Russian = new SerializerTestCase( '' + 'ты любопытный кот' + '' + - '' + '', ); Serializer.Fields.LabelSerializable.Japanese = new SerializerTestCase( 'Japanese', @@ -431,7 +431,7 @@ Serializer.Fields.LabelSerializable.Japanese = new SerializerTestCase( '' + 'あなたは好奇心旺盛な猫です' + '' + - '' + '', ); Serializer.Fields.LabelSerializable.Zalgo = new SerializerTestCase( 'Zalgo', @@ -439,7 +439,7 @@ Serializer.Fields.LabelSerializable.Zalgo = new SerializerTestCase( '' + 'z̴̪͈̲̜͕̽̈̀͒͂̓̋̉̍a̸̧̧̜̻̘̤̫̱̲͎̞̻͆̋ļ̸̛̖̜̳͚̖͔̟̈́͂̉̀͑̑͑̎ǵ̸̫̳̽̐̃̑̚̕o̶͇̫͔̮̼̭͕̹̘̬͋̀͆̂̇̋͊̒̽' + '' + - '' + '', ); Serializer.Fields.LabelSerializable.ControlChars = new SerializerTestCase( 'ControlChars', @@ -447,7 +447,7 @@ Serializer.Fields.LabelSerializable.ControlChars = new SerializerTestCase( '' + '&#a1;' + '' + - '' + '', ); Serializer.Fields.LabelSerializable.testCases = [ Serializer.Fields.LabelSerializable.Simple, @@ -471,7 +471,7 @@ Serializer.Fields.MultilineInput.SingleLine = new SerializerTestCase( '' + 'test' + '' + - '' + '', ); Serializer.Fields.MultilineInput.MultipleLines = new SerializerTestCase( 'MultipleLines', @@ -479,7 +479,7 @@ Serializer.Fields.MultilineInput.MultipleLines = new SerializerTestCase( '' + 'line1&#10;line2&#10;line3' + '' + - '' + '', ); Serializer.Fields.MultilineInput.Indentation = new SerializerTestCase( 'Indentation', @@ -487,7 +487,7 @@ Serializer.Fields.MultilineInput.Indentation = new SerializerTestCase( '' + 'line1&#10; line2&#10; line3' + '' + - '' + '', ); /* eslint-disable no-tabs */ Serializer.Fields.MultilineInput.Tabs = new SerializerTestCase( @@ -498,7 +498,7 @@ Serializer.Fields.MultilineInput.Tabs = new SerializerTestCase( 'line1&#10;&#x9line2&#10;&#x9line3' + '' + '' + - '' + '', ); /* eslint-enable no-tabs */ Serializer.Fields.MultilineInput.Symbols = new SerializerTestCase( @@ -507,7 +507,7 @@ Serializer.Fields.MultilineInput.Symbols = new SerializerTestCase( '' + '~`!@#$%^*()_+-={[}]|\\:;,.?/' + '' + - '' + '', ); Serializer.Fields.MultilineInput.EscapedSymbols = new SerializerTestCase( 'EscapedSymbols', @@ -515,7 +515,7 @@ Serializer.Fields.MultilineInput.EscapedSymbols = new SerializerTestCase( '' + '&<>' + '' + - '' + '', ); Serializer.Fields.MultilineInput.SingleQuotes = new SerializerTestCase( 'SingleQuotes', @@ -523,7 +523,7 @@ Serializer.Fields.MultilineInput.SingleQuotes = new SerializerTestCase( '' + '\'test\'' + '' + - '' + '', ); Serializer.Fields.MultilineInput.DoubleQuotes = new SerializerTestCase( 'DoubleQuotes', @@ -531,7 +531,7 @@ Serializer.Fields.MultilineInput.DoubleQuotes = new SerializerTestCase( '' + '"test"' + '' + - '' + '', ); Serializer.Fields.MultilineInput.Numbers = new SerializerTestCase( 'Numbers', @@ -539,7 +539,7 @@ Serializer.Fields.MultilineInput.Numbers = new SerializerTestCase( '' + '1234567890a123a123a' + '' + - '' + '', ); Serializer.Fields.MultilineInput.Emoji = new SerializerTestCase( 'Emoji', @@ -547,7 +547,7 @@ Serializer.Fields.MultilineInput.Emoji = new SerializerTestCase( '' + '😀👋🏿👋🏾👋🏽👋🏼👋🏻😀❤❤❤' + '' + - '' + '', ); Serializer.Fields.MultilineInput.Russian = new SerializerTestCase( 'Russian', @@ -555,7 +555,7 @@ Serializer.Fields.MultilineInput.Russian = new SerializerTestCase( '' + 'ты любопытный кот' + '' + - '' + '', ); Serializer.Fields.MultilineInput.Japanese = new SerializerTestCase( 'Japanese', @@ -563,7 +563,7 @@ Serializer.Fields.MultilineInput.Japanese = new SerializerTestCase( '' + 'あなたは好奇心旺盛な猫です' + '' + - '' + '', ); Serializer.Fields.MultilineInput.Zalgo = new SerializerTestCase( 'Zalgo', @@ -571,7 +571,7 @@ Serializer.Fields.MultilineInput.Zalgo = new SerializerTestCase( '' + 'z̴̪͈̲̜͕̽̈̀͒͂̓̋̉̍a̸̧̧̜̻̘̤̫̱̲͎̞̻͆̋ļ̸̛̖̜̳͚̖͔̟̈́͂̉̀͑̑͑̎ǵ̸̫̳̽̐̃̑̚̕o̶͇̫͔̮̼̭͕̹̘̬͋̀͆̂̇̋͊̒̽' + '' + - '' + '', ); Serializer.Fields.MultilineInput.ControlChars = new SerializerTestCase( 'ControlChars', @@ -579,7 +579,7 @@ Serializer.Fields.MultilineInput.ControlChars = new SerializerTestCase( '' + '&#a1;' + '' + - '' + '', ); Serializer.Fields.MultilineInput.testCases = [ Serializer.Fields.MultilineInput.SingleLine, @@ -606,7 +606,7 @@ Serializer.Fields.Number.Simple = new SerializerTestCase( '' + '123' + '' + - '' + '', ); Serializer.Fields.Number.Negative = new SerializerTestCase( 'Negative', @@ -614,7 +614,7 @@ Serializer.Fields.Number.Negative = new SerializerTestCase( '' + '-123' + '' + - '' + '', ); Serializer.Fields.Number.PosInfinity = new SerializerTestCase( 'PosInfinity', @@ -622,7 +622,7 @@ Serializer.Fields.Number.PosInfinity = new SerializerTestCase( '' + 'Infinity' + '' + - '' + '', ); Serializer.Fields.Number.NegInfinity = new SerializerTestCase( 'NegInfinity', @@ -630,7 +630,7 @@ Serializer.Fields.Number.NegInfinity = new SerializerTestCase( '' + '-Infinity' + '' + - '' + '', ); Serializer.Fields.Number.Decimals = new SerializerTestCase( 'Decimals', @@ -638,7 +638,7 @@ Serializer.Fields.Number.Decimals = new SerializerTestCase( '' + '1.5' + '' + - '' + '', ); Serializer.Fields.Number.Smallest = new SerializerTestCase( 'Smallest', @@ -646,7 +646,7 @@ Serializer.Fields.Number.Smallest = new SerializerTestCase( '' + '5e-324' + '' + - '' + '', ); Serializer.Fields.Number.Largest = new SerializerTestCase( 'Largest', @@ -654,7 +654,7 @@ Serializer.Fields.Number.Largest = new SerializerTestCase( '' + '1.7976931348623157e+308' + '' + - '' + '', ); Serializer.Fields.Number.MaxPrecisionSmall = new SerializerTestCase( 'MaxPrecisionSmall', @@ -662,7 +662,7 @@ Serializer.Fields.Number.MaxPrecisionSmall = new SerializerTestCase( '' + '1.000000000000001' + '' + - '' + '', ); Serializer.Fields.Number.MaxPrecisionLarge = new SerializerTestCase( 'MaxPrecisionLarge', @@ -670,7 +670,7 @@ Serializer.Fields.Number.MaxPrecisionLarge = new SerializerTestCase( '' + '1000000000000001' + '' + - '' + '', ); Serializer.Fields.Number.testCases = [ Serializer.Fields.Number.Simple, @@ -691,7 +691,7 @@ Serializer.Fields.TextInput.Simple = new SerializerTestCase( '' + 'test' + '' + - '' + '', ); /* eslint-disable no-tabs */ Serializer.Fields.TextInput.Tabs = new SerializerTestCase( @@ -700,7 +700,7 @@ Serializer.Fields.TextInput.Tabs = new SerializerTestCase( '' + 'line1&#x9line2&#x9line3' + '' + - '' + '', ); /* eslint-enable no-tabs */ Serializer.Fields.TextInput.Symbols = new SerializerTestCase( @@ -709,7 +709,7 @@ Serializer.Fields.TextInput.Symbols = new SerializerTestCase( '' + '~`!@#$%^*()_+-={[}]|\\:;,.?/' + '' + - '' + '', ); Serializer.Fields.TextInput.EscapedSymbols = new SerializerTestCase( 'EscapedSymbols', @@ -717,7 +717,7 @@ Serializer.Fields.TextInput.EscapedSymbols = new SerializerTestCase( '' + '&<>' + '' + - '' + '', ); Serializer.Fields.TextInput.SingleQuotes = new SerializerTestCase( 'SingleQuotes', @@ -725,7 +725,7 @@ Serializer.Fields.TextInput.SingleQuotes = new SerializerTestCase( '' + '\'test\'' + '' + - '' + '', ); Serializer.Fields.TextInput.DoubleQuotes = new SerializerTestCase( 'DoubleQuotes', @@ -733,7 +733,7 @@ Serializer.Fields.TextInput.DoubleQuotes = new SerializerTestCase( '' + '"test"' + '' + - '' + '', ); Serializer.Fields.TextInput.Numbers = new SerializerTestCase( 'Numbers', @@ -741,7 +741,7 @@ Serializer.Fields.TextInput.Numbers = new SerializerTestCase( '' + '1234567890a123a123a' + '' + - '' + '', ); Serializer.Fields.TextInput.Emoji = new SerializerTestCase( 'Emoji', @@ -749,7 +749,7 @@ Serializer.Fields.TextInput.Emoji = new SerializerTestCase( '' + '😀👋🏿👋🏾👋🏽👋🏼👋🏻😀❤❤❤' + '' + - '' + '', ); Serializer.Fields.TextInput.Russian = new SerializerTestCase( 'Russian', @@ -757,7 +757,7 @@ Serializer.Fields.TextInput.Russian = new SerializerTestCase( '' + 'ты любопытный кот' + '' + - '' + '', ); Serializer.Fields.TextInput.Japanese = new SerializerTestCase( 'Japanese', @@ -765,7 +765,7 @@ Serializer.Fields.TextInput.Japanese = new SerializerTestCase( '' + 'あなたは好奇心旺盛な猫です' + '' + - '' + '', ); Serializer.Fields.TextInput.Zalgo = new SerializerTestCase( 'Zalgo', @@ -773,7 +773,7 @@ Serializer.Fields.TextInput.Zalgo = new SerializerTestCase( '' + 'z̴̪͈̲̜͕̽̈̀͒͂̓̋̉̍a̸̧̧̜̻̘̤̫̱̲͎̞̻͆̋ļ̸̛̖̜̳͚̖͔̟̈́͂̉̀͑̑͑̎ǵ̸̫̳̽̐̃̑̚̕o̶͇̫͔̮̼̭͕̹̘̬͋̀͆̂̇̋͊̒̽' + '' + - '' + '', ); Serializer.Fields.TextInput.ControlChars = new SerializerTestCase( 'ControlChars', @@ -781,7 +781,7 @@ Serializer.Fields.TextInput.ControlChars = new SerializerTestCase( '' + '&#a1;' + '' + - '' + '', ); Serializer.Fields.TextInput.testCases = [ Serializer.Fields.TextInput.Simple, @@ -809,7 +809,7 @@ Serializer.Fields.Variable.Simple = new SerializerTestCase( '' + 'test' + '' + - '' + '', ); Serializer.Fields.Variable.Types = new SerializerTestCase( 'Types', @@ -828,7 +828,7 @@ Serializer.Fields.Variable.Types = new SerializerTestCase( '' + 'test3' + '' + - '' + '', ); /* eslint-disable no-tabs */ Serializer.Fields.Variable.Tabs = new SerializerTestCase( @@ -840,7 +840,7 @@ Serializer.Fields.Variable.Tabs = new SerializerTestCase( '' + 'line1&#x9line2&#x9line3' + '' + - '' + '', ); /* eslint-enable no-tabs */ Serializer.Fields.Variable.Symbols = new SerializerTestCase( @@ -852,7 +852,7 @@ Serializer.Fields.Variable.Symbols = new SerializerTestCase( '' + '~`!@#$%^*()_+-={[}]|\\:;,.?/' + '' + - '' + '', ); Serializer.Fields.Variable.EscapedSymbols = new SerializerTestCase( 'EscapedSymbols', @@ -863,7 +863,7 @@ Serializer.Fields.Variable.EscapedSymbols = new SerializerTestCase( '' + '&<>' + '' + - '' + '', ); Serializer.Fields.Variable.SingleQuotes = new SerializerTestCase( 'SingleQuotes', @@ -874,7 +874,7 @@ Serializer.Fields.Variable.SingleQuotes = new SerializerTestCase( '' + '\'test\'' + '' + - '' + '', ); Serializer.Fields.Variable.DoubleQuotes = new SerializerTestCase( 'DoubleQuotes', @@ -885,7 +885,7 @@ Serializer.Fields.Variable.DoubleQuotes = new SerializerTestCase( '' + '"test"' + '' + - '' + '', ); Serializer.Fields.Variable.Numbers = new SerializerTestCase( 'Numbers', @@ -896,7 +896,7 @@ Serializer.Fields.Variable.Numbers = new SerializerTestCase( '' + '1234567890a123a123a' + '' + - '' + '', ); Serializer.Fields.Variable.Emoji = new SerializerTestCase( 'Emoji', @@ -907,7 +907,7 @@ Serializer.Fields.Variable.Emoji = new SerializerTestCase( '' + '😀👋🏿👋🏾👋🏽👋🏼👋🏻😀❤❤❤' + '' + - '' + '', ); Serializer.Fields.Variable.Russian = new SerializerTestCase( 'Russian', @@ -918,7 +918,7 @@ Serializer.Fields.Variable.Russian = new SerializerTestCase( '' + 'ты любопытный кот' + '' + - '' + '', ); Serializer.Fields.Variable.Japanese = new SerializerTestCase( 'Japanese', @@ -929,7 +929,7 @@ Serializer.Fields.Variable.Japanese = new SerializerTestCase( '' + 'あなたは好奇心旺盛な猫です' + '' + - '' + '', ); Serializer.Fields.Variable.Zalgo = new SerializerTestCase( 'Zalgo', @@ -940,7 +940,7 @@ Serializer.Fields.Variable.Zalgo = new SerializerTestCase( '' + 'z̴̪͈̲̜͕̽̈̀͒͂̓̋̉̍a̸̧̧̜̻̘̤̫̱̲͎̞̻͆̋ļ̸̛̖̜̳͚̖͔̟̈́͂̉̀͑̑͑̎ǵ̸̫̳̽̐̃̑̚̕o̶͇̫͔̮̼̭͕̹̘̬͋̀͆̂̇̋͊̒̽' + '' + - '' + '', ); Serializer.Fields.Variable.ControlChars = new SerializerTestCase( 'ControlChars', @@ -951,7 +951,7 @@ Serializer.Fields.Variable.ControlChars = new SerializerTestCase( '' + '&#a1;' + '' + - '' + '', ); Serializer.Fields.Variable.testCases = [ Serializer.Fields.Variable.Simple, @@ -982,7 +982,7 @@ Serializer.Fields.Variable.Id.Length.Short = new SerializerTestCase( '' + 'test' + '' + - '' + '', ); Serializer.Fields.Variable.Id.Length.Long = new SerializerTestCase( 'Long', @@ -993,7 +993,7 @@ Serializer.Fields.Variable.Id.Length.Long = new SerializerTestCase( '' + 'test' + '' + - '' + '', ); Serializer.Fields.Variable.Id.Length.testCases = [ Serializer.Fields.Variable.Id.Length.Short, @@ -1014,7 +1014,7 @@ Serializer.Fields.Variable.Id.Chars.Symbols = new SerializerTestCase( '' + 'test2' + '' + - '' + '', ); Serializer.Fields.Variable.Id.Chars.Uppercase = new SerializerTestCase( 'Uppercase', @@ -1029,7 +1029,7 @@ Serializer.Fields.Variable.Id.Chars.Uppercase = new SerializerTestCase( '' + 'test2' + '' + - '' + '', ); Serializer.Fields.Variable.Id.Chars.Lowercase = new SerializerTestCase( 'Lowercase', @@ -1044,7 +1044,7 @@ Serializer.Fields.Variable.Id.Chars.Lowercase = new SerializerTestCase( '' + 'test2' + '' + - '' + '', ); Serializer.Fields.Variable.Id.Chars.Numbers = new SerializerTestCase( 'Numbers', @@ -1055,7 +1055,7 @@ Serializer.Fields.Variable.Id.Chars.Numbers = new SerializerTestCase( '' + 'test' + '' + - '' + '', ); Serializer.Fields.Variable.Id.Chars.testCases = [ Serializer.Fields.Variable.Id.Chars.Symbols, @@ -1092,7 +1092,7 @@ Serializer.Icons.Comment.Basic = new SerializerTestCase( '' + 'test' + '' + - '' + '', ); Serializer.Icons.Comment.Size = new SerializerTestSuite('Size'); @@ -1102,7 +1102,7 @@ Serializer.Icons.Comment.Size.Different = new SerializerTestCase( '' + 'test' + '' + - '' + '', ); Serializer.Icons.Comment.Size.Large = new SerializerTestCase( 'Large', @@ -1110,7 +1110,7 @@ Serializer.Icons.Comment.Size.Large = new SerializerTestCase( '' + 'test' + '' + - '' + '', ); Serializer.Icons.Comment.Size.testCases = [ Serializer.Icons.Comment.Size.Different, @@ -1124,7 +1124,7 @@ Serializer.Icons.Comment.Pinned.True = new SerializerTestCase( '' + 'test' + '' + - '' + '', ); Serializer.Icons.Comment.Pinned.False = new SerializerTestCase( 'False', @@ -1132,7 +1132,7 @@ Serializer.Icons.Comment.Pinned.False = new SerializerTestCase( '' + 'test' + '' + - '' + '', ); Serializer.Icons.Comment.Pinned.testCases = [ Serializer.Icons.Comment.Pinned.True, @@ -1146,7 +1146,7 @@ Serializer.Icons.Comment.Text.Symbols = new SerializerTestCase( '' + '~`!@#$%^*()_+-={[}]|\\:;,.?/' + '' + - '' + '', ); Serializer.Icons.Comment.Text.EscapedSymbols = new SerializerTestCase( 'EscapedSymbols', @@ -1154,7 +1154,7 @@ Serializer.Icons.Comment.Text.EscapedSymbols = new SerializerTestCase( '' + '&<>' + '' + - '' + '', ); Serializer.Icons.Comment.Text.SingleQuotes = new SerializerTestCase( 'SingleQuotes', @@ -1162,7 +1162,7 @@ Serializer.Icons.Comment.Text.SingleQuotes = new SerializerTestCase( '' + '\'test\'' + '' + - '' + '', ); Serializer.Icons.Comment.Text.DoubleQuotes = new SerializerTestCase( 'DoubleQuotes', @@ -1170,7 +1170,7 @@ Serializer.Icons.Comment.Text.DoubleQuotes = new SerializerTestCase( '' + '"test"' + '' + - '' + '', ); Serializer.Icons.Comment.Text.Numbers = new SerializerTestCase( 'Numbers', @@ -1178,7 +1178,7 @@ Serializer.Icons.Comment.Text.Numbers = new SerializerTestCase( '' + '1234567890a123a123a' + '' + - '' + '', ); Serializer.Icons.Comment.Text.Emoji = new SerializerTestCase( 'Emoji', @@ -1186,7 +1186,7 @@ Serializer.Icons.Comment.Text.Emoji = new SerializerTestCase( '' + '😀👋🏿👋🏾👋🏽👋🏼👋🏻😀❤❤❤' + '' + - '' + '', ); Serializer.Icons.Comment.Text.Russian = new SerializerTestCase( 'Russian', @@ -1194,7 +1194,7 @@ Serializer.Icons.Comment.Text.Russian = new SerializerTestCase( '' + 'ты любопытный кот' + '' + - '' + '', ); Serializer.Icons.Comment.Text.Japanese = new SerializerTestCase( 'Japanese', @@ -1202,7 +1202,7 @@ Serializer.Icons.Comment.Text.Japanese = new SerializerTestCase( '' + 'あなたは好奇心旺盛な猫です' + '' + - '' + '', ); Serializer.Icons.Comment.Text.Zalgo = new SerializerTestCase( 'Zalgo', @@ -1210,7 +1210,7 @@ Serializer.Icons.Comment.Text.Zalgo = new SerializerTestCase( '' + 'z̴̪͈̲̜͕̽̈̀͒͂̓̋̉̍a̸̧̧̜̻̘̤̫̱̲͎̞̻͆̋ļ̸̛̖̜̳͚̖͔̟̈́͂̉̀͑̑͑̎ǵ̸̫̳̽̐̃̑̚̕o̶͇̫͔̮̼̭͕̹̘̬͋̀͆̂̇̋͊̒̽' + '' + - '' + '', ); Serializer.Icons.Comment.Text.ControlChars = new SerializerTestCase( 'ControlChars', @@ -1218,7 +1218,7 @@ Serializer.Icons.Comment.Text.ControlChars = new SerializerTestCase( '' + '&#a1;' + '' + - '' + '', ); Serializer.Icons.Comment.Text.testCases = [ Serializer.Icons.Comment.Text.Symbols, @@ -1257,7 +1257,7 @@ Serializer.Connections.Child.Value = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Connections.Child.Statement = new SerializerTestCase( 'Statement', @@ -1267,7 +1267,7 @@ Serializer.Connections.Child.Statement = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Connections.Child.Next = new SerializerTestCase( 'Next', @@ -1277,7 +1277,7 @@ Serializer.Connections.Child.Next = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Connections.Child.Row = new SerializerTestCase( 'Row', @@ -1293,7 +1293,7 @@ Serializer.Connections.Child.Row = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Connections.Child.Nested = new SerializerTestCase( 'Nested', @@ -1307,7 +1307,7 @@ Serializer.Connections.Child.Nested = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Connections.Child.Stack = new SerializerTestCase( 'Stack', @@ -1321,7 +1321,7 @@ Serializer.Connections.Child.Stack = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Connections.Child.testCases = [ Serializer.Connections.Child.Value, @@ -1343,7 +1343,7 @@ Serializer.Connections.Shadow.Value = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Connections.Shadow.Statement = new SerializerTestCase( 'Statement', @@ -1353,7 +1353,7 @@ Serializer.Connections.Shadow.Statement = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Connections.Shadow.Next = new SerializerTestCase( 'Next', @@ -1363,7 +1363,7 @@ Serializer.Connections.Shadow.Next = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Connections.Shadow.Row = new SerializerTestCase( 'Row', @@ -1379,7 +1379,7 @@ Serializer.Connections.Shadow.Row = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Connections.Shadow.Nested = new SerializerTestCase( 'Nested', @@ -1393,7 +1393,7 @@ Serializer.Connections.Shadow.Nested = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Connections.Shadow.Stack = new SerializerTestCase( 'Stack', @@ -1407,7 +1407,7 @@ Serializer.Connections.Shadow.Stack = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Connections.Shadow.testCases = [ Serializer.Connections.Shadow.Value, @@ -1419,7 +1419,7 @@ Serializer.Connections.Shadow.testCases = [ ]; Serializer.Connections.OverwrittenShadow = new SerializerTestSuite( - 'OverwrittenShadow' + 'OverwrittenShadow', ); Serializer.Connections.OverwrittenShadow.Value = new SerializerTestCase( 'Value', @@ -1434,7 +1434,7 @@ Serializer.Connections.OverwrittenShadow.Value = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Connections.OverwrittenShadow.Statement = new SerializerTestCase( 'Statement', @@ -1445,7 +1445,7 @@ Serializer.Connections.OverwrittenShadow.Statement = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Connections.OverwrittenShadow.Next = new SerializerTestCase( 'Next', @@ -1456,7 +1456,7 @@ Serializer.Connections.OverwrittenShadow.Next = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Connections.OverwrittenShadow.Row = new SerializerTestCase( 'Row', @@ -1475,7 +1475,7 @@ Serializer.Connections.OverwrittenShadow.Row = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Connections.OverwrittenShadow.Nested = new SerializerTestCase( 'Nested', @@ -1490,7 +1490,7 @@ Serializer.Connections.OverwrittenShadow.Nested = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Connections.OverwrittenShadow.Stack = new SerializerTestCase( 'Stack', @@ -1505,7 +1505,7 @@ Serializer.Connections.OverwrittenShadow.Stack = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Connections.OverwrittenShadow.testCases = [ Serializer.Connections.OverwrittenShadow.Value, @@ -1531,7 +1531,7 @@ Serializer.Mutations.ListGetIndex = new SerializerTestCase( 'REMOVE' + 'LAST' + '' + - '' + '', ); Serializer.Mutations.ListSetIndex = new SerializerTestCase( 'ListSetIndex', @@ -1541,7 +1541,7 @@ Serializer.Mutations.ListSetIndex = new SerializerTestCase( 'SET' + 'LAST' + '' + - '' + '', ); Serializer.Mutations.ListGetSublist = new SerializerTestCase( 'ListGetSublist', @@ -1551,7 +1551,7 @@ Serializer.Mutations.ListGetSublist = new SerializerTestCase( 'FIRST' + 'LAST' + '' + - '' + '', ); Serializer.Mutations.MathNumberProperty = new SerializerTestCase( 'MathNumberProperty', @@ -1560,7 +1560,7 @@ Serializer.Mutations.MathNumberProperty = new SerializerTestCase( '' + 'DIVISIBLE_BY' + '' + - '' + '', ); Serializer.Mutations.MathOnList = new SerializerTestCase( 'MathOnList', @@ -1569,7 +1569,7 @@ Serializer.Mutations.MathOnList = new SerializerTestCase( '' + 'MODE' + '' + - '' + '', ); Serializer.Mutations.TextJoin = new SerializerTestCase( 'TextJoin', @@ -1577,7 +1577,7 @@ Serializer.Mutations.TextJoin = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.TextCharAt = new SerializerTestCase( 'TextCharAt', @@ -1586,7 +1586,7 @@ Serializer.Mutations.TextCharAt = new SerializerTestCase( '' + 'FIRST' + '' + - '' + '', ); Serializer.Mutations.TextGetSubstring = new SerializerTestCase( 'TextGetSubstring', @@ -1596,7 +1596,7 @@ Serializer.Mutations.TextGetSubstring = new SerializerTestCase( 'FROM_START' + 'LAST' + '' + - '' + '', ); Serializer.Mutations.TextPromptExt = new SerializerTestCase( 'TextPromptExt', @@ -1605,7 +1605,7 @@ Serializer.Mutations.TextPromptExt = new SerializerTestCase( '' + 'NUMBER' + '' + - '' + '', ); Serializer.Mutations.TextPrompt = new SerializerTestCase( 'TextPrompt', @@ -1615,7 +1615,7 @@ Serializer.Mutations.TextPrompt = new SerializerTestCase( 'NUMBER' + '' + '' + - '' + '', ); Serializer.Mutations.testCases = [ Serializer.Mutations.ListGetIndex, @@ -1635,7 +1635,7 @@ Serializer.Mutations.ControlsIf.NoMutation = new SerializerTestCase( 'NoMutation', '' + '' + - '' + '', ); Serializer.Mutations.ControlsIf.ElseIfAndElse = new SerializerTestCase( 'ElseIfAndElse', @@ -1643,7 +1643,7 @@ Serializer.Mutations.ControlsIf.ElseIfAndElse = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.ControlsIf.MultipleElseIfs = new SerializerTestCase( 'MultipleElseIfs', @@ -1651,7 +1651,7 @@ Serializer.Mutations.ControlsIf.MultipleElseIfs = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.ControlsIf.MutlipleElseIfsAndElse = new SerializerTestCase( 'MutlipleElseIfsAndElse', @@ -1659,7 +1659,7 @@ Serializer.Mutations.ControlsIf.MutlipleElseIfsAndElse = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.ControlsIf.testCases = [ Serializer.Mutations.ControlsIf.NoMutation, @@ -1675,7 +1675,7 @@ Serializer.Mutations.ControlsIf.ElseIf.NoChild = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.ControlsIf.ElseIf.Child = new SerializerTestCase( 'Child', @@ -1686,7 +1686,7 @@ Serializer.Mutations.ControlsIf.ElseIf.Child = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.ControlsIf.ElseIf.Shadow = new SerializerTestCase( 'Shadow', @@ -1697,7 +1697,7 @@ Serializer.Mutations.ControlsIf.ElseIf.Shadow = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.ControlsIf.ElseIf.OverwrittenShadow = new SerializerTestCase( @@ -1710,7 +1710,7 @@ Serializer.Mutations.ControlsIf.ElseIf.OverwrittenShadow = '' + '' + '' + - '' + '', ); Serializer.Mutations.ControlsIf.ElseIf.testCases = [ Serializer.Mutations.ControlsIf.ElseIf.NoChild, @@ -1726,7 +1726,7 @@ Serializer.Mutations.ControlsIf.Else.NoChild = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.ControlsIf.Else.Child = new SerializerTestCase( 'Child', @@ -1737,7 +1737,7 @@ Serializer.Mutations.ControlsIf.Else.Child = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.ControlsIf.Else.Shadow = new SerializerTestCase( 'Shadow', @@ -1748,7 +1748,7 @@ Serializer.Mutations.ControlsIf.Else.Shadow = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.ControlsIf.Else.OverwrittenShadow = new SerializerTestCase( 'OverwrittenShadow', @@ -1760,7 +1760,7 @@ Serializer.Mutations.ControlsIf.Else.OverwrittenShadow = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.ControlsIf.Else.testCases = [ Serializer.Mutations.ControlsIf.Else.NoChild, @@ -1781,7 +1781,7 @@ Serializer.Mutations.ListCreate.Default = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.ListCreate.ZeroInputs = new SerializerTestCase( 'ZeroInputs', @@ -1789,7 +1789,7 @@ Serializer.Mutations.ListCreate.ZeroInputs = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.ListCreate.MultipleInputs = new SerializerTestCase( 'MultipleInputs', @@ -1797,7 +1797,7 @@ Serializer.Mutations.ListCreate.MultipleInputs = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.ListCreate.testCases = [ Serializer.Mutations.ListCreate.Default, @@ -1812,7 +1812,7 @@ Serializer.Mutations.ListCreate.OneInput.NoChild = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.ListCreate.OneInput.Child = new SerializerTestCase( 'Child', @@ -1823,7 +1823,7 @@ Serializer.Mutations.ListCreate.OneInput.Child = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.ListCreate.OneInput.Shadow = new SerializerTestCase( 'Shadow', @@ -1834,7 +1834,7 @@ Serializer.Mutations.ListCreate.OneInput.Shadow = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.ListCreate.OneInput.OverwrittenShadow = new SerializerTestCase( @@ -1847,7 +1847,7 @@ Serializer.Mutations.ListCreate.OneInput.OverwrittenShadow = '' + '' + '' + - '' + '', ); Serializer.Mutations.ListCreate.OneInput.testCases = [ Serializer.Mutations.ListCreate.OneInput.NoChild, @@ -1867,7 +1867,7 @@ Serializer.Mutations.Procedure.NoMutation = new SerializerTestCase( '' + 'do something' + '' + - '' + '', ); Serializer.Mutations.Procedure.Variables = new SerializerTestCase( 'Variables', @@ -1885,7 +1885,7 @@ Serializer.Mutations.Procedure.Variables = new SerializerTestCase( '' + 'do something' + '' + - '' + '', ); Serializer.Mutations.Procedure.NoStatements = new SerializerTestCase( 'NoStatements', @@ -1894,7 +1894,7 @@ Serializer.Mutations.Procedure.NoStatements = new SerializerTestCase( '' + 'do something' + '' + - '' + '', ); Serializer.Mutations.Procedure.IfReturn = new SerializerTestCase( 'IfReturn', @@ -1907,7 +1907,7 @@ Serializer.Mutations.Procedure.IfReturn = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.Procedure.Caller = new SerializerTestCase( 'Caller', @@ -1929,7 +1929,7 @@ Serializer.Mutations.Procedure.Caller = new SerializerTestCase( '' + '' + '' + - '' + '', ); Serializer.Mutations.Procedure.CollapsedProceduresCallreturn = new SerializerTestCase( @@ -1950,7 +1950,7 @@ Serializer.Mutations.Procedure.CollapsedProceduresCallreturn = '' + '' + '' + - '' + '', ); Serializer.Mutations.Procedure.CollapsedProceduresCallnoreturn = new SerializerTestCase( @@ -1971,7 +1971,7 @@ Serializer.Mutations.Procedure.CollapsedProceduresCallnoreturn = '' + '' + '' + - '' + '', ); Serializer.Mutations.Procedure.testCases = [ Serializer.Mutations.Procedure.NoMutation, @@ -1990,7 +1990,7 @@ Serializer.Mutations.Procedure.Names.Symbols = new SerializerTestCase( '' + '~`!@#$%^*()_+-={[}]|\\:;,.?/' + '' + - '' + '', ); Serializer.Mutations.Procedure.Names.EscapedSymbols = new SerializerTestCase( 'EscapedSymbols', @@ -1998,7 +1998,7 @@ Serializer.Mutations.Procedure.Names.EscapedSymbols = new SerializerTestCase( '' + '&<>' + '' + - '' + '', ); Serializer.Mutations.Procedure.Names.SingleQuotes = new SerializerTestCase( 'SingleQuotes', @@ -2006,7 +2006,7 @@ Serializer.Mutations.Procedure.Names.SingleQuotes = new SerializerTestCase( '' + '\'test\'' + '' + - '' + '', ); Serializer.Mutations.Procedure.Names.DoubleQuotes = new SerializerTestCase( 'DoubleQuotes', @@ -2014,7 +2014,7 @@ Serializer.Mutations.Procedure.Names.DoubleQuotes = new SerializerTestCase( '' + '"test"' + '' + - '' + '', ); Serializer.Mutations.Procedure.Names.Numbers = new SerializerTestCase( 'Numbers', @@ -2022,7 +2022,7 @@ Serializer.Mutations.Procedure.Names.Numbers = new SerializerTestCase( '' + '1234567890a123a123a' + '' + - '' + '', ); Serializer.Mutations.Procedure.Names.Emoji = new SerializerTestCase( 'Emoji', @@ -2030,7 +2030,7 @@ Serializer.Mutations.Procedure.Names.Emoji = new SerializerTestCase( '' + '😀👋🏿👋🏾👋🏽👋🏼👋🏻😀❤❤❤' + '' + - '' + '', ); Serializer.Mutations.Procedure.Names.Russian = new SerializerTestCase( 'Russian', @@ -2038,7 +2038,7 @@ Serializer.Mutations.Procedure.Names.Russian = new SerializerTestCase( '' + 'ты любопытный кот' + '' + - '' + '', ); Serializer.Mutations.Procedure.Names.Japanese = new SerializerTestCase( 'Japanese', @@ -2046,7 +2046,7 @@ Serializer.Mutations.Procedure.Names.Japanese = new SerializerTestCase( '' + 'あなたは好奇心旺盛な猫です' + '' + - '' + '', ); Serializer.Mutations.Procedure.Names.Zalgo = new SerializerTestCase( 'Zalgo', @@ -2054,7 +2054,7 @@ Serializer.Mutations.Procedure.Names.Zalgo = new SerializerTestCase( '' + 'z̴̪͈̲̜͕̽̈̀͒͂̓̋̉̍a̸̧̧̜̻̘̤̫̱̲͎̞̻͆̋ļ̸̛̖̜̳͚̖͔̟̈́͂̉̀͑̑͑̎ǵ̸̫̳̽̐̃̑̚̕o̶͇̫͔̮̼̭͕̹̘̬͋̀͆̂̇̋͊̒̽' + '' + - '' + '', ); Serializer.Mutations.Procedure.Names.ControlChars = new SerializerTestCase( 'ControlChars', @@ -2062,7 +2062,7 @@ Serializer.Mutations.Procedure.Names.ControlChars = new SerializerTestCase( '' + '&#a1;' + '' + - '' + '', ); Serializer.Mutations.Procedure.Names.testCases = [ Serializer.Mutations.Procedure.Names.Symbols, @@ -2103,7 +2103,7 @@ const runSerializerTestSuite = (serializer, deserializer, testSuite) => { return function () { Blockly.Xml.domToWorkspace( Blockly.utils.xml.textToDom(test.xml), - this.workspace + this.workspace, ); if (serializer && deserializer) { const save = serializer(workspaces.save(this.workspace)); @@ -2143,5 +2143,5 @@ runSerializerTestSuite(null, null, Serializer); runSerializerTestSuite( (state) => state, (state) => state, - Serializer + Serializer, ); diff --git a/tests/mocha/shortcut_registry_test.js b/tests/mocha/shortcut_registry_test.js index beddfd6eb..5c1cd7dcd 100644 --- a/tests/mocha/shortcut_registry_test.js +++ b/tests/mocha/shortcut_registry_test.js @@ -42,7 +42,7 @@ suite('Keyboard Shortcut Registry Test', function () { chai.assert.throws( shouldThrow, Error, - 'Shortcut named "test_shortcut" already exists.' + 'Shortcut named "test_shortcut" already exists.', ); }); test('Registers shortcut with same name opt_allowOverrides=true', function () { @@ -109,7 +109,7 @@ suite('Keyboard Shortcut Registry Test', function () { chai.assert.isFalse(registry.unregister('test')); sinon.assert.calledOnceWithExactly( consoleStub, - 'Keyboard shortcut named "test" not found.' + 'Keyboard shortcut named "test" not found.', ); }); test('Unregistering a shortcut with key mappings', function () { @@ -180,7 +180,7 @@ suite('Keyboard Shortcut Registry Test', function () { chai.assert.throws( shouldThrow, Error, - 'Shortcut named "test_shortcut" collides with shortcuts "test_shortcut_2"' + 'Shortcut named "test_shortcut" collides with shortcuts "test_shortcut_2"', ); }); }); @@ -196,7 +196,7 @@ suite('Keyboard Shortcut Registry Test', function () { const isRemoved = this.registry.removeKeyMapping( 'keyCode', - 'test_shortcut' + 'test_shortcut', ); const shortcutNames = this.registry.getKeyMap()['keyCode']; @@ -222,13 +222,13 @@ suite('Keyboard Shortcut Registry Test', function () { const isRemoved = this.registry.removeKeyMapping( 'keyCode', - 'test_shortcut' + 'test_shortcut', ); chai.assert.isFalse(isRemoved); sinon.assert.calledOnceWithExactly( consoleStub, - 'No keyboard shortcut named "test_shortcut" registered with key code "keyCode"' + 'No keyboard shortcut named "test_shortcut" registered with key code "keyCode"', ); }); test('Removes a key map that does not exist from empty key mapping opt_quiet=false', function () { @@ -236,13 +236,13 @@ suite('Keyboard Shortcut Registry Test', function () { const isRemoved = this.registry.removeKeyMapping( 'keyCode', - 'test_shortcut' + 'test_shortcut', ); chai.assert.isFalse(isRemoved); sinon.assert.calledOnceWithExactly( consoleStub, - 'No keyboard shortcut named "test_shortcut" registered with key code "keyCode"' + 'No keyboard shortcut named "test_shortcut" registered with key code "keyCode"', ); }); }); @@ -253,7 +253,7 @@ suite('Keyboard Shortcut Registry Test', function () { chai.assert.equal(Object.keys(this.registry.getKeyMap()).length, 1); chai.assert.equal( this.registry.getKeyMap()['keyCode'][0], - 'test_shortcut' + 'test_shortcut', ); }); test('Gets a copy of the key map', function () { @@ -269,7 +269,7 @@ suite('Keyboard Shortcut Registry Test', function () { registrycopy['shortcutName']['name'] = 'shortcutName1'; chai.assert.equal( this.registry.getRegistry()['shortcutName']['name'], - 'shortcutName' + 'shortcutName', ); }); test('Gets keyboard shortcuts from a key code', function () { @@ -311,7 +311,7 @@ suite('Keyboard Shortcut Registry Test', function () { this.registry, this.testShortcut, Blockly.utils.KeyCodes.C, - true + true, ); }); test('Execute a shortcut from event', function () { @@ -344,7 +344,7 @@ suite('Keyboard Shortcut Registry Test', function () { this.registry, testShortcut2, Blockly.utils.KeyCodes.C, - false + false, ); chai.assert.isTrue(this.registry.onKeyDown(this.workspace, event)); sinon.assert.calledOnce(testShortcut2Stub); @@ -365,7 +365,7 @@ suite('Keyboard Shortcut Registry Test', function () { this.registry, testShortcut2, Blockly.utils.KeyCodes.C, - true + true, ); chai.assert.isTrue(this.registry.onKeyDown(this.workspace, event)); sinon.assert.calledOnce(testShortcut2Stub); @@ -376,7 +376,7 @@ suite('Keyboard Shortcut Registry Test', function () { suite('createSerializedKey', function () { test('Serialize key', function () { const serializedKey = this.registry.createSerializedKey( - Blockly.utils.KeyCodes.A + Blockly.utils.KeyCodes.A, ); chai.assert.equal(serializedKey, '65'); }); @@ -384,7 +384,7 @@ suite('Keyboard Shortcut Registry Test', function () { test('Serialize key code and modifier', function () { const serializedKey = this.registry.createSerializedKey( Blockly.utils.KeyCodes.A, - [Blockly.utils.KeyCodes.CTRL] + [Blockly.utils.KeyCodes.CTRL], ); chai.assert.equal(serializedKey, 'Control+65'); }); diff --git a/tests/mocha/test_helpers/events.js b/tests/mocha/test_helpers/events.js index 90f87cc0f..46ce32830 100644 --- a/tests/mocha/test_helpers/events.js +++ b/tests/mocha/test_helpers/events.js @@ -59,7 +59,7 @@ function assertXmlProperties_(obj, expectedXmlProperties) { if (expectedValue === undefined) { chai.assert.isUndefined( value, - 'Expected ' + key + ' property to be undefined' + 'Expected ' + key + ' property to be undefined', ); return; } @@ -96,7 +96,7 @@ export function assertEventEquals( expectedBlockId, expectedProperties, isUiEvent = false, - message + message, ) { let prependMessage = message ? message + ' ' : ''; prependMessage += 'Event fired '; @@ -104,12 +104,12 @@ export function assertEventEquals( chai.assert.equal( event.workspaceId, expectedWorkspaceId, - prependMessage + 'workspace id' + prependMessage + 'workspace id', ); chai.assert.equal( event.blockId, expectedBlockId, - prependMessage + 'block id' + prependMessage + 'block id', ); Object.keys(expectedProperties).map((key) => { const value = event[key]; @@ -147,14 +147,14 @@ export function assertEventFired( instanceType, expectedProperties, expectedWorkspaceId, - expectedBlockId + expectedBlockId, ) { expectedProperties = Object.assign( { workspaceId: expectedWorkspaceId, blockId: expectedBlockId, }, - expectedProperties + expectedProperties, ); const expectedEvent = sinon.match .instanceOf(instanceType) @@ -197,7 +197,7 @@ export function assertEventFiredShallow( instanceType, expectedProperties, expectedWorkspaceId, - expectedBlockId + expectedBlockId, ) { const properties = { ...expectedProperties, @@ -206,7 +206,7 @@ export function assertEventFiredShallow( }; sinon.assert.calledWith( spy, - sinon.match.instanceOf(instanceType).and(shallowMatch(properties)) + sinon.match.instanceOf(instanceType).and(shallowMatch(properties)), ); } @@ -225,7 +225,7 @@ export function assertEventNotFired( instanceType, expectedProperties, expectedWorkspaceId, - expectedBlockId + expectedBlockId, ) { if (expectedWorkspaceId !== undefined) { expectedProperties.workspaceId = expectedWorkspaceId; @@ -278,7 +278,7 @@ export function assertNthCallEventArgEquals( instanceType, expectedProperties, expectedWorkspaceId, - expectedBlockId + expectedBlockId, ) { const nthCall = spy.getCall(n); const splitProperties = splitByXmlProperties_(expectedProperties); @@ -290,7 +290,7 @@ export function assertNthCallEventArgEquals( instanceType, nonXmlProperties, expectedWorkspaceId, - expectedBlockId + expectedBlockId, ); const eventArg = nthCall.firstArg; assertXmlProperties_(eventArg, xmlProperties); diff --git a/tests/mocha/test_helpers/fields.js b/tests/mocha/test_helpers/fields.js index 23e502eca..468a29bda 100644 --- a/tests/mocha/test_helpers/fields.js +++ b/tests/mocha/test_helpers/fields.js @@ -69,7 +69,7 @@ export class FieldCreationTestCase { export function assertFieldValue( field, expectedValue, - expectedText = undefined + expectedText = undefined, ) { const actualValue = field.getValue(); const actualText = field.getText(); @@ -151,7 +151,7 @@ export function runConstructorSuiteTests( invalidValueTestCases, validRunAssertField, assertFieldDefault, - customCreateWithJs + customCreateWithJs, ) { suite('Constructor', function () { if (assertFieldDefault) { @@ -185,7 +185,7 @@ export function runConstructorSuiteTests( runCreationTests_( invalidValueTestCases, assertFieldDefault, - createWithJs + createWithJs, ); } else { runCreationTestsAssertThrows_(invalidValueTestCases, createWithJs); @@ -216,7 +216,7 @@ export function runFromJsonSuiteTests( invalidValueTestCases, validRunAssertField, assertFieldDefault, - customCreateWithJson + customCreateWithJson, ) { suite('fromJson', function () { if (assertFieldDefault) { @@ -250,7 +250,7 @@ export function runFromJsonSuiteTests( runCreationTests_( invalidValueTestCases, assertFieldDefault, - createWithJson + createWithJson, ); } else { runCreationTestsAssertThrows_(invalidValueTestCases, createWithJson); @@ -274,7 +274,7 @@ export function runSetValueTests( validValueTestCases, invalidValueTestCases, invalidRunExpectedValue, - invalidRunExpectedText + invalidRunExpectedText, ) { /** * Creates test callback for invalid setValue test. @@ -287,7 +287,7 @@ export function runSetValueTests( assertFieldValue( this.field, invalidRunExpectedValue, - invalidRunExpectedText + invalidRunExpectedText, ); }; }; @@ -302,7 +302,7 @@ export function runSetValueTests( assertFieldValue( this.field, testCase.expectedValue, - testCase.expectedText + testCase.expectedText, ); }; }; diff --git a/tests/mocha/test_helpers/procedures.js b/tests/mocha/test_helpers/procedures.js index 7c04963a5..73f220eeb 100644 --- a/tests/mocha/test_helpers/procedures.js +++ b/tests/mocha/test_helpers/procedures.js @@ -33,7 +33,7 @@ function assertCallBlockArgsStructure(callBlock, args) { chai.assert.equal( callBlock.inputList.length - 1, args.length, - 'call block has the expected number of args' + 'call block has the expected number of args', ); for (let i = 0; i < args.length; i++) { @@ -44,7 +44,7 @@ function assertCallBlockArgsStructure(callBlock, args) { chai.assert.equal( callInput.fieldRow[0].getValue(), expectedName, - 'Call block consts did not match expected.' + 'Call block consts did not match expected.', ); } chai.assert.sameOrderedMembers(callBlock.getVars(), args); @@ -66,41 +66,41 @@ export function assertDefBlockStructure( hasReturn = false, args = [], varIds = [], - hasStatements = true + hasStatements = true, ) { if (hasStatements) { chai.assert.isNotNull( defBlock.getInput('STACK'), - 'Def block should have STACK input' + 'Def block should have STACK input', ); } else { chai.assert.isNull( defBlock.getInput('STACK'), - 'Def block should not have STACK input' + 'Def block should not have STACK input', ); } if (hasReturn) { chai.assert.isNotNull( defBlock.getInput('RETURN'), - 'Def block should have RETURN input' + 'Def block should have RETURN input', ); } else { chai.assert.isNull( defBlock.getInput('RETURN'), - 'Def block should not have RETURN input' + 'Def block should not have RETURN input', ); } if (args.length) { chai.assert.include( defBlock.toString(), 'with', - 'Def block string should include "with"' + 'Def block string should include "with"', ); } else { chai.assert.notInclude( defBlock.toString(), 'with', - 'Def block string should not include "with"' + 'Def block string should not include "with"', ); } @@ -120,7 +120,7 @@ export function assertCallBlockStructure( callBlock, args = [], varIds = [], - name = undefined + name = undefined, ) { if (args.length) { chai.assert.include(callBlock.toString(), 'with'); @@ -148,7 +148,7 @@ export function createProcDefBlock( workspace, hasReturn = false, args = [], - name = 'proc name' + name = 'proc name', ) { const type = hasReturn ? 'procedures_defreturn' : 'procedures_defnoreturn'; let xml = ``; @@ -170,14 +170,14 @@ export function createProcDefBlock( export function createProcCallBlock( workspace, hasReturn = false, - name = 'proc name' + name = 'proc name', ) { const type = hasReturn ? 'procedures_callreturn' : 'procedures_callnoreturn'; return Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom( - `` + ` ` + `` + `` + ` ` + ``, ), - workspace + workspace, ); } diff --git a/tests/mocha/test_helpers/serialization.js b/tests/mocha/test_helpers/serialization.js index 4dd05f9e1..766992ab8 100644 --- a/tests/mocha/test_helpers/serialization.js +++ b/tests/mocha/test_helpers/serialization.js @@ -63,12 +63,12 @@ export const runSerializationTestSuite = (testCases) => { block = Blockly.serialization.blocks.append( testCase.json, this.workspace, - {recordUndo: true} + {recordUndo: true}, ); } else { block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(testCase.xml), - this.workspace + this.workspace, ); } this.clock.runAll(); @@ -86,7 +86,7 @@ export const runSerializationTestSuite = (testCases) => { const block = Blockly.serialization.blocks.append( testCase.json, this.workspace, - {recordUndo: true} + {recordUndo: true}, ); this.clock.runAll(); const generatedJson = Blockly.serialization.blocks.save(block); @@ -95,11 +95,11 @@ export const runSerializationTestSuite = (testCases) => { } else { const block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(testCase.xml), - this.workspace + this.workspace, ); this.clock.runAll(); const generatedXml = Blockly.Xml.domToPrettyText( - Blockly.Xml.blockToDom(block) + Blockly.Xml.blockToDom(block), ); const expectedXml = testCase.expectedXml || testCase.xml; chai.assert.equal(generatedXml, expectedXml); diff --git a/tests/mocha/test_helpers/setup_teardown.js b/tests/mocha/test_helpers/setup_teardown.js index e05a3b229..dc2dfaa09 100644 --- a/tests/mocha/test_helpers/setup_teardown.js +++ b/tests/mocha/test_helpers/setup_teardown.js @@ -76,7 +76,7 @@ export function addBlockTypeToCleanup(sharedCleanupObj, blockType) { function wrapDefineBlocksWithJsonArrayWithCleanup_(sharedCleanupObj) { const stub = sinon.stub( Blockly.common.TEST_ONLY, - 'defineBlocksWithJsonArrayInternal' + 'defineBlocksWithJsonArrayInternal', ); stub.callsFake(function (jsonArray) { if (jsonArray) { @@ -168,7 +168,7 @@ export function sharedTestTeardown() { '"' + testRef.fullTitle() + '" needed cleanup of Blockly.Events.TEST_ONLY.FIRE_QUEUE. This may ' + - 'indicate leakage from an earlier test' + 'indicate leakage from an earlier test', ); } diff --git a/tests/mocha/test_helpers/toolbox_definitions.js b/tests/mocha/test_helpers/toolbox_definitions.js index daf89fc2a..1a163831b 100644 --- a/tests/mocha/test_helpers/toolbox_definitions.js +++ b/tests/mocha/test_helpers/toolbox_definitions.js @@ -206,11 +206,11 @@ export function getXmlArray() { 2 - ` + `, ); const separator = Blockly.utils.xml.textToDom(''); const button = Blockly.utils.xml.textToDom( - '' + '', ); const label = Blockly.utils.xml.textToDom(''); return [block, separator, button, label]; diff --git a/tests/mocha/test_helpers/workspace.js b/tests/mocha/test_helpers/workspace.js index e21005da1..bce02ee34 100644 --- a/tests/mocha/test_helpers/workspace.js +++ b/tests/mocha/test_helpers/workspace.js @@ -43,13 +43,13 @@ export function testAWorkspace() { const varModel = block.getVarModels()[0]; chai.assert.exists( varModel, - 'VariableModel for block at topBlocks[' + blockIndex + ']' + 'VariableModel for block at topBlocks[' + blockIndex + ']', ); const blockVarName = varModel.name; chai.assert.equal( blockVarName, name, - 'VariableModel name for block at topBlocks[' + blockIndex + ']' + 'VariableModel name for block at topBlocks[' + blockIndex + ']', ); } @@ -275,7 +275,7 @@ export function testAWorkspace() { chai.assert.equal( this.workspace.getTopBlocks(true).length, 0, - 'Clear empty workspace' + 'Clear empty workspace', ); this.workspace.newBlock(''); this.workspace.newBlock(''); @@ -348,7 +348,7 @@ export function testAWorkspace() { chai.assert.equal( this.workspace.getAllBlocks(true).length, 0, - 'Clear empty workspace' + 'Clear empty workspace', ); this.workspace.newBlock(''); this.workspace.newBlock(''); @@ -406,7 +406,7 @@ export function testAWorkspace() { test('No instance limit', function () { chai.assert.equal( this.workspace.remainingCapacityOfType('get_var_block'), - Infinity + Infinity, ); }); @@ -415,13 +415,13 @@ export function testAWorkspace() { chai.assert.equal( this.workspace.remainingCapacityOfType('get_var_block'), 1, - 'With maxInstances limit 3' + 'With maxInstances limit 3', ); this.workspace.options.maxInstances['get_var_block'] = 4; chai.assert.equal( this.workspace.remainingCapacityOfType('get_var_block'), 2, - 'With maxInstances limit 4' + 'With maxInstances limit 4', ); }); @@ -433,13 +433,13 @@ export function testAWorkspace() { chai.assert.equal( this.workspace.remainingCapacityOfType('get_var_block'), 1, - 'With maxInstances limit 3' + 'With maxInstances limit 3', ); this.workspace.options.maxInstances['get_var_block'] = 4; chai.assert.equal( this.workspace.remainingCapacityOfType('get_var_block'), 2, - 'With maxInstances limit 4' + 'With maxInstances limit 4', ); }); @@ -448,7 +448,7 @@ export function testAWorkspace() { chai.assert.equal( this.workspace.remainingCapacityOfType('get_var_block'), 0, - 'With maxInstances limit 2' + 'With maxInstances limit 2', ); }); @@ -457,7 +457,7 @@ export function testAWorkspace() { this.workspace.options.maxInstances['get_var_block'] = 0; chai.assert.equal( this.workspace.remainingCapacityOfType('get_var_block'), - 0 + 0, ); }); @@ -469,7 +469,7 @@ export function testAWorkspace() { chai.assert.equal( this.workspace.remainingCapacityOfType('get_var_block'), 0, - 'With maxInstances limit 2' + 'With maxInstances limit 2', ); }); @@ -481,7 +481,7 @@ export function testAWorkspace() { this.workspace.clear(); chai.assert.equal( this.workspace.remainingCapacityOfType('get_var_block'), - 0 + 0, ); }); @@ -490,7 +490,7 @@ export function testAWorkspace() { chai.assert.equal( this.workspace.remainingCapacityOfType('get_var_block'), -1, - 'With maxInstances limit 1' + 'With maxInstances limit 1', ); }); @@ -499,7 +499,7 @@ export function testAWorkspace() { chai.assert.equal( this.workspace.remainingCapacityOfType('get_var_block'), -2, - 'With maxInstances limit 0' + 'With maxInstances limit 0', ); }); @@ -511,7 +511,7 @@ export function testAWorkspace() { chai.assert.equal( this.workspace.remainingCapacityOfType('get_var_block'), -1, - 'With maxInstances limit 1' + 'With maxInstances limit 1', ); }); @@ -523,7 +523,7 @@ export function testAWorkspace() { chai.assert.equal( this.workspace.remainingCapacityOfType('get_var_block'), -2, - 'With maxInstances limit 0' + 'With maxInstances limit 0', ); }); }); @@ -559,7 +559,7 @@ export function testAWorkspace() { const typeCountsMap = {'get_var_block': 1}; chai.assert.isFalse( this.workspace.isCapacityAvailable(typeCountsMap), - 'With maxBlocks limit 1 and maxInstances limit 3' + 'With maxBlocks limit 1 and maxInstances limit 3', ); }); @@ -569,7 +569,7 @@ export function testAWorkspace() { const typeCountsMap = {'get_var_block': 1}; chai.assert.isFalse( this.workspace.isCapacityAvailable(typeCountsMap), - 'With maxBlocks limit 0 and maxInstances limit 3' + 'With maxBlocks limit 0 and maxInstances limit 3', ); }); @@ -579,7 +579,7 @@ export function testAWorkspace() { const typeCountsMap = {'get_var_block': 1}; chai.assert.isFalse( this.workspace.isCapacityAvailable(typeCountsMap), - 'With maxBlocks limit 1 and maxInstances limit 2' + 'With maxBlocks limit 1 and maxInstances limit 2', ); }); @@ -589,7 +589,7 @@ export function testAWorkspace() { const typeCountsMap = {'get_var_block': 1}; chai.assert.isFalse( this.workspace.isCapacityAvailable(typeCountsMap), - 'With maxBlocks limit 1 and maxInstances limit 1' + 'With maxBlocks limit 1 and maxInstances limit 1', ); }); @@ -599,7 +599,7 @@ export function testAWorkspace() { const typeCountsMap = {'get_var_block': 1}; chai.assert.isFalse( this.workspace.isCapacityAvailable(typeCountsMap), - 'With maxBlocks limit 0 and maxInstances limit 1' + 'With maxBlocks limit 0 and maxInstances limit 1', ); }); @@ -609,7 +609,7 @@ export function testAWorkspace() { const typeCountsMap = {'get_var_block': 1}; chai.assert.isFalse( this.workspace.isCapacityAvailable(typeCountsMap), - 'With maxBlocks limit 1 and maxInstances limit 0' + 'With maxBlocks limit 1 and maxInstances limit 0', ); }); @@ -636,12 +636,12 @@ export function testAWorkspace() { chai.assert.equal( Blockly.Workspace.getById(this.workspace.id), this.workspace, - 'Find workspace' + 'Find workspace', ); chai.assert.equal( Blockly.Workspace.getById(this.workspaceB.id), this.workspaceB, - 'Find workspaceB' + 'Find workspaceB', ); }); @@ -675,11 +675,11 @@ export function testAWorkspace() { test('Trivial', function () { chai.assert.equal( this.workspace.getBlockById(this.blockA.id), - this.blockA + this.blockA, ); chai.assert.equal( this.workspace.getBlockById(this.blockB.id), - this.blockB + this.blockB, ); }); @@ -696,7 +696,7 @@ export function testAWorkspace() { chai.assert.isNull(this.workspace.getBlockById(this.blockA.id)); chai.assert.equal( this.workspace.getBlockById(this.blockB.id), - this.blockB + this.blockB, ); }); @@ -724,14 +724,14 @@ export function testAWorkspace() { actual.getAttribute(attr.name), attr.value, `expected attribute ${attr.name} on ${actualString} to match ` + - `${expectedString}` + `${expectedString}`, ); } chai.assert.equal( actual.childElementCount, expected.childElementCount, `expected node ${actualString} to have the same children as node ` + - `${expectedString}` + `${expectedString}`, ); for (let i = 0; i < expected.childElementCount; i++) { assertNodesEqual(actual.children[i], expected.children[i]); @@ -807,7 +807,7 @@ export function testAWorkspace() { ' ' + ' ' + ' ' + - '' + '', ); }); @@ -818,7 +818,7 @@ export function testAWorkspace() { ' ' + ' ' + ' ' + - '' + '', ); }); @@ -829,7 +829,7 @@ export function testAWorkspace() { ' ' + ' ' + ' ' + - '' + '', ); }); @@ -840,7 +840,7 @@ export function testAWorkspace() { ' ' + ' ' + ' ' + - '' + '', ); }); @@ -851,7 +851,7 @@ export function testAWorkspace() { ' ' + ' ' + ' ' + - '' + '', ); }); @@ -862,7 +862,7 @@ export function testAWorkspace() { ' ' + ' ' + ' ' + - '' + '', ); }); }); @@ -1218,7 +1218,7 @@ export function testAWorkspace() { this.workspace.getAllBlocks().length, 2, 'expected there to only be 2 blocks on the workspace ' + - '(check for shadows)' + '(check for shadows)', ); }); @@ -1237,7 +1237,7 @@ export function testAWorkspace() { this.workspace.getAllBlocks().length, 2, 'expected there to only be 2 blocks on the workspace ' + - '(check for shadows)' + '(check for shadows)', ); }); @@ -1403,7 +1403,7 @@ export function testAWorkspace() { chai.assert.equal(undoStack[undoStack.length - 1].type, 'var_delete'); chai.assert.notEqual( undoStack[undoStack.length - 2].type, - 'var_delete' + 'var_delete', ); // Undo delete @@ -1434,7 +1434,7 @@ export function testAWorkspace() { chai.assert.equal(undoStack[undoStack.length - 2].type, 'delete'); chai.assert.notEqual( undoStack[undoStack.length - 3].type, - 'var_delete' + 'var_delete', ); // Undo delete diff --git a/tests/mocha/theme_test.js b/tests/mocha/theme_test.js index 5a4617ddd..b63c6f99f 100644 --- a/tests/mocha/theme_test.js +++ b/tests/mocha/theme_test.js @@ -136,7 +136,7 @@ suite('Theme', function () { }; const refreshToolboxSelectionStub = sinon.stub( workspace, - 'refreshToolboxSelection' + 'refreshToolboxSelection', ); blockA.styleName_ = 'styleOne'; @@ -155,7 +155,7 @@ suite('Theme', function () { this.eventsFireStub, Blockly.Events.ThemeChange, {themeName: 'themeName', type: eventUtils.THEME_CHANGE}, - workspace.id + workspace.id, ); } finally { workspaceTeardown.call(this, workspace); @@ -177,7 +177,7 @@ suite('Theme', function () { }; stringifyAndCompare( this.constants.validatedBlockStyle_(inputStyle), - expectedOutput + expectedOutput, ); }); @@ -191,7 +191,7 @@ suite('Theme', function () { }; stringifyAndCompare( this.constants.validatedBlockStyle_(inputStyle), - expectedOutput + expectedOutput, ); }); @@ -207,7 +207,7 @@ suite('Theme', function () { }; stringifyAndCompare( this.constants.validatedBlockStyle_(inputStyle), - expectedOutput + expectedOutput, ); }); @@ -226,7 +226,7 @@ suite('Theme', function () { }; stringifyAndCompare( this.constants.validatedBlockStyle_(inputStyle), - expectedOutput + expectedOutput, ); }); @@ -244,7 +244,7 @@ suite('Theme', function () { }; stringifyAndCompare( this.constants.validatedBlockStyle_(inputStyle), - expectedOutput + expectedOutput, ); }); @@ -260,7 +260,7 @@ suite('Theme', function () { }; stringifyAndCompare( this.constants.validatedBlockStyle_(inputStyle), - expectedOutput + expectedOutput, ); }); @@ -278,7 +278,7 @@ suite('Theme', function () { }; stringifyAndCompare( this.constants.validatedBlockStyle_(inputStyle), - expectedOutput + expectedOutput, ); }); @@ -294,7 +294,7 @@ suite('Theme', function () { }; stringifyAndCompare( this.constants.validatedBlockStyle_(inputStyle), - expectedOutput + expectedOutput, ); }); }); diff --git a/tests/mocha/toolbox_test.js b/tests/mocha/toolbox_test.js index 4289e3ab1..1f76e4cdf 100644 --- a/tests/mocha/toolbox_test.js +++ b/tests/mocha/toolbox_test.js @@ -50,7 +50,7 @@ suite('Toolbox', function () { .childNodes[0]; chai.assert.equal( toolboxDiv.className, - 'blocklyToolboxDiv blocklyNonSelectable' + 'blocklyToolboxDiv blocklyNonSelectable', ); }); test('Init called -> Toolbox is subscribed to background and foreground colour', function () { @@ -63,13 +63,13 @@ suite('Toolbox', function () { themeManagerSpy, this.toolbox.HtmlDiv, 'toolboxBackgroundColour', - 'background-color' + 'background-color', ); sinon.assert.calledWith( themeManagerSpy, this.toolbox.HtmlDiv, 'toolboxForegroundColour', - 'color' + 'color', ); }); test('Init called -> Render is called', function () { @@ -195,7 +195,7 @@ suite('Toolbox', function () { test('Toolbox clicked -> Should close flyout', function () { const hideChaffStub = sinon.stub( Blockly.WorkspaceSvg.prototype, - 'hideChaff' + 'hideChaff', ); const evt = new PointerEvent('pointerdown', {}); this.toolbox.HtmlDiv.dispatchEvent(evt); @@ -248,7 +248,7 @@ suite('Toolbox', function () { this.toolbox, 'ArrowUp', 'selectPrevious_', - true + true, ); }); test('Left button is pushed -> Should call selectParent_', function () { @@ -256,7 +256,7 @@ suite('Toolbox', function () { this.toolbox, 'ArrowLeft', 'selectParent_', - true + true, ); }); test('Right button is pushed -> Should call selectChild_', function () { @@ -264,14 +264,14 @@ suite('Toolbox', function () { this.toolbox, 'ArrowRight', 'selectChild_', - true + true, ); }); test('Enter button is pushed -> Should toggle expanded', function () { this.toolbox.selectedItem_ = getCollapsibleItem(this.toolbox); const toggleExpandedStub = sinon.stub( this.toolbox.selectedItem_, - 'toggleExpanded' + 'toggleExpanded', ); const event = createKeyDownMock('Enter'); const preventDefaultEvent = sinon.stub(event, 'preventDefault'); @@ -364,7 +364,7 @@ suite('Toolbox', function () { chai.assert.isTrue(handled); chai.assert.equal( this.toolbox.selectedItem_, - this.toolbox.contents_[1] + this.toolbox.contents_[1], ); }); test('Selected item is last item -> Should not handle event', function () { @@ -505,7 +505,7 @@ suite('Toolbox', function () { const showFlyoutstub = sinon.stub(this.toolbox.flyout_, 'show'); const scrollToStartFlyout = sinon.stub( this.toolbox.flyout_, - 'scrollToStart' + 'scrollToStart', ); const newItem = getNonCollapsibleItem(this.toolbox); this.toolbox.updateFlyout_(null, newItem); @@ -525,14 +525,14 @@ suite('Toolbox', function () { chai.assert.equal( toolbox.HtmlDiv.style.left, '0px', - 'Check left position' + 'Check left position', ); chai.assert.equal(toolbox.HtmlDiv.style.height, 'auto', 'Check height'); chai.assert.equal(toolbox.HtmlDiv.style.width, '100%', 'Check width'); chai.assert.equal( toolbox.height_, toolbox.HtmlDiv.offsetHeight, - 'Check height' + 'Check height', ); } function checkVerticalToolbox(toolbox) { @@ -540,7 +540,7 @@ suite('Toolbox', function () { chai.assert.equal( toolbox.width_, toolbox.HtmlDiv.offsetWidth, - 'Check width' + 'Check width', ); } test('HtmlDiv is not created -> Should not resize', function () { @@ -596,7 +596,7 @@ suite('Toolbox', function () { chai.assert.equal( actualVal.toUpperCase(), expectedVal.toUpperCase(), - 'Checking value for: ' + value + 'Checking value for: ' + value, ); } function checkContents(actualContents, expectedContents) { @@ -605,7 +605,7 @@ suite('Toolbox', function () { // TODO: Check the values as well as all the keys. chai.assert.containsAllKeys( actualContents[i], - Object.keys(expectedContents[i]) + Object.keys(expectedContents[i]), ); } } @@ -630,14 +630,14 @@ suite('Toolbox', function () { suite('parseToolbox', function () { test('Category Toolbox: JSON', function () { const toolboxDef = Blockly.utils.toolbox.convertToolboxDefToJson( - this.categoryToolboxJSON + this.categoryToolboxJSON, ); chai.assert.isNotNull(toolboxDef); checkCategoryToolbox(toolboxDef, this.categoryToolboxJSON); }); test('Simple Toolbox: JSON', function () { const toolboxDef = Blockly.utils.toolbox.convertToolboxDefToJson( - this.simpleToolboxJSON + this.simpleToolboxJSON, ); chai.assert.isNotNull(toolboxDef); checkSimpleToolbox(toolboxDef, this.simpleToolboxJSON); @@ -726,7 +726,7 @@ suite('Toolbox', function () { }); test('Json', function () { const flyoutDef = Blockly.utils.toolbox.convertFlyoutDefToJsonArray( - this.simpleToolboxJSON + this.simpleToolboxJSON, ); checkContents(flyoutDef, this.simpleToolboxJSON['contents']); }); @@ -751,7 +751,7 @@ suite('Toolbox', function () { chai.assert.isTrue( innerCategory.isVisible(), - 'All ancestors are expanded, so category should be visible' + 'All ancestors are expanded, so category should be visible', ); }); test('Child categories not visible if any ancestor not expanded', function () { @@ -767,7 +767,7 @@ suite('Toolbox', function () { chai.assert.isFalse( innerCategory.isVisible(), - 'Not all ancestors are expanded, so category should not be visible' + 'Not all ancestors are expanded, so category should not be visible', ); }); }); diff --git a/tests/mocha/tooltip_test.js b/tests/mocha/tooltip_test.js index dc6aa5eaf..d3b59acc7 100644 --- a/tests/mocha/tooltip_test.js +++ b/tests/mocha/tooltip_test.js @@ -59,16 +59,16 @@ suite('Tooltip', function () { // Fire pointer events directly on the relevant SVG. this.block.pathObject.svgPath.dispatchEvent( - new PointerEvent('pointerover') + new PointerEvent('pointerover'), ); this.block.pathObject.svgPath.dispatchEvent( - new PointerEvent('pointermove') + new PointerEvent('pointermove'), ); this.clock.runAll(); chai.assert.isTrue( wasCalled, - 'Expected custom tooltip function to have been called' + 'Expected custom tooltip function to have been called', ); }); }); @@ -134,7 +134,7 @@ suite('Tooltip', function () { setFunctionReturningObjectTooltip(this.block); chai.assert.throws( this.block.getTooltip.bind(this.block), - 'Tooltip function must return a string.' + 'Tooltip function must return a string.', ); }); @@ -175,7 +175,7 @@ suite('Tooltip', function () { setFunctionReturningObjectTooltip(this.block); chai.assert.throws( this.block.getTooltip.bind(this.block), - 'Tooltip function must return a string.' + 'Tooltip function must return a string.', ); }); @@ -210,7 +210,7 @@ suite('Tooltip', function () { setFunctionReturningObjectTooltip(this.field); chai.assert.throws( this.field.getTooltip.bind(this.field), - 'Tooltip function must return a string.' + 'Tooltip function must return a string.', ); }); @@ -258,7 +258,7 @@ suite('Tooltip', function () { setFunctionReturningObjectTooltip(this.field); chai.assert.throws( this.field.getTooltip.bind(this.field), - 'Tooltip function must return a string.' + 'Tooltip function must return a string.', ); }); diff --git a/tests/mocha/touch_test.js b/tests/mocha/touch_test.js index 3eae21c2d..4b45d8a5f 100644 --- a/tests/mocha/touch_test.js +++ b/tests/mocha/touch_test.js @@ -98,7 +98,7 @@ suite('Touch', function () { }); chai.assert.equal( Blockly.Touch.getTouchIdentifierFromEvent(pointerdown), - 7 + 7, ); }); @@ -109,7 +109,7 @@ suite('Touch', function () { }); chai.assert.equal( Blockly.Touch.getTouchIdentifierFromEvent(pointerdown), - 42 + 42, ); }); }); diff --git a/tests/mocha/trashcan_test.js b/tests/mocha/trashcan_test.js index d29b5699f..3faee3793 100644 --- a/tests/mocha/trashcan_test.js +++ b/tests/mocha/trashcan_test.js @@ -26,7 +26,7 @@ suite('Trashcan', function () { let xml = Blockly.utils.xml.textToDom( '' + xmlString + - '' + '', ); xml = xml.children[0]; const block = Blockly.Xml.domToBlock(xml, workspace); @@ -78,7 +78,7 @@ suite('Trashcan', function () { let xml = Blockly.utils.xml.textToDom( '' + ' ' + - '' + '', ); xml = xml.children[0]; fireNonDeleteEvent(this.workspace, xml); @@ -99,7 +99,7 @@ suite('Trashcan', function () { Blockly.Events.Click, {targetType: 'workspace', type: eventUtils.CLICK}, this.workspace.id, - undefined + undefined, ); }); test('Click with contents - fires trashcanOpen', function () { @@ -116,7 +116,7 @@ suite('Trashcan', function () { this.eventsFireStub, Blockly.Events.TrashcanOpen, {isOpen: true, type: eventUtils.TRASHCAN_OPEN}, - this.workspace.id + this.workspace.id, ); assertEventNotFired(this.eventsFireStub, Blockly.Events.Click, { type: eventUtils.TRASHCAN_OPEN, @@ -135,14 +135,14 @@ suite('Trashcan', function () { this.eventsFireStub, Blockly.Events.TrashcanOpen, {isOpen: false, type: eventUtils.TRASHCAN_OPEN}, - this.workspace.id + this.workspace.id, ); assertEventFired( this.eventsFireStub, Blockly.Events.Click, {targetType: 'workspace', type: eventUtils.CLICK}, this.workspace.id, - undefined + undefined, ); }); }); @@ -155,22 +155,22 @@ suite('Trashcan', function () { test('Different Coords', function () { fireDeleteEvent( this.workspace, - '' + '', ); fireDeleteEvent( this.workspace, - '' + '', ); chai.assert.equal(this.trashcan.contents.length, 1); }); test('Different IDs', function () { fireDeleteEvent( this.workspace, - '' + '', ); fireDeleteEvent( this.workspace, - '' + '', ); chai.assert.equal(this.trashcan.contents.length, 1); }); @@ -178,7 +178,7 @@ suite('Trashcan', function () { fireDeleteEvent(this.workspace, ''); fireDeleteEvent( this.workspace, - '' + '', ); // Disabled tags get removed because disabled blocks aren't allowed to // be dragged from flyouts. See #2239 and #3243. @@ -189,13 +189,13 @@ suite('Trashcan', function () { this.workspace, '' + ' dummy_value1' + - '' + '', ); fireDeleteEvent( this.workspace, '' + ' dummy_value2' + - '' + '', ); chai.assert.equal(this.trashcan.contents.length, 2); }); @@ -207,7 +207,7 @@ suite('Trashcan', function () { ' ' + ' ' + ' ' + - '' + '', ); chai.assert.equal(this.trashcan.contents.length, 2); }); @@ -218,7 +218,7 @@ suite('Trashcan', function () { ' ' + ' ' + ' ' + - '' + '', ); fireDeleteEvent( this.workspace, @@ -226,7 +226,7 @@ suite('Trashcan', function () { ' ' + ' ' + ' ' + - '' + '', ); chai.assert.equal(this.trashcan.contents.length, 2); }); @@ -238,7 +238,7 @@ suite('Trashcan', function () { ' ' + ' ' + ' ' + - '' + '', ); chai.assert.equal(this.trashcan.contents.length, 2); }); @@ -249,7 +249,7 @@ suite('Trashcan', function () { ' ' + ' ' + ' ' + - '' + '', ); fireDeleteEvent( this.workspace, @@ -257,7 +257,7 @@ suite('Trashcan', function () { ' ' + ' ' + ' ' + - '' + '', ); chai.assert.equal(this.trashcan.contents.length, 2); }); @@ -269,7 +269,7 @@ suite('Trashcan', function () { ' ' + ' ' + ' ' + - '' + '', ); chai.assert.equal(this.trashcan.contents.length, 2); }); @@ -280,7 +280,7 @@ suite('Trashcan', function () { ' ' + ' ' + ' ' + - '' + '', ); fireDeleteEvent( this.workspace, @@ -288,7 +288,7 @@ suite('Trashcan', function () { ' ' + ' ' + ' ' + - '' + '', ); chai.assert.equal(this.trashcan.contents.length, 2); }); @@ -298,7 +298,7 @@ suite('Trashcan', function () { this.workspace, '' + ' comment_text' + - '' + '', ); chai.assert.equal(this.trashcan.contents.length, 2); }); @@ -307,13 +307,13 @@ suite('Trashcan', function () { this.workspace, '' + ' comment_text1' + - '' + '', ); fireDeleteEvent( this.workspace, '' + ' comment_text2' + - '' + '', ); chai.assert.equal(this.trashcan.contents.length, 2); }); @@ -322,13 +322,13 @@ suite('Trashcan', function () { this.workspace, '' + ' comment_text' + - '' + '', ); fireDeleteEvent( this.workspace, '' + ' comment_text' + - '' + '', ); // h & w tags are removed b/c the blocks appear the same. chai.assert.equal(this.trashcan.contents.length, 1); @@ -338,13 +338,13 @@ suite('Trashcan', function () { this.workspace, '' + ' comment_text' + - '' + '', ); fireDeleteEvent( this.workspace, '' + ' comment_text' + - '' + '', ); // pinned tags are removed b/c the blocks appear the same. chai.assert.equal(this.trashcan.contents.length, 1); @@ -354,13 +354,13 @@ suite('Trashcan', function () { this.workspace, '' + ' ' + - '' + '', ); fireDeleteEvent( this.workspace, '' + ' ' + - '' + '', ); chai.assert.equal(this.trashcan.contents.length, 2); }); diff --git a/tests/mocha/utils_test.js b/tests/mocha/utils_test.js index 3f7ba6fc5..af5df8790 100644 --- a/tests/mocha/utils_test.js +++ b/tests/mocha/utils_test.js @@ -34,28 +34,28 @@ suite('Utils', function () { test('Empty string', function () { chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation(''), - [] + [], ); }); test('No interpolation', function () { chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('Hello'), - ['Hello'] + ['Hello'], ); }); test('Unescaped %', function () { chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('Hello%World'), - ['Hello%World'] + ['Hello%World'], ); }); test('Escaped %', function () { chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('Hello%%World'), - ['Hello%World'] + ['Hello%World'], ); }); }); @@ -64,21 +64,21 @@ suite('Utils', function () { test('Single-digit number interpolation', function () { chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('Hello%1World'), - ['Hello', 1, 'World'] + ['Hello', 1, 'World'], ); }); test('Multi-digit number interpolation', function () { chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('%123Hello%456World%789'), - [123, 'Hello', 456, 'World', 789] + [123, 'Hello', 456, 'World', 789], ); }); test('Escaped number', function () { chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('Hello %%1 World'), - ['Hello %1 World'] + ['Hello %1 World'], ); }); @@ -87,7 +87,7 @@ suite('Utils', function () { // as well keep it. chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('%%%x%%0%00%01%'), - ['%%x%0', 0, 1, '%'] + ['%%x%0', 0, 1, '%'], ); }); }); @@ -97,7 +97,7 @@ suite('Utils', function () { Blockly.Msg.STRING_REF = 'test string'; chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('%{bky_string_ref}'), - ['test string'] + ['test string'], ); }); @@ -105,7 +105,7 @@ suite('Utils', function () { Blockly.Msg.STRING_REF = 'test string'; chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('%{BkY_StRiNg_ReF}'), - ['test string'] + ['test string'], ); }); @@ -113,9 +113,9 @@ suite('Utils', function () { Blockly.Msg.STRING_REF = 'test string'; chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation( - 'before %{bky_string_ref} after' + 'before %{bky_string_ref} after', ), - ['before test string after'] + ['before test string after'], ); }); @@ -123,7 +123,7 @@ suite('Utils', function () { Blockly.Msg.WITH_PARAM = 'before %1 after'; chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('%{bky_with_param}'), - ['before ', 1, ' after'] + ['before ', 1, ' after'], ); }); @@ -132,7 +132,7 @@ suite('Utils', function () { Blockly.Msg.RECURSE = 'before %{bky_string_ref} after'; chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('%{bky_recurse}'), - ['before test string after'] + ['before test string after'], ); }); @@ -140,14 +140,14 @@ suite('Utils', function () { Blockly.Msg['1'] = 'test string'; chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('%{bky_1}'), - ['test string'] + ['test string'], ); }); test('Undefined reference', function () { chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('%{bky_undefined}'), - ['%{bky_undefined}'] + ['%{bky_undefined}'], ); }); @@ -155,7 +155,7 @@ suite('Utils', function () { Blockly.Msg.STRING_REF = 'test string'; chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('%{string_ref}'), - ['%{string_ref}'] + ['%{string_ref}'], ); }); @@ -163,7 +163,7 @@ suite('Utils', function () { Blockly.Msg['1'] = 'test string'; chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('%{1}'), - ['%{1}'] + ['%{1}'], ); }); @@ -171,7 +171,7 @@ suite('Utils', function () { Blockly.Msg['string ref'] = 'test string'; chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('%{bky_string ref}'), - ['%{bky_string ref}'] + ['%{bky_string ref}'], ); }); @@ -179,7 +179,7 @@ suite('Utils', function () { Blockly.Msg['string-ref'] = 'test string'; chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('%{bky_string-ref}'), - ['%{bky_string-ref}'] + ['%{bky_string-ref}'], ); }); @@ -187,7 +187,7 @@ suite('Utils', function () { Blockly.Msg['string.ref'] = 'test string'; chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('%{bky_string.ref}'), - ['%{bky_string.ref}'] + ['%{bky_string.ref}'], ); }); @@ -195,7 +195,7 @@ suite('Utils', function () { Blockly.Msg['string&ref'] = 'test string'; chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('%{bky_string&ref}'), - ['%{bky_string&ref}'] + ['%{bky_string&ref}'], ); }); @@ -203,7 +203,7 @@ suite('Utils', function () { Blockly.Msg.UNCLOSED = 'test string'; chai.assert.deepEqual( Blockly.utils.parsing.tokenizeInterpolation('%{bky_unclosed'), - ['%{bky_unclosed'] + ['%{bky_unclosed'], ); }); }); @@ -228,7 +228,7 @@ suite('Utils', function () { chai.assert.equal( resultString, '%a', - 'Unrecognized % escape code treated as literal' + 'Unrecognized % escape code treated as literal', ); resultString = Blockly.utils.parsing.replaceMessageReferences('%1'); @@ -240,7 +240,7 @@ suite('Utils', function () { chai.assert.equal( resultString, 'before %1 after', - 'Interpolation tokens ignored.' + 'Interpolation tokens ignored.', ); // Blockly.Msg.STRING_REF cases: @@ -248,48 +248,48 @@ suite('Utils', function () { Blockly.utils.parsing.replaceMessageReferences('%{bky_string_ref}'); chai.assert.equal(resultString, 'test string', 'Message ref dereferenced.'); resultString = Blockly.utils.parsing.replaceMessageReferences( - 'before %{bky_string_ref} after' + 'before %{bky_string_ref} after', ); chai.assert.equal( resultString, 'before test string after', - 'Message ref dereferenced.' + 'Message ref dereferenced.', ); // Blockly.Msg.STRING_REF_WITH_ARG cases: resultString = Blockly.utils.parsing.replaceMessageReferences( - '%{bky_string_ref_with_arg}' + '%{bky_string_ref_with_arg}', ); chai.assert.equal( resultString, 'test %1 string', - 'Message ref dereferenced with argument preserved.' + 'Message ref dereferenced with argument preserved.', ); resultString = Blockly.utils.parsing.replaceMessageReferences( - 'before %{bky_string_ref_with_arg} after' + 'before %{bky_string_ref_with_arg} after', ); chai.assert.equal( resultString, 'before test %1 string after', - 'Message ref dereferenced with argument preserved.' + 'Message ref dereferenced with argument preserved.', ); // Blockly.Msg.STRING_REF_WITH_SUBREF cases: resultString = Blockly.utils.parsing.replaceMessageReferences( - '%{bky_string_ref_with_subref}' + '%{bky_string_ref_with_subref}', ); chai.assert.equal( resultString, 'test subref string', - 'Message ref and subref dereferenced.' + 'Message ref and subref dereferenced.', ); resultString = Blockly.utils.parsing.replaceMessageReferences( - 'before %{bky_string_ref_with_subref} after' + 'before %{bky_string_ref_with_subref} after', ); chai.assert.equal( resultString, 'before test subref string after', - 'Message ref and subref dereferenced.' + 'Message ref and subref dereferenced.', ); }); @@ -319,12 +319,12 @@ suite('Utils', function () { chai.assert.equal( m[1], '1.23456e+42', - 'translate(1.23456e+42 0.123456e-42), x' + 'translate(1.23456e+42 0.123456e-42), x', ); chai.assert.equal( m[3], '0.123456e-42', - 'translate(1.23456e+42 0.123456e-42), y' + 'translate(1.23456e+42 0.123456e-42), y', ); }); @@ -358,12 +358,12 @@ suite('Utils', function () { chai.assert.equal( m[1], '1.23456e+42', - 'transform: translate(1.23456e+42px 0.123456e-42px), x' + 'transform: translate(1.23456e+42px 0.123456e-42px), x', ); chai.assert.equal( m[3], '0.123456e-42', - 'transform: translate(1.23456e+42px 0.123456e-42px), y' + 'transform: translate(1.23456e+42px 0.123456e-42px), y', ); m = 'transform:translate3d(20px, 21px, 22px)'.match(regex); @@ -382,12 +382,12 @@ suite('Utils', function () { chai.assert.equal( m[1], '1.23456e+42', - 'transform:translate3d(1.23456e+42px 0.123456e-42px 42px), x' + 'transform:translate3d(1.23456e+42px 0.123456e-42px 42px), x', ); chai.assert.equal( m[3], '0.123456e-42', - 'transform:translate3d(1.23456e+42px 0.123456e-42px 42px), y' + 'transform:translate3d(1.23456e+42px 0.123456e-42px 42px), y', ); }); @@ -414,7 +414,7 @@ suite('Utils', function () { chai.assert.isTrue(Blockly.utils.dom.hasClass(p, 'three'), 'Has "three"'); chai.assert.isFalse( Blockly.utils.dom.hasClass(p, 'four'), - 'Has no "four"' + 'Has no "four"', ); chai.assert.isFalse(Blockly.utils.dom.hasClass(p, 't'), 'Has no "t"'); }); @@ -440,11 +440,11 @@ suite('Utils', function () { suite('String', function () { test('shortest string length', function () { let len = Blockly.utils.string.shortestStringLength( - 'one,two,three,four,five'.split(',') + 'one,two,three,four,five'.split(','), ); chai.assert.equal(len, 3, 'Length of "one"'); len = Blockly.utils.string.shortestStringLength( - 'one,two,three,four,five,'.split(',') + 'one,two,three,four,five,'.split(','), ); chai.assert.equal(len, 0, 'Length of ""'); len = Blockly.utils.string.shortestStringLength(['Hello World']); @@ -455,15 +455,15 @@ suite('Utils', function () { test('comment word prefix', function () { let len = Blockly.utils.string.commonWordPrefix( - 'one,two,three,four,five'.split(',') + 'one,two,three,four,five'.split(','), ); chai.assert.equal(len, 0, 'No prefix'); len = Blockly.utils.string.commonWordPrefix( - 'Xone,Xtwo,Xthree,Xfour,Xfive'.split(',') + 'Xone,Xtwo,Xthree,Xfour,Xfive'.split(','), ); chai.assert.equal(len, 0, 'No word prefix'); len = Blockly.utils.string.commonWordPrefix( - 'abc de,abc de,abc de,abc de'.split(',') + 'abc de,abc de,abc de,abc de'.split(','), ); chai.assert.equal(len, 6, 'Full equality'); len = Blockly.utils.string.commonWordPrefix('abc deX,abc deY'.split(',')); @@ -477,26 +477,26 @@ suite('Utils', function () { len = Blockly.utils.string.commonWordPrefix([]); chai.assert.equal(len, 0, 'Empty list'); len = Blockly.utils.string.commonWordPrefix( - 'turn left,turn right'.split(',') + 'turn left,turn right'.split(','), ); chai.assert.equal(len, 0, 'No prefix due to &nbsp;'); len = Blockly.utils.string.commonWordPrefix( - 'turn\u00A0left,turn\u00A0right'.split(',') + 'turn\u00A0left,turn\u00A0right'.split(','), ); chai.assert.equal(len, 0, 'No prefix due to \\u00A0'); }); test('comment word suffix', function () { let len = Blockly.utils.string.commonWordSuffix( - 'one,two,three,four,five'.split(',') + 'one,two,three,four,five'.split(','), ); chai.assert.equal(len, 0, 'No suffix'); len = Blockly.utils.string.commonWordSuffix( - 'oneX,twoX,threeX,fourX,fiveX'.split(',') + 'oneX,twoX,threeX,fourX,fiveX'.split(','), ); chai.assert.equal(len, 0, 'No word suffix'); len = Blockly.utils.string.commonWordSuffix( - 'abc de,abc de,abc de,abc de'.split(',') + 'abc de,abc de,abc de,abc de'.split(','), ); chai.assert.equal(len, 6, 'Full equality'); len = Blockly.utils.string.commonWordSuffix('Xabc de,Yabc de'.split(',')); @@ -524,7 +524,7 @@ suite('Utils', function () { chai.assert.equal( Blockly.utils.math.toRadians(360 + 90), 5 * quarter, - '450' + '450', ); }); @@ -539,7 +539,7 @@ suite('Utils', function () { chai.assert.equal( Blockly.utils.math.toDegrees(5 * quarter), 360 + 90, - '450' + '450', ); }); }); diff --git a/tests/mocha/variable_map_test.js b/tests/mocha/variable_map_test.js index 71cea2c16..21e9af8fe 100644 --- a/tests/mocha/variable_map_test.js +++ b/tests/mocha/variable_map_test.js @@ -283,7 +283,7 @@ suite('Variable Map', function () { varName: 'test name', varId: 'test id', }, - this.workspace.id + this.workspace.id, ); }); @@ -297,7 +297,7 @@ suite('Variable Map', function () { this.eventSpy, Blockly.Events.VarCreate, {}, - this.workspace.id + this.workspace.id, ); }); }); @@ -308,7 +308,7 @@ suite('Variable Map', function () { const variable = this.variableMap.createVariable( 'test name', 'test type', - 'test id' + 'test id', ); this.variableMap.deleteVariable(variable); @@ -320,7 +320,7 @@ suite('Variable Map', function () { varName: 'test name', varId: 'test id', }, - this.workspace.id + this.workspace.id, ); }); @@ -329,7 +329,7 @@ suite('Variable Map', function () { this.workspace, 'test name', 'test type', - 'test id' + 'test id', ); this.variableMap.deleteVariable(variable); @@ -337,7 +337,7 @@ suite('Variable Map', function () { this.eventSpy, Blockly.Events.VarDelete, {}, - this.workspace.id + this.workspace.id, ); }); }); @@ -355,7 +355,7 @@ suite('Variable Map', function () { varName: 'test name', varId: 'test id', }, - this.workspace.id + this.workspace.id, ); }); @@ -366,7 +366,7 @@ suite('Variable Map', function () { this.eventSpy, Blockly.Events.VarDelete, {}, - this.workspace.id + this.workspace.id, ); }); }); @@ -378,7 +378,7 @@ suite('Variable Map', function () { const variable = this.variableMap.createVariable( 'test name', 'test type', - 'test id' + 'test id', ); this.variableMap.renameVariable(variable, 'new test name'); @@ -390,7 +390,7 @@ suite('Variable Map', function () { newName: 'new test name', varId: 'test id', }, - this.workspace.id + this.workspace.id, ); }); @@ -398,7 +398,7 @@ suite('Variable Map', function () { const variable = this.variableMap.createVariable( 'test name', 'test type', - 'test id' + 'test id', ); this.variableMap.renameVariable(variable, 'test name'); @@ -406,7 +406,7 @@ suite('Variable Map', function () { this.eventSpy, Blockly.Events.VarRename, {}, - this.workspace.id + this.workspace.id, ); }); @@ -414,7 +414,7 @@ suite('Variable Map', function () { const variable = new Blockly.VariableModel( 'test name', 'test type', - 'test id' + 'test id', ); this.variableMap.renameVariable(variable, 'test name'); @@ -422,7 +422,7 @@ suite('Variable Map', function () { this.eventSpy, Blockly.Events.VarRename, {}, - this.workspace.id + this.workspace.id, ); }); }); @@ -440,7 +440,7 @@ suite('Variable Map', function () { newName: 'new test name', varId: 'test id', }, - this.workspace.id + this.workspace.id, ); }); @@ -452,7 +452,7 @@ suite('Variable Map', function () { this.eventSpy, Blockly.Events.VarRename, {}, - this.workspace.id + this.workspace.id, ); }); diff --git a/tests/mocha/variable_model_test.js b/tests/mocha/variable_model_test.js index 14765da57..d328c388c 100644 --- a/tests/mocha/variable_model_test.js +++ b/tests/mocha/variable_model_test.js @@ -26,7 +26,7 @@ suite('Variable Model', function () { this.workspace, 'test', 'test_type', - 'test_id' + 'test_id', ); chai.assert.equal(variable.name, 'test'); chai.assert.equal(variable.type, 'test_type'); @@ -38,7 +38,7 @@ suite('Variable Model', function () { this.workspace, 'test', null, - 'test_id' + 'test_id', ); chai.assert.equal(variable.type, ''); }); @@ -48,7 +48,7 @@ suite('Variable Model', function () { this.workspace, 'test', undefined, - 'test_id' + 'test_id', ); chai.assert.equal(variable.type, ''); }); @@ -58,7 +58,7 @@ suite('Variable Model', function () { this.workspace, 'test', 'test_type', - null + null, ); chai.assert.equal(variable.name, 'test'); chai.assert.equal(variable.type, 'test_type'); @@ -70,7 +70,7 @@ suite('Variable Model', function () { this.workspace, 'test', 'test_type', - undefined + undefined, ); chai.assert.equal(variable.name, 'test'); chai.assert.equal(variable.type, 'test_type'); diff --git a/tests/mocha/widget_div_test.js b/tests/mocha/widget_div_test.js index ecf2292c4..354696ea6 100644 --- a/tests/mocha/widget_div_test.js +++ b/tests/mocha/widget_div_test.js @@ -48,13 +48,13 @@ suite('WidgetDiv', function () { rtl, expectedX, expectedY, - expectedHeight + expectedHeight, ) { Blockly.WidgetDiv.positionWithAnchor( this.viewportBBox, anchorBBox, this.widgetSize, - rtl + rtl, ); const style = Blockly.WidgetDiv.getDiv().style; chai.assert.equal(style.left, expectedX + 'px', 'Left'); @@ -70,7 +70,7 @@ suite('WidgetDiv', function () { 500, 500, this.anchorSize.width, - this.anchorSize.height + this.anchorSize.height, ); // The widget div should be placed just below at the left side of the // anchor. @@ -81,7 +81,7 @@ suite('WidgetDiv', function () { false, expectedX, expectedY, - this.widgetSize.height + this.widgetSize.height, ); }); @@ -91,7 +91,7 @@ suite('WidgetDiv', function () { 500, 50, this.anchorSize.width, - this.anchorSize.height + this.anchorSize.height, ); // The widget div should be placed just below the anchor. const expectedX = anchorBBox.left; @@ -101,7 +101,7 @@ suite('WidgetDiv', function () { false, expectedX, expectedY, - this.widgetSize.height + this.widgetSize.height, ); }); @@ -111,7 +111,7 @@ suite('WidgetDiv', function () { 500, 900, this.anchorSize.width, - this.anchorSize.height + this.anchorSize.height, ); // The widget div should be placed just above the anchor. const expectedX = anchorBBox.left; @@ -121,7 +121,7 @@ suite('WidgetDiv', function () { false, expectedX, expectedY, - this.widgetSize.height + this.widgetSize.height, ); }); @@ -131,7 +131,7 @@ suite('WidgetDiv', function () { 50, 500, this.anchorSize.width, - this.anchorSize.height + this.anchorSize.height, ); // The widget div should be placed at the anchor. const expectedX = anchorBBox.left; @@ -141,7 +141,7 @@ suite('WidgetDiv', function () { false, expectedX, expectedY, - this.widgetSize.height + this.widgetSize.height, ); }); @@ -151,7 +151,7 @@ suite('WidgetDiv', function () { 950, 500, this.anchorSize.width, - this.anchorSize.height + this.anchorSize.height, ); // The widget div should be placed as far right as possible--at the edge of // the screen. @@ -162,7 +162,7 @@ suite('WidgetDiv', function () { false, expectedX, expectedY, - this.widgetSize.height + this.widgetSize.height, ); }); }); @@ -173,7 +173,7 @@ suite('WidgetDiv', function () { 500, 500, this.anchorSize.width, - this.anchorSize.height + this.anchorSize.height, ); // The widget div should be placed at the right side of the anchor. const expectedX = anchorBBox.right - this.widgetSize.width; @@ -183,7 +183,7 @@ suite('WidgetDiv', function () { true, expectedX, expectedY, - this.widgetSize.height + this.widgetSize.height, ); }); @@ -193,7 +193,7 @@ suite('WidgetDiv', function () { 500, 50, this.anchorSize.width, - this.anchorSize.height + this.anchorSize.height, ); // The widget div should be placed just below the anchor. const expectedX = anchorBBox.right - this.widgetSize.width; @@ -203,7 +203,7 @@ suite('WidgetDiv', function () { true, expectedX, expectedY, - this.widgetSize.height + this.widgetSize.height, ); }); @@ -213,7 +213,7 @@ suite('WidgetDiv', function () { 500, 900, this.anchorSize.width, - this.anchorSize.height + this.anchorSize.height, ); // The widget div should be placed just above the anchor. const expectedX = anchorBBox.right - this.widgetSize.width; @@ -223,7 +223,7 @@ suite('WidgetDiv', function () { true, expectedX, expectedY, - this.widgetSize.height + this.widgetSize.height, ); }); @@ -233,7 +233,7 @@ suite('WidgetDiv', function () { 10, 500, this.anchorSize.width, - this.anchorSize.height + this.anchorSize.height, ); // The widget div should be placed as far left as possible--at the edge of // the screen. @@ -244,7 +244,7 @@ suite('WidgetDiv', function () { true, expectedX, expectedY, - this.widgetSize.height + this.widgetSize.height, ); }); @@ -254,7 +254,7 @@ suite('WidgetDiv', function () { 950, 500, this.anchorSize.width, - this.anchorSize.height + this.anchorSize.height, ); // The widget div should be placed as far right as possible--at the edge of // the screen. @@ -265,7 +265,7 @@ suite('WidgetDiv', function () { true, expectedX, expectedY, - this.widgetSize.height + this.widgetSize.height, ); }); }); diff --git a/tests/mocha/workspace_comment_test.js b/tests/mocha/workspace_comment_test.js index 2bd52c616..e8a336052 100644 --- a/tests/mocha/workspace_comment_test.js +++ b/tests/mocha/workspace_comment_test.js @@ -32,7 +32,7 @@ suite('Workspace comment', function () { 'comment text', 0, 0, - 'comment id' + 'comment id', ); chai.assert.equal(this.workspace.getTopComments(true).length, 1); chai.assert.equal(this.workspace.commentDB.get('comment id'), comment); @@ -49,7 +49,7 @@ suite('Workspace comment', function () { 'comment text', 0, 0, - 'comment id' + 'comment id', ); this.workspace.clear(); chai.assert.equal(this.workspace.getTopComments(true).length, 0); @@ -62,7 +62,7 @@ suite('Workspace comment', function () { 'comment text', 0, 0, - 'comment id' + 'comment id', ); comment.dispose(); chai.assert.equal(this.workspace.getTopComments(true).length, 0); @@ -81,7 +81,7 @@ suite('Workspace comment', function () { 'comment text', 0, 0, - 'comment id' + 'comment id', ); chai.assert.equal(this.workspace.getTopComments(false).length, 1); chai.assert.equal(this.workspace.commentDB.get('comment id'), comment); @@ -98,7 +98,7 @@ suite('Workspace comment', function () { 'comment text', 0, 0, - 'comment id' + 'comment id', ); this.workspace.clear(); chai.assert.equal(this.workspace.getTopComments(false).length, 0); @@ -111,7 +111,7 @@ suite('Workspace comment', function () { 'comment text', 0, 0, - 'comment id' + 'comment id', ); comment.dispose(); chai.assert.equal(this.workspace.getTopComments(false).length, 0); @@ -126,7 +126,7 @@ suite('Workspace comment', function () { 'comment text', 0, 0, - 'comment id' + 'comment id', ); chai.assert.equal(this.workspace.getCommentById(comment.id), comment); }); @@ -145,7 +145,7 @@ suite('Workspace comment', function () { 'comment text', 0, 0, - 'comment id' + 'comment id', ); comment.dispose(); chai.assert.isNull(this.workspace.getCommentById(comment.id)); @@ -159,7 +159,7 @@ suite('Workspace comment', function () { 'comment text', 0, 0, - 'comment id' + 'comment id', ); comment.dispose(); // Nothing should go wrong the second time dispose is called. @@ -172,7 +172,7 @@ suite('Workspace comment', function () { 'comment text', 0, 0, - 'comment id' + 'comment id', ); comment.dispose(); // Nothing should go wrong the second time dispose is called. @@ -187,7 +187,7 @@ suite('Workspace comment', function () { 'comment text', 10, 20, - 'comment id' + 'comment id', ); }); @@ -216,7 +216,7 @@ suite('Workspace comment', function () { 'comment text', 10, 20, - 'comment id' + 'comment id', ); }); @@ -241,7 +241,7 @@ suite('Workspace comment', function () { 'comment text', 0, 0, - 'comment id' + 'comment id', ); }); @@ -254,7 +254,7 @@ suite('Workspace comment', function () { chai.assert.equal( this.workspace.undoStack_.length, 1, - 'Workspace undo stack' + 'Workspace undo stack', ); }); @@ -265,7 +265,7 @@ suite('Workspace comment', function () { chai.assert.equal( this.workspace.undoStack_.length, 1, - 'Workspace undo stack' + 'Workspace undo stack', ); }); @@ -275,7 +275,7 @@ suite('Workspace comment', function () { chai.assert.equal( this.workspace.undoStack_.length, 2, - 'Workspace undo stack' + 'Workspace undo stack', ); }); }); diff --git a/tests/mocha/workspace_svg_test.js b/tests/mocha/workspace_svg_test.js index 56a6a4822..9fe076904 100644 --- a/tests/mocha/workspace_svg_test.js +++ b/tests/mocha/workspace_svg_test.js @@ -59,41 +59,41 @@ suite('WorkspaceSvg', function () { '' + ' ' + ' ' + - '' + '', ); Blockly.Xml.appendDomToWorkspace(dom, this.workspace); chai.assert.equal( this.workspace.getAllBlocks(false).length, 1, - 'Block count' + 'Block count', ); Blockly.Xml.appendDomToWorkspace(dom, this.workspace); chai.assert.equal( this.workspace.getAllBlocks(false).length, 2, - 'Block count' + 'Block count', ); const blocks = this.workspace.getAllBlocks(false); chai.assert.equal( blocks[0].getRelativeToSurfaceXY().x, 21, - 'Block 1 position x' + 'Block 1 position x', ); chai.assert.equal( blocks[0].getRelativeToSurfaceXY().y, 23, - 'Block 1 position y' + 'Block 1 position y', ); chai.assert.equal( blocks[1].getRelativeToSurfaceXY().x, 21, - 'Block 2 position x' + 'Block 2 position x', ); // Y separation value defined in appendDomToWorkspace as 10 chai.assert.equal( blocks[1].getRelativeToSurfaceXY().y, 23 + blocks[0].getHeightWidth().height + 10, - 'Block 2 position y' + 'Block 2 position y', ); }); @@ -105,7 +105,7 @@ suite('WorkspaceSvg', function () { '' + '' + '' + - '' + '', ); Blockly.Xml.appendDomToWorkspace(dom, this.workspace); @@ -131,7 +131,7 @@ suite('WorkspaceSvg', function () { function () { this.workspace.updateToolbox(null); }.bind(this), - "Can't nullify an existing toolbox." + "Can't nullify an existing toolbox.", ); }); test('Passes in toolbox def when current toolbox is null', function () { @@ -140,7 +140,7 @@ suite('WorkspaceSvg', function () { function () { this.workspace.updateToolbox({'contents': []}); }.bind(this), - "Existing toolbox is null. Can't create new toolbox." + "Existing toolbox is null. Can't create new toolbox.", ); }); test('Existing toolbox has no categories', function () { @@ -152,7 +152,7 @@ suite('WorkspaceSvg', function () { function () { this.workspace.updateToolbox({'contents': []}); }.bind(this), - "Existing toolbox has no categories. Can't change mode." + "Existing toolbox has no categories. Can't change mode.", ); }); test('Existing toolbox has categories', function () { @@ -164,7 +164,7 @@ suite('WorkspaceSvg', function () { function () { this.workspace.updateToolbox({'contents': []}); }.bind(this), - "Existing toolbox has categories. Can't change mode." + "Existing toolbox has categories. Can't change mode.", ); }); }); @@ -179,20 +179,20 @@ suite('WorkspaceSvg', function () { spy, Blockly.Events.ViewportChange, expectedProperties, - workspace.id + workspace.id, ); assertEventFired( spy, Blockly.Events.ViewportChange, expectedProperties, - workspace.id + workspace.id, ); } function assertViewportEventFired( eventsFireStub, changeListenerSpy, workspace, - expectedEventCount = 1 + expectedEventCount = 1, ) { const metrics = workspace.getMetrics(); const expectedProperties = { @@ -205,12 +205,12 @@ suite('WorkspaceSvg', function () { assertSpyFiredViewportEvent( eventsFireStub, workspace, - expectedProperties + expectedProperties, ); assertSpyFiredViewportEvent( changeListenerSpy, workspace, - expectedProperties + expectedProperties, ); sinon.assert.callCount(changeListenerSpy, expectedEventCount); sinon.assert.callCount(eventsFireStub, expectedEventCount); @@ -221,7 +221,7 @@ suite('WorkspaceSvg', function () { changeListenerSpy, workspace, clock, - expectedEventCount = 1 + expectedEventCount = 1, ) { clock.runAll(); resetEventHistory(eventsFireStub, changeListenerSpy); @@ -230,7 +230,7 @@ suite('WorkspaceSvg', function () { eventsFireStub, changeListenerSpy, workspace, - expectedEventCount + expectedEventCount, ); } setup(function () { @@ -248,7 +248,7 @@ suite('WorkspaceSvg', function () { this.eventsFireStub, this.changeListenerSpy, this.workspace, - this.clock + this.clock, ); }); test('zoom(50, 50, 1)', function () { @@ -257,7 +257,7 @@ suite('WorkspaceSvg', function () { this.eventsFireStub, this.changeListenerSpy, this.workspace, - this.clock + this.clock, ); }); test('zoom(50, 50, -1)', function () { @@ -266,7 +266,7 @@ suite('WorkspaceSvg', function () { this.eventsFireStub, this.changeListenerSpy, this.workspace, - this.clock + this.clock, ); }); test('zoomCenter(1)', function () { @@ -275,7 +275,7 @@ suite('WorkspaceSvg', function () { this.eventsFireStub, this.changeListenerSpy, this.workspace, - this.clock + this.clock, ); }); test('zoomCenter(-1)', function () { @@ -284,7 +284,7 @@ suite('WorkspaceSvg', function () { this.eventsFireStub, this.changeListenerSpy, this.workspace, - this.clock + this.clock, ); }); test('zoomToFit', function () { @@ -296,7 +296,7 @@ suite('WorkspaceSvg', function () { this.eventsFireStub, this.changeListenerSpy, this.workspace, - this.clock + this.clock, ); }); }); @@ -310,7 +310,7 @@ suite('WorkspaceSvg', function () { this.eventsFireStub, this.changeListenerSpy, this.workspace, - this.clock + this.clock, ); }); test('scroll', function () { @@ -319,7 +319,7 @@ suite('WorkspaceSvg', function () { this.eventsFireStub, this.changeListenerSpy, this.workspace, - this.clock + this.clock, ); }); test('scrollCenter', function () { @@ -328,7 +328,7 @@ suite('WorkspaceSvg', function () { this.eventsFireStub, this.changeListenerSpy, this.workspace, - this.clock + this.clock, ); }); }); @@ -348,7 +348,7 @@ suite('WorkspaceSvg', function () { this.changeListenerSpy, this.workspace, this.clock, - 2 + 2, ); }); test("domToWorkspace that doesn't trigger scroll", function () { @@ -360,32 +360,32 @@ suite('WorkspaceSvg', function () { '' + '' + '' + - '' + '', ), - this.workspace + this.workspace, ); const xmlDom = Blockly.utils.xml.textToDom( - '' + '', ); this.clock.runAll(); resetEventHistory(this.eventsFireStub, this.changeListenerSpy); // Add block in center of other blocks, not triggering scroll. Blockly.Xml.domToWorkspace( Blockly.utils.xml.textToDom( - '' + '', ), - this.workspace + this.workspace, ); this.clock.runAll(); assertEventNotFired( this.eventsFireStub, Blockly.Events.ViewportChange, - {type: eventUtils.VIEWPORT_CHANGE} + {type: eventUtils.VIEWPORT_CHANGE}, ); assertEventNotFired( this.changeListenerSpy, Blockly.Events.ViewportChange, - {type: eventUtils.VIEWPORT_CHANGE} + {type: eventUtils.VIEWPORT_CHANGE}, ); }); test("domToWorkspace at 0,0 that doesn't trigger scroll", function () { @@ -397,12 +397,12 @@ suite('WorkspaceSvg', function () { '' + '' + '' + - '' + '', ), - this.workspace + this.workspace, ); const xmlDom = Blockly.utils.xml.textToDom( - '' + '', ); this.clock.runAll(); resetEventHistory(this.eventsFireStub, this.changeListenerSpy); @@ -412,12 +412,12 @@ suite('WorkspaceSvg', function () { assertEventNotFired( this.eventsFireStub, Blockly.Events.ViewportChange, - {type: eventUtils.VIEWPORT_CHANGE} + {type: eventUtils.VIEWPORT_CHANGE}, ); assertEventNotFired( this.changeListenerSpy, Blockly.Events.ViewportChange, - {type: eventUtils.VIEWPORT_CHANGE} + {type: eventUtils.VIEWPORT_CHANGE}, ); }); test.skip('domToWorkspace multiple blocks triggers one viewport event', function () { @@ -430,9 +430,9 @@ suite('WorkspaceSvg', function () { '' + '' + '' + - '' + '', ), - this.workspace + this.workspace, ); }; // Expect 10 events, 4 create, 4 move, 1 viewport, 1 finished loading @@ -442,7 +442,7 @@ suite('WorkspaceSvg', function () { this.changeListenerSpy, this.workspace, this.clock, - 10 + 10, ); }); }); diff --git a/tests/mocha/xml_test.js b/tests/mocha/xml_test.js index 948d6cd0c..8fecbcf69 100644 --- a/tests/mocha/xml_test.js +++ b/tests/mocha/xml_test.js @@ -90,7 +90,7 @@ suite('XML', function () { chai.assert.equal( dom.getElementsByTagName('block').length, 6, - 'Block tags' + 'Block tags', ); }); @@ -101,7 +101,7 @@ suite('XML', function () { const dom = Blockly.utils.xml.textToDom(' '); assertXmlDoc(dom); chai.assert.equal(dom.firstChild.textContent, '\u0001\t\u001f'); - } + }, ); test( @@ -111,7 +111,7 @@ suite('XML', function () { const dom = Blockly.utils.xml.textToDom(' '); assertXmlDoc(dom); chai.assert.equal(dom.firstChild.textContent, '\u0001\u0009\u001f'); - } + }, ); test('text with an escaped ampersand is properly deserialized', function () { @@ -145,7 +145,7 @@ suite('XML', function () { ]); const block = new Blockly.Block( this.workspace, - 'field_angle_test_block' + 'field_angle_test_block', ); const resultFieldDom = Blockly.Xml.blockToDom(block).childNodes[0]; assertNonVariableField(resultFieldDom, 'ANGLE', '90'); @@ -166,7 +166,7 @@ suite('XML', function () { ]); const block = new Blockly.Block( this.workspace, - 'field_checkbox_test_block' + 'field_checkbox_test_block', ); const resultFieldDom = Blockly.Xml.blockToDom(block).childNodes[0]; assertNonVariableField(resultFieldDom, 'CHECKBOX', 'TRUE'); @@ -187,7 +187,7 @@ suite('XML', function () { ]); const block = new Blockly.Block( this.workspace, - 'field_colour_test_block' + 'field_colour_test_block', ); const resultFieldDom = Blockly.Xml.blockToDom(block).childNodes[0]; assertNonVariableField(resultFieldDom, 'COLOUR', '#000099'); @@ -212,7 +212,7 @@ suite('XML', function () { ]); const block = new Blockly.Block( this.workspace, - 'field_dropdown_test_block' + 'field_dropdown_test_block', ); const resultFieldDom = Blockly.Xml.blockToDom(block).childNodes[0]; assertNonVariableField(resultFieldDom, 'DROPDOWN', 'A'); @@ -237,7 +237,7 @@ suite('XML', function () { ]); const block = new Blockly.Block( this.workspace, - 'field_image_test_block' + 'field_image_test_block', ); const resultFieldDom = Blockly.Xml.blockToDom(block); assertNonSerializingFieldDom(resultFieldDom); @@ -258,7 +258,7 @@ suite('XML', function () { ]); const block = new Blockly.Block( this.workspace, - 'field_label_test_block' + 'field_label_test_block', ); const resultFieldDom = Blockly.Xml.blockToDom(block); assertNonSerializingFieldDom(resultFieldDom); @@ -279,7 +279,7 @@ suite('XML', function () { ]); const block = new Blockly.Block( this.workspace, - 'field_label_serializable_test_block' + 'field_label_serializable_test_block', ); const resultFieldDom = Blockly.Xml.blockToDom(block).childNodes[0]; assertNonVariableField(resultFieldDom, 'LABEL', 'default'); @@ -300,7 +300,7 @@ suite('XML', function () { ]); const block = new Blockly.Block( this.workspace, - 'field_number_test_block' + 'field_number_test_block', ); const resultFieldDom = Blockly.Xml.blockToDom(block).childNodes[0]; assertNonVariableField(resultFieldDom, 'NUMBER', '97'); @@ -321,7 +321,7 @@ suite('XML', function () { ]); const block = new Blockly.Block( this.workspace, - 'field_text_input_test_block' + 'field_text_input_test_block', ); const resultFieldDom = Blockly.Xml.blockToDom(block).childNodes[0]; assertNonVariableField(resultFieldDom, 'TEXT', 'default'); @@ -346,7 +346,7 @@ suite('XML', function () { this.workspace.createVariable('name1', '', 'id1'); const block = new Blockly.Block( this.workspace, - 'field_variable_test_block' + 'field_variable_test_block', ); block.inputList[0].fieldRow[0].setValue('id1'); const resultFieldDom = Blockly.Xml.blockToDom(block).childNodes[0]; @@ -356,7 +356,7 @@ suite('XML', function () { this.workspace.createVariable('name1', 'string', 'id1'); const block = new Blockly.Block( this.workspace, - 'field_variable_test_block' + 'field_variable_test_block', ); block.inputList[0].fieldRow[0].setValue('id1'); const resultFieldDom = Blockly.Xml.blockToDom(block).childNodes[0]; @@ -365,7 +365,7 @@ suite('XML', function () { 'VAR', 'string', 'id1', - 'name1' + 'name1', ); }); test('Variable Default Case', function () { @@ -375,7 +375,7 @@ suite('XML', function () { Blockly.Events.disable(); const block = new Blockly.Block( this.workspace, - 'field_variable_test_block' + 'field_variable_test_block', ); block.inputList[0].fieldRow[0].setValue('1'); Blockly.Events.enable(); @@ -391,7 +391,7 @@ suite('XML', function () { setup(function () { this.block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(''), - this.workspace + this.workspace, ); }); test('Text', function () { @@ -417,7 +417,7 @@ suite('XML', function () { this.workspace = Blockly.inject('blocklyDiv', {comments: true}); this.block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(''), - this.workspace + this.workspace, ); }); teardown(function () { @@ -494,7 +494,7 @@ suite('XML', function () { createGenUidStubWithReturns('1'); this.workspace.createVariable('name1'); const resultDom = Blockly.Xml.variablesToDom( - this.workspace.getAllVariables() + this.workspace.getAllVariables(), ); chai.assert.equal(resultDom.children.length, 1); const resultVariableDom = resultDom.children[0]; @@ -510,13 +510,13 @@ suite('XML', function () { Blockly.Events.disable(); const block = new Blockly.Block( this.workspace, - 'field_variable_test_block' + 'field_variable_test_block', ); block.inputList[0].fieldRow[0].setValue('id1'); Blockly.Events.enable(); const resultDom = Blockly.Xml.variablesToDom( - this.workspace.getAllVariables() + this.workspace.getAllVariables(), ); chai.assert.equal(resultDom.children.length, 2); assertVariableDom(resultDom.children[0], null, 'id1', 'name1'); @@ -524,7 +524,7 @@ suite('XML', function () { }); test('No variables', function () { const resultDom = Blockly.Xml.variablesToDom( - this.workspace.getAllVariables() + this.workspace.getAllVariables(), ); chai.assert.equal(resultDom.children.length, 0); }); @@ -537,7 +537,7 @@ suite('XML', function () { chai.assert.equal( text.replace(/\s+/g, ''), this.complexXmlText.replace(/\s+/g, ''), - 'Round trip' + 'Round trip', ); }); @@ -546,7 +546,7 @@ suite('XML', function () { dom.appendChild(Blockly.utils.xml.createTextNode('')); // u0001 chai.assert.equal( Blockly.utils.xml.domToText(dom), - '' + '', ); }); @@ -555,7 +555,7 @@ suite('XML', function () { dom.appendChild(Blockly.utils.xml.createTextNode('&')); chai.assert.equal( Blockly.Xml.domToText(dom), - '&' + '&', ); }); }); @@ -567,7 +567,7 @@ suite('XML', function () { chai.assert.equal( text.replace(/\s+/g, ''), this.complexXmlText.replace(/\s+/g, ''), - 'Round trip' + 'Round trip', ); }); }); @@ -582,7 +582,7 @@ suite('XML', function () { test('Untyped Variables', function () { this.workspace.createVariable('name1', '', 'id1'); const blocksArray = Blockly.Variables.flyoutCategoryBlocks( - this.workspace + this.workspace, ); for (let i = 0, xml; (xml = blocksArray[i]); i++) { Blockly.Xml.domToBlock(xml, this.workspace); @@ -593,7 +593,7 @@ suite('XML', function () { this.workspace.createVariable('name2', 'Number', 'id2'); this.workspace.createVariable('name3', 'Colour', 'id3'); const blocksArray = Blockly.VariablesDynamic.flyoutCategoryBlocks( - this.workspace + this.workspace, ); for (let i = 0, xml; (xml = blocksArray[i]); i++) { Blockly.Xml.domToBlock(xml, this.workspace); @@ -607,9 +607,9 @@ suite('XML', function () { Blockly.utils.xml.textToDom( '' + ' test text' + - '' + '', ), - this.workspace + this.workspace, ); chai.assert.equal(block.getCommentText(), 'test text'); }); @@ -618,9 +618,9 @@ suite('XML', function () { Blockly.utils.xml.textToDom( '' + ' ' + - '' + '', ), - this.workspace + this.workspace, ); chai.assert.equal(block.getCommentText(), ''); }); @@ -629,16 +629,16 @@ suite('XML', function () { Blockly.utils.xml.textToDom( '' + ' test text' + - '' + '', ), - this.workspace + this.workspace, ); chai.assert.deepEqual( block.getIcon(Blockly.icons.CommentIcon.TYPE).getBubbleSize(), { width: 100, height: 200, - } + }, ); }); test('Pinned True', function () { @@ -646,12 +646,12 @@ suite('XML', function () { Blockly.utils.xml.textToDom( '' + ' test text' + - '' + '', ), - this.workspace + this.workspace, ); chai.assert.isTrue( - block.getIcon(Blockly.icons.CommentIcon.TYPE).bubbleIsVisible() + block.getIcon(Blockly.icons.CommentIcon.TYPE).bubbleIsVisible(), ); }); test('Pinned False', function () { @@ -659,12 +659,12 @@ suite('XML', function () { Blockly.utils.xml.textToDom( '' + ' test text' + - '' + '', ), - this.workspace + this.workspace, ); chai.assert.isFalse( - block.getIcon(Blockly.icons.CommentIcon.TYPE).bubbleIsVisible() + block.getIcon(Blockly.icons.CommentIcon.TYPE).bubbleIsVisible(), ); }); test('Pinned Undefined', function () { @@ -672,12 +672,12 @@ suite('XML', function () { Blockly.utils.xml.textToDom( '' + ' test text' + - '' + '', ), - this.workspace + this.workspace, ); chai.assert.isFalse( - block.getIcon(Blockly.icons.CommentIcon.TYPE).bubbleIsVisible() + block.getIcon(Blockly.icons.CommentIcon.TYPE).bubbleIsVisible(), ); }); }); @@ -694,9 +694,9 @@ suite('XML', function () { Blockly.utils.xml.textToDom( '' + ' test text' + - '' + '', ), - this.workspace + this.workspace, ); chai.assert.equal(block.getCommentText(), 'test text'); chai.assert.isOk(block.getIcon(Blockly.icons.CommentIcon.TYPE)); @@ -706,9 +706,9 @@ suite('XML', function () { Blockly.utils.xml.textToDom( '' + ' ' + - '' + '', ), - this.workspace + this.workspace, ); chai.assert.equal(block.getCommentText(), ''); chai.assert.isOk(block.getIcon(Blockly.icons.CommentIcon.TYPE)); @@ -718,9 +718,9 @@ suite('XML', function () { Blockly.utils.xml.textToDom( '' + ' test text' + - '' + '', ), - this.workspace + this.workspace, ); chai.assert.isOk(block.getIcon(Blockly.icons.CommentIcon.TYPE)); chai.assert.deepEqual( @@ -728,7 +728,7 @@ suite('XML', function () { { width: 100, height: 200, - } + }, ); }); suite('Pinned', function () { @@ -737,9 +737,9 @@ suite('XML', function () { Blockly.utils.xml.textToDom( '' + ' test text' + - '' + '', ), - this.workspace + this.workspace, ); this.clock.runAll(); const icon = block.getIcon(Blockly.icons.CommentIcon.TYPE); @@ -751,9 +751,9 @@ suite('XML', function () { Blockly.utils.xml.textToDom( '' + ' test text' + - '' + '', ), - this.workspace + this.workspace, ); this.clock.runAll(); const icon = block.getIcon(Blockly.icons.CommentIcon.TYPE); @@ -765,9 +765,9 @@ suite('XML', function () { Blockly.utils.xml.textToDom( '' + ' test text' + - '' + '', ), - this.workspace + this.workspace, ); this.clock.runAll(); const icon = block.getIcon(Blockly.icons.CommentIcon.TYPE); @@ -805,13 +805,13 @@ suite('XML', function () { ' ' + ' name1' + ' ' + - '' + '', ); Blockly.Xml.domToWorkspace(dom, this.workspace); chai.assert.equal( this.workspace.getAllBlocks(false).length, 1, - 'Block count' + 'Block count', ); assertVariableValues(this.workspace, 'name1', '', '1'); }); @@ -826,13 +826,13 @@ suite('XML', function () { ' ' + ' name3' + ' ' + - '' + '', ); Blockly.Xml.domToWorkspace(dom, this.workspace); chai.assert.equal( this.workspace.getAllBlocks(false).length, 1, - 'Block count' + 'Block count', ); assertVariableValues(this.workspace, 'name1', 'type1', 'id1'); assertVariableValues(this.workspace, 'name2', 'type2', 'id2'); @@ -845,7 +845,7 @@ suite('XML', function () { ' ' + ' ' + ' ' + - '' + '', ); chai.assert.throws(function () { Blockly.Xml.domToWorkspace(dom, this.workspace); @@ -860,7 +860,7 @@ suite('XML', function () { ' ' + ' name3' + ' ' + - '' + '', ); chai.assert.throws(function () { Blockly.Xml.domToWorkspace(dom, this.workspace); @@ -875,7 +875,7 @@ suite('XML', function () { ' ' + ' name1' + ' ' + - '' + '', ); chai.assert.throws(function () { Blockly.Xml.domToWorkspace(dom, this.workspace); @@ -902,19 +902,19 @@ suite('XML', function () { '' + ' ' + ' ' + - '' + '', ); Blockly.Xml.appendDomToWorkspace(dom, this.workspace); chai.assert.equal( this.workspace.getAllBlocks(false).length, 1, - 'Block count' + 'Block count', ); const newBlockIds = Blockly.Xml.appendDomToWorkspace(dom, this.workspace); chai.assert.equal( this.workspace.getAllBlocks(false).length, 2, - 'Block count' + 'Block count', ); chai.assert.equal(newBlockIds.length, 1, 'Number of new block ids'); }); @@ -926,7 +926,7 @@ suite('XML', function () { }; this.renderedWorkspace = Blockly.inject('blocklyDiv', options); this.headlessWorkspace = new Blockly.Workspace( - new Blockly.Options(options) + new Blockly.Options(options), ); }); teardown(function () { @@ -947,7 +947,7 @@ suite('XML', function () { test('Comment', function () { const block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(''), - this.renderedWorkspace + this.renderedWorkspace, ); block.setCommentText('test text'); const icon = block.getIcon(Blockly.icons.CommentIcon.TYPE); @@ -960,7 +960,7 @@ suite('XML', function () { test('Comment', function () { const block = Blockly.Xml.domToBlock( Blockly.utils.xml.textToDom(''), - this.headlessWorkspace + this.headlessWorkspace, ); block.setCommentText('test text'); const icon = block.getIcon(Blockly.icons.CommentIcon.TYPE); @@ -988,7 +988,7 @@ suite('XML', function () { }; const generatedXml = Blockly.Xml.domToText( - Blockly.Variables.generateVariableFieldDom(mockVariableModel) + Blockly.Variables.generateVariableFieldDom(mockVariableModel), ); const expectedXml = ' + @@ -41,10 +41,10 @@ setBackgroundColour(); var match = location.search.match(/toolbox=([^&]+)/); var toolbox = document.getElementById( - 'toolbox-' + (match ? match[1] : 'categories') + 'toolbox-' + (match ? match[1] : 'categories'), ); document.forms.options.elements.toolbox.selectedIndex = Number( - toolbox.getElementsByTagName('category').length == 0 + toolbox.getElementsByTagName('category').length == 0, ); startBlocklyInstance('VertStartLTR', false, false, 'start', toolbox); startBlocklyInstance('VertStartRTL', true, false, 'start', toolbox); @@ -57,14 +57,14 @@ false, true, 'start', - toolbox + toolbox, ); startBlocklyInstance( 'HorizontalStartRTL', true, true, 'start', - toolbox + toolbox, ); startBlocklyInstance('HorizontalEndLTR', false, true, 'end', toolbox); @@ -76,7 +76,7 @@ rtl, horizontalLayout, position, - toolbox + toolbox, ) { options.rtl = rtl; options.toolbox = toolbox; diff --git a/tests/playground.html b/tests/playground.html index a8a48f1da..6ba532cd0 100644 --- a/tests/playground.html +++ b/tests/playground.html @@ -1,4 +1,4 @@ - + @@ -119,7 +119,7 @@ return toolboxTestBlocks; } else { alert( - "You need to run 'npm install' in order to use the test blocks." + "You need to run 'npm install' in order to use the test blocks.", ); toolboxSuffix = 'categories'; } @@ -267,7 +267,7 @@ // Adds a default-sized workspace comment to the workspace. menuOptions.push( - Blockly.ContextMenu.workspaceCommentOption(workspace, e) + Blockly.ContextMenu.workspaceCommentOption(workspace, e), ); } @@ -295,7 +295,7 @@ Math.round(Math.random() * 450 + 40) + ', ' + Math.round(Math.random() * 600 + 40) + - ')' + ')', ); block.render(); } @@ -306,7 +306,7 @@ for (var i = 0; i < n; i++) { xml = xml.replace( /(<(statement|next)( name="DO0")?>)<\//g, - '$1' + spaghettiXml + ' + @@ -55,7 +55,7 @@ function initPlayground() { if (typeof window.createPlayground === 'undefined') { alert( - "You need to run 'npm install' in order to use this playground." + "You need to run 'npm install' in order to use this playground.", ); return; } @@ -108,7 +108,7 @@ createWorkspace, defaultOptions, playgroundConfig, - 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.19.2/min/vs' + 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.19.2/min/vs', ).then(function (playground) { configurePlayground(playground); }); @@ -141,7 +141,7 @@ // Adds a default-sized workspace comment to the workspace. menuOptions.push( - Blockly.ContextMenu.workspaceCommentOption(workspace, e) + Blockly.ContextMenu.workspaceCommentOption(workspace, e), ); } start(); diff --git a/tests/playgrounds/iframe.html b/tests/playgrounds/iframe.html index 6cc4fb219..521d1d1a7 100644 --- a/tests/playgrounds/iframe.html +++ b/tests/playgrounds/iframe.html @@ -1,4 +1,4 @@ - + diff --git a/tests/playgrounds/screenshot.js b/tests/playgrounds/screenshot.js index 402a0a415..6768694f1 100644 --- a/tests/playgrounds/screenshot.js +++ b/tests/playgrounds/screenshot.js @@ -34,7 +34,7 @@ function svgToPng_(data, width, height, callback) { 0, 0, canvas.width, - canvas.height + canvas.height, ); try { const dataUri = canvas.toDataURL('image/png'); @@ -80,7 +80,7 @@ function workspaceToSvg_(workspace, callback, customCss) { 'blocklySvg ' + (workspace.options.renderer || 'geras') + '-renderer ' + - (workspace.getTheme ? workspace.getTheme().name + '-theme' : '') + (workspace.getTheme ? workspace.getTheme().name + '-theme' : ''), ); svg.setAttribute('width', width); svg.setAttribute('height', height); @@ -90,7 +90,7 @@ function workspaceToSvg_(workspace, callback, customCss) { .call(document.head.querySelectorAll('style')) .filter( (el) => - /\.blocklySvg/.test(el.innerText) || el.id.indexOf('blockly-') === 0 + /\.blocklySvg/.test(el.innerText) || el.id.indexOf('blockly-') === 0, ) .map((el) => el.innerText) .join('\n'); diff --git a/tests/playgrounds/shared_procedures.html b/tests/playgrounds/shared_procedures.html index 2c9260d8d..d43ebb53e 100644 --- a/tests/playgrounds/shared_procedures.html +++ b/tests/playgrounds/shared_procedures.html @@ -1,4 +1,4 @@ - +