From 55decfe7c9958edc52c512f057c2785dbbacb72e Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Thu, 29 Jun 2023 13:37:10 -0700 Subject: [PATCH 01/58] chore: delete unused function getFirstStatementConnection (#7228) --- core/block.ts | 19 ------------------- core/block_svg.ts | 8 -------- 2 files changed, 27 deletions(-) diff --git a/core/block.ts b/core/block.ts index a4627e3ad5e..70f16bd6e69 100644 --- a/core/block.ts +++ b/core/block.ts @@ -624,25 +624,6 @@ export class Block implements IASTNodeLocation, IDeletable { return this.previousConnection && this.previousConnection.targetBlock(); } - /** - * Return the connection on the first statement input on this block, or null - * if there are none. - * - * @returns The first statement connection or null. - * @internal - */ - getFirstStatementConnection(): Connection | null { - for (let i = 0, input; (input = this.inputList[i]); i++) { - if ( - input.connection && - input.connection.type === ConnectionType.NEXT_STATEMENT - ) { - return input.connection; - } - } - return null; - } - /** * Return the top-most block in this block's tree. * This will return itself if this block is at the top level. diff --git a/core/block_svg.ts b/core/block_svg.ts index ed942b1aae3..fea8b4320cd 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -1529,14 +1529,6 @@ export class BlockSvg } } - /** - * @returns The first statement connection or null. - * @internal - */ - override getFirstStatementConnection(): RenderedConnection | null { - return super.getFirstStatementConnection() as RenderedConnection | null; - } - /** * Find all the blocks that are directly nested inside this one. * Includes value and statement inputs, as well as any following statement. From 2d27105e3c03b5783a6584ea5ae425ebd138286d Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Thu, 29 Jun 2023 13:54:37 -0700 Subject: [PATCH 02/58] chore: delete unused fuction clearTransformAttributes_ (#7229) --- core/block_svg.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/core/block_svg.ts b/core/block_svg.ts index fea8b4320cd..0b320c2e0b3 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -428,21 +428,13 @@ export class BlockSvg this.getSvgRoot().setAttribute('transform', this.getTranslation()); } - /** - * Clear the block of transform="..." attributes. - * Used when the block is switching from 3d to 2d transform or vice versa. - */ - private clearTransformAttributes_() { - this.getSvgRoot().removeAttribute('transform'); - } - /** Snap this block to the nearest grid point. */ snapToGrid() { if (this.isDeadOrDying()) { return; // Deleted block. } if (this.workspace.isDragging()) { - return; // Don't bump blocks during a drag.; + return; // Don't bump blocks during a drag. } if (this.getParent()) { @@ -1085,7 +1077,6 @@ export class BlockSvg } // Overrides of functions on Blockly.Block that take into account whether the - // block has been rendered. /** From a2672a4fe6a84131fc5ee98b1a0d73ba53c10b7c Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 29 Jun 2023 14:00:24 -0700 Subject: [PATCH 03/58] chore: delete drag surface files (#7216) --- core/block_drag_surface.ts | 247 ----------------------------- core/workspace_drag_surface_svg.ts | 193 ---------------------- 2 files changed, 440 deletions(-) delete mode 100644 core/block_drag_surface.ts delete mode 100644 core/workspace_drag_surface_svg.ts diff --git a/core/block_drag_surface.ts b/core/block_drag_surface.ts deleted file mode 100644 index c249458cb44..00000000000 --- a/core/block_drag_surface.ts +++ /dev/null @@ -1,247 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * A class that manages a surface for dragging blocks. When a - * block drag is started, we move the block (and children) to a separate DOM - * element that we move around using translate3d. At the end of the drag, the - * blocks are put back in into the SVG they came from. This helps - * performance by avoiding repainting the entire SVG on every mouse move - * while dragging blocks. - * - * @class - */ -import * as goog from '../closure/goog/goog.js'; -goog.declareModuleId('Blockly.BlockDragSurfaceSvg'); - -import {Coordinate} from './utils/coordinate.js'; -import * as deprecation from './utils/deprecation.js'; -import * as dom from './utils/dom.js'; -import {Svg} from './utils/svg.js'; -import * as svgMath from './utils/svg_math.js'; - -/** - * Class for a drag surface for the currently dragged block. This is a separate - * SVG that contains only the currently moving block, or nothing. - * - * @alias Blockly.BlockDragSurfaceSvg - */ -export class BlockDragSurfaceSvg { - /** - * The root element of the drag surface. - */ - private svg: SVGElement; - - /** - * This is where blocks live while they are being dragged if the drag - * surface is enabled. - */ - private dragGroup: SVGElement; - - /** - * Cached value for the scale of the drag surface. - * Used to set/get the correct translation during and after a drag. - */ - private scale = 1; - - /** - * Cached value for the translation of the drag surface. - * This translation is in pixel units, because the scale is applied to the - * drag group rather than the top-level SVG. - */ - private surfaceXY = new Coordinate(0, 0); - - /** - * Cached value for the translation of the child drag surface in pixel - * units. Since the child drag surface tracks the translation of the - * workspace this is ultimately the translation of the workspace. - */ - private readonly childSurfaceXY = new Coordinate(0, 0); - - /** @param container Containing element. */ - constructor(private readonly container: Element) { - this.svg = dom.createSvgElement( - Svg.SVG, - { - 'xmlns': dom.SVG_NS, - 'xmlns:html': dom.HTML_NS, - 'xmlns:xlink': dom.XLINK_NS, - 'version': '1.1', - 'class': 'blocklyBlockDragSurface', - }, - this.container - ); - - this.dragGroup = dom.createSvgElement(Svg.G, {}, this.svg); - } - - /** - * Create the drag surface and inject it into the container. - * - * @deprecated The DOM is automatically created by the constructor. - */ - createDom() { - // No alternative provided, because now the dom is just automatically - // created in the constructor now. - deprecation.warn('BlockDragSurfaceSvg createDom', 'June 2022', 'June 2023'); - } - - /** - * Set the SVG blocks on the drag surface's group and show the surface. - * Only one block group should be on the drag surface at a time. - * - * @param blocks Block or group of blocks to place on the drag surface. - */ - setBlocksAndShow(blocks: SVGElement) { - if (this.dragGroup.childNodes.length) { - throw Error('Already dragging a block.'); - } - // appendChild removes the blocks from the previous parent - this.dragGroup.appendChild(blocks); - this.svg.style.display = 'block'; - this.surfaceXY = new Coordinate(0, 0); - } - - /** - * Translate and scale the entire drag surface group to the given position, to - * keep in sync with the workspace. - * - * @param x X translation in pixel coordinates. - * @param y Y translation in pixel coordinates. - * @param scale Scale of the group. - */ - translateAndScaleGroup(x: number, y: number, scale: number) { - this.scale = scale; - // Make sure the svg exists on a pixel boundary so that it is not fuzzy. - const roundX = Math.round(x); - const roundY = Math.round(y); - this.childSurfaceXY.x = roundX; - this.childSurfaceXY.y = roundY; - this.dragGroup.setAttribute( - 'transform', - 'translate(' + roundX + ',' + roundY + ') scale(' + scale + ')' - ); - } - - /** - * Translate the drag surface's SVG based on its internal state. - * - * @internal - */ - translateSurfaceInternal_() { - // Make sure the svg exists on a pixel boundary so that it is not fuzzy. - const x = Math.round(this.surfaceXY.x); - const y = Math.round(this.surfaceXY.y); - this.svg.style.display = 'block'; - dom.setCssTransform(this.svg, 'translate3d(' + x + 'px, ' + y + 'px, 0)'); - } - - /** - * Translates the entire surface by a relative offset. - * - * @param deltaX Horizontal offset in pixel units. - * @param deltaY Vertical offset in pixel units. - */ - translateBy(deltaX: number, deltaY: number) { - const x = this.surfaceXY.x + deltaX; - const y = this.surfaceXY.y + deltaY; - this.surfaceXY = new Coordinate(x, y); - this.translateSurfaceInternal_(); - } - - /** - * Translate the entire drag surface during a drag. - * We translate the drag surface instead of the blocks inside the surface - * so that the browser avoids repainting the SVG. - * Because of this, the drag coordinates must be adjusted by scale. - * - * @param x X translation for the entire surface. - * @param y Y translation for the entire surface. - */ - translateSurface(x: number, y: number) { - this.surfaceXY = new Coordinate(x * this.scale, y * this.scale); - this.translateSurfaceInternal_(); - } - - /** - * Reports the surface translation in scaled workspace coordinates. - * Use this when finishing a drag to return blocks to the correct position. - * - * @returns Current translation of the surface. - */ - getSurfaceTranslation(): Coordinate { - const xy = svgMath.getRelativeXY(this.svg); - return new Coordinate(xy.x / this.scale, xy.y / this.scale); - } - - /** - * Provide a reference to the drag group (primarily for - * BlockSvg.getRelativeToSurfaceXY). - * - * @returns Drag surface group element. - */ - getGroup(): SVGElement { - return this.dragGroup; - } - - /** - * Returns the SVG drag surface. - * - * @returns The SVG drag surface. - */ - getSvgRoot(): SVGElement { - return this.svg; - } - - /** - * Get the current blocks on the drag surface, if any (primarily - * for BlockSvg.getRelativeToSurfaceXY). - * - * @returns Drag surface block DOM element, or null if no blocks exist. - */ - getCurrentBlock(): Element | null { - return this.dragGroup.firstChild as Element; - } - - /** - * Gets the translation of the child block surface - * This surface is in charge of keeping track of how much the workspace has - * moved. - * - * @returns The amount the workspace has been moved. - */ - getWsTranslation(): Coordinate { - // Returning a copy so the coordinate can not be changed outside this class. - return this.childSurfaceXY.clone(); - } - - /** - * Clear the group and hide the surface; move the blocks off onto the provided - * element. - * If the block is being deleted it doesn't need to go back to the original - * surface, since it would be removed immediately during dispose. - * - * @param opt_newSurface Surface the dragging blocks should be moved to, or - * null if the blocks should be removed from this surface without being - * moved to a different surface. - */ - clearAndHide(opt_newSurface?: Element) { - const currentBlockElement = this.getCurrentBlock(); - if (currentBlockElement) { - if (opt_newSurface) { - // appendChild removes the node from this.dragGroup - opt_newSurface.appendChild(currentBlockElement); - } else { - this.dragGroup.removeChild(currentBlockElement); - } - } - this.svg.style.display = 'none'; - if (this.dragGroup.childNodes.length) { - throw Error('Drag group was not cleared.'); - } - this.surfaceXY = new Coordinate(0, 0); - } -} diff --git a/core/workspace_drag_surface_svg.ts b/core/workspace_drag_surface_svg.ts deleted file mode 100644 index 08e19b656ea..00000000000 --- a/core/workspace_drag_surface_svg.ts +++ /dev/null @@ -1,193 +0,0 @@ -/** - * @license - * Copyright 2016 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * An SVG that floats on top of the workspace. - * Blocks are moved into this SVG during a drag, improving performance. - * The entire SVG is translated using CSS translation instead of SVG so the - * blocks are never repainted during drag improving performance. - * - * @class - */ -import * as goog from '../closure/goog/goog.js'; -goog.declareModuleId('Blockly.WorkspaceDragSurfaceSvg'); - -import type {Coordinate} from './utils/coordinate.js'; -import * as dom from './utils/dom.js'; -import {Svg} from './utils/svg.js'; -import * as svgMath from './utils/svg_math.js'; - -/** - * Blocks are moved into this SVG during a drag, improving performance. - * The entire SVG is translated using CSS transforms instead of SVG so the - * blocks are never repainted during drag improving performance. - * - * @alias Blockly.WorkspaceDragSurfaceSvg - */ -export class WorkspaceDragSurfaceSvg { - /** - * The SVG drag surface. Set once by WorkspaceDragSurfaceSvg.createDom. - */ - private SVG!: SVGElement; - - /** - * The element to insert the block canvas and bubble canvas after when it - * goes back in the DOM at the end of a drag. - */ - private previousSibling: Element | null = null; - - /** @param container Containing element. */ - constructor(private readonly container: Element) { - this.createDom(); - } - - /** Create the drag surface and inject it into the container. */ - createDom() { - if (this.SVG) { - return; // Already created. - } - /** - * Dom structure when the workspace is being dragged. If there is no drag in - * progress, the SVG is empty and display: none. - * - * - * /g> - * - */ - this.SVG = dom.createSvgElement(Svg.SVG, { - 'xmlns': dom.SVG_NS, - 'xmlns:html': dom.HTML_NS, - 'xmlns:xlink': dom.XLINK_NS, - 'version': '1.1', - 'class': 'blocklyWsDragSurface blocklyOverflowVisible', - }); - this.container.appendChild(this.SVG); - } - - /** - * Translate the entire drag surface during a drag. - * We translate the drag surface instead of the blocks inside the surface - * so that the browser avoids repainting the SVG. - * Because of this, the drag coordinates must be adjusted by scale. - * - * @param x X translation for the entire surface - * @param y Y translation for the entire surface - * @internal - */ - translateSurface(x: number, y: number) { - // Make sure the svg exists on a pixel boundary so that it is not fuzzy. - const fixedX = Math.round(x); - const fixedY = Math.round(y); - - this.SVG.style.display = 'block'; - dom.setCssTransform( - this.SVG, - 'translate3d(' + fixedX + 'px, ' + fixedY + 'px, 0)' - ); - } - - /** - * Reports the surface translation in scaled workspace coordinates. - * Use this when finishing a drag to return blocks to the correct position. - * - * @returns Current translation of the surface - * @internal - */ - getSurfaceTranslation(): Coordinate { - return svgMath.getRelativeXY(this.SVG); - } - - /** - * Move the blockCanvas and bubbleCanvas out of the surface SVG and on to - * newSurface. - * - * @param newSurface The element to put the drag surface contents into. - * @internal - */ - clearAndHide(newSurface: SVGElement) { - if (!newSurface) { - throw Error( - "Couldn't clear and hide the drag surface: missing new surface." - ); - } - const blockCanvas = this.SVG.childNodes[0] as Element; - const bubbleCanvas = this.SVG.childNodes[1] as Element; - if ( - !blockCanvas || - !bubbleCanvas || - !( - blockCanvas.classList.contains('blocklyBlockCanvas') || - !bubbleCanvas.classList.contains('blocklyBubbleCanvas') - ) - ) { - throw Error( - "Couldn't clear and hide the drag surface. A node was missing." - ); - } - - // If there is a previous sibling, put the blockCanvas back right - // afterwards, otherwise insert it as the first child node in newSurface. - if (this.previousSibling !== null) { - dom.insertAfter(blockCanvas, this.previousSibling); - } else { - newSurface.insertBefore(blockCanvas, newSurface.firstChild); - } - - // Reattach the bubble canvas after the blockCanvas. - dom.insertAfter(bubbleCanvas, blockCanvas); - // Hide the drag surface. - this.SVG.style.display = 'none'; - if (this.SVG.childNodes.length) { - throw Error('Drag surface was not cleared.'); - } - dom.setCssTransform(this.SVG, ''); - this.previousSibling = null; - } - - /** - * Set the SVG to have the block canvas and bubble canvas in it and then - * show the surface. - * - * @param blockCanvas The block canvas element from the - * workspace. - * @param bubbleCanvas The element that contains the - bubbles. - * @param previousSibling The element to insert the block canvas and - bubble canvas after when it goes back in the DOM at the end of a - drag. - * @param width The width of the workspace SVG element. - * @param height The height of the workspace SVG element. - * @param scale The scale of the workspace being dragged. - * @internal - */ - setContentsAndShow( - blockCanvas: SVGElement, - bubbleCanvas: SVGElement, - previousSibling: Element, - width: number, - height: number, - scale: number - ) { - if (this.SVG.childNodes.length) { - throw Error('Already dragging a block.'); - } - this.previousSibling = previousSibling; - // Make sure the blocks and bubble canvas are scaled appropriately. - blockCanvas.setAttribute( - 'transform', - 'translate(0, 0) scale(' + scale + ')' - ); - bubbleCanvas.setAttribute( - 'transform', - 'translate(0, 0) scale(' + scale + ')' - ); - this.SVG.setAttribute('width', String(width)); - this.SVG.setAttribute('height', String(height)); - this.SVG.appendChild(blockCanvas); - this.SVG.appendChild(bubbleCanvas); - this.SVG.style.display = 'block'; - } -} From fa58cbaaf7456ab227c2214af5dd0e7025dc731c Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Fri, 30 Jun 2023 14:12:48 -0700 Subject: [PATCH 04/58] chore: update app engine version names (#7231) --- scripts/gulpfiles/appengine_tasks.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/scripts/gulpfiles/appengine_tasks.js b/scripts/gulpfiles/appengine_tasks.js index 09f9e29a7e3..1f08ca3d569 100644 --- a/scripts/gulpfiles/appengine_tasks.js +++ b/scripts/gulpfiles/appengine_tasks.js @@ -122,13 +122,8 @@ function deployToAndClean(demoVersion) { * package.json. */ function getDemosVersion() { - const minorVersion = packageJson.version.split('.')[1]; - const patchVersion = packageJson.version.split('.')[2]; - let demoVersion = minorVersion; - if (patchVersion !== 0) { - demoVersion += '-' + patchVersion; - } - return demoVersion; + // Replace all '.' with '-' e.g. 9-3-3-beta-2 + return packageJson.version.replace(/\./g, '-'); } /** From 57fdb71ad949b8ce268258b7f4fdfe7a07e835e0 Mon Sep 17 00:00:00 2001 From: jayway <70596906+jibranabsarulislam@users.noreply.github.com> Date: Wed, 5 Jul 2023 11:24:03 -0400 Subject: [PATCH 05/58] fix: set flyout visbility on calling setExpanded (#7199) * fix: set flyout visbility on calling setExpanded * move setVisible to only set false when category is no longer expanded --- core/toolbox/collapsible_category.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/toolbox/collapsible_category.ts b/core/toolbox/collapsible_category.ts index cb5270995ef..fe4b7cf5584 100644 --- a/core/toolbox/collapsible_category.ts +++ b/core/toolbox/collapsible_category.ts @@ -185,7 +185,7 @@ export class CollapsibleToolboxCategory } /** - * Opens or closes the current category. + * Opens or closes the current category and the associated flyout. * * @param isExpanded True to expand the category, false to close. */ @@ -197,6 +197,7 @@ export class CollapsibleToolboxCategory this.subcategoriesDiv_!.style.display = 'block'; this.openIcon_(this.iconDom_); } else { + this.parentToolbox_.getFlyout()?.setVisible(false); this.subcategoriesDiv_!.style.display = 'none'; this.closeIcon_(this.iconDom_); } From a677355f7319140f68c13c3468470b0ecd9d25b8 Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Wed, 5 Jul 2023 17:04:49 +0100 Subject: [PATCH 06/58] fix: Restore `HSV_SATURATION` and `HSV_VALUE` accessors and deprecate (#7249) * fix: Restore HSV_SATURATION and HSV_VALUE accessors Contrary to the notice at the top of the `Object.defineProperties` call, these were not actually marked as deprecated, and their removal in Blockly 10.0.0 constituted an avoidable zero-notice breaking change. * deprecate: Add deprecation notices for HSV_SATURATION and HSV_VALUE DEPRECATION: Blockly.HSV_SATURATION and Blockly.HSV_VALUE are deprecated and will be removed in a future version of Blockly. Use Blockly.colour.getHsvSaturation / Blockly.colour.setHsvSaturation and Blockly.colour.getHsvValue / Blockly.colour.setHsvValue instead. --- core/main.js | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 2 deletions(-) diff --git a/core/main.js b/core/main.js index 8672273cd2e..0b8e1a1712a 100644 --- a/core/main.js +++ b/core/main.js @@ -13,9 +13,79 @@ goog.module('Blockly.main'); -/** @suppress {extraRequire} */ -goog.require('Blockly'); +const Blockly = goog.require('Blockly'); const Msg = goog.require('Blockly.Msg'); +const colour = goog.require('Blockly.utils.colour'); +const deprecation = goog.require('Blockly.utils.deprecation'); + +/* + * Aliased functions and properties that used to be on the Blockly namespace. + * Everything in this section is deprecated. Both external and internal code + * should avoid using these functions and use the designated replacements. + * Everything in this section will be removed in a future version of Blockly. + */ + +// Add accessors for properties on Blockly that have now been deprecated. +Object.defineProperties(Blockly, { + /** + * The richness of block colours, regardless of the hue. + * Must be in the range of 0 (inclusive) to 1 (exclusive). + * @name Blockly.HSV_SATURATION + * @type {number} + * @deprecated Use Blockly.colour.getHsvSaturation() / .setHsvSaturation( + * instead. (July 2023) + * @suppress {checkTypes} + */ + HSV_SATURATION: { + get: function () { + deprecation.warn( + 'Blockly.HSV_SATURATION', + 'version 10', + 'version 11', + 'Blockly.colour.getHsvSaturation()' + ); + return colour.getHsvSaturation(); + }, + set: function (newValue) { + deprecation.warn( + 'Blockly.HSV_SATURATION', + 'version 10', + 'version 11', + 'Blockly.colour.setHsvSaturation()' + ); + colour.setHsvSaturation(newValue); + }, + }, + /** + * The intensity of block colours, regardless of the hue. + * Must be in the range of 0 (inclusive) to 1 (exclusive). + * @name Blockly.HSV_VALUE + * @type {number} + * @deprecated Use Blockly.colour.getHsvValue() / .setHsvValue instead. + * (July 2023) + * @suppress {checkTypes} + */ + HSV_VALUE: { + get: function () { + deprecation.warn( + 'Blockly.HSV_VALUE', + 'version 10', + 'version 11', + 'Blockly.colour.getHsvValue()' + ); + return colour.getHsvValue(); + }, + set: function (newValue) { + deprecation.warn( + 'Blockly.HSV_VALUE', + 'version 10', + 'version 11', + 'Blockly.colour.setHsvValue()' + ); + colour.setHsvValue(newValue); + }, + }, +}); // If Blockly is compiled with ADVANCED_COMPILATION and/or loaded as a // CJS or ES module there will not be a Blockly global variable From f1e0e113129d069e99045cc72e44419d7851afda Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Thu, 6 Jul 2023 10:30:53 -0700 Subject: [PATCH 07/58] =?UTF-8?q?feat(test):=20add=20helper=20functions=20?= =?UTF-8?q?for=20getting=20selected=20block=20and=20block=E2=80=A6=20(#725?= =?UTF-8?q?4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(test): add helper functions for getting selected block and block by ID * chore: format test files * chore: fix lint --- tests/browser/test/procedure_test.js | 19 +++++++++--------- tests/browser/test/test_setup.js | 30 +++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/tests/browser/test/procedure_test.js b/tests/browser/test/procedure_test.js index 7a4fa2c5445..4b01488d5eb 100644 --- a/tests/browser/test/procedure_test.js +++ b/tests/browser/test/procedure_test.js @@ -9,7 +9,11 @@ */ const chai = require('chai'); -const {testSetup, testFileLocations} = require('./test_setup'); +const { + testSetup, + testFileLocations, + getSelectedBlockElement, +} = require('./test_setup'); let browser; suite('Testing Connecting Blocks', function (done) { @@ -48,9 +52,7 @@ suite('Testing Connecting Blocks', function (done) { ); await mathNumeric.dragAndDrop({x: 50, y: 20}); // Connect numeric to first procedure - const numericWorkspace = await browser.$( - '#content_blocks > div > svg.blocklySvg > g > g.blocklyBlockCanvas > g.blocklyDraggable.blocklySelected' - ); + const numericWorkspace = await getSelectedBlockElement(browser); const doSomething = await browser.$( '#content_blocks > div > svg.blocklySvg > g > g.blocklyBlockCanvas > g:nth-child(2)' ); @@ -70,9 +72,7 @@ suite('Testing Connecting Blocks', function (done) { ); await doSomethingFlyout.dragAndDrop(doSomething2); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec - const doSomethingFlyoutWorkspace = await browser.$( - '#content_blocks > div > svg.blocklySvg > g > g.blocklyBlockCanvas > g.blocklyDraggable.blocklySelected' - ); + const doSomethingFlyoutWorkspace = await getSelectedBlockElement(browser); await doSomethingFlyoutWorkspace.dragAndDrop({x: 130, y: 20}); // Drag out print from flyout and connect it with doSomething 2 @@ -92,9 +92,8 @@ suite('Testing Connecting Blocks', function (done) { await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec await doSomething2Flyout.dragAndDrop({x: 130, y: 20}); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec - const doSomething2FlyoutWorkspace = await browser.$( - '#content_blocks > div > svg.blocklySvg > g > g.blocklyBlockCanvas > g.blocklyDraggable.blocklySelected' - ); + const doSomething2FlyoutWorkspace = await getSelectedBlockElement(browser); + const printWorkSpace = await browser.$( '#content_blocks > div > svg.blocklySvg > g > g.blocklyBlockCanvas > g:nth-child(4)' ); diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index b9a7b9b2c06..d8641c4f9c0 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -73,4 +73,32 @@ const testFileLocations = { playground: 2, }; -module.exports = {testSetup, testFileLocations}; +/** + * @param {Browser} browser The active WebdriverIO Browser object. + * @return {WebElement} The selected block's root SVG element, as an interactable + * browser element. + */ +async function getSelectedBlockElement(browser) { + const result = await browser.execute(() => { + // Note: selected is an ICopyable and I am assuming that it is a BlockSvg. + return Blockly.common.getSelected()?.id; + }); + return await browser.$(`[data-id="${result}"]`); +} + +/** + * @param {Browser} browser The active WebdriverIO Browser object. + * @param {string} id The ID of the Blockly block to search for. + * @return {WebElement} The root SVG element of the block with the given ID, as an + * interactable browser element. + */ +async function getBlockElementById(browser, id) { + return await browser.$(`[data-id="${id}"]`); +} + +module.exports = { + testSetup, + testFileLocations, + getSelectedBlockElement, + getBlockElementById, +}; From 956b72ad5cf51fcbf346899b645e53ff0871159f Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 6 Jul 2023 11:08:29 -0700 Subject: [PATCH 08/58] chore: add test helpers for getting blocks from the toolbox (#7255) * chore: add test helpers for getting blocks from the toolbox * chore: format * chore: switch to use getBlockType * chore: format * chore: restore teardown --- tests/browser/test/procedure_test.js | 50 ++++++++++------------------ tests/browser/test/test_setup.js | 41 +++++++++++++++++++++++ 2 files changed, 59 insertions(+), 32 deletions(-) diff --git a/tests/browser/test/procedure_test.js b/tests/browser/test/procedure_test.js index 4b01488d5eb..2d7489a1854 100644 --- a/tests/browser/test/procedure_test.js +++ b/tests/browser/test/procedure_test.js @@ -13,9 +13,12 @@ const { testSetup, testFileLocations, getSelectedBlockElement, + getNthBlockOfCategory, + getBlockTypeFromCategory, } = require('./test_setup'); let browser; + suite('Testing Connecting Blocks', function (done) { // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test this.timeout(0); @@ -27,30 +30,26 @@ suite('Testing Connecting Blocks', function (done) { test('Testing Procedure', async function () { // Drag out first function - const functionCategory = await browser.$('#blockly-8'); - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec - functionCategory.click(); - let proceduresDefReturn = await browser.$( - '#content_blocks > div > svg:nth-child(7) > g > g.blocklyBlockCanvas > g:nth-child(5)' + let proceduresDefReturn = await getBlockTypeFromCategory( + 'Functions', + 'procedures_defreturn' ); await proceduresDefReturn.dragAndDrop({x: 50, y: 20}); - - // Drag out second function - functionCategory.click(); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec - proceduresDefReturn = await browser.$( - '#content_blocks > div > svg:nth-child(7) > g > g.blocklyBlockCanvas > g:nth-child(5)' + + // Drag out second function. + proceduresDefReturn = await getBlockTypeFromCategory( + 'Functions', + 'procedures_defreturn' ); await proceduresDefReturn.dragAndDrop({x: 300, y: 200}); + await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec // Drag out numeric - const mathCategory = await browser.$('#blockly-2'); - mathCategory.click(); - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec - const mathNumeric = await browser.$( - '#content_blocks > div > svg:nth-child(7) > g > g.blocklyBlockCanvas > g:nth-child(3)' - ); + const mathNumeric = await getBlockTypeFromCategory('Math', 'math_number'); await mathNumeric.dragAndDrop({x: 50, y: 20}); + await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec + // Connect numeric to first procedure const numericWorkspace = await getSelectedBlockElement(browser); const doSomething = await browser.$( @@ -65,30 +64,17 @@ suite('Testing Connecting Blocks', function (done) { const doSomething2 = await browser.$( '#content_blocks > div > svg.blocklySvg > g > g.blocklyBlockCanvas > g:nth-child(2)' ); - functionCategory.click(); - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec - const doSomethingFlyout = await browser.$( - '#content_blocks > div > svg:nth-child(7) > g > g.blocklyBlockCanvas > g:nth-child(9)' - ); + const doSomethingFlyout = await getNthBlockOfCategory('Functions', 3); await doSomethingFlyout.dragAndDrop(doSomething2); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec const doSomethingFlyoutWorkspace = await getSelectedBlockElement(browser); await doSomethingFlyoutWorkspace.dragAndDrop({x: 130, y: 20}); // Drag out print from flyout and connect it with doSomething 2 - const textButton = await browser.$('#blockly-3'); - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec - textButton.click(); - const printFlyout = await browser.$( - '#content_blocks > div > svg:nth-child(7) > g > g.blocklyBlockCanvas > g:nth-child(23)' - ); + const printFlyout = await getBlockTypeFromCategory('Text', 'text_print'); await printFlyout.dragAndDrop({x: 50, y: 20}); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec - functionCategory.click(); - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec - const doSomething2Flyout = await browser.$( - '#content_blocks > div > svg:nth-child(7) > g > g.blocklyBlockCanvas > g:nth-child(11)' - ); + const doSomething2Flyout = await getNthBlockOfCategory('Functions', 4); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec await doSomething2Flyout.dragAndDrop({x: 130, y: 20}); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index d8641c4f9c0..3b15bb5f098 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -95,10 +95,51 @@ async function getSelectedBlockElement(browser) { async function getBlockElementById(browser, id) { return await browser.$(`[data-id="${id}"]`); } +async function getCategory(categoryName) { + const categories = await browser.$$('.blocklyTreeLabel'); + + let category; + for (const c of categories) { + const text = await c.getText(); + if (text === categoryName) { + category = c; + } + } + if (!category) throw Error(); + + return category; +} + +async function getNthBlockOfCategory(categoryName, n) { + const category = await getCategory(categoryName); + category.click(); + await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec + const block = await browser.$( + `.blocklyFlyout .blocklyBlockCanvas > g:nth-child(${3 + n * 2})` + ); + return block; +} + +async function getBlockTypeFromCategory(categoryName, blockType) { + const category = await getCategory(categoryName); + category.click(); + await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec + + const id = browser.execute(() => { + return Blockly.getMainWorkspace() + .getFlyout() + .getWorkspace() + .getBlocksByType(blockType)[0].id; + }); + return await browser.$(`[data-id="${id}"]`); +} module.exports = { testSetup, testFileLocations, getSelectedBlockElement, getBlockElementById, + getCategory, + getNthBlockOfCategory, + getBlockTypeFromCategory, }; From eb4025bb61abb36d4285996fb9867117dd441f7f Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 6 Jul 2023 13:13:58 -0700 Subject: [PATCH 09/58] chore: fix problems from rebase (#7257) --- tests/browser/test/procedure_test.js | 26 ++++++++++++++++++++++---- tests/browser/test/test_setup.js | 14 +++++++------- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/tests/browser/test/procedure_test.js b/tests/browser/test/procedure_test.js index 2d7489a1854..69e66c7c12c 100644 --- a/tests/browser/test/procedure_test.js +++ b/tests/browser/test/procedure_test.js @@ -31,6 +31,7 @@ suite('Testing Connecting Blocks', function (done) { test('Testing Procedure', async function () { // Drag out first function let proceduresDefReturn = await getBlockTypeFromCategory( + browser, 'Functions', 'procedures_defreturn' ); @@ -39,6 +40,7 @@ suite('Testing Connecting Blocks', function (done) { // Drag out second function. proceduresDefReturn = await getBlockTypeFromCategory( + browser, 'Functions', 'procedures_defreturn' ); @@ -46,7 +48,11 @@ suite('Testing Connecting Blocks', function (done) { await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec // Drag out numeric - const mathNumeric = await getBlockTypeFromCategory('Math', 'math_number'); + const mathNumeric = await getBlockTypeFromCategory( + browser, + 'Math', + 'math_number' + ); await mathNumeric.dragAndDrop({x: 50, y: 20}); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec @@ -64,17 +70,29 @@ suite('Testing Connecting Blocks', function (done) { const doSomething2 = await browser.$( '#content_blocks > div > svg.blocklySvg > g > g.blocklyBlockCanvas > g:nth-child(2)' ); - const doSomethingFlyout = await getNthBlockOfCategory('Functions', 3); + const doSomethingFlyout = await getNthBlockOfCategory( + browser, + 'Functions', + 3 + ); await doSomethingFlyout.dragAndDrop(doSomething2); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec const doSomethingFlyoutWorkspace = await getSelectedBlockElement(browser); await doSomethingFlyoutWorkspace.dragAndDrop({x: 130, y: 20}); // Drag out print from flyout and connect it with doSomething 2 - const printFlyout = await getBlockTypeFromCategory('Text', 'text_print'); + const printFlyout = await getBlockTypeFromCategory( + browser, + 'Text', + 'text_print' + ); await printFlyout.dragAndDrop({x: 50, y: 20}); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec - const doSomething2Flyout = await getNthBlockOfCategory('Functions', 4); + const doSomething2Flyout = await getNthBlockOfCategory( + browser, + 'Functions', + 4 + ); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec await doSomething2Flyout.dragAndDrop({x: 130, y: 20}); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index 3b15bb5f098..819ae7d92da 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -95,7 +95,7 @@ async function getSelectedBlockElement(browser) { async function getBlockElementById(browser, id) { return await browser.$(`[data-id="${id}"]`); } -async function getCategory(categoryName) { +async function getCategory(browser, categoryName) { const categories = await browser.$$('.blocklyTreeLabel'); let category; @@ -110,8 +110,8 @@ async function getCategory(categoryName) { return category; } -async function getNthBlockOfCategory(categoryName, n) { - const category = await getCategory(categoryName); +async function getNthBlockOfCategory(browser, categoryName, n) { + const category = await getCategory(browser, categoryName); category.click(); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec const block = await browser.$( @@ -120,17 +120,17 @@ async function getNthBlockOfCategory(categoryName, n) { return block; } -async function getBlockTypeFromCategory(categoryName, blockType) { - const category = await getCategory(categoryName); +async function getBlockTypeFromCategory(browser, categoryName, blockType) { + const category = await getCategory(browser, categoryName); category.click(); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec - const id = browser.execute(() => { + const id = await browser.execute((blockType) => { return Blockly.getMainWorkspace() .getFlyout() .getWorkspace() .getBlocksByType(blockType)[0].id; - }); + }, blockType); return await browser.$(`[data-id="${id}"]`); } From 07ba841850f1db4c49e088b46a40a9d0f717b1e3 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 6 Jul 2023 15:35:58 -0700 Subject: [PATCH 10/58] chore: add test helpers for connecting blocks (#7258) * chore: get procedure test passing on linux * chore: cleanup * chore: format --- core/rendered_connection.ts | 1 - core/utils/svg_math.ts | 28 ++++++++++ tests/browser/test/procedure_test.js | 41 ++++++-------- tests/browser/test/test_setup.js | 82 +++++++++++++++++++++++++--- 4 files changed, 121 insertions(+), 31 deletions(-) diff --git a/core/rendered_connection.ts b/core/rendered_connection.ts index c1e01f86ccf..a3cd51a9638 100644 --- a/core/rendered_connection.ts +++ b/core/rendered_connection.ts @@ -262,7 +262,6 @@ export class RenderedConnection extends Connection { * Get the offset of this connection relative to the top left of its block. * * @returns The offset of the connection. - * @internal */ getOffsetInBlock(): Coordinate { return this.offsetInBlock; diff --git a/core/utils/svg_math.ts b/core/utils/svg_math.ts index 4c583a49f4e..1eef15db555 100644 --- a/core/utils/svg_math.ts +++ b/core/utils/svg_math.ts @@ -175,6 +175,34 @@ export function screenToWsCoordinates( return finalOffsetMainWs; } +/** + * Converts workspace coordinates to screen coordinates. + * + * @param ws The workspace to get the coordinates out of. + * @param workspaceCoordinates The workspace coordinates to be converted + * to screen coordinates. + * @returns The screen coordinates. + */ +export function wsToScreenCoordinates( + ws: WorkspaceSvg, + workspaceCoordinates: Coordinate +): Coordinate { + // Fix workspace scale vs browser scale. + const screenCoordinates = workspaceCoordinates.scale(ws.scale); + const screenX = screenCoordinates.x; + const screenY = screenCoordinates.y; + + const injectionDiv = ws.getInjectionDiv(); + const boundingRect = injectionDiv.getBoundingClientRect(); + const mainOffset = ws.getOriginOffsetInPixels(); + + // Fix workspace origin vs browser origin. + return new Coordinate( + screenX + boundingRect.left + mainOffset.x, + screenY + boundingRect.top + mainOffset.y + ); +} + export const TEST_ONLY = { XY_REGEX, XY_STYLE_REGEX, diff --git a/tests/browser/test/procedure_test.js b/tests/browser/test/procedure_test.js index 69e66c7c12c..2a32bf8e10b 100644 --- a/tests/browser/test/procedure_test.js +++ b/tests/browser/test/procedure_test.js @@ -15,6 +15,7 @@ const { getSelectedBlockElement, getNthBlockOfCategory, getBlockTypeFromCategory, + connect, } = require('./test_setup'); let browser; @@ -37,6 +38,7 @@ suite('Testing Connecting Blocks', function (done) { ); await proceduresDefReturn.dragAndDrop({x: 50, y: 20}); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec + const doSomething = await getSelectedBlockElement(browser); // Drag out second function. proceduresDefReturn = await getBlockTypeFromCategory( @@ -46,6 +48,7 @@ suite('Testing Connecting Blocks', function (done) { ); await proceduresDefReturn.dragAndDrop({x: 300, y: 200}); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec + const doSomething2 = await getSelectedBlockElement(browser); // Drag out numeric const mathNumeric = await getBlockTypeFromCategory( @@ -55,32 +58,25 @@ suite('Testing Connecting Blocks', function (done) { ); await mathNumeric.dragAndDrop({x: 50, y: 20}); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec + const numeric = await getSelectedBlockElement(browser); // Connect numeric to first procedure - const numericWorkspace = await getSelectedBlockElement(browser); - const doSomething = await browser.$( - '#content_blocks > div > svg.blocklySvg > g > g.blocklyBlockCanvas > g:nth-child(2)' - ); - await numericWorkspace.dragAndDrop(doSomething); - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec - await numericWorkspace.dragAndDrop({x: 100, y: 25}); - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec + await connect(browser, numeric, 'OUTPUT', doSomething, 'RETURN'); - // Drag out doSomething from flyout and connect it to doSomething2 - const doSomething2 = await browser.$( - '#content_blocks > div > svg.blocklySvg > g > g.blocklyBlockCanvas > g:nth-child(2)' - ); + // Drag out doSomething caller from flyout. const doSomethingFlyout = await getNthBlockOfCategory( browser, 'Functions', 3 ); - await doSomethingFlyout.dragAndDrop(doSomething2); + await doSomethingFlyout.dragAndDrop({x: 50, y: 20}); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec - const doSomethingFlyoutWorkspace = await getSelectedBlockElement(browser); - await doSomethingFlyoutWorkspace.dragAndDrop({x: 130, y: 20}); + const doSomethingCaller = await getSelectedBlockElement(browser); - // Drag out print from flyout and connect it with doSomething 2 + // Connect the doSomething caller to doSomething2 + await connect(browser, doSomethingCaller, 'OUTPUT', doSomething2, 'RETURN'); + + // Drag out print from flyout. const printFlyout = await getBlockTypeFromCategory( browser, 'Text', @@ -88,6 +84,9 @@ suite('Testing Connecting Blocks', function (done) { ); await printFlyout.dragAndDrop({x: 50, y: 20}); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec + const print = await getSelectedBlockElement(browser); + + // Drag out doSomething2 caller from flyout. const doSomething2Flyout = await getNthBlockOfCategory( browser, 'Functions', @@ -96,14 +95,10 @@ suite('Testing Connecting Blocks', function (done) { await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec await doSomething2Flyout.dragAndDrop({x: 130, y: 20}); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec - const doSomething2FlyoutWorkspace = await getSelectedBlockElement(browser); + const doSomething2Caller = await getSelectedBlockElement(browser); - const printWorkSpace = await browser.$( - '#content_blocks > div > svg.blocklySvg > g > g.blocklyBlockCanvas > g:nth-child(4)' - ); - await doSomething2FlyoutWorkspace.dragAndDrop(printWorkSpace); - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec - await doSomething2FlyoutWorkspace.dragAndDrop({x: 65, y: 0}); + // Connect doSomething2 caller with print. + await connect(browser, doSomething2Caller, 'OUTPUT', print, 'TEXT'); // Click run button and verify the number is 123 await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index 819ae7d92da..7d8d048618d 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -73,17 +73,21 @@ const testFileLocations = { playground: 2, }; +async function getSelectedBlockId(browser) { + return await browser.execute(() => { + // Note: selected is an ICopyable and I am assuming that it is a BlockSvg. + return Blockly.common.getSelected()?.id; + }); +} + /** * @param {Browser} browser The active WebdriverIO Browser object. * @return {WebElement} The selected block's root SVG element, as an interactable * browser element. */ async function getSelectedBlockElement(browser) { - const result = await browser.execute(() => { - // Note: selected is an ICopyable and I am assuming that it is a BlockSvg. - return Blockly.common.getSelected()?.id; - }); - return await browser.$(`[data-id="${result}"]`); + const id = await getSelectedBlockId(browser); + return getBlockElementById(browser, id); } /** @@ -93,7 +97,9 @@ async function getSelectedBlockElement(browser) { * interactable browser element. */ async function getBlockElementById(browser, id) { - return await browser.$(`[data-id="${id}"]`); + const elem = await browser.$(`[data-id="${id}"]`); + elem['id'] = id; + return elem; } async function getCategory(browser, categoryName) { const categories = await browser.$$('.blocklyTreeLabel'); @@ -131,15 +137,77 @@ async function getBlockTypeFromCategory(browser, categoryName, blockType) { .getWorkspace() .getBlocksByType(blockType)[0].id; }, blockType); - return await browser.$(`[data-id="${id}"]`); + return getBlockElementById(browser, id); +} + +async function getLocationOfBlockConnection(browser, id, connectionName) { + return await browser.execute( + (id, connectionName) => { + const block = Blockly.getMainWorkspace().getBlockById(id); + + let connection; + switch (connectionName) { + case 'OUTPUT': + connection = block.outputConnection; + break; + case 'PREVIOUS': + connection = block.previousConnection; + break; + case 'NEXT': + connection = block.nextConnection; + break; + default: + connection = block.getInput(connectionName).connection; + break; + } + + const loc = Blockly.utils.Coordinate.sum( + block.getRelativeToSurfaceXY(), + connection.getOffsetInBlock() + ); + return Blockly.utils.svgMath.wsToScreenCoordinates( + Blockly.getMainWorkspace(), + loc + ); + }, + id, + connectionName + ); +} + +async function connect( + browser, + draggedBlock, + draggedConnection, + targetBlock, + targetConnection +) { + const draggedLocation = await getLocationOfBlockConnection( + browser, + draggedBlock.id, + draggedConnection + ); + const targetLocation = await getLocationOfBlockConnection( + browser, + targetBlock.id, + targetConnection + ); + + const delta = { + x: targetLocation.x - draggedLocation.x, + y: targetLocation.y - draggedLocation.y, + }; + await draggedBlock.dragAndDrop(delta); } module.exports = { testSetup, testFileLocations, getSelectedBlockElement, + getSelectedBlockId, getBlockElementById, getCategory, getNthBlockOfCategory, getBlockTypeFromCategory, + connect, }; From aefb97d7801f1efc014d6f68aeb95dfc1a37ffe1 Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Fri, 7 Jul 2023 17:15:03 +0100 Subject: [PATCH 11/58] fix(tests): Make test `import`s correct and more consistent (#7260) * fix(tests): Fix invalid import paths in mocha tests This resolves the warnings generated during buildDeps by closure-make-deps. This commit does not attempt to address #7224 or otherwise rationalise the imports and usage thereof. * fix(tests): Fix failing context menu item test Test appears to have been wrong: Block.prototype.getIcon is typed as getIcon(/* ... */): T | undefined and documented as "@returns The icon with the given type if it exists on the block, undefined otherwise." * refactor(tests): Clean up inconsistent usage of CommentIcon Tweak the test files touched by PR #7200 to be consistent with existing usage of Blockly.icons.CommentIcon instead of importing this separately. --- tests/mocha/comment_deserialization_test.js | 4 +--- tests/mocha/contextmenu_items_test.js | 7 +++---- tests/mocha/field_multilineinput_test.js | 10 +++++----- tests/mocha/generator_test.js | 10 +++++----- tests/mocha/xml_test.js | 11 ++++++----- 5 files changed, 20 insertions(+), 22 deletions(-) diff --git a/tests/mocha/comment_deserialization_test.js b/tests/mocha/comment_deserialization_test.js index 08fe164b34e..4adba246fec 100644 --- a/tests/mocha/comment_deserialization_test.js +++ b/tests/mocha/comment_deserialization_test.js @@ -10,7 +10,6 @@ import { sharedTestSetup, sharedTestTeardown, } from './test_helpers/setup_teardown.js'; -import {CommentIcon} from '../../core/icons/comment_icon.js'; import {simulateClick} from './test_helpers/user_input.js'; suite('Comment Deserialization', function () { @@ -62,8 +61,7 @@ suite('Comment Deserialization', function () { const icon = block.getIcon(Blockly.icons.CommentIcon.TYPE); icon.setBubbleVisible(true); // Check comment bubble size. - const comment = block.getIcon(CommentIcon.TYPE); - const bubbleSize = comment.getBubbleSize(); + const bubbleSize = icon.getBubbleSize(); chai.assert.isNotNaN(bubbleSize.width); chai.assert.isNotNaN(bubbleSize.height); chai.assert.equal(icon.getText(), text); diff --git a/tests/mocha/contextmenu_items_test.js b/tests/mocha/contextmenu_items_test.js index 4c551742b35..566b3374875 100644 --- a/tests/mocha/contextmenu_items_test.js +++ b/tests/mocha/contextmenu_items_test.js @@ -11,7 +11,6 @@ import { sharedTestTeardown, workspaceTeardown, } from './test_helpers/setup_teardown.js'; -import {CommentIcon} from '../../core/icons/comment_icon.js'; suite('Context Menu Items', function () { setup(function () { @@ -459,12 +458,12 @@ suite('Context Menu Items', function () { }); test('Creates comment if one did not exist', function () { - chai.assert.isNull( - this.block.getIcon(CommentIcon.TYPE), + chai.assert.isUndefined( + this.block.getIcon(Blockly.icons.CommentIcon.TYPE), 'New block should not have a comment' ); this.commentOption.callback(this.scope); - chai.assert.exists(this.block.getIcon(CommentIcon.TYPE)); + chai.assert.exists(this.block.getIcon(Blockly.icons.CommentIcon.TYPE)); chai.assert.isEmpty( this.block.getCommentText(), 'Block should have empty comment text' diff --git a/tests/mocha/field_multilineinput_test.js b/tests/mocha/field_multilineinput_test.js index cf1102f3e13..8daaad82812 100644 --- a/tests/mocha/field_multilineinput_test.js +++ b/tests/mocha/field_multilineinput_test.js @@ -23,11 +23,11 @@ import { workspaceTeardown, } from './test_helpers/setup_teardown.js'; import {runCodeGenerationTestSuites} from './test_helpers/code_generation.js'; -import {dartGenerator} from '../../generators/dart.js'; -import {javascriptGenerator} from '../../generators/javascript.js'; -import {luaGenerator} from '../../generators/lua.js'; -import {phpGenerator} from '../../generators/php.js'; -import {pythonGenerator} from '../../generators/python.js'; +import {dartGenerator} from '../../build/src/generators/dart.js'; +import {javascriptGenerator} from '../../build/src/generators/javascript.js'; +import {luaGenerator} from '../../build/src/generators/lua.js'; +import {phpGenerator} from '../../build/src/generators/php.js'; +import {pythonGenerator} from '../../build/src/generators/python.js'; suite('Multiline Input Fields', function () { setup(function () { diff --git a/tests/mocha/generator_test.js b/tests/mocha/generator_test.js index 60f6190dc97..a60c0cd8648 100644 --- a/tests/mocha/generator_test.js +++ b/tests/mocha/generator_test.js @@ -7,11 +7,11 @@ goog.declareModuleId('Blockly.test.generator'); import * as Blockly from '../../build/src/core/blockly.js'; -import {DartGenerator} from '../../generators/dart/dart_generator.js'; -import {JavascriptGenerator} from '../../generators/javascript/javascript_generator.js'; -import {LuaGenerator} from '../../generators/lua/lua_generator.js'; -import {PhpGenerator} from '../../generators/php/php_generator.js'; -import {PythonGenerator} from '../../generators/python/python_generator.js'; +import {DartGenerator} from '../../build/src/generators/dart/dart_generator.js'; +import {JavascriptGenerator} from '../../build/src/generators/javascript/javascript_generator.js'; +import {LuaGenerator} from '../../build/src/generators/lua/lua_generator.js'; +import {PhpGenerator} from '../../build/src/generators/php/php_generator.js'; +import {PythonGenerator} from '../../build/src/generators/python/python_generator.js'; import { sharedTestSetup, sharedTestTeardown, diff --git a/tests/mocha/xml_test.js b/tests/mocha/xml_test.js index fe4c7505039..948d6cd0c6e 100644 --- a/tests/mocha/xml_test.js +++ b/tests/mocha/xml_test.js @@ -13,7 +13,6 @@ import { sharedTestTeardown, workspaceTeardown, } from './test_helpers/setup_teardown.js'; -import {CommentIcon} from '../../core/icons/comment_icon.js'; import {assertVariableValues} from './test_helpers/variables.js'; suite('XML', function () { @@ -443,7 +442,7 @@ suite('XML', function () { test('Size', function () { this.block.setCommentText('test text'); this.block - .getIcon(CommentIcon.TYPE) + .getIcon(Blockly.icons.CommentIcon.TYPE) .setBubbleSize(new Blockly.utils.Size(100, 200)); const xml = Blockly.Xml.blockToDom(this.block); const commentXml = xml.firstChild; @@ -453,7 +452,9 @@ suite('XML', function () { }); test('Pinned True', function () { this.block.setCommentText('test text'); - this.block.getIcon(CommentIcon.TYPE).setBubbleVisible(true); + this.block + .getIcon(Blockly.icons.CommentIcon.TYPE) + .setBubbleVisible(true); const xml = Blockly.Xml.blockToDom(this.block); const commentXml = xml.firstChild; chai.assert.equal(commentXml.tagName, 'comment'); @@ -698,7 +699,7 @@ suite('XML', function () { this.workspace ); chai.assert.equal(block.getCommentText(), 'test text'); - chai.assert.isOk(block.getIcon(CommentIcon.TYPE)); + chai.assert.isOk(block.getIcon(Blockly.icons.CommentIcon.TYPE)); }); test('No Text', function () { const block = Blockly.Xml.domToBlock( @@ -723,7 +724,7 @@ suite('XML', function () { ); chai.assert.isOk(block.getIcon(Blockly.icons.CommentIcon.TYPE)); chai.assert.deepEqual( - block.getIcon(CommentIcon.TYPE).getBubbleSize(), + block.getIcon(Blockly.icons.CommentIcon.TYPE).getBubbleSize(), { width: 100, height: 200, From 28b08ea3066b988f2dd37bd2213c5380ae3589e2 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Fri, 7 Jul 2023 14:19:17 -0700 Subject: [PATCH 12/58] chore: add css classes to individual zoom controls (#7261) --- core/zoom_controls.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/zoom_controls.ts b/core/zoom_controls.ts index 093121b1079..524eef44d79 100644 --- a/core/zoom_controls.ts +++ b/core/zoom_controls.ts @@ -256,7 +256,7 @@ export class ZoomControls implements IPositionable { */ this.zoomOutGroup = dom.createSvgElement( Svg.G, - {'class': 'blocklyZoom'}, + {'class': 'blocklyZoom blocklyZoomOut'}, this.svgGroup ); const clip = dom.createSvgElement( @@ -320,7 +320,7 @@ export class ZoomControls implements IPositionable { */ this.zoomInGroup = dom.createSvgElement( Svg.G, - {'class': 'blocklyZoom'}, + {'class': 'blocklyZoom blocklyZoomIn'}, this.svgGroup ); const clip = dom.createSvgElement( @@ -401,7 +401,7 @@ export class ZoomControls implements IPositionable { */ this.zoomResetGroup = dom.createSvgElement( Svg.G, - {'class': 'blocklyZoom'}, + {'class': 'blocklyZoom blocklyZoomReset'}, this.svgGroup ); const clip = dom.createSvgElement( From f0f72c01550cd8cc608b681122fb3b224cd1f083 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 08:42:00 -0700 Subject: [PATCH 13/58] chore(deps): Bump tough-cookie from 4.1.2 to 4.1.3 (#7265) Bumps [tough-cookie](https://github.com/salesforce/tough-cookie) from 4.1.2 to 4.1.3. - [Release notes](https://github.com/salesforce/tough-cookie/releases) - [Changelog](https://github.com/salesforce/tough-cookie/blob/master/CHANGELOG.md) - [Commits](https://github.com/salesforce/tough-cookie/compare/v4.1.2...v4.1.3) --- updated-dependencies: - dependency-name: tough-cookie dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 172 ++-------------------------------------------- 1 file changed, 6 insertions(+), 166 deletions(-) diff --git a/package-lock.json b/package-lock.json index acaac9945eb..885e0ab4b49 100644 --- a/package-lock.json +++ b/package-lock.json @@ -714,84 +714,6 @@ "@rushstack/node-core-library": "3.59.4" } }, - "node_modules/@microsoft/api-extractor/node_modules/@microsoft/api-extractor-model": { - "version": "7.27.3", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.27.3.tgz", - "integrity": "sha512-fSFvw7otYHduOkyshjTbapKKgwF8bgquVHvgF8VgeKtMYvqXkoaj7W6VcM7PNY7E2bbblhUgC4XNdqZLD4SJGw==", - "dev": true, - "dependencies": { - "@microsoft/tsdoc": "0.14.2", - "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.59.4" - } - }, - "node_modules/@microsoft/api-extractor/node_modules/@rushstack/node-core-library": { - "version": "3.59.4", - "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.59.4.tgz", - "integrity": "sha512-YAKJDC6Mz/KA1D7bvB88WaRX3knt/ZuLzkRu5G9QADGSjLtvTWzCNCytRF2PCSaaHOZaZsWul4F1KQdgFgUDqA==", - "dev": true, - "dependencies": { - "colors": "~1.2.1", - "fs-extra": "~7.0.1", - "import-lazy": "~4.0.0", - "jju": "~1.4.0", - "resolve": "~1.22.1", - "semver": "~7.3.0", - "z-schema": "~5.0.2" - }, - "peerDependencies": { - "@types/node": "*" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - } - } - }, - "node_modules/@microsoft/api-extractor/node_modules/@rushstack/ts-command-line": { - "version": "4.15.1", - "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.15.1.tgz", - "integrity": "sha512-EL4jxZe5fhb1uVL/P/wQO+Z8Rc8FMiWJ1G7VgnPDvdIt5GVjRfK7vwzder1CZQiX3x0PY6uxENYLNGTFd1InRQ==", - "dev": true, - "dependencies": { - "@types/argparse": "1.0.38", - "argparse": "~1.0.9", - "colors": "~1.2.1", - "string-argv": "~0.3.1" - } - }, - "node_modules/@microsoft/api-extractor/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/@microsoft/api-extractor/node_modules/fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@microsoft/api-extractor/node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "dev": true, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, "node_modules/@microsoft/api-extractor/node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -814,15 +736,6 @@ "node": ">=12.20" } }, - "node_modules/@microsoft/api-extractor/node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/@microsoft/tsdoc": { "version": "0.14.2", "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz", @@ -11093,9 +11006,9 @@ } }, "node_modules/tough-cookie": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz", - "integrity": "sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", "dependencies": { "psl": "^1.1.33", "punycode": "^2.1.1", @@ -12737,73 +12650,6 @@ "typescript": "~5.0.4" }, "dependencies": { - "@microsoft/api-extractor-model": { - "version": "7.27.3", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.27.3.tgz", - "integrity": "sha512-fSFvw7otYHduOkyshjTbapKKgwF8bgquVHvgF8VgeKtMYvqXkoaj7W6VcM7PNY7E2bbblhUgC4XNdqZLD4SJGw==", - "dev": true, - "requires": { - "@microsoft/tsdoc": "0.14.2", - "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.59.4" - } - }, - "@rushstack/node-core-library": { - "version": "3.59.4", - "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.59.4.tgz", - "integrity": "sha512-YAKJDC6Mz/KA1D7bvB88WaRX3knt/ZuLzkRu5G9QADGSjLtvTWzCNCytRF2PCSaaHOZaZsWul4F1KQdgFgUDqA==", - "dev": true, - "requires": { - "colors": "~1.2.1", - "fs-extra": "~7.0.1", - "import-lazy": "~4.0.0", - "jju": "~1.4.0", - "resolve": "~1.22.1", - "semver": "~7.3.0", - "z-schema": "~5.0.2" - } - }, - "@rushstack/ts-command-line": { - "version": "4.15.1", - "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.15.1.tgz", - "integrity": "sha512-EL4jxZe5fhb1uVL/P/wQO+Z8Rc8FMiWJ1G7VgnPDvdIt5GVjRfK7vwzder1CZQiX3x0PY6uxENYLNGTFd1InRQ==", - "dev": true, - "requires": { - "@types/argparse": "1.0.38", - "argparse": "~1.0.9", - "colors": "~1.2.1", - "string-argv": "~0.3.1" - } - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -12815,12 +12661,6 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", "dev": true - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true } } }, @@ -20936,9 +20776,9 @@ } }, "tough-cookie": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz", - "integrity": "sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", "requires": { "psl": "^1.1.33", "punycode": "^2.1.1", From 75ea8d994151f0639709477aadc345b0a40f13a2 Mon Sep 17 00:00:00 2001 From: John Nesky Date: Mon, 10 Jul 2023 09:18:42 -0700 Subject: [PATCH 14/58] fix: disposing workspace comments. (#7264) * fix: disposing workspace comments. * whitespace formatting --- core/workspace_comment_svg.ts | 7 ------- tests/mocha/workspace_comment_test.js | 14 +++++++++++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/core/workspace_comment_svg.ts b/core/workspace_comment_svg.ts index 98127cb8e78..b8f7547ecab 100644 --- a/core/workspace_comment_svg.ts +++ b/core/workspace_comment_svg.ts @@ -144,8 +144,6 @@ export class WorkspaceCommentSvg } dom.removeNode(this.svgGroup); - // Dispose of any rendered components - this.disposeInternal(); eventUtils.disable(); super.dispose(); @@ -989,11 +987,6 @@ export class WorkspaceCommentSvg this.resizeComment(); } - /** Dispose of any rendered comment components. */ - private disposeInternal() { - this.disposed_ = true; - } - /** * Set the focus on the text area. * diff --git a/tests/mocha/workspace_comment_test.js b/tests/mocha/workspace_comment_test.js index e6b15811c7b..2bd52c616ad 100644 --- a/tests/mocha/workspace_comment_test.js +++ b/tests/mocha/workspace_comment_test.js @@ -6,7 +6,6 @@ goog.declareModuleId('Blockly.test.workspaceComment'); -import {WorkspaceComment} from '../../build/src/core/workspace_comment.js'; import { sharedTestSetup, sharedTestTeardown, @@ -166,6 +165,19 @@ suite('Workspace comment', function () { // Nothing should go wrong the second time dispose is called. comment.dispose(); }); + + test('WorkspaceCommentSvg disposed', function () { + const comment = new Blockly.WorkspaceCommentSvg( + this.workspace, + 'comment text', + 0, + 0, + 'comment id' + ); + comment.dispose(); + // Nothing should go wrong the second time dispose is called. + comment.dispose(); + }); }); suite('Width and height', function () { From c7d0610ed04f1f6966926ced70cb470b2d3fdd2c Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Mon, 10 Jul 2023 14:24:30 -0700 Subject: [PATCH 15/58] feat(tests): add right click tests and helpers (#7262) * feat(tests): add test for collapsing block * chore: format * chore: format * feat(tests): add right-click tests and helpers * chore(tests): respond to review feedback --- tests/browser/test/basic_playground_test.js | 90 ++++++++++++++++++++- tests/browser/test/procedure_test.js | 2 +- tests/browser/test/test_setup.js | 30 +++++++ 3 files changed, 120 insertions(+), 2 deletions(-) diff --git a/tests/browser/test/basic_playground_test.js b/tests/browser/test/basic_playground_test.js index 034b295af16..a9a24741bf3 100644 --- a/tests/browser/test/basic_playground_test.js +++ b/tests/browser/test/basic_playground_test.js @@ -9,7 +9,24 @@ */ const chai = require('chai'); -const {testSetup, testFileLocations} = require('./test_setup'); +const { + testSetup, + testFileLocations, + dragNthBlockFromFlyout, + contextMenuSelect, +} = require('./test_setup'); + +async function getIsCollapsed(browser, blockId) { + return await browser.execute((blockId) => { + return Blockly.getMainWorkspace().getBlockById(blockId).isCollapsed(); + }, blockId); +} + +async function getIsEnabled(browser, blockId) { + return await browser.execute((blockId) => { + return Blockly.getMainWorkspace().getBlockById(blockId).isEnabled(); + }, blockId); +} let browser; suite('Testing Connecting Blocks', function (done) { @@ -46,3 +63,74 @@ suite('Testing Connecting Blocks', function (done) { await browser.deleteSession(); }); }); + +suite('Right Clicking on Blocks', function (done) { + // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test + this.timeout(0); + + // Setup Selenium for all of the tests + suiteSetup(async function () { + browser = await testSetup(testFileLocations.playground); + }); + + test('Collapse', async function () { + await browser.refresh(); + const block = await dragNthBlockFromFlyout(browser, 'Loops', 0, 20, 20); + + const blockId = block.id; + let isCollapsed = await getIsCollapsed(browser, blockId); + chai.assert.isFalse(isCollapsed); + + await contextMenuSelect(browser, block, 'Collapse Block'); + + isCollapsed = await getIsCollapsed(browser, blockId); + + chai.assert.isTrue(isCollapsed); + }); + + test('Expand', async function () { + await browser.refresh(); + const block = await dragNthBlockFromFlyout(browser, 'Loops', 0, 20, 20); + + await contextMenuSelect(browser, block, 'Collapse Block'); + await contextMenuSelect(browser, block, 'Expand Block'); + + // Verify. + const blockId = block.id; + const isCollapsed = await getIsCollapsed(browser, blockId); + chai.assert.isFalse(isCollapsed); + }); + + test('Disable', async function () { + await browser.refresh(); + const block = await dragNthBlockFromFlyout(browser, 'Loops', 0, 20, 20); + + const blockId = block.id; + let isEnabled = await getIsEnabled(browser, blockId); + chai.assert.isTrue(isEnabled); + + await contextMenuSelect(browser, block, 'Disable Block'); + + await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec + + isEnabled = await getIsEnabled(browser, blockId); + chai.assert.isFalse(isEnabled); + }); + + test('Enable', async function () { + await browser.refresh(); + const block = await dragNthBlockFromFlyout(browser, 'Loops', 0, 20, 20); + + const blockId = block.id; + await contextMenuSelect(browser, block, 'Disable Block'); + await contextMenuSelect(browser, block, 'Enable Block'); + + const isEnabled = await getIsEnabled(browser, blockId); + chai.assert.isTrue(isEnabled); + }); + + // Teardown entire suite after test are done running + suiteTeardown(async function () { + await browser.deleteSession(); + }); +}); diff --git a/tests/browser/test/procedure_test.js b/tests/browser/test/procedure_test.js index 2a32bf8e10b..1db2d171d32 100644 --- a/tests/browser/test/procedure_test.js +++ b/tests/browser/test/procedure_test.js @@ -82,7 +82,7 @@ suite('Testing Connecting Blocks', function (done) { 'Text', 'text_print' ); - await printFlyout.dragAndDrop({x: 50, y: 20}); + await printFlyout.dragAndDrop({x: 50, y: 0}); await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec const print = await getSelectedBlockElement(browser); diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index 7d8d048618d..0201187106b 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -200,6 +200,34 @@ async function connect( await draggedBlock.dragAndDrop(delta); } +async function dragNthBlockFromFlyout(browser, categoryName, n, x, y) { + const flyoutBlock = await getNthBlockOfCategory(browser, categoryName, n); + await browser.pause(2000); + await flyoutBlock.dragAndDrop({x: x, y: y}); + await browser.pause(2000); + return await getSelectedBlockElement(browser); +} + +async function dragBlockTypeFromFlyout(browser, categoryName, type, x, y) { + const flyoutBlock = await getBlockTypeFromCategory( + browser, + categoryName, + type + ); + await browser.pause(2000); + await flyoutBlock.dragAndDrop({x: x, y: y}); + await browser.pause(2000); + return await getSelectedBlockElement(browser); +} + +async function contextMenuSelect(browser, block, itemText) { + await block.click({button: 2}); + await browser.pause(2000); + const item = await browser.$(`div=${itemText}`); + await item.click(); + await browser.pause(2000); +} + module.exports = { testSetup, testFileLocations, @@ -209,5 +237,7 @@ module.exports = { getCategory, getNthBlockOfCategory, getBlockTypeFromCategory, + dragNthBlockFromFlyout, connect, + contextMenuSelect, }; From b1045a27b0fbf92672732dda1bbf18955357ddf1 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 11 Jul 2023 09:24:01 -0700 Subject: [PATCH 16/58] chore: remove extra waits and shorten necessary ones (#7259) --- tests/browser/test/procedure_test.js | 12 ++---------- tests/browser/test/test_setup.js | 12 ++++-------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/tests/browser/test/procedure_test.js b/tests/browser/test/procedure_test.js index 1db2d171d32..e8890d988f0 100644 --- a/tests/browser/test/procedure_test.js +++ b/tests/browser/test/procedure_test.js @@ -37,7 +37,6 @@ suite('Testing Connecting Blocks', function (done) { 'procedures_defreturn' ); await proceduresDefReturn.dragAndDrop({x: 50, y: 20}); - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec const doSomething = await getSelectedBlockElement(browser); // Drag out second function. @@ -47,7 +46,6 @@ suite('Testing Connecting Blocks', function (done) { 'procedures_defreturn' ); await proceduresDefReturn.dragAndDrop({x: 300, y: 200}); - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec const doSomething2 = await getSelectedBlockElement(browser); // Drag out numeric @@ -57,7 +55,6 @@ suite('Testing Connecting Blocks', function (done) { 'math_number' ); await mathNumeric.dragAndDrop({x: 50, y: 20}); - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec const numeric = await getSelectedBlockElement(browser); // Connect numeric to first procedure @@ -70,7 +67,6 @@ suite('Testing Connecting Blocks', function (done) { 3 ); await doSomethingFlyout.dragAndDrop({x: 50, y: 20}); - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec const doSomethingCaller = await getSelectedBlockElement(browser); // Connect the doSomething caller to doSomething2 @@ -82,8 +78,7 @@ suite('Testing Connecting Blocks', function (done) { 'Text', 'text_print' ); - await printFlyout.dragAndDrop({x: 50, y: 0}); - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec + await printFlyout.dragAndDrop({x: 50, y: 20}); const print = await getSelectedBlockElement(browser); // Drag out doSomething2 caller from flyout. @@ -92,19 +87,16 @@ suite('Testing Connecting Blocks', function (done) { 'Functions', 4 ); - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec await doSomething2Flyout.dragAndDrop({x: 130, y: 20}); - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec const doSomething2Caller = await getSelectedBlockElement(browser); // Connect doSomething2 caller with print. await connect(browser, doSomething2Caller, 'OUTPUT', print, 'TEXT'); // Click run button and verify the number is 123 - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec const runButton = await browser.$('#runButton'); runButton.click(); - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec + await browser.pause(200); const alertText = await browser.getAlertText(); // get the alert text chai.assert.equal(alertText, '123'); }); diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index 0201187106b..05a70991d6d 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -119,7 +119,7 @@ async function getCategory(browser, categoryName) { async function getNthBlockOfCategory(browser, categoryName, n) { const category = await getCategory(browser, categoryName); category.click(); - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec + await browser.pause(100); const block = await browser.$( `.blocklyFlyout .blocklyBlockCanvas > g:nth-child(${3 + n * 2})` ); @@ -129,7 +129,7 @@ async function getNthBlockOfCategory(browser, categoryName, n) { async function getBlockTypeFromCategory(browser, categoryName, blockType) { const category = await getCategory(browser, categoryName); category.click(); - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec + await browser.pause(100); const id = await browser.execute((blockType) => { return Blockly.getMainWorkspace() @@ -202,9 +202,7 @@ async function connect( async function dragNthBlockFromFlyout(browser, categoryName, n, x, y) { const flyoutBlock = await getNthBlockOfCategory(browser, categoryName, n); - await browser.pause(2000); await flyoutBlock.dragAndDrop({x: x, y: y}); - await browser.pause(2000); return await getSelectedBlockElement(browser); } @@ -214,18 +212,16 @@ async function dragBlockTypeFromFlyout(browser, categoryName, type, x, y) { categoryName, type ); - await browser.pause(2000); await flyoutBlock.dragAndDrop({x: x, y: y}); - await browser.pause(2000); return await getSelectedBlockElement(browser); } async function contextMenuSelect(browser, block, itemText) { await block.click({button: 2}); - await browser.pause(2000); + await browser.pause(200); const item = await browser.$(`div=${itemText}`); await item.click(); - await browser.pause(2000); + await browser.pause(200); } module.exports = { From cae721e9684420c77a446f45cb1c7d31e7f09b98 Mon Sep 17 00:00:00 2001 From: ericblackmonGoogle <129398736+ericblackmonGoogle@users.noreply.github.com> Date: Tue, 11 Jul 2023 16:51:04 +0000 Subject: [PATCH 17/58] chore: create test for undo block movements and editing a field (#7272) * chore: create test for undo block movements and editing a field * chore: create test for undo block movements and editing a field * chore: create test for undo block movements and editing a field * chore: create test for undo block movements and editing a field * chore: create test for undo block movements and editing a field * chore: create test for undo block movements and editing a field * chore: create test for undo block movements and editing a field * chore: create test for undo block movements and editing a field * chore: create test for undo block movements and editing a field * chore: create test for undo block movements and editing a field * chore: create test for undo block movements and editing a field --- tests/browser/test/block_undo_test.js | 63 ++++++++++++++++++++++ tests/browser/test/field_edits_test.js | 75 ++++++++++++++++++++++++++ tests/browser/test/test_setup.js | 18 +++++++ 3 files changed, 156 insertions(+) create mode 100644 tests/browser/test/block_undo_test.js create mode 100644 tests/browser/test/field_edits_test.js diff --git a/tests/browser/test/block_undo_test.js b/tests/browser/test/block_undo_test.js new file mode 100644 index 00000000000..d11c95c5360 --- /dev/null +++ b/tests/browser/test/block_undo_test.js @@ -0,0 +1,63 @@ +/** + * @license + * Copyright 2023 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Node.js script to run Automated tests in Chrome, via webdriver. + */ + +const chai = require('chai'); +const {Key} = require('webdriverio'); +const { + testSetup, + testFileLocations, + switchRTL, + dragBlockTypeFromFlyout, + screenDirection, +} = require('./test_setup'); + +let browser; +suite('Testing undo block movement', function (done) { + // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test + this.timeout(0); + + // Setup Selenium for all of the tests + suiteSetup(async function () { + browser = await testSetup(testFileLocations.playground); + }); + + test('Undoing Block Movement LTR', async function () { + await testUndoBlock(screenDirection.LTR); + }); + + test('Undoing Block Movement RTL', async function () { + await switchRTL(browser); + await testUndoBlock(screenDirection.RTL); + }); + + // Teardown entire suite after test are done running + suiteTeardown(async function () { + await browser.deleteSession(); + }); +}); + +async function testUndoBlock(delta) { + // Drag out first function + const defReturnBlock = await dragBlockTypeFromFlyout( + browser, + 'Functions', + 'procedures_defreturn', + 50 * delta, + 20 + ); + + await browser.keys([Key.Ctrl, 'z']); + + const blockOnWorkspace = await browser.execute(() => { + return !!Blockly.getMainWorkspace().getAllBlocks(false)[0]; + }); + + chai.assert.isFalse(blockOnWorkspace); +} diff --git a/tests/browser/test/field_edits_test.js b/tests/browser/test/field_edits_test.js new file mode 100644 index 00000000000..b7a25c75b64 --- /dev/null +++ b/tests/browser/test/field_edits_test.js @@ -0,0 +1,75 @@ +/** + * @license + * Copyright 2023 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Node.js script to run Automated tests in Chrome, via webdriver. + */ + +const chai = require('chai'); +const { + testSetup, + testFileLocations, + getSelectedBlockElement, + switchRTL, + dragBlockTypeFromFlyout, + screenDirection, +} = require('./test_setup'); +const {Key} = require('webdriverio'); + +let browser; +suite('Testing Field Edits', function (done) { + // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test + this.timeout(0); + + // Setup Selenium for all of the tests + suiteSetup(async function () { + browser = await testSetup(testFileLocations.playground); + }); + + test('Testing Field Edits LTR', async function () { + await testFieldEdits(screenDirection.LTR); + }); + + test('Testing Field Edits RTL', async function () { + switchRTL(browser); + await testFieldEdits(screenDirection.RTL); + }); + + // Teardown entire suite after test are done running + suiteTeardown(async function () { + await browser.deleteSession(); + }); +}); + +async function testFieldEdits(delta) { + const mathNumber = await dragBlockTypeFromFlyout( + browser, + 'Math', + 'math_number', + 50 * delta, + 20 + ); + await browser.pause(2000); + + // Click on the field to change the value + const numeric = await getSelectedBlockElement(browser); + await numeric.doubleClick(); + await browser.keys([Key.Delete]); + await numeric.doubleClick(); + await browser.keys(['1093']); + // Click on the workspace + const workspace = await browser.$('#blocklyDiv > div > svg.blocklySvg > g'); + await workspace.click(); + await browser.pause(2000); + // Get value of the number + const numericText = await browser + .$( + '#blocklyDiv > div > svg.blocklySvg > g > g.blocklyBlockCanvas > g.blocklyDraggable > g > text' + ) + .getHTML(); + + chai.assert.isTrue(numericText.includes('1093')); +} diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index 05a70991d6d..adb74c17d80 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -73,6 +73,16 @@ const testFileLocations = { playground: 2, }; +/** + * Enum for both LTR and RTL use cases. + * @readonly + * @enum {number} + */ +const screenDirection = { + RTL: -1, + LTR: 1, +}; + async function getSelectedBlockId(browser) { return await browser.execute(() => { // Note: selected is an ICopyable and I am assuming that it is a BlockSvg. @@ -200,6 +210,11 @@ async function connect( await draggedBlock.dragAndDrop(delta); } +async function switchRTL(browser) { + // Switch to RTL + const ltrForm = await browser.$('#options > select:nth-child(1)'); + await ltrForm.selectByIndex(1); +} async function dragNthBlockFromFlyout(browser, categoryName, n, x, y) { const flyoutBlock = await getNthBlockOfCategory(browser, categoryName, n); await flyoutBlock.dragAndDrop({x: x, y: y}); @@ -235,5 +250,8 @@ module.exports = { getBlockTypeFromCategory, dragNthBlockFromFlyout, connect, + switchRTL, contextMenuSelect, + dragBlockTypeFromFlyout, + screenDirection, }; From 6b3803e68fd1e57ab20e0aaabe1be8dfc8177d24 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Tue, 11 Jul 2023 14:43:53 -0700 Subject: [PATCH 18/58] chore(tests): Add documentation to browser test helper functions (#7280) * chore(test): release strictness of jsdoc parsing in browser tests * chore(tests): add jsdoc to browser test helper functions * Update tests/browser/test/test_setup.js Co-authored-by: Beka Westberg --------- Co-authored-by: Beka Westberg --- tests/browser/.eslintrc.json | 9 ++- tests/browser/test/test_setup.js | 100 ++++++++++++++++++++++++++++--- 2 files changed, 100 insertions(+), 9 deletions(-) diff --git a/tests/browser/.eslintrc.json b/tests/browser/.eslintrc.json index 17590c00c65..2fe4f6a6bb5 100644 --- a/tests/browser/.eslintrc.json +++ b/tests/browser/.eslintrc.json @@ -13,7 +13,14 @@ // Allow uncommented helper functions in tests. "require-jsdoc": ["off"], "prefer-rest-params": ["off"], - "no-invalid-this": ["off"] + "no-invalid-this": ["off"], + "valid-jsdoc": [ + "error", + { + "requireReturnType": false, + "requireParamType": false + } + ] }, "extends": "../../.eslintrc.js", "parserOptions": { diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index adb74c17d80..74cc42dfdd4 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -7,6 +7,10 @@ /** * @fileoverview Node.js script to run automated functional tests in Chrome, via webdriver. * This file is to be used in the suiteSetup for any automated fuctional test. + * Note: In this file many functions return browser elements that can + * be clicked or otherwise interacted with through Selenium WebDriver. These + * elements are not the raw HTML and SVG elements on the page; they are + * identifiers that Selenium can use to find those elements. */ const webdriverio = require('webdriverio'); @@ -83,6 +87,10 @@ const screenDirection = { LTR: 1, }; +/** + * @param browser The active WebdriverIO Browser object. + * @return A Promise that resolves to the ID of the currently selected block. + */ async function getSelectedBlockId(browser) { return await browser.execute(() => { // Note: selected is an ICopyable and I am assuming that it is a BlockSvg. @@ -91,9 +99,9 @@ async function getSelectedBlockId(browser) { } /** - * @param {Browser} browser The active WebdriverIO Browser object. - * @return {WebElement} The selected block's root SVG element, as an interactable - * browser element. + * @param browser The active WebdriverIO Browser object. + * @return A Promise that resolves to the selected block's root SVG element, + * as an interactable browser element. */ async function getSelectedBlockElement(browser) { const id = await getSelectedBlockId(browser); @@ -101,16 +109,24 @@ async function getSelectedBlockElement(browser) { } /** - * @param {Browser} browser The active WebdriverIO Browser object. - * @param {string} id The ID of the Blockly block to search for. - * @return {WebElement} The root SVG element of the block with the given ID, as an - * interactable browser element. + * @param browser The active WebdriverIO Browser object. + * @param id The ID of the Blockly block to search for. + * @return A Promise that resolves to the root SVG element of the block with + * the given ID, as an interactable browser element. */ async function getBlockElementById(browser, id) { const elem = await browser.$(`[data-id="${id}"]`); elem['id'] = id; return elem; } + +/** + * @param browser The active WebdriverIO Browser object. + * @param categoryName The name of the toolbox category to find. + * @return A Promise that resolves to the root element of the toolbox + * category with the given name, as an interactable browser element. + * @throws If the category cannot be found. + */ async function getCategory(browser, categoryName) { const categories = await browser.$$('.blocklyTreeLabel'); @@ -126,6 +142,13 @@ async function getCategory(browser, categoryName) { return category; } +/** + * @param browser The active WebdriverIO Browser object. + * @param categoryName The name of the toolbox category to search. + * @param n Which block to select, 0-indexed from the top of the category. + * @return A Promise that resolves to the root element of the nth block in the + * given category. + */ async function getNthBlockOfCategory(browser, categoryName, n) { const category = await getCategory(browser, categoryName); category.click(); @@ -136,6 +159,13 @@ async function getNthBlockOfCategory(browser, categoryName, n) { return block; } +/** + * @param browser The active WebdriverIO Browser object. + * @param categoryName The name of the toolbox category to search. + * @param blockType The type of the block to search for. + * @return A Promise that resolves to the root element of the first block with the + * given type in the given category. + */ async function getBlockTypeFromCategory(browser, categoryName, blockType) { const category = await getCategory(browser, categoryName); category.click(); @@ -150,6 +180,14 @@ async function getBlockTypeFromCategory(browser, categoryName, blockType) { return getBlockElementById(browser, id); } +/** + * @param browser The active WebdriverIO Browser object. + * @param id The ID of the block the connection is on. + * @param connectionName Which connection to return. An input name + * to get a value or statement connection, and otherwise the type of the connection. + * @return A Promise that resolves to the location of the specific connection in screen + * coordinates. + */ async function getLocationOfBlockConnection(browser, id, connectionName) { return await browser.execute( (id, connectionName) => { @@ -185,6 +223,15 @@ async function getLocationOfBlockConnection(browser, id, connectionName) { ); } +/** + * Drags a block toward another block so that the specified connections attach. + * @param browser The active WebdriverIO Browser object. + * @param draggedBlock The block to drag. + * @param draggedConnection The active connection on the block being dragged. + * @param targetBlock The block to drag to. + * @param targetConnection The connection to connect to on the target block. + * @return A Promise that resolves when the actions are completed. + */ async function connect( browser, draggedBlock, @@ -210,17 +257,46 @@ async function connect( await draggedBlock.dragAndDrop(delta); } +/** + * Switch the playground to RTL mode. + * @param browser The active WebdriverIO Browser object. + * @return A Promise that resolves when the actions are completed. + */ async function switchRTL(browser) { - // Switch to RTL const ltrForm = await browser.$('#options > select:nth-child(1)'); await ltrForm.selectByIndex(1); } + +/** + * Drag the specified block from the flyout and return the root element + * of the block. + * @param browser The active WebdriverIO Browser object. + * @param categoryName The name of the toolbox category to search. + * @param n Which block to select, indexed from the top of the category. + * @param x The x-distance to drag, as a delta from the block's initial location + * on screen. + * @param y The y-distance to drag, as a delta from the block's initial location + * on screen. + * @return A Promise that resolves to the root element of the newly created block. + */ async function dragNthBlockFromFlyout(browser, categoryName, n, x, y) { const flyoutBlock = await getNthBlockOfCategory(browser, categoryName, n); await flyoutBlock.dragAndDrop({x: x, y: y}); return await getSelectedBlockElement(browser); } +/** + * Drag the specified block from the flyout and return the root element + * of the block. + * @param browser The active WebdriverIO Browser object. + * @param categoryName The name of the toolbox category to search. + * @param type The type of the block to search for. + * @param x The x-distance to drag, as a delta from the block's initial location + * on screen. + * @param y The y-distance to drag, as a delta from the block's initial location + * on screen. + * @return A Promise that resolves to the root element of the newly created block. + */ async function dragBlockTypeFromFlyout(browser, categoryName, type, x, y) { const flyoutBlock = await getBlockTypeFromCategory( browser, @@ -231,6 +307,14 @@ async function dragBlockTypeFromFlyout(browser, categoryName, type, x, y) { return await getSelectedBlockElement(browser); } +/** + * Right-click on the specified block, then click on the specified context menu + * item. + * @param browser The active WebdriverIO Browser object. + * @param block The block to click, as an interactable element. + * @param itemText The display text of the context menu item to click. + * @return A Promise that resolves when the actions are completed. + */ async function contextMenuSelect(browser, block, itemText) { await block.click({button: 2}); await browser.pause(200); From a940dc567161b90b91b52cc5356d631fcb9a456f Mon Sep 17 00:00:00 2001 From: ericblackmonGoogle <129398736+ericblackmonGoogle@users.noreply.github.com> Date: Wed, 12 Jul 2023 15:22:59 +0000 Subject: [PATCH 19/58] chore: Added test for loading json and interblock deletion (#7282) * chore: Added test for loading json and interblock deletion * chore: Added test for loading json and interblock deletion * chore: Added test for loading json and interblock deletion * chore: Added test for loading json and interblock deletion * chore: Added test for loading json and interblock deletion --- tests/browser/test/extensive_test.js | 203 +++++++++++++++++++++++++++ tests/browser/test/test_setup.js | 21 +++ 2 files changed, 224 insertions(+) create mode 100644 tests/browser/test/extensive_test.js diff --git a/tests/browser/test/extensive_test.js b/tests/browser/test/extensive_test.js new file mode 100644 index 00000000000..edfd5d3b970 --- /dev/null +++ b/tests/browser/test/extensive_test.js @@ -0,0 +1,203 @@ +/** + * @license + * Copyright 2023 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Node.js script to run Automated tests in Chrome, via webdriver. + */ + +const chai = require('chai'); +const { + testSetup, + testFileLocations, + getBlockElementById, +} = require('./test_setup'); +const {Key} = require('webdriverio'); + +let browser; +suite('This tests loading Large Configuration and Deletion', function (done) { + // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test + this.timeout(0); + + // Setup Selenium for all of the tests + suiteSetup(async function () { + browser = await testSetup(testFileLocations.playground); + }); + + test('This test loading from JSON results in the correct number of blocks', async function () { + const blockNum = await testingJSONLoad(); + chai.assert.equal(blockNum, 13); + }); + + test('This test deleting block results in the correct number of blocks', async function () { + const fourthRepeatDo = await getBlockElementById( + browser, + 'E8bF[-r:B~cabGLP#QYd' + ); + await fourthRepeatDo.click({x: -100, y: -40}); + await browser.keys([Key.Delete]); + await browser.pause(100); + const blockNum = await browser.execute(() => { + return Blockly.getMainWorkspace().getAllBlocks(false).length; + }); + chai.assert.equal(blockNum, 10); + }); + + test('This test undoing delete block results in the correct number of blocks', async function () { + await browser.keys([Key.Ctrl, 'z']); + await browser.pause(100); + const blockNum = await browser.execute(() => { + return Blockly.getMainWorkspace().getAllBlocks(false).length; + }); + chai.assert.equal(blockNum, 13); + }); + + // Teardown entire suite after test are done running + suiteTeardown(async function () { + await browser.deleteSession(); + }); +}); + +async function testingJSONLoad() { + return await browser.execute(() => { + const myWorkspace = Blockly.getMainWorkspace(); + const state = { + 'blocks': { + 'languageVersion': 0, + 'blocks': [ + { + 'type': 'controls_if', + 'id': 'O]NpXoWXyz9okeD.PxV0', + 'x': 112, + 'y': 38, + 'extraState': { + 'elseIfCount': 1, + 'hasElse': true, + }, + 'inputs': { + 'DO0': { + 'block': { + 'type': 'controls_repeat_ext', + 'id': ',8#9eTr9hCrD3nR|uW1L', + 'inputs': { + 'TIMES': { + 'shadow': { + 'type': 'math_number', + 'id': '(6!seVzJ[5W=!M_s@s=I', + 'fields': { + 'NUM': 4, + }, + }, + }, + }, + }, + }, + 'DO1': { + 'block': { + 'type': 'controls_repeat_ext', + 'id': ']X9#sM4FJiVrRP;y0m6H', + 'inputs': { + 'TIMES': { + 'shadow': { + 'type': 'math_number', + 'id': '%k#p|;f+Y*#.8DX].a6Y', + 'fields': { + 'NUM': -10, + }, + }, + }, + }, + }, + }, + 'ELSE': { + 'block': { + 'type': 'controls_repeat_ext', + 'id': '`ZOj01@KGMQ?+MMcLKZ:', + 'inputs': { + 'TIMES': { + 'shadow': { + 'type': 'math_number', + 'id': 'IIK8IHzVCoUpTfx[j=^9', + 'fields': { + 'NUM': 10, + }, + }, + 'block': { + 'type': 'logic_ternary', + 'id': '!$UboN.F)peh:!o]D48-', + 'inputs': { + 'IF': { + 'block': { + 'type': 'logic_boolean', + 'id': '|?-zstzEVy,Ec%%dJZM{', + 'fields': { + 'BOOL': 'FALSE', + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + 'next': { + 'block': { + 'type': 'controls_repeat_ext', + 'id': 'E8bF[-r:B~cabGLP#QYd', + 'inputs': { + 'TIMES': { + 'shadow': { + 'type': 'math_number', + 'id': 'vOb`Us7f.bIuXRGd(K.e', + 'fields': { + 'NUM': 10, + }, + }, + 'block': { + 'type': 'logic_ternary', + 'id': 'AyS?@78RwAtQ$?aU[-$L', + 'inputs': { + 'IF': { + 'block': { + 'type': 'logic_boolean', + 'id': 'K@$Ewnj*Y6JcKR`mycf8', + 'fields': { + 'BOOL': 'FALSE', + }, + }, + }, + }, + }, + }, + }, + 'next': { + 'block': { + 'type': 'controls_repeat_ext', + 'id': 'XFO4v:Cf@2~rgH9CQZ]/', + 'inputs': { + 'TIMES': { + 'shadow': { + 'type': 'math_number', + 'id': 'jf)XYgvoi!c.3V[u@h+-', + 'fields': { + 'NUM': 10, + }, + }, + }, + }, + }, + }, + }, + }, + }, + ], + }, + }; + Blockly.serialization.workspaces.load(state, myWorkspace); + return myWorkspace.getAllBlocks(false).length; + }); +} diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index 74cc42dfdd4..588b2c52dbe 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -180,6 +180,26 @@ async function getBlockTypeFromCategory(browser, categoryName, blockType) { return getBlockElementById(browser, id); } +/** + * @param browser The active WebdriverIO Browser object. + * @param blockType The type of the block to search for in the workspace. + * @param position The the position of the block type on the workspace. + * @return A Promise that resolves to the root element of the block with the + * given position and type on the workspace. + */ +async function getBlockTypeFromWorkspace(browser, blockType, position) { + const id = await browser.execute( + (blockType, position) => { + return Blockly.getMainWorkspace().getBlocksByType(blockType, true)[ + position + ].id; + }, + blockType, + position + ); + return getBlockElementById(browser, id); +} + /** * @param browser The active WebdriverIO Browser object. * @param id The ID of the block the connection is on. @@ -338,4 +358,5 @@ module.exports = { contextMenuSelect, dragBlockTypeFromFlyout, screenDirection, + getBlockTypeFromWorkspace, }; From 741e8dbebb1838d69d903609a54feb311d0c0d86 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Thu, 13 Jul 2023 13:57:38 -0700 Subject: [PATCH 20/58] chore(tests): Add tests for adding and removing comments (#7284) * chore(tests): Add tests for adding and removing comments * chore(tests): respond to PR feedback --- tests/browser/test/basic_playground_test.js | 79 ++++++++++----------- 1 file changed, 36 insertions(+), 43 deletions(-) diff --git a/tests/browser/test/basic_playground_test.js b/tests/browser/test/basic_playground_test.js index a9a24741bf3..dd93549297e 100644 --- a/tests/browser/test/basic_playground_test.js +++ b/tests/browser/test/basic_playground_test.js @@ -28,6 +28,12 @@ async function getIsEnabled(browser, blockId) { }, blockId); } +async function getCommentText(browser, blockId) { + return await browser.execute((blockId) => { + return Blockly.getMainWorkspace().getBlockById(blockId).getCommentText(); + }, blockId); +} + let browser; suite('Testing Connecting Blocks', function (done) { // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test @@ -64,6 +70,10 @@ suite('Testing Connecting Blocks', function (done) { }); }); +/** + * These tests have to run together. Each test acts on the state left by the + * previous test, and each test has a single assertion. + */ suite('Right Clicking on Blocks', function (done) { // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test this.timeout(0); @@ -71,62 +81,45 @@ suite('Right Clicking on Blocks', function (done) { // Setup Selenium for all of the tests suiteSetup(async function () { browser = await testSetup(testFileLocations.playground); + this.block = await dragNthBlockFromFlyout(browser, 'Loops', 0, 20, 20); + this.blockId = this.block.id; }); - test('Collapse', async function () { - await browser.refresh(); - const block = await dragNthBlockFromFlyout(browser, 'Loops', 0, 20, 20); - - const blockId = block.id; - let isCollapsed = await getIsCollapsed(browser, blockId); - chai.assert.isFalse(isCollapsed); - - await contextMenuSelect(browser, block, 'Collapse Block'); - - isCollapsed = await getIsCollapsed(browser, blockId); - + test('clicking the collapse option collapses the block', async function () { + await contextMenuSelect(browser, this.block, 'Collapse Block'); + const isCollapsed = await getIsCollapsed(browser, this.blockId); chai.assert.isTrue(isCollapsed); }); - test('Expand', async function () { - await browser.refresh(); - const block = await dragNthBlockFromFlyout(browser, 'Loops', 0, 20, 20); - - await contextMenuSelect(browser, block, 'Collapse Block'); - await contextMenuSelect(browser, block, 'Expand Block'); - - // Verify. - const blockId = block.id; - const isCollapsed = await getIsCollapsed(browser, blockId); + // Assumes that + test('clicking the expand option expands the block', async function () { + await contextMenuSelect(browser, this.block, 'Expand Block'); + const isCollapsed = await getIsCollapsed(browser, this.blockId); chai.assert.isFalse(isCollapsed); }); - test('Disable', async function () { - await browser.refresh(); - const block = await dragNthBlockFromFlyout(browser, 'Loops', 0, 20, 20); - - const blockId = block.id; - let isEnabled = await getIsEnabled(browser, blockId); - chai.assert.isTrue(isEnabled); - - await contextMenuSelect(browser, block, 'Disable Block'); - - await new Promise((resolve) => setTimeout(resolve, 2000)); // 2 sec - - isEnabled = await getIsEnabled(browser, blockId); + test('clicking the disable option disables the block', async function () { + await contextMenuSelect(browser, this.block, 'Disable Block'); + const isEnabled = await getIsEnabled(browser, this.blockId); chai.assert.isFalse(isEnabled); }); - test('Enable', async function () { - await browser.refresh(); - const block = await dragNthBlockFromFlyout(browser, 'Loops', 0, 20, 20); + test('clicking the enable option enables the block', async function () { + await contextMenuSelect(browser, this.block, 'Enable Block'); + const isEnabled = await getIsEnabled(browser, this.block.id); + chai.assert.isTrue(isEnabled); + }); - const blockId = block.id; - await contextMenuSelect(browser, block, 'Disable Block'); - await contextMenuSelect(browser, block, 'Enable Block'); + test('clicking the add comment option adds a comment to the block', async function () { + await contextMenuSelect(browser, this.block, 'Add Comment'); + const commentText = await getCommentText(browser, this.block.id); + chai.assert.equal(commentText, ''); + }); - const isEnabled = await getIsEnabled(browser, blockId); - chai.assert.isTrue(isEnabled); + test('clicking the remove comment option removes a comment from the block', async function () { + await contextMenuSelect(browser, this.block, 'Remove Comment'); + const commentText = await getCommentText(browser, this.block.id); + chai.assert.isNull(commentText); }); // Teardown entire suite after test are done running From 8355351898662b76b4a34e4d9275c8db9db9cbe4 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 13 Jul 2023 17:18:48 -0700 Subject: [PATCH 21/58] fix: add compose and decompose errors to mutator icon (#7289) * fix: add compose and decompose errors to mutator icon * chore: format --- core/icons/mutator_icon.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/icons/mutator_icon.ts b/core/icons/mutator_icon.ts index eee9e585d93..8817450ce3e 100644 --- a/core/icons/mutator_icon.ts +++ b/core/icons/mutator_icon.ts @@ -227,7 +227,12 @@ export class MutatorIcon extends Icon implements IHasBubble { /** Decomposes the source block to create blocks in the mini workspace. */ private createRootBlock() { - this.rootBlock = this.sourceBlock.decompose!( + if (!this.sourceBlock.decompose) { + throw new Error( + 'Blocks with mutator icons must include a decompose method' + ); + } + this.rootBlock = this.sourceBlock.decompose( this.miniWorkspaceBubble!.getWorkspace() )!; @@ -290,12 +295,17 @@ export class MutatorIcon extends Icon implements IHasBubble { /** Recomposes the source block based on changes to the mini workspace. */ private recomposeSourceBlock() { if (!this.rootBlock) return; + if (!this.sourceBlock.compose) { + throw new Error( + 'Blocks with mutator icons must include a compose method' + ); + } const existingGroup = eventUtils.getGroup(); if (!existingGroup) eventUtils.setGroup(true); const oldExtraState = BlockChange.getExtraBlockState_(this.sourceBlock); - this.sourceBlock.compose!(this.rootBlock); + this.sourceBlock.compose(this.rootBlock); const newExtraState = BlockChange.getExtraBlockState_(this.sourceBlock); if (oldExtraState !== newExtraState) { From 82a775a982c8bd3f7d2ffdb4b508b75d9c2c44b8 Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Fri, 14 Jul 2023 15:51:38 +0100 Subject: [PATCH 22/58] test: Basic Blocks: verify drag blocks works properly (#7291) * refactor(tests): Have testSetup accept a URL Have testSetup accept a URL. Make testFileLocations a dictionary whose values are URLs, and change the spellings of the keys to be CONSTANT_CASE. This allows tests to specify their own URL, or to add a query or fragment. * feat(tests): Add getAllBlocks helper * test: Verify drag blocks works properly * chore(tests): Reformat comments Manually reformat comments to comply with styleguide. --- .../browser/test/basic_block_factory_test.js | 2 +- tests/browser/test/basic_block_test.js | 55 +++++++++ tests/browser/test/basic_playground_test.js | 4 +- tests/browser/test/block_undo_test.js | 2 +- tests/browser/test/extensive_test.js | 2 +- tests/browser/test/field_edits_test.js | 2 +- tests/browser/test/procedure_test.js | 2 +- tests/browser/test/test_setup.js | 113 +++++++++++------- 8 files changed, 130 insertions(+), 52 deletions(-) create mode 100644 tests/browser/test/basic_block_test.js diff --git a/tests/browser/test/basic_block_factory_test.js b/tests/browser/test/basic_block_factory_test.js index cd9f098006d..def7ef0ef5f 100644 --- a/tests/browser/test/basic_block_factory_test.js +++ b/tests/browser/test/basic_block_factory_test.js @@ -18,7 +18,7 @@ suite('Testing Connecting Blocks', function (done) { // Setup Selenium for all of the tests suiteSetup(async function () { - browser = await testSetup(testFileLocations.blockfactory); + browser = await testSetup(testFileLocations.BLOCK_FACTORY); }); test('Testing Block Drag', async function () { diff --git a/tests/browser/test/basic_block_test.js b/tests/browser/test/basic_block_test.js new file mode 100644 index 00000000000..4a2a3ea2080 --- /dev/null +++ b/tests/browser/test/basic_block_test.js @@ -0,0 +1,55 @@ +/** + * @license + * Copyright 2023 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Node.js script to run Automated tests in Chrome, via + * webdriver, of basic Blockly block functionality. + */ + +const chai = require('chai'); +const { + testSetup, + testFileLocations, + getAllBlocks, + getSelectedBlockElement, + switchRTL, + dragBlockTypeFromFlyout, + screenDirection, +} = require('./test_setup'); +const {Key} = require('webdriverio'); + +let browser; + +suite('Basic block tests', function (done) { + // Setting timeout to unlimited as the webdriver takes a longer time + // to run than most mocha test + this.timeout(0); + + // Setup Selenium for all of the tests + suiteSetup(async function () { + browser = await testSetup( + testFileLocations.PLAYGROUND + '?toolbox=test-blocks' + ); + }); + + test('Drag three blocks into the workspace', async function () { + for (let i = 1; i <= 3; i++) { + await dragBlockTypeFromFlyout( + browser, + 'Basic', + 'test_basic_empty', + 250, + 50 * i + ); + chai.assert.equal((await getAllBlocks(browser)).length, i); + } + }); + + // Teardown entire suite after test are done running + suiteTeardown(async function () { + await browser.deleteSession(); + }); +}); diff --git a/tests/browser/test/basic_playground_test.js b/tests/browser/test/basic_playground_test.js index dd93549297e..7f9fb3a702b 100644 --- a/tests/browser/test/basic_playground_test.js +++ b/tests/browser/test/basic_playground_test.js @@ -41,7 +41,7 @@ suite('Testing Connecting Blocks', function (done) { // Setup Selenium for all of the tests suiteSetup(async function () { - browser = await testSetup(testFileLocations.playground); + browser = await testSetup(testFileLocations.PLAYGROUND); }); test('Testing Block Flyout', async function () { @@ -80,7 +80,7 @@ suite('Right Clicking on Blocks', function (done) { // Setup Selenium for all of the tests suiteSetup(async function () { - browser = await testSetup(testFileLocations.playground); + browser = await testSetup(testFileLocations.PLAYGROUND); this.block = await dragNthBlockFromFlyout(browser, 'Loops', 0, 20, 20); this.blockId = this.block.id; }); diff --git a/tests/browser/test/block_undo_test.js b/tests/browser/test/block_undo_test.js index d11c95c5360..1acfbd6f9be 100644 --- a/tests/browser/test/block_undo_test.js +++ b/tests/browser/test/block_undo_test.js @@ -25,7 +25,7 @@ suite('Testing undo block movement', function (done) { // Setup Selenium for all of the tests suiteSetup(async function () { - browser = await testSetup(testFileLocations.playground); + browser = await testSetup(testFileLocations.PLAYGROUND); }); test('Undoing Block Movement LTR', async function () { diff --git a/tests/browser/test/extensive_test.js b/tests/browser/test/extensive_test.js index edfd5d3b970..015877400d6 100644 --- a/tests/browser/test/extensive_test.js +++ b/tests/browser/test/extensive_test.js @@ -23,7 +23,7 @@ suite('This tests loading Large Configuration and Deletion', function (done) { // Setup Selenium for all of the tests suiteSetup(async function () { - browser = await testSetup(testFileLocations.playground); + browser = await testSetup(testFileLocations.PLAYGROUND); }); test('This test loading from JSON results in the correct number of blocks', async function () { diff --git a/tests/browser/test/field_edits_test.js b/tests/browser/test/field_edits_test.js index b7a25c75b64..5a88b7b8f65 100644 --- a/tests/browser/test/field_edits_test.js +++ b/tests/browser/test/field_edits_test.js @@ -26,7 +26,7 @@ suite('Testing Field Edits', function (done) { // Setup Selenium for all of the tests suiteSetup(async function () { - browser = await testSetup(testFileLocations.playground); + browser = await testSetup(testFileLocations.PLAYGROUND); }); test('Testing Field Edits LTR', async function () { diff --git a/tests/browser/test/procedure_test.js b/tests/browser/test/procedure_test.js index e8890d988f0..0a675a836a5 100644 --- a/tests/browser/test/procedure_test.js +++ b/tests/browser/test/procedure_test.js @@ -26,7 +26,7 @@ suite('Testing Connecting Blocks', function (done) { // Setup Selenium for all of the tests suiteSetup(async function () { - browser = await testSetup(testFileLocations.code); + browser = await testSetup(testFileLocations.CODE_DEMO); }); test('Testing Procedure', async function () { diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index 588b2c52dbe..6797b47ac69 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -5,8 +5,11 @@ */ /** - * @fileoverview Node.js script to run automated functional tests in Chrome, via webdriver. + * @fileoverview Node.js script to run automated functional tests in + * Chrome, via webdriver. + * * This file is to be used in the suiteSetup for any automated fuctional test. + * * Note: In this file many functions return browser elements that can * be clicked or otherwise interacted with through Selenium WebDriver. These * elements are not the raw HTML and SVG elements on the page; they are @@ -18,8 +21,7 @@ const path = require('path'); const {posixPath} = require('../../../scripts/helpers'); let browser; -async function testSetup(testFile) { - let url; +async function testSetup(url) { const options = { capabilities: { 'browserName': 'chrome', @@ -45,25 +47,6 @@ async function testSetup(testFile) { options.capabilities['goog:chromeOptions'].args.push('--disable-gpu'); } // Use Selenium to bring up the page - if (testFile == testFileLocations.blockfactory) { - url = - 'file://' + - posixPath( - path.join(__dirname, '..', '..', '..', 'demos', 'blockfactory') - ) + - '/index.html'; - } else if (testFile == testFileLocations.code) { - url = - 'file://' + - posixPath(path.join(__dirname, '..', '..', '..', 'demos', 'code')) + - '/index.html'; - } else { - url = - 'file://' + - posixPath(path.join(__dirname, '..', '..')) + - '/playground.html'; - } - console.log(url); console.log('Starting webdriverio...'); browser = await webdriverio.remote(options); console.log('Loading URL: ' + url); @@ -72,13 +55,23 @@ async function testSetup(testFile) { } const testFileLocations = { - blockfactory: 0, - code: 1, - playground: 2, + BLOCK_FACTORY: + 'file://' + + posixPath(path.join(__dirname, '..', '..', '..', 'demos', 'blockfactory')) + + '/index.html', + CODE_DEMO: + 'file://' + + posixPath(path.join(__dirname, '..', '..', '..', 'demos', 'code')) + + '/index.html', + PLAYGROUND: + 'file://' + + posixPath(path.join(__dirname, '..', '..')) + + '/playground.html', }; /** * Enum for both LTR and RTL use cases. + * * @readonly * @enum {number} */ @@ -146,8 +139,8 @@ async function getCategory(browser, categoryName) { * @param browser The active WebdriverIO Browser object. * @param categoryName The name of the toolbox category to search. * @param n Which block to select, 0-indexed from the top of the category. - * @return A Promise that resolves to the root element of the nth block in the - * given category. + * @return A Promise that resolves to the root element of the nth + * block in the given category. */ async function getNthBlockOfCategory(browser, categoryName, n) { const category = await getCategory(browser, categoryName); @@ -163,8 +156,8 @@ async function getNthBlockOfCategory(browser, categoryName, n) { * @param browser The active WebdriverIO Browser object. * @param categoryName The name of the toolbox category to search. * @param blockType The type of the block to search for. - * @return A Promise that resolves to the root element of the first block with the - * given type in the given category. + * @return A Promise that resolves to the root element of the first + * block with the given type in the given category. */ async function getBlockTypeFromCategory(browser, categoryName, blockType) { const category = await getCategory(browser, categoryName); @@ -203,10 +196,11 @@ async function getBlockTypeFromWorkspace(browser, blockType, position) { /** * @param browser The active WebdriverIO Browser object. * @param id The ID of the block the connection is on. - * @param connectionName Which connection to return. An input name - * to get a value or statement connection, and otherwise the type of the connection. - * @return A Promise that resolves to the location of the specific connection in screen - * coordinates. + * @param connectionName Which connection to return. An input name to + * get a value or statement connection, and otherwise the type of + * the connection. + * @return A Promise that resolves to the location of the specific + * connection in screen coordinates. */ async function getLocationOfBlockConnection(browser, id, connectionName) { return await browser.execute( @@ -233,6 +227,7 @@ async function getLocationOfBlockConnection(browser, id, connectionName) { block.getRelativeToSurfaceXY(), connection.getOffsetInBlock() ); + console.log(Blockly); return Blockly.utils.svgMath.wsToScreenCoordinates( Blockly.getMainWorkspace(), loc @@ -245,6 +240,7 @@ async function getLocationOfBlockConnection(browser, id, connectionName) { /** * Drags a block toward another block so that the specified connections attach. + * * @param browser The active WebdriverIO Browser object. * @param draggedBlock The block to drag. * @param draggedConnection The active connection on the block being dragged. @@ -279,6 +275,7 @@ async function connect( /** * Switch the playground to RTL mode. + * * @param browser The active WebdriverIO Browser object. * @return A Promise that resolves when the actions are completed. */ @@ -290,14 +287,16 @@ async function switchRTL(browser) { /** * Drag the specified block from the flyout and return the root element * of the block. + * * @param browser The active WebdriverIO Browser object. * @param categoryName The name of the toolbox category to search. * @param n Which block to select, indexed from the top of the category. - * @param x The x-distance to drag, as a delta from the block's initial location - * on screen. - * @param y The y-distance to drag, as a delta from the block's initial location - * on screen. - * @return A Promise that resolves to the root element of the newly created block. + * @param x The x-distance to drag, as a delta from the block's + * initial location on screen. + * @param y The y-distance to drag, as a delta from the block's + * initial location on screen. + * @return A Promise that resolves to the root element of the newly + * created block. */ async function dragNthBlockFromFlyout(browser, categoryName, n, x, y) { const flyoutBlock = await getNthBlockOfCategory(browser, categoryName, n); @@ -308,14 +307,16 @@ async function dragNthBlockFromFlyout(browser, categoryName, n, x, y) { /** * Drag the specified block from the flyout and return the root element * of the block. + * * @param browser The active WebdriverIO Browser object. * @param categoryName The name of the toolbox category to search. * @param type The type of the block to search for. - * @param x The x-distance to drag, as a delta from the block's initial location - * on screen. - * @param y The y-distance to drag, as a delta from the block's initial location - * on screen. - * @return A Promise that resolves to the root element of the newly created block. + * @param x The x-distance to drag, as a delta from the block's + * initial location on screen. + * @param y The y-distance to drag, as a delta from the block's + * initial location on screen. + * @return A Promise that resolves to the root element of the newly + * created block. */ async function dragBlockTypeFromFlyout(browser, categoryName, type, x, y) { const flyoutBlock = await getBlockTypeFromCategory( @@ -328,8 +329,9 @@ async function dragBlockTypeFromFlyout(browser, categoryName, type, x, y) { } /** - * Right-click on the specified block, then click on the specified context menu - * item. + * Right-click on the specified block, then click on the specified + * context menu item. + * * @param browser The active WebdriverIO Browser object. * @param block The block to click, as an interactable element. * @param itemText The display text of the context menu item to click. @@ -343,6 +345,26 @@ async function contextMenuSelect(browser, block, itemText) { await browser.pause(200); } +/** + * Get all blocks on the main workspace. Because the blocks have circular + * references that can't be JSON-encoded they can't be returned directly, so + * extract relevant properties only. + * + * @param browser The active WebdriverIO Browser object. + * @return A Promise that resolves to an array of blocks on the main workspace. + */ +async function getAllBlocks(browser) { + return browser.execute(() => { + // return Blockly.getMainWorkspace().getAllBlocks(false); + return Blockly.getMainWorkspace() + .getAllBlocks(false) + .map((block) => ({ + type: block.type, + id: block.id, + })); + }); +} + module.exports = { testSetup, testFileLocations, @@ -359,4 +381,5 @@ module.exports = { dragBlockTypeFromFlyout, screenDirection, getBlockTypeFromWorkspace, + getAllBlocks, }; From d503fbb409e58d80a3a4db89ec603532505e8663 Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Mon, 17 Jul 2023 20:40:27 +0100 Subject: [PATCH 23/58] fix(generators): Changes to exports and access controls for TypeScript compatibility (#7295) * fix(generators): Add missing declarations for Order enums * chore(generators): Remove spurious whitespace * fix(generators): Make provideFunction_ etc. public Remove the protected declaration on provideFunction_ and FUNCTION_NAME_PLACEHOLDER_ so they can be used from generator functions written in TypeScript. Not strictly part of #7283, but closely related and required to fixing the related issue google/blockly-samples#1785. * chore(generators): format --- core/generator.ts | 7 ++--- generators/python/python_generator.js | 36 ++++++++++++------------ typings/dart.d.ts | 21 ++++++++++++++ typings/javascript.d.ts | 38 +++++++++++++++++++++++++ typings/lua.d.ts | 15 ++++++++++ typings/php.d.ts | 40 +++++++++++++++++++++++++++ typings/python.d.ts | 24 ++++++++++++++++ 7 files changed, 158 insertions(+), 23 deletions(-) diff --git a/core/generator.ts b/core/generator.ts index 2485e589877..28d6d1f762e 100644 --- a/core/generator.ts +++ b/core/generator.ts @@ -49,7 +49,7 @@ export class CodeGenerator { * legitimately appear in a function definition (or comment), and it must * not confuse the regular expression parser. */ - protected FUNCTION_NAME_PLACEHOLDER_ = '{leCUI8hutHZI4480Dc}'; + FUNCTION_NAME_PLACEHOLDER_ = '{leCUI8hutHZI4480Dc}'; FUNCTION_NAME_PLACEHOLDER_REGEXP_: RegExp; /** @@ -471,10 +471,7 @@ export class CodeGenerator { * @returns The actual name of the new function. This may differ from * desiredName if the former has already been taken by the user. */ - protected provideFunction_( - desiredName: string, - code: string[] | string - ): string { + provideFunction_(desiredName: string, code: string[] | string): string { if (!this.definitions_[desiredName]) { const functionName = this.nameDB_!.getDistinctName( desiredName, diff --git a/generators/python/python_generator.js b/generators/python/python_generator.js index 5897b436607..2f0aabe0c13 100644 --- a/generators/python/python_generator.js +++ b/generators/python/python_generator.js @@ -72,7 +72,7 @@ export class PythonGenerator extends CodeGenerator { // (foo.bar)() -> foo.bar() // (foo[0])() -> foo[0]() [Order.MEMBER, Order.FUNCTION_CALL], - + // not (not foo) -> not not foo [Order.LOGICAL_NOT, Order.LOGICAL_NOT], // a and (b and c) -> a and b and c @@ -80,7 +80,7 @@ export class PythonGenerator extends CodeGenerator { // a or (b or c) -> a or b or c [Order.LOGICAL_OR, Order.LOGICAL_OR] ]; - + constructor(name) { super(name ?? 'Python'); this.isInitialized = false; @@ -143,7 +143,7 @@ export class PythonGenerator extends CodeGenerator { 'vars,xrange,zip' ); } - + /** * Initialise the database of variable names. * @param {!Workspace} workspace Workspace to generate code from. @@ -151,22 +151,22 @@ export class PythonGenerator extends CodeGenerator { */ init(workspace) { super.init(workspace); - + /** * Empty loops or conditionals are not allowed in Python. */ this.PASS = this.INDENT + 'pass\n'; - + if (!this.nameDB_) { this.nameDB_ = new Names(this.RESERVED_WORDS_); } else { this.nameDB_.reset(); } - + this.nameDB_.setVariableMap(workspace.getVariableMap()); this.nameDB_.populateVariables(workspace); this.nameDB_.populateProcedures(workspace); - + const defvars = []; // Add developer variables (not created or named by the user). const devVarList = Variables.allDeveloperVariables(workspace); @@ -175,7 +175,7 @@ export class PythonGenerator extends CodeGenerator { this.nameDB_.getName(devVarList[i], Names.DEVELOPER_VARIABLE_TYPE) + ' = None'); } - + // Add user variables, but only ones that are being used. const variables = Variables.allUsedVarModels(workspace); for (let i = 0; i < variables.length; i++) { @@ -183,11 +183,11 @@ export class PythonGenerator extends CodeGenerator { this.nameDB_.getName(variables[i].getId(), NameType.VARIABLE) + ' = None'); } - + this.definitions_['variables'] = defvars.join('\n'); this.isInitialized = true; } - + /** * Prepend the generated code with import statements and variable definitions. * @param {string} code Generated code. @@ -208,12 +208,12 @@ export class PythonGenerator extends CodeGenerator { // Call Blockly.CodeGenerator's finish. code = super.finish(code); this.isInitialized = false; - + this.nameDB_.reset(); const allDefs = imports.join('\n') + '\n\n' + definitions.join('\n\n'); return allDefs.replace(/\n\n+/g, '\n\n').replace(/\n*$/, '\n\n\n') + code; } - + /** * Naked values are top-level blocks with outputs that aren't plugged into * anything. @@ -223,7 +223,7 @@ export class PythonGenerator extends CodeGenerator { scrubNakedValue(line) { return line + '\n'; } - + /** * Encode a string as a properly escaped Python string, complete with quotes. * @param {string} string Text to encode. @@ -232,7 +232,7 @@ export class PythonGenerator extends CodeGenerator { */ quote_(string) { string = string.replace(/\\/g, '\\\\').replace(/\n/g, '\\\n'); - + // Follow the CPython behaviour of repr() for a non-byte string. let quote = '\''; if (string.indexOf('\'') !== -1) { @@ -244,7 +244,7 @@ export class PythonGenerator extends CodeGenerator { } return quote + string + quote; } - + /** * Encode a string as a properly escaped multiline Python string, complete * with quotes. @@ -258,7 +258,7 @@ export class PythonGenerator extends CodeGenerator { // + '\n' + return lines.join(' + \'\\n\' + \n'); } - + /** * Common tasks for generating Python from blocks. * Handles comments for the specified block and any connected value blocks. @@ -297,7 +297,7 @@ export class PythonGenerator extends CodeGenerator { const nextCode = opt_thisOnly ? '' : this.blockToCode(nextBlock); return commentCode + code + nextCode; } - + /** * Gets a property and adjusts the value, taking into account indexing. * If a static int, casts to an integer, otherwise returns a code string. @@ -315,7 +315,7 @@ export class PythonGenerator extends CodeGenerator { const defaultAtIndex = block.workspace.options.oneBasedIndex ? '1' : '0'; const atOrder = delta ? this.ORDER_ADDITIVE : this.ORDER_NONE; let at = this.valueToCode(block, atId, atOrder) || defaultAtIndex; - + if (stringUtils.isNumber(at)) { // If the index is a naked number, adjust it right now. at = parseInt(at, 10) + delta; diff --git a/typings/dart.d.ts b/typings/dart.d.ts index a547e00fe5d..4dda479a497 100644 --- a/typings/dart.d.ts +++ b/typings/dart.d.ts @@ -4,4 +4,25 @@ * SPDX-License-Identifier: Apache-2.0 */ +export enum Order { + ATOMIC = 0, // 0 "" ... + UNARY_POSTFIX = 1, // expr++ expr-- () [] . ?. + UNARY_PREFIX = 2, // -expr !expr ~expr ++expr --expr + MULTIPLICATIVE = 3, // * / % ~/ + ADDITIVE = 4, // + - + SHIFT = 5, // << >> + BITWISE_AND = 6, // & + BITWISE_XOR = 7, // ^ + BITWISE_OR = 8, // | + RELATIONAL = 9, // >= > <= < as is is! + EQUALITY = 10, // == != + LOGICAL_AND = 11, // && + LOGICAL_OR = 12, // || + IF_NULL = 13, // ?? + CONDITIONAL = 14, // expr ? expr : expr + CASCADE = 15, // .. + ASSIGNMENT = 16, // = *= /= ~/= %= += -= <<= >>= &= ^= |= + NONE = 99, // (...) +} + export declare const dartGenerator: any; diff --git a/typings/javascript.d.ts b/typings/javascript.d.ts index cbb55fd65c9..b507a9be4a4 100644 --- a/typings/javascript.d.ts +++ b/typings/javascript.d.ts @@ -4,4 +4,42 @@ * SPDX-License-Identifier: Apache-2.0 */ +export enum Order { + ATOMIC = 0, // 0 "" ... + NEW = 1.1, // new + MEMBER = 1.2, // . [] + FUNCTION_CALL = 2, // () + INCREMENT = 3, // ++ + DECREMENT = 3, // -- + BITWISE_NOT = 4.1, // ~ + UNARY_PLUS = 4.2, // + + UNARY_NEGATION = 4.3, // - + LOGICAL_NOT = 4.4, // ! + TYPEOF = 4.5, // typeof + VOID = 4.6, // void + DELETE = 4.7, // delete + AWAIT = 4.8, // await + EXPONENTIATION = 5.0, // ** + MULTIPLICATION = 5.1, // * + DIVISION = 5.2, // / + MODULUS = 5.3, // % + SUBTRACTION = 6.1, // - + ADDITION = 6.2, // + + BITWISE_SHIFT = 7, // << >> >>> + RELATIONAL = 8, // < <= > >= + IN = 8, // in + INSTANCEOF = 8, // instanceof + EQUALITY = 9, // == != === !== + BITWISE_AND = 10, // & + BITWISE_XOR = 11, // ^ + BITWISE_OR = 12, // | + LOGICAL_AND = 13, // && + LOGICAL_OR = 14, // || + CONDITIONAL = 15, // ?: + ASSIGNMENT = 16, // = += -= **= *= /= %= <<= >>= ... + YIELD = 17, // yield + COMMA = 18, // , + NONE = 99, // (...) +} + export declare const javascriptGenerator: any; diff --git a/typings/lua.d.ts b/typings/lua.d.ts index 551c67772f7..693fb0ba25f 100644 --- a/typings/lua.d.ts +++ b/typings/lua.d.ts @@ -4,4 +4,19 @@ * SPDX-License-Identifier: Apache-2.0 */ +export enum Order { + ATOMIC = 0, // literals + // The next level was not explicit in documentation and inferred by Ellen. + HIGH = 1, // Function calls, tables[] + EXPONENTIATION = 2, // ^ + UNARY = 3, // not # - ~ + MULTIPLICATIVE = 4, // * / % + ADDITIVE = 5, // + - + CONCATENATION = 6, // .. + RELATIONAL = 7, // < > <= >= ~= == + AND = 8, // and + OR = 9, // or + NONE = 99, +} + export declare const luaGenerator: any; diff --git a/typings/php.d.ts b/typings/php.d.ts index df438507ae9..29a223613be 100644 --- a/typings/php.d.ts +++ b/typings/php.d.ts @@ -4,4 +4,44 @@ * SPDX-License-Identifier: Apache-2.0 */ +export enum Order { + ATOMIC = 0, // 0 "" ... + CLONE = 1, // clone + NEW = 1, // new + MEMBER = 2.1, // [] + FUNCTION_CALL = 2.2, // () + POWER = 3, // ** + INCREMENT = 4, // ++ + DECREMENT = 4, // -- + BITWISE_NOT = 4, // ~ + CAST = 4, // (int) (float) (string) (array) ... + SUPPRESS_ERROR = 4, // @ + INSTANCEOF = 5, // instanceof + LOGICAL_NOT = 6, // ! + UNARY_PLUS = 7.1, // + + UNARY_NEGATION = 7.2, // - + MULTIPLICATION = 8.1, // * + DIVISION = 8.2, // / + MODULUS = 8.3, // % + ADDITION = 9.1, // + + SUBTRACTION = 9.2, // - + STRING_CONCAT = 9.3, // . + BITWISE_SHIFT = 10, // << >> + RELATIONAL = 11, // < <= > >= + EQUALITY = 12, // == != === !== <> <=> + REFERENCE = 13, // & + BITWISE_AND = 13, // & + BITWISE_XOR = 14, // ^ + BITWISE_OR = 15, // | + LOGICAL_AND = 16, // && + LOGICAL_OR = 17, // || + IF_NULL = 18, // ?? + CONDITIONAL = 19, // ?: + ASSIGNMENT = 20, // = += -= *= /= %= <<= >>= ... + LOGICAL_AND_WEAK = 21, // and + LOGICAL_XOR = 22, // xor + LOGICAL_OR_WEAK = 23, // or + NONE = 99, // (...) +} + export declare const phpGenerator: any; diff --git a/typings/python.d.ts b/typings/python.d.ts index ab931669b18..6d6449e3791 100644 --- a/typings/python.d.ts +++ b/typings/python.d.ts @@ -4,4 +4,28 @@ * SPDX-License-Identifier: Apache-2.0 */ +export enum Order { + ATOMIC = 0, // 0 "" ... + COLLECTION = 1, // tuples, lists, dictionaries + STRING_CONVERSION = 1, // `expression...` + MEMBER = 2.1, // . [] + FUNCTION_CALL = 2.2, // () + EXPONENTIATION = 3, // ** + UNARY_SIGN = 4, // + - + BITWISE_NOT = 4, // ~ + MULTIPLICATIVE = 5, // * / // % + ADDITIVE = 6, // + - + BITWISE_SHIFT = 7, // << >> + BITWISE_AND = 8, // & + BITWISE_XOR = 9, // ^ + BITWISE_OR = 10, // | + RELATIONAL = 11, // in, not in, is, is not, >, >=, <>, !=, == + LOGICAL_NOT = 12, // not + LOGICAL_AND = 13, // and + LOGICAL_OR = 14, // or + CONDITIONAL = 15, // if else + LAMBDA = 16, // lambda + NONE = 99, // (...) +} + export declare const pythonGenerator: any; From 1bc4f67d78cc88c15a4e55d7d102743db1e04a4c Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Mon, 17 Jul 2023 21:00:06 +0100 Subject: [PATCH 24/58] fix: Correct errors in `HSV_SATURATION`, `HSV_VALUE` accessors (#7297) * fix: Correct errors in HSV_SATURATION, HSV_VALUE accessors Fix the comment / message errors noted in https://github.com/google/blockly/pull/7249#issuecomment-1638645810 * chore: Add renamings for HSV_SATURATION, HSV_VALUE --- core/main.js | 14 +++++++------- scripts/migration/renamings.json5 | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/core/main.js b/core/main.js index 0b8e1a1712a..cc83733d46c 100644 --- a/core/main.js +++ b/core/main.js @@ -32,8 +32,8 @@ Object.defineProperties(Blockly, { * Must be in the range of 0 (inclusive) to 1 (exclusive). * @name Blockly.HSV_SATURATION * @type {number} - * @deprecated Use Blockly.colour.getHsvSaturation() / .setHsvSaturation( - * instead. (July 2023) + * @deprecated Use Blockly.utils.colour.getHsvSaturation() / + * .setHsvSaturation() instead. (July 2023) * @suppress {checkTypes} */ HSV_SATURATION: { @@ -42,7 +42,7 @@ Object.defineProperties(Blockly, { 'Blockly.HSV_SATURATION', 'version 10', 'version 11', - 'Blockly.colour.getHsvSaturation()' + 'Blockly.utils.colour.getHsvSaturation()' ); return colour.getHsvSaturation(); }, @@ -51,7 +51,7 @@ Object.defineProperties(Blockly, { 'Blockly.HSV_SATURATION', 'version 10', 'version 11', - 'Blockly.colour.setHsvSaturation()' + 'Blockly.utils.colour.setHsvSaturation()' ); colour.setHsvSaturation(newValue); }, @@ -61,7 +61,7 @@ Object.defineProperties(Blockly, { * Must be in the range of 0 (inclusive) to 1 (exclusive). * @name Blockly.HSV_VALUE * @type {number} - * @deprecated Use Blockly.colour.getHsvValue() / .setHsvValue instead. + * @deprecated Use Blockly.utils.colour.getHsvValue() / .setHsvValue instead. * (July 2023) * @suppress {checkTypes} */ @@ -71,7 +71,7 @@ Object.defineProperties(Blockly, { 'Blockly.HSV_VALUE', 'version 10', 'version 11', - 'Blockly.colour.getHsvValue()' + 'Blockly.utils.colour.getHsvValue()' ); return colour.getHsvValue(); }, @@ -80,7 +80,7 @@ Object.defineProperties(Blockly, { 'Blockly.HSV_VALUE', 'version 10', 'version 11', - 'Blockly.colour.setHsvValue()' + 'Blockly.utils.colour.setHsvValue()' ); colour.setHsvValue(newValue); }, diff --git a/scripts/migration/renamings.json5 b/scripts/migration/renamings.json5 index ee1c33834f7..97fbc3fc0fc 100644 --- a/scripts/migration/renamings.json5 +++ b/scripts/migration/renamings.json5 @@ -1577,5 +1577,23 @@ }, ], + '10.0.1': [ + { + oldName: 'Blockly', + exports: { + HSV_SATURATION: { + newModule: 'Blockly.utils.colour', + getMethod: 'getHsvSaturation', + setMethod: 'setHsvSaturation', + }, + HSV_VALUE: { + newModule: 'Blockly.utils.colour', + getMethod: 'getHsvValue', + setMethod: 'setHsvValue', + }, + }, + }, + ], + 'develop': [], } From abb82a2f91568673b8436af177083d2e6a1e8eb1 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Mon, 17 Jul 2023 13:28:03 -0700 Subject: [PATCH 25/58] chore: add tests for disabling blocks (#7279) * chore: add tests for disabling blocks * chore: update asserts to be one line * fix: test setup --- tests/browser/test/basic_playground_test.js | 125 +++++++++++++++++--- tests/browser/test/test_setup.js | 17 ++- 2 files changed, 122 insertions(+), 20 deletions(-) diff --git a/tests/browser/test/basic_playground_test.js b/tests/browser/test/basic_playground_test.js index 7f9fb3a702b..2805be12cde 100644 --- a/tests/browser/test/basic_playground_test.js +++ b/tests/browser/test/basic_playground_test.js @@ -13,6 +13,8 @@ const { testSetup, testFileLocations, dragNthBlockFromFlyout, + dragBlockTypeFromFlyout, + connect, contextMenuSelect, } = require('./test_setup'); @@ -22,9 +24,10 @@ async function getIsCollapsed(browser, blockId) { }, blockId); } -async function getIsEnabled(browser, blockId) { +async function getIsDisabled(browser, blockId) { return await browser.execute((blockId) => { - return Blockly.getMainWorkspace().getBlockById(blockId).isEnabled(); + const block = Blockly.getMainWorkspace().getBlockById(blockId); + return !block.isEnabled() || block.getInheritedDisabled(); }, blockId); } @@ -35,7 +38,7 @@ async function getCommentText(browser, blockId) { } let browser; -suite('Testing Connecting Blocks', function (done) { +suite('Testing Connecting Blocks', function () { // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test this.timeout(0); @@ -74,7 +77,7 @@ suite('Testing Connecting Blocks', function (done) { * These tests have to run together. Each test acts on the state left by the * previous test, and each test has a single assertion. */ -suite('Right Clicking on Blocks', function (done) { +suite('Right Clicking on Blocks', function () { // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test this.timeout(0); @@ -87,39 +90,33 @@ suite('Right Clicking on Blocks', function (done) { test('clicking the collapse option collapses the block', async function () { await contextMenuSelect(browser, this.block, 'Collapse Block'); - const isCollapsed = await getIsCollapsed(browser, this.blockId); - chai.assert.isTrue(isCollapsed); + chai.assert.isTrue(await getIsCollapsed(browser, this.blockId)); }); // Assumes that test('clicking the expand option expands the block', async function () { await contextMenuSelect(browser, this.block, 'Expand Block'); - const isCollapsed = await getIsCollapsed(browser, this.blockId); - chai.assert.isFalse(isCollapsed); + chai.assert.isFalse(await getIsCollapsed(browser, this.blockId)); }); test('clicking the disable option disables the block', async function () { await contextMenuSelect(browser, this.block, 'Disable Block'); - const isEnabled = await getIsEnabled(browser, this.blockId); - chai.assert.isFalse(isEnabled); + chai.assert.isTrue(await getIsDisabled(browser, this.blockId)); }); test('clicking the enable option enables the block', async function () { await contextMenuSelect(browser, this.block, 'Enable Block'); - const isEnabled = await getIsEnabled(browser, this.block.id); - chai.assert.isTrue(isEnabled); + chai.assert.isFalse(await getIsDisabled(browser, this.block.id)); }); test('clicking the add comment option adds a comment to the block', async function () { await contextMenuSelect(browser, this.block, 'Add Comment'); - const commentText = await getCommentText(browser, this.block.id); - chai.assert.equal(commentText, ''); + chai.assert.equal(await getCommentText(browser, this.block.id), ''); }); test('clicking the remove comment option removes a comment from the block', async function () { await contextMenuSelect(browser, this.block, 'Remove Comment'); - const commentText = await getCommentText(browser, this.block.id); - chai.assert.isNull(commentText); + chai.assert.isNull(await getCommentText(browser, this.block.id)); }); // Teardown entire suite after test are done running @@ -127,3 +124,99 @@ suite('Right Clicking on Blocks', function (done) { await browser.deleteSession(); }); }); + +suite('Disabling', function () { + // Setting timeout to unlimited as the webdriver takes a longer + // time to run than most mocha tests. + this.timeout(0); + + suiteSetup(async function () { + browser = await testSetup(testFileLocations.PLAYGROUND); + }); + + setup(async function () { + await browser.refresh(); + }); + + test( + 'children connected to value inputs are disabled when the ' + + 'parent is diabled', + async function () { + const parent = await dragBlockTypeFromFlyout( + browser, + 'Logic', + 'controls_if', + 10, + 10 + ); + const child = await dragBlockTypeFromFlyout( + browser, + 'Logic', + 'logic_boolean', + 110, + 110 + ); + await connect(browser, child, 'OUTPUT', parent, 'IF0'); + + await contextMenuSelect(browser, parent, 'Disable Block'); + + chai.assert.isTrue(await getIsDisabled(browser, child.id)); + } + ); + + test( + 'children connected to statement inputs are disabled when the ' + + 'parent is disabled', + async function () { + const parent = await dragBlockTypeFromFlyout( + browser, + 'Logic', + 'controls_if', + 10, + 10 + ); + const child = await dragBlockTypeFromFlyout( + browser, + 'Logic', + 'controls_if', + 110, + 110 + ); + await connect(browser, child, 'PREVIOUS', parent, 'IF0'); + + await contextMenuSelect(browser, parent, 'Disable Block'); + + chai.assert.isTrue(await getIsDisabled(browser, child.id)); + } + ); + + test( + 'children connected to next connections are not disabled when the ' + + 'parent is disabled', + async function () { + const parent = await dragBlockTypeFromFlyout( + browser, + 'Logic', + 'controls_if', + 10, + 10 + ); + const child = await dragBlockTypeFromFlyout( + browser, + 'Logic', + 'controls_if', + 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 () { + await browser.deleteSession(); + }); +}); diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index 6797b47ac69..c25073cf444 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -338,11 +338,20 @@ async function dragBlockTypeFromFlyout(browser, categoryName, type, x, y) { * @return A Promise that resolves when the actions are completed. */ async function contextMenuSelect(browser, block, itemText) { - await block.click({button: 2}); - await browser.pause(200); + // Clicking will always happen in the middle of the block's bounds + // (including children) by default, which causes problems if it has holes + // (e.g. statement inputs). + // Instead we want to click 20% from the right and 5% from the top. + const xOffset = -Math.round((await block.getSize('width')) * 0.3); + const yOffset = -Math.round((await block.getSize('height')) * 0.45); + + await block.click({button: 2, x: xOffset, y: yOffset}); + await browser.pause(100); + const item = await browser.$(`div=${itemText}`); await item.click(); - await browser.pause(200); + + await browser.pause(100); } /** @@ -375,10 +384,10 @@ module.exports = { getNthBlockOfCategory, getBlockTypeFromCategory, dragNthBlockFromFlyout, + dragBlockTypeFromFlyout, connect, switchRTL, contextMenuSelect, - dragBlockTypeFromFlyout, screenDirection, getBlockTypeFromWorkspace, getAllBlocks, From 30ed44558d135465b9015fc8b9a45cc238d4f199 Mon Sep 17 00:00:00 2001 From: ericblackmonGoogle <129398736+ericblackmonGoogle@users.noreply.github.com> Date: Mon, 17 Jul 2023 20:51:30 +0000 Subject: [PATCH 26/58] release: v10.0.2 #7295 and #7297 (#7298) (#7299) * fix(generators): Changes to exports and access controls for TypeScript compatibility (#7295) * fix(generators): Add missing declarations for Order enums * chore(generators): Remove spurious whitespace * fix(generators): Make provideFunction_ etc. public Remove the protected declaration on provideFunction_ and FUNCTION_NAME_PLACEHOLDER_ so they can be used from generator functions written in TypeScript. Not strictly part of #7283, but closely related and required to fixing the related issue google/blockly-samples#1785. * chore(generators): format (cherry picked from commit d503fbb409e58d80a3a4db89ec603532505e8663) * fix: Correct errors in `HSV_SATURATION`, `HSV_VALUE` accessors (#7297) * fix: Correct errors in HSV_SATURATION, HSV_VALUE accessors Fix the comment / message errors noted in https://github.com/google/blockly/pull/7249#issuecomment-1638645810 * chore: Add renamings for HSV_SATURATION, HSV_VALUE (cherry picked from commit 1bc4f67d78cc88c15a4e55d7d102743db1e04a4c) * release: Update version number to 10.0.2 --------- Co-authored-by: Christopher Allen --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index d8c25f0c7f5..5d4019525bb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "blockly", - "version": "10.0.1", + "version": "10.0.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "blockly", - "version": "10.0.1", + "version": "10.0.2", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index a5c91d25f98..354553b55a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blockly", - "version": "10.0.1", + "version": "10.0.2", "description": "Blockly is a library for building visual programming editors.", "keywords": [ "blockly" From 06ba992206090b1eade12577ce01164f1af2b486 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Tue, 18 Jul 2023 19:36:20 +0200 Subject: [PATCH 27/58] feat: Allow dragging from simple toolbox (#7301) fix: Add delay after block connection. Otherwise it can randomly and silently fail. --- tests/browser/test/test_setup.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index c25073cf444..ff05d751cd0 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -155,14 +155,17 @@ async function getNthBlockOfCategory(browser, categoryName, n) { /** * @param browser The active WebdriverIO Browser object. * @param categoryName The name of the toolbox category to search. + * Null if the toolbox has no categories (simple). * @param blockType The type of the block to search for. * @return A Promise that resolves to the root element of the first * block with the given type in the given category. */ async function getBlockTypeFromCategory(browser, categoryName, blockType) { - const category = await getCategory(browser, categoryName); - category.click(); - await browser.pause(100); + if (categoryName) { + const category = await getCategory(browser, categoryName); + category.click(); + await browser.pause(100); + } const id = await browser.execute((blockType) => { return Blockly.getMainWorkspace() @@ -271,6 +274,7 @@ async function connect( y: targetLocation.y - draggedLocation.y, }; await draggedBlock.dragAndDrop(delta); + await browser.pause(200); } /** @@ -310,6 +314,7 @@ async function dragNthBlockFromFlyout(browser, categoryName, n, x, y) { * * @param browser The active WebdriverIO Browser object. * @param categoryName The name of the toolbox category to search. + * Null if the toolbox has no categories (simple). * @param type The type of the block to search for. * @param x The x-distance to drag, as a delta from the block's * initial location on screen. From 9efc0d7dd0cd975da25a633760abe0a0ad753415 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 20 Jul 2023 13:50:12 -0700 Subject: [PATCH 28/58] chore: fix renamings (#7312) --- scripts/migration/renamings.json5 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/migration/renamings.json5 b/scripts/migration/renamings.json5 index 97fbc3fc0fc..bdbb2a132f2 100644 --- a/scripts/migration/renamings.json5 +++ b/scripts/migration/renamings.json5 @@ -1454,7 +1454,7 @@ Warning: { newExport: 'WarningIcon', oldPath: 'Blockly.Warning', - newPath: 'Blocky.icons.WarningIcon', + newPath: 'Blockly.icons.WarningIcon', }, }, }, @@ -1464,7 +1464,7 @@ Comment: { newExport: 'CommentIcon', oldPath: 'Blockly.Comment', - newPath: 'Blocky.icons.CommentIcon', + newPath: 'Blockly.icons.CommentIcon', }, }, }, @@ -1475,7 +1475,7 @@ Mutator: { newExport: 'MutatorIcon', oldPath: 'Blockly.Mutator', - newPath: 'Blocky.icons.MutatorIcon', + newPath: 'Blockly.icons.MutatorIcon', }, }, }, From 786553efb1bbd09eed648b673a8129e92df2a229 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Mon, 24 Jul 2023 10:21:51 -0700 Subject: [PATCH 29/58] chore: update block test dependency (#7313) * chore: update block test dependency * chore: bump block test to 5.0.0 * chore: update dev-tools * chore: bump theme modern dependency --- package-lock.json | 590 ++++++++-------------------------------------- package.json | 6 +- 2 files changed, 96 insertions(+), 500 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5d4019525bb..b2afe7e716b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,9 +13,9 @@ "jsdom": "22.1.0" }, "devDependencies": { - "@blockly/block-test": "^3.0.0", - "@blockly/dev-tools": "^5.0.0", - "@blockly/theme-modern": "^3.0.0", + "@blockly/block-test": "^5.0.0", + "@blockly/dev-tools": "^7.0.2", + "@blockly/theme-modern": "^5.0.0", "@hyperjump/json-schema": "^1.5.0", "@microsoft/api-documenter": "^7.22.4", "@microsoft/api-extractor": "^7.29.5", @@ -175,28 +175,28 @@ } }, "node_modules/@blockly/block-test": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.1.2.tgz", - "integrity": "sha512-a/Y21p6KcZIeRCsfx+Caqw9HEYyfGA1gwwWYi+nJttRpJCO8W0IAG6cMqNRDn0vPCoWdIa8o9xhoMBdyPURU3Q==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-5.0.0.tgz", + "integrity": "sha512-TASw4N3FQpJekOJTAm8ubGXOqf1pzVRBM64uqE6g+PtOgGGKw9G7F+Fs+OccS96mjwPEg1e+Eh6rsLRdV5kMqA==", "dev": true, "engines": { "node": ">=8.17.0" }, "peerDependencies": { - "blockly": "^9.2.0" + "blockly": "^10.0.0" } }, "node_modules/@blockly/dev-tools": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/@blockly/dev-tools/-/dev-tools-5.3.1.tgz", - "integrity": "sha512-3xpxjJgv//z7uItocjEvJnkjHQCaCQHCuB0z5P6u9ysQcFaWmSRNcf5rCEjHSVUlQU22pAhhjytpM8mVzszh6w==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@blockly/dev-tools/-/dev-tools-7.0.2.tgz", + "integrity": "sha512-AwG+CnyAeRIZGkeG+WhclRnrwMjXRWhd9xAkoXdKBaY9LHyLU61WSOk0D8E7ta98e19Yo/fl4CwYMYEQ8F63kw==", "dev": true, "dependencies": { - "@blockly/block-test": "^3.1.2", - "@blockly/theme-dark": "^4.0.10", - "@blockly/theme-deuteranopia": "^3.0.10", - "@blockly/theme-highcontrast": "^3.0.10", - "@blockly/theme-tritanopia": "^3.0.11", + "@blockly/block-test": "^5.0.0", + "@blockly/theme-dark": "^6.0.0", + "@blockly/theme-deuteranopia": "^5.0.0", + "@blockly/theme-highcontrast": "^5.0.0", + "@blockly/theme-tritanopia": "^5.0.0", "chai": "^4.2.0", "dat.gui": "^0.7.7", "lodash.assign": "^4.2.0", @@ -208,67 +208,67 @@ "node": ">=8.0.0" }, "peerDependencies": { - "blockly": "^9.0.0" + "blockly": "^10.0.0" } }, - "node_modules/@blockly/theme-dark": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/@blockly/theme-dark/-/theme-dark-4.0.10.tgz", - "integrity": "sha512-deoNn1SsjEVAAXjOrQag/s5X49DsHSID4McwvPLl6lRh0C8C0G9zRSEF90n/mqlLu855Y4xnfzxJWxTdTKUikQ==", + "node_modules/@blockly/dev-tools/node_modules/@blockly/theme-dark": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-dark/-/theme-dark-6.0.0.tgz", + "integrity": "sha512-BipmTIYehNHI6lT2EgTmePyYWw6U6eLtoz74yxMWxpDM8QMTU511cmkHAIBSzEORw1Wh2vk87fRW5mtKpDrE1g==", "dev": true, "engines": { "node": ">=8.17.0" }, "peerDependencies": { - "blockly": "^9.0.0" + "blockly": "^10.0.0" } }, - "node_modules/@blockly/theme-deuteranopia": { - "version": "3.0.10", - "resolved": "https://registry.npmjs.org/@blockly/theme-deuteranopia/-/theme-deuteranopia-3.0.10.tgz", - "integrity": "sha512-m+RxF+DlP+BA5FPQYunPWoFXGlfspTqF97uGkkA0RK8P5UadXbWf4XQAscoMX96zjyfHME8GyQiwmdCcLHm9OQ==", + "node_modules/@blockly/dev-tools/node_modules/@blockly/theme-deuteranopia": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-deuteranopia/-/theme-deuteranopia-5.0.0.tgz", + "integrity": "sha512-+Y9UcMjdgkYiSElLDGW877r11kS/WSyxDDbpytblI5HuzOyn+oopXCrWWzlMGyaTV/rQTzUmQfNdH4vHHaMuZQ==", "dev": true, "engines": { "node": ">=8.17.0" }, "peerDependencies": { - "blockly": "^9.0.0" + "blockly": "^10.0.0" } }, - "node_modules/@blockly/theme-highcontrast": { - "version": "3.0.10", - "resolved": "https://registry.npmjs.org/@blockly/theme-highcontrast/-/theme-highcontrast-3.0.10.tgz", - "integrity": "sha512-4PSJgObr/F57YsE54Tg2y6+qVvJoRrwGysP0K7fZhGKB6XMVEmwbzG6pds3SE9y7AHtaQ3lQOauojciwOUHUTg==", + "node_modules/@blockly/dev-tools/node_modules/@blockly/theme-highcontrast": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-highcontrast/-/theme-highcontrast-5.0.0.tgz", + "integrity": "sha512-Bh8BSwdPic6NFOFsjNwEi0OduGR+FPjb4hcp5gD5JLIWXdL+/OboKVb8CgX4+NsJzlkbv+fOGfrXfrPIBiFeFg==", "dev": true, "engines": { "node": ">=8.17.0" }, "peerDependencies": { - "blockly": "^9.0.0" + "blockly": "^10.0.0" } }, - "node_modules/@blockly/theme-modern": { - "version": "3.0.10", - "resolved": "https://registry.npmjs.org/@blockly/theme-modern/-/theme-modern-3.0.10.tgz", - "integrity": "sha512-02px8PlvC3ZcVSZGLf7fYhni6xohoMg3P56ZSaP/Js4L+TDD4tzHDK9vE8BpYmmV0ZmwReKiN/fazrUwhYNSFA==", + "node_modules/@blockly/dev-tools/node_modules/@blockly/theme-tritanopia": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-tritanopia/-/theme-tritanopia-5.0.0.tgz", + "integrity": "sha512-U1vqarnMwMcStfqoKFna6nJnL/5DeyXhPFbj7gfbORJKQuOs49OETPmQlHb2/PjHbHq9VUlRnkW/MJ0K+6cVGw==", "dev": true, "engines": { "node": ">=8.17.0" }, "peerDependencies": { - "blockly": "^9.0.0" + "blockly": "^10.0.0" } }, - "node_modules/@blockly/theme-tritanopia": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/@blockly/theme-tritanopia/-/theme-tritanopia-3.0.11.tgz", - "integrity": "sha512-bGtOpYglDx50yxOAZiIcgnbtWQZaSSlfMTALjkw/1+sxa0kwq2Oxws02uQ4LMni/8o9jY/dvoEGLStXFby0FzA==", + "node_modules/@blockly/theme-modern": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-modern/-/theme-modern-5.0.0.tgz", + "integrity": "sha512-K5qg+PVkapG/h4NEVuTE85/n/BeR73ygeFipKLRf0S6A8PbffpLWbolutBWDzsArTeEQ4e/ItqKveuFpG8iZIg==", "dev": true, "engines": { "node": ">=8.17.0" }, "peerDependencies": { - "blockly": "^9.0.0" + "blockly": "^10.0.0" } }, "node_modules/@es-joy/jsdoccomment": { @@ -1878,17 +1878,6 @@ "node": ">=0.4.0" } }, - "node_modules/acorn-globals": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz", - "integrity": "sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==", - "dev": true, - "peer": true, - "dependencies": { - "acorn": "^8.1.0", - "acorn-walk": "^8.0.2" - } - }, "node_modules/acorn-jsx": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", @@ -2524,59 +2513,13 @@ } }, "node_modules/blockly": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/blockly/-/blockly-9.2.0.tgz", - "integrity": "sha512-rygZJupS5u4DMGGQ70gExH71c34vUEUjTVVBzhgVH7PCAK2RaitCNwr2yF6hGj/QTVodkjjEOdTzbHqLbuPipQ==", - "dev": true, - "peer": true, - "dependencies": { - "jsdom": "20.0.3" - } - }, - "node_modules/blockly/node_modules/jsdom": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz", - "integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==", + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/blockly/-/blockly-10.0.2.tgz", + "integrity": "sha512-d4o8x/cyJt6KkeStcQxbihvOVFADIrYQaHt85+TOTgUZKPHSTDPKqjKzrUQRJ3ouwYGF9KXC6y2V+oordnDLKA==", "dev": true, "peer": true, "dependencies": { - "abab": "^2.0.6", - "acorn": "^8.8.1", - "acorn-globals": "^7.0.0", - "cssom": "^0.5.0", - "cssstyle": "^2.3.0", - "data-urls": "^3.0.2", - "decimal.js": "^10.4.2", - "domexception": "^4.0.0", - "escodegen": "^2.0.0", - "form-data": "^4.0.0", - "html-encoding-sniffer": "^3.0.0", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.1", - "is-potential-custom-element-name": "^1.0.1", - "nwsapi": "^2.2.2", - "parse5": "^7.1.1", - "saxes": "^6.0.0", - "symbol-tree": "^3.2.4", - "tough-cookie": "^4.1.2", - "w3c-xmlserializer": "^4.0.0", - "webidl-conversions": "^7.0.0", - "whatwg-encoding": "^2.0.0", - "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^11.0.0", - "ws": "^8.11.0", - "xml-name-validator": "^4.0.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "canvas": "^2.5.0" - }, - "peerDependenciesMeta": { - "canvas": { - "optional": true - } + "jsdom": "22.1.0" } }, "node_modules/brace-expansion": { @@ -3468,33 +3411,6 @@ "node": ">=0.10.0" } }, - "node_modules/cssom": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", - "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==", - "dev": true, - "peer": true - }, - "node_modules/cssstyle": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", - "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", - "dev": true, - "peer": true, - "dependencies": { - "cssom": "~0.3.6" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cssstyle/node_modules/cssom": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", - "dev": true, - "peer": true - }, "node_modules/d": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", @@ -3511,21 +3427,6 @@ "integrity": "sha512-sRl/28gF/XRC5ywC9I4zriATTsQcpSsRG7seXCPnTkK8/EQMIbCu5NPMpICLGxX9ZEUvcXR3ArLYCtgreFoMDw==", "dev": true }, - "node_modules/data-urls": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", - "integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==", - "dev": true, - "peer": true, - "dependencies": { - "abab": "^2.0.6", - "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^11.0.0" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/date-fns": { "version": "2.30.0", "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", @@ -3997,105 +3898,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/escodegen": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz", - "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==", - "dev": true, - "peer": true, - "dependencies": { - "esprima": "^4.0.1", - "estraverse": "^5.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1" - }, - "bin": { - "escodegen": "bin/escodegen.js", - "esgenerate": "bin/esgenerate.js" - }, - "engines": { - "node": ">=6.0" - }, - "optionalDependencies": { - "source-map": "~0.6.1" - } - }, - "node_modules/escodegen/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "peer": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/escodegen/node_modules/levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", - "dev": true, - "peer": true, - "dependencies": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/escodegen/node_modules/optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dev": true, - "peer": true, - "dependencies": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/escodegen/node_modules/prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", - "dev": true, - "peer": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/escodegen/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/escodegen/node_modules/type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", - "dev": true, - "peer": true, - "dependencies": { - "prelude-ls": "~1.1.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/eslint": { "version": "8.43.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.43.0.tgz", @@ -11027,19 +10829,6 @@ "node": ">= 4.0.0" } }, - "node_modules/tr46": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", - "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", - "dev": true, - "peer": true, - "dependencies": { - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/tree-kill": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", @@ -11844,20 +11633,6 @@ "node": ">=12" } }, - "node_modules/whatwg-url": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", - "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", - "dev": true, - "peer": true, - "dependencies": { - "tr46": "^3.0.0", - "webidl-conversions": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -12263,63 +12038,65 @@ } }, "@blockly/block-test": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-3.1.2.tgz", - "integrity": "sha512-a/Y21p6KcZIeRCsfx+Caqw9HEYyfGA1gwwWYi+nJttRpJCO8W0IAG6cMqNRDn0vPCoWdIa8o9xhoMBdyPURU3Q==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@blockly/block-test/-/block-test-5.0.0.tgz", + "integrity": "sha512-TASw4N3FQpJekOJTAm8ubGXOqf1pzVRBM64uqE6g+PtOgGGKw9G7F+Fs+OccS96mjwPEg1e+Eh6rsLRdV5kMqA==", "dev": true, "requires": {} }, "@blockly/dev-tools": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/@blockly/dev-tools/-/dev-tools-5.3.1.tgz", - "integrity": "sha512-3xpxjJgv//z7uItocjEvJnkjHQCaCQHCuB0z5P6u9ysQcFaWmSRNcf5rCEjHSVUlQU22pAhhjytpM8mVzszh6w==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@blockly/dev-tools/-/dev-tools-7.0.2.tgz", + "integrity": "sha512-AwG+CnyAeRIZGkeG+WhclRnrwMjXRWhd9xAkoXdKBaY9LHyLU61WSOk0D8E7ta98e19Yo/fl4CwYMYEQ8F63kw==", "dev": true, "requires": { - "@blockly/block-test": "^3.1.2", - "@blockly/theme-dark": "^4.0.10", - "@blockly/theme-deuteranopia": "^3.0.10", - "@blockly/theme-highcontrast": "^3.0.10", - "@blockly/theme-tritanopia": "^3.0.11", + "@blockly/block-test": "^5.0.0", + "@blockly/theme-dark": "^6.0.0", + "@blockly/theme-deuteranopia": "^5.0.0", + "@blockly/theme-highcontrast": "^5.0.0", + "@blockly/theme-tritanopia": "^5.0.0", "chai": "^4.2.0", "dat.gui": "^0.7.7", "lodash.assign": "^4.2.0", "lodash.merge": "^4.6.2", "monaco-editor": "^0.20.0", "sinon": "^9.0.2" + }, + "dependencies": { + "@blockly/theme-dark": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-dark/-/theme-dark-6.0.0.tgz", + "integrity": "sha512-BipmTIYehNHI6lT2EgTmePyYWw6U6eLtoz74yxMWxpDM8QMTU511cmkHAIBSzEORw1Wh2vk87fRW5mtKpDrE1g==", + "dev": true, + "requires": {} + }, + "@blockly/theme-deuteranopia": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-deuteranopia/-/theme-deuteranopia-5.0.0.tgz", + "integrity": "sha512-+Y9UcMjdgkYiSElLDGW877r11kS/WSyxDDbpytblI5HuzOyn+oopXCrWWzlMGyaTV/rQTzUmQfNdH4vHHaMuZQ==", + "dev": true, + "requires": {} + }, + "@blockly/theme-highcontrast": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-highcontrast/-/theme-highcontrast-5.0.0.tgz", + "integrity": "sha512-Bh8BSwdPic6NFOFsjNwEi0OduGR+FPjb4hcp5gD5JLIWXdL+/OboKVb8CgX4+NsJzlkbv+fOGfrXfrPIBiFeFg==", + "dev": true, + "requires": {} + }, + "@blockly/theme-tritanopia": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-tritanopia/-/theme-tritanopia-5.0.0.tgz", + "integrity": "sha512-U1vqarnMwMcStfqoKFna6nJnL/5DeyXhPFbj7gfbORJKQuOs49OETPmQlHb2/PjHbHq9VUlRnkW/MJ0K+6cVGw==", + "dev": true, + "requires": {} + } } }, - "@blockly/theme-dark": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/@blockly/theme-dark/-/theme-dark-4.0.10.tgz", - "integrity": "sha512-deoNn1SsjEVAAXjOrQag/s5X49DsHSID4McwvPLl6lRh0C8C0G9zRSEF90n/mqlLu855Y4xnfzxJWxTdTKUikQ==", - "dev": true, - "requires": {} - }, - "@blockly/theme-deuteranopia": { - "version": "3.0.10", - "resolved": "https://registry.npmjs.org/@blockly/theme-deuteranopia/-/theme-deuteranopia-3.0.10.tgz", - "integrity": "sha512-m+RxF+DlP+BA5FPQYunPWoFXGlfspTqF97uGkkA0RK8P5UadXbWf4XQAscoMX96zjyfHME8GyQiwmdCcLHm9OQ==", - "dev": true, - "requires": {} - }, - "@blockly/theme-highcontrast": { - "version": "3.0.10", - "resolved": "https://registry.npmjs.org/@blockly/theme-highcontrast/-/theme-highcontrast-3.0.10.tgz", - "integrity": "sha512-4PSJgObr/F57YsE54Tg2y6+qVvJoRrwGysP0K7fZhGKB6XMVEmwbzG6pds3SE9y7AHtaQ3lQOauojciwOUHUTg==", - "dev": true, - "requires": {} - }, "@blockly/theme-modern": { - "version": "3.0.10", - "resolved": "https://registry.npmjs.org/@blockly/theme-modern/-/theme-modern-3.0.10.tgz", - "integrity": "sha512-02px8PlvC3ZcVSZGLf7fYhni6xohoMg3P56ZSaP/Js4L+TDD4tzHDK9vE8BpYmmV0ZmwReKiN/fazrUwhYNSFA==", - "dev": true, - "requires": {} - }, - "@blockly/theme-tritanopia": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/@blockly/theme-tritanopia/-/theme-tritanopia-3.0.11.tgz", - "integrity": "sha512-bGtOpYglDx50yxOAZiIcgnbtWQZaSSlfMTALjkw/1+sxa0kwq2Oxws02uQ4LMni/8o9jY/dvoEGLStXFby0FzA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@blockly/theme-modern/-/theme-modern-5.0.0.tgz", + "integrity": "sha512-K5qg+PVkapG/h4NEVuTE85/n/BeR73ygeFipKLRf0S6A8PbffpLWbolutBWDzsArTeEQ4e/ItqKveuFpG8iZIg==", "dev": true, "requires": {} }, @@ -13493,17 +13270,6 @@ "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", "dev": true }, - "acorn-globals": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz", - "integrity": "sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==", - "dev": true, - "peer": true, - "requires": { - "acorn": "^8.1.0", - "acorn-walk": "^8.0.2" - } - }, "acorn-jsx": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", @@ -13997,50 +13763,13 @@ } }, "blockly": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/blockly/-/blockly-9.2.0.tgz", - "integrity": "sha512-rygZJupS5u4DMGGQ70gExH71c34vUEUjTVVBzhgVH7PCAK2RaitCNwr2yF6hGj/QTVodkjjEOdTzbHqLbuPipQ==", + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/blockly/-/blockly-10.0.2.tgz", + "integrity": "sha512-d4o8x/cyJt6KkeStcQxbihvOVFADIrYQaHt85+TOTgUZKPHSTDPKqjKzrUQRJ3ouwYGF9KXC6y2V+oordnDLKA==", "dev": true, "peer": true, "requires": { - "jsdom": "20.0.3" - }, - "dependencies": { - "jsdom": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz", - "integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==", - "dev": true, - "peer": true, - "requires": { - "abab": "^2.0.6", - "acorn": "^8.8.1", - "acorn-globals": "^7.0.0", - "cssom": "^0.5.0", - "cssstyle": "^2.3.0", - "data-urls": "^3.0.2", - "decimal.js": "^10.4.2", - "domexception": "^4.0.0", - "escodegen": "^2.0.0", - "form-data": "^4.0.0", - "html-encoding-sniffer": "^3.0.0", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.1", - "is-potential-custom-element-name": "^1.0.1", - "nwsapi": "^2.2.2", - "parse5": "^7.1.1", - "saxes": "^6.0.0", - "symbol-tree": "^3.2.4", - "tough-cookie": "^4.1.2", - "w3c-xmlserializer": "^4.0.0", - "webidl-conversions": "^7.0.0", - "whatwg-encoding": "^2.0.0", - "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^11.0.0", - "ws": "^8.11.0", - "xml-name-validator": "^4.0.0" - } - } + "jsdom": "22.1.0" } }, "brace-expansion": { @@ -14742,32 +14471,6 @@ "integrity": "sha1-Xv1sLupeof1rasV+wEJ7GEUkJOo=", "dev": true }, - "cssom": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", - "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==", - "dev": true, - "peer": true - }, - "cssstyle": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", - "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", - "dev": true, - "peer": true, - "requires": { - "cssom": "~0.3.6" - }, - "dependencies": { - "cssom": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", - "dev": true, - "peer": true - } - } - }, "d": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", @@ -14784,18 +14487,6 @@ "integrity": "sha512-sRl/28gF/XRC5ywC9I4zriATTsQcpSsRG7seXCPnTkK8/EQMIbCu5NPMpICLGxX9ZEUvcXR3ArLYCtgreFoMDw==", "dev": true }, - "data-urls": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", - "integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==", - "dev": true, - "peer": true, - "requires": { - "abab": "^2.0.6", - "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^11.0.0" - } - }, "date-fns": { "version": "2.30.0", "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", @@ -15171,80 +14862,6 @@ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true }, - "escodegen": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz", - "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==", - "dev": true, - "peer": true, - "requires": { - "esprima": "^4.0.1", - "estraverse": "^5.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.6.1" - }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "peer": true - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", - "dev": true, - "peer": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dev": true, - "peer": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - } - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", - "dev": true, - "peer": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "optional": true, - "peer": true - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", - "dev": true, - "peer": true, - "requires": { - "prelude-ls": "~1.1.2" - } - } - } - }, "eslint": { "version": "8.43.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.43.0.tgz", @@ -20793,16 +20410,6 @@ } } }, - "tr46": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", - "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", - "dev": true, - "peer": true, - "requires": { - "punycode": "^2.1.1" - } - }, "tree-kill": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", @@ -21425,17 +21032,6 @@ "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==" }, - "whatwg-url": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", - "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", - "dev": true, - "peer": true, - "requires": { - "tr46": "^3.0.0", - "webidl-conversions": "^7.0.0" - } - }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index 354553b55a0..876b2a7552b 100644 --- a/package.json +++ b/package.json @@ -68,9 +68,9 @@ }, "license": "Apache-2.0", "devDependencies": { - "@blockly/block-test": "^3.0.0", - "@blockly/dev-tools": "^5.0.0", - "@blockly/theme-modern": "^3.0.0", + "@blockly/block-test": "^5.0.0", + "@blockly/dev-tools": "^7.0.2", + "@blockly/theme-modern": "^5.0.0", "@hyperjump/json-schema": "^1.5.0", "@microsoft/api-documenter": "^7.22.4", "@microsoft/api-extractor": "^7.29.5", From 36ba408b794928fe642ceecb76344a56323c7b59 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Mon, 24 Jul 2023 14:43:14 -0700 Subject: [PATCH 30/58] fix: have icons use the new render management system (#7296) * feat: add method for triggering renders * chore: switch icon methods to use queue --- core/block_svg.ts | 12 ++++++------ core/render_management.ts | 25 ++++++++++++++++++++++++- tests/mocha/block_test.js | 4 ++-- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/core/block_svg.ts b/core/block_svg.ts index 0b320c2e0b3..d87e042be64 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -59,7 +59,7 @@ import * as svgMath from './utils/svg_math.js'; import {WarningIcon} from './icons/warning_icon.js'; import type {Workspace} from './workspace.js'; import type {WorkspaceSvg} from './workspace_svg.js'; -import {queueRender} from './render_management.js'; +import * as renderManagement from './render_management.js'; import * as deprecation from './utils/deprecation.js'; import {IconType} from './icons/icon_types.js'; @@ -983,8 +983,8 @@ export class BlockSvg icon.initView(this.createIconPointerDownListener(icon)); icon.applyColour(); icon.updateEditable(); - // TODO: Change this based on #7068. - this.render(); + this.queueRender(); + renderManagement.triggerQueuedRenders(); this.bumpNeighbours(); } @@ -1012,8 +1012,8 @@ export class BlockSvg if (type.equals(MutatorIcon.TYPE)) this.mutator = null; if (this.rendered) { - // TODO: Change this based on #7068. - this.render(); + this.queueRender(); + renderManagement.triggerQueuedRenders(); this.bumpNeighbours(); } return removed; @@ -1542,7 +1542,7 @@ export class BlockSvg * @internal */ queueRender(): Promise { - return queueRender(this); + return renderManagement.queueRender(this); } /** diff --git a/core/render_management.ts b/core/render_management.ts index 8c469f856c7..9a9a4d0cf2f 100644 --- a/core/render_management.ts +++ b/core/render_management.ts @@ -21,6 +21,15 @@ let dirtyBlocks = new WeakSet(); */ let afterRendersPromise: Promise | null = null; +/** The function to call to resolve the `afterRendersPromise`. */ +let afterRendersResolver: (() => void) | null = null; + +/** + * The ID of the current animation frame request. Used to cancel the request + * if necessary. + */ +let animationRequestId = 0; + /** * Registers that the given block and all of its parents need to be rerendered, * and registers a callback to do so after a delay, to allowf or batching. @@ -35,7 +44,8 @@ export function queueRender(block: BlockSvg): Promise { queueBlock(block); if (!afterRendersPromise) { afterRendersPromise = new Promise((resolve) => { - window.requestAnimationFrame(() => { + afterRendersResolver = resolve; + animationRequestId = window.requestAnimationFrame(() => { doRenders(); resolve(); }); @@ -54,6 +64,19 @@ export function finishQueuedRenders(): Promise { return afterRendersPromise ? afterRendersPromise : Promise.resolve(); } +/** + * Triggers an immediate render of all queued renders. Should only be used in + * cases where queueing renders breaks functionality + backwards compatibility + * (such as rendering icons). + * + * @internal + */ +export function triggerQueuedRenders() { + window.cancelAnimationFrame(animationRequestId); + doRenders(); + if (afterRendersResolver) afterRendersResolver(); +} + /** * Adds the given block and its parents to the render queue. Adds the root block * to the list of root blocks. diff --git a/tests/mocha/block_test.js b/tests/mocha/block_test.js index 4da49a08cd5..fd640ddbb52 100644 --- a/tests/mocha/block_test.js +++ b/tests/mocha/block_test.js @@ -1468,7 +1468,7 @@ suite('Blocks', function () { this.block = this.workspace.newBlock('stack_block'); this.block.initSvg(); this.block.render(); - this.renderSpy = sinon.spy(this.block, 'render'); + this.renderSpy = sinon.spy(this.block, 'queueRender'); }); teardown(function () { @@ -1513,7 +1513,7 @@ suite('Blocks', function () { this.block = this.workspace.newBlock('stack_block'); this.block.initSvg(); this.block.render(); - this.renderSpy = sinon.spy(this.block, 'render'); + this.renderSpy = sinon.spy(this.block, 'queueRender'); }); teardown(function () { From c61da55566ff8ada000591dd72970caa8cd215b4 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Mon, 24 Jul 2023 15:10:00 -0700 Subject: [PATCH 31/58] fix(tests): fix broken browser tests (#7324) * fix(tests):broken browser tests * chore: format * chore(tests): flip assertion order --- tests/browser/test/.mocharc.js | 1 - tests/browser/test/basic_block_test.js | 13 ++----------- tests/browser/test/basic_playground_test.js | 2 +- tests/browser/test/test_setup.js | 10 +++++----- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/tests/browser/test/.mocharc.js b/tests/browser/test/.mocharc.js index 42378c7fa9d..27fa880fbf8 100644 --- a/tests/browser/test/.mocharc.js +++ b/tests/browser/test/.mocharc.js @@ -2,5 +2,4 @@ module.exports = { ui: 'tdd', - reporter: 'landing', }; diff --git a/tests/browser/test/basic_block_test.js b/tests/browser/test/basic_block_test.js index 4a2a3ea2080..47f9007b84c 100644 --- a/tests/browser/test/basic_block_test.js +++ b/tests/browser/test/basic_block_test.js @@ -14,10 +14,7 @@ const { testSetup, testFileLocations, getAllBlocks, - getSelectedBlockElement, - switchRTL, - dragBlockTypeFromFlyout, - screenDirection, + dragNthBlockFromFlyout, } = require('./test_setup'); const {Key} = require('webdriverio'); @@ -37,13 +34,7 @@ suite('Basic block tests', function (done) { test('Drag three blocks into the workspace', async function () { for (let i = 1; i <= 3; i++) { - await dragBlockTypeFromFlyout( - browser, - 'Basic', - 'test_basic_empty', - 250, - 50 * i - ); + await dragNthBlockFromFlyout(browser, 'Align', 0, 250, 50 * i); chai.assert.equal((await getAllBlocks(browser)).length, i); } }); diff --git a/tests/browser/test/basic_playground_test.js b/tests/browser/test/basic_playground_test.js index 2805be12cde..8f950799653 100644 --- a/tests/browser/test/basic_playground_test.js +++ b/tests/browser/test/basic_playground_test.js @@ -182,7 +182,7 @@ suite('Disabling', function () { 110, 110 ); - await connect(browser, child, 'PREVIOUS', parent, 'IF0'); + await connect(browser, child, 'PREVIOUS', parent, 'DO0'); await contextMenuSelect(browser, parent, 'Disable Block'); diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index ff05d751cd0..35cf841e363 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -230,7 +230,6 @@ async function getLocationOfBlockConnection(browser, id, connectionName) { block.getRelativeToSurfaceXY(), connection.getOffsetInBlock() ); - console.log(Blockly); return Blockly.utils.svgMath.wsToScreenCoordinates( Blockly.getMainWorkspace(), loc @@ -346,9 +345,11 @@ async function contextMenuSelect(browser, block, itemText) { // Clicking will always happen in the middle of the block's bounds // (including children) by default, which causes problems if it has holes // (e.g. statement inputs). - // Instead we want to click 20% from the right and 5% from the top. - const xOffset = -Math.round((await block.getSize('width')) * 0.3); - const yOffset = -Math.round((await block.getSize('height')) * 0.45); + // Instead we want to click 10px from the left and 10px from the top. + const blockWidth = await block.getSize('width'); + const blockHeight = await block.getSize('height'); + const xOffset = -Math.round(blockWidth * 0.5) + 10; + const yOffset = -Math.round(blockHeight * 0.5) + 10; await block.click({button: 2, x: xOffset, y: yOffset}); await browser.pause(100); @@ -369,7 +370,6 @@ async function contextMenuSelect(browser, block, itemText) { */ async function getAllBlocks(browser) { return browser.execute(() => { - // return Blockly.getMainWorkspace().getAllBlocks(false); return Blockly.getMainWorkspace() .getAllBlocks(false) .map((block) => ({ From 9fc57a3bfa6f8981d5738296664dae10897b61ab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Jul 2023 15:54:49 +0100 Subject: [PATCH 32/58] chore(deps): Bump word-wrap from 1.2.3 to 1.2.5 (#7323) Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.5. - [Release notes](https://github.com/jonschlinkert/word-wrap/releases) - [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.5) --- updated-dependencies: - dependency-name: word-wrap dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index b2afe7e716b..39d30de5b78 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11655,9 +11655,9 @@ "dev": true }, "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", "dev": true, "engines": { "node": ">=0.10.0" @@ -21048,9 +21048,9 @@ "dev": true }, "word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", "dev": true }, "workerpool": { 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 33/58] 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 a147b360d4c..7ac097990e6 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 3c2b101b8c0..e1c7c0a7aa0 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 6996d1721b6..4c103426129 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 fa9d77656d1..77090343e38 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 c6797921528..7232888d21f 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 58095c81df9..54d6355898c 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 0ce745d14e2..fca84a519b9 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 19705f4ae4a..d0a2814bddb 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 70fd4bb2ca2..fed8cbcb3c1 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 70f16bd6e69..7c7de425aae 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 9c9a52aa78f..7e0ec7b742d 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 1e6d34a7d35..b6f3ab7bab1 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 d87e042be64..ebcf2bb2595 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 ed74064bbc3..c14f3452b39 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 d5fdff0a113..20c41f63e83 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 31abf6c7b65..5c87249fa49 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 7eaee873eab..4bea9d863b7 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 7d3877b9aba..035d7c66119 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 ecbe5a20009..6f50d303b0e 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 5f86e235b3c..081f86097b6 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 7f48167911b..4810f2b1cc4 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 ec10d222d20..b5fcd354021 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 4eed1d2a4c2..548cafcb345 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 c7c9a3da691..5dd8f06b90f 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 25cf8713028..a0361d219f0 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 1cf8900b7c1..781608bb7ea 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 dc8cf15122f..5a0c159433c 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 ab0b104fc50..aedd72614a9 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 cd7534a6370..440022d5c09 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 046b40c13a7..2de954bdc03 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 f4b69b00aa9..76a7ad29817 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 4e6b6de125e..284d2fa7ae1 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 10fb8427883..456669c26c0 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 ff638266f09..242af9e73b7 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 285a5b9e8a2..9abf5bac3ec 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 737939a6568..627b388dfa9 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 501c36076e3..78f8de7a358 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 76e3c10688e..9eacee8be06 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 de32299a9e5..114a1b09d36 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 32c76b4909c..d275ee68341 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 a33ea88973d..8b324f9e1bc 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 0dc4ee62f5a..1612a180c51 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 62064f41adc..bbdd171c4ce 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 6bd317b3dc9..e7d7f7360fd 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 8b418735de8..e920c47fd6f 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 a5039a24f9d..243071b85e4 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 07453251071..dc82b7c8203 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 833420a5a6c..e857db5f0c3 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 4deb1d70abb..b236dcc5f41 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 f89485da668..56bbb189bb3 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 71b12dbe2ff..567197b659c 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 1792c411ac5..98f9ed1ba92 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 83f541f9aa3..0e17f0a3e7d 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 e12dcf592f7..bdb3d19fc1b 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 c80b4e2efe0..4d2d3101942 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 31e35e18c9f..3a0a7961b95 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 0636a39fe96..3ca6065b05c 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 550b6ebdafd..ab947320c18 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 1b133f7ef2b..b3da9f1372d 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 866d31bf77e..ba547800822 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 1f06bfc44b3..918b885da0b 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 bd8533c2dcb..44dea25fa1c 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 5ff12c595ff..d5ea7ee8047 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 251ebd81af3..3f94657624f 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 b8f04f2d4a7..752ef3e787d 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 59c1615732f..ee6f669157e 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 06426a4c2e9..9d3d987446f 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 d493aa598ea..3a37e06963b 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 631d7e31e3e..cb812b428e9 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 511f275539d..f7f219988f9 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 11930272319..2f3c70981ca 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 3dc1052b06c..48f8a0c6e53 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 6c9bfed41ba..8c1fa54b6a5 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 25fe446e6d7..e523c91a4c4 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 e9bf40d5f2a..a5f8f3662bd 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 192b46797ad..ad27ca1dcf5 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 baccbbbd549..52bdf3cbbe2 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 2d24cfb33a1..d0c4a5d585e 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 28d6d1f762e..f70856367f3 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 2c882027f37..f720b67f071 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 491ca5df40e..b43fb148e9a 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 4533c6f3942..45a7aa8c4b4 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 55d0ef83072..26b48e7c88a 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 bdc5129c439..095f52509af 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 8817450ce3e..f0798a39e40 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 5585a32a375..ed6be0a004b 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 f28e5effdf7..9ae2c67b002 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 be9891e4cd4..cc8668a294b 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 3521b9df00b..afb4b375b5f 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 557f0d9399b..31d3773b663 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 ee066345918..cf97de2343c 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 ef88ac58e97..e8049b471f4 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 016d76b90e3..660cc0611f4 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 7264895df5f..9d98deb3e0c 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 540f9ad690f..719245a8e24 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 cab4dc93fc2..3bd7e19bf21 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 a06e0ca4a06..36151863f9c 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 e24e2ced3e3..d37a6ea1359 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 453608c95e5..d9ceedf8175 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 71433f94f2f..b2042bfb2f5 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 ce01b1a7ba6..932bec62270 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 96566a4c0aa..71bd879f91e 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 cc83733d46c..9606a67b613 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 c811c7e335c..51cbee170fc 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 b5a214515eb..f3239122ce1 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 f2df7f94e56..6687f61cf4e 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 a24d257d1f9..c7c0fbf7aed 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 8f8b45c0724..8413de61586 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 03060f9f389..99a0e83a243 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 ae221468a3b..d7eb5d2581f 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 03e4db229dc..db03a9dcf7f 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 68bd536850b..a2022700045 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 9a9a4d0cf2f..8adc83c202c 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 a3cd51a9638..f6a60627995 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 8d93e71d3a0..09eef3be02f 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 1ef32a54a32..27317cb54f7 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 8e334cca47f..a2a46f287c1 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 6b5511ad2fe..6818c608c30 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 13db9ea0b57..6736ab7dc5d 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 eb054141f33..a30ba5e6328 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 d29b616392b..2dcd5c55634 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 d96933de7cf..5439db54754 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 e904c55279f..2f511302983 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 c9aee9a2e41..af468fae213 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 6dc5e6675ec..eb22bce09cd 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 71a8dde16c3..7cdc3d87cde 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 ddee103b7bb..2a85e739e3e 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 7884046633b..a544f2a73f2 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 9cfe3503585..06b465833b5 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 6efb16b513d..06ef5730ab7 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 bcd5d245ffc..53e93435e76 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 f68ad2c7c2c..2da84f76efb 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 69747d313a8..50dd1611b06 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 d7f769d9fc4..f61d785315e 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 b8a237d704e..cd9aac8add6 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 2b40d645c0a..aa72ccd1f67 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 1e9ab107689..56bf0610852 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 350762fd6e3..6b3bd222cfc 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 93168a96e30..20821f72c10 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 7c6bbb4e8c0..7ba4275a03f 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 8e015645554..4547778e6ec 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 a2d615e0612..de0842257cd 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 a6a4cfe8fa8..d806fb0b669 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 f386babe6ce..e4e40258477 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 68f7ca2c148..170b95f4d63 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 1f2114dcc46..08396bee2b7 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 68aa433c1d7..2a7984a72ea 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 39e7bea8bc8..5b8ede4e7d6 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 23de10dbab3..194792ff668 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 da454362f50..472785898b8 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 cb17fe606e9..34d381171a1 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 c07c9c0a7c8..3ee12210dd1 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 40c7204dd5e..1cce4e0b624 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 cb6263feaa0..e4d157495cf 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 e5203903111..76bd00e7430 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 63448093fe3..6ac6f24fa3d 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 6d23d1a696a..47374a5b3b4 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 fe4b7cf5584..0d7d3439b31 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 5308268a14b..3e77cbb6a63 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 dcea49787cc..f1915ba7bf0 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 f17273a7a32..8ca41d5153b 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 2fa42891185..fd5a729c1b2 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 0794151d861..58046f4667b 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 e71194fa7ec..c1c96751811 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 97f195858a6..c30bc403f18 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 4044a89ca2c..920524a9384 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 6c800d68e63..25e14ead6f5 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 22f49018949..0ebe7e99af9 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 da7628e18ca..851a170d244 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 2fc6330c80c..8d053004c80 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 9f41a14df14..ee6695db44b 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 32d8bc69217..b7a75b4cc7a 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 0b71b7b0450..9b941face30 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 343e0e27e29..c05da1feca9 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 9adeadf1f44..d029824a2f3 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 21a1b796871..b2ad3dea9bb 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 1eef15db555..2c7b24d3556 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 891ba2151d5..38685746da9 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 569731591cb..b2d71e3b6fe 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 75a4d70c862..22a77634f4d 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 b8db8a54e11..66968baab6b 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 1fe58772f6a..a317e02ec4f 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 1a871bc3f01..4d8df8f9403 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 a143487b87a..0e49ed32680 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 a92dd7fbec5..3eb8b8e94a3 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 f184ce6a801..257ff08b140 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 d045ab4dbd3..f89dac0b0f3 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 ad900d23b19..94864810b1b 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 b8f7547ecab..ab57fd5eff7 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 443249c8f1f..0b7b7bb4a42 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 0367e550a32..1dc2d186277 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 524eef44d79..66d179dff17 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 39d30de5b78..08466c9406c 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 876b2a7552b..d0788e79ce2 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 e78a7e348ef..ac0d56e8e01 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 cc05e037a86..dace6e3a1f6 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 18df496d1ec..86ebcb4adaf 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 def7ef0ef5f..84069f5df15 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 47f9007b84c..31fea8fd958 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 8f950799653..e3a746f2186 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 1acfbd6f9be..2f057d26f76 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 015877400d6..ed218a6321d 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 5a88b7b8f65..a507d860ea8 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 0a675a836a5..8438fba21de 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 35cf841e363..cfc051371cf 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 5ea838b3a7b..b0f0e6f7fbf 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 5295a7abc90..a9111926190 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 4f678b5b1b1..538995f0b51 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 fd640ddbb52..3d038e608ec 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 c2060a25af6..e4875225ac0 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 5dd684109c2..9a1e3be4849 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 6eb686cb369..5163e715d3e 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 ce3a55ace85..75afa9d56a8 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 4adba246fec..c7398bbe0e0 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 1aa05d92b1e..fa3190d956f 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 8b14aa995a1..908adf8fb70 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 b2d13987124..7f3219fa2c9 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 ce7833bd137..0646458b8b6 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 566b3374875..4e18a6801b5 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 56ad69d210e..c435a1e5ec0 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 345be60df32..a2e08e4d129 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 98a8b8b40d2..39823852741 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 7a28979e388..1469df4bbff 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 7fc9581f355..6990eda19ba 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 c5d4acade36..910030b9d49 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 d6a998b43fe..47ee96edf07 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 2d0523bac19..fd9827ac6c2 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 a25e881533d..31ebd2e9410 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 bc5db9d91e3..ae9c016b698 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 53f6ce41175..d192053f00c 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 5b86061364b..df8fa544a07 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 12b0ba6d849..83a64a56619 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 4d47306f5cd..1fd7addb12a 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 f729bbdb150..1e3fa2c884b 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 942a028d4aa..32b0857811d 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 2418bdb64ad..c85dbd3d1d0 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 c18977aaeaf..433d5d4ae5f 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 9d962eec25d..2619a8db05c 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 73a142b39c8..8f9d63d88c3 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 9a0ed216391..275d6854bfc 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 ba30f5cfdfa..f918b935cf3 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 067a91c3cf7..6ab13084289 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 6394a7f9123..5e971cd0cdf 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 11bbd424432..97aba7d9595 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 d9083fdfe62..26820230ee4 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 12c2cae8487..6911d867924 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 3a1d4208e7e..61c6d72c720 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 08aaeef45a1..a378334a22d 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 8daaad82812..de2a8189f37 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 f77f9ca1330..3b03a51351a 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 e6cefcaedb2..c8e73e29d89 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 2250429d0f6..27d95078931 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 621b9c5705e..011c44dbce5 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 0e6686b296e..18b512b5d36 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 a60c0cd8648..7d14158749c 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 e4dabc33870..01885427bbb 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 452295e9ac6..4c3d204928d 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 e05169b071a..a38e0851789 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 65df415426c..0d7abe6bd36 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 96575c86c7e..1eeb8cac8d3 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 f59c735df27..b63452faee4 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 34b5fead7b4..cadcc13742e 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 36583611ff6..b8b28b170b7 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 214118a5991..d8a139eedc3 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 4809330b3dd..e33f3c39df2 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 de3c19d8a1b..7c551435f10 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 e10caa576b7..9a1c6169819 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 79da40189ee..093e4e132f4 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 66ba9fac961..ca7d3fca6d6 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 9f9f545fed9..10cf210ba66 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 beddfd6eb73..5c1cd7dcdb2 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 90f87cc0faa..46ce328306e 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 23e502eca9f..468a29bda3e 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 7c04963a50d..73f220eeb1e 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 4dd05f9e1b9..766992ab8b2 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 e05a3b22923..dc2dfaa09ca 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 daf89fc2aca..1a163831beb 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 e21005da10c..bce02ee34f8 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 5a4617ddd7b..b63c6f99fbb 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 4289e3ab10a..1f76e4cdfc2 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 dc6aa5eaf2a..d3b59acc703 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 3eae21c2dd2..4b45d8a5ffd 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 d29b5699fb9..3faee3793df 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 3f7ba6fc5dc..af5df8790f7 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 71cea2c1623..21e9af8fe16 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 14765da57ec..d328c388c41 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 ecf2292c473..354696ea6e3 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 2bd52c616ad..e8a3360525a 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 56a6a482248..9fe07690486 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 948d6cd0c6e..8fecbcf692c 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 a8a48f1da73..6ba532cd0c9 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 6cc4fb219f9..521d1d1a7cf 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 402a0a415de..6768694f1e5 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 2c9260d8d8a..d43ebb53ecc 100644 --- a/tests/playgrounds/shared_procedures.html +++ b/tests/playgrounds/shared_procedures.html @@ -1,4 +1,4 @@ - + From b5911c25dedc255ed7173f18860d057180ee0639 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Tue, 25 Jul 2023 09:41:05 -0700 Subject: [PATCH 34/58] chore(tests): use a shared chrome instance for all browser tests (#7328) * chore(tests): use a shared chrome instance for all browser tests * chore: format * chore: lint --- tests/browser/test/.mocharc.js | 1 + .../browser/test/basic_block_factory_test.js | 15 ++-- tests/browser/test/basic_block_test.js | 13 +-- tests/browser/test/basic_playground_test.js | 87 ++++++++----------- tests/browser/test/block_undo_test.js | 16 ++-- tests/browser/test/extensive_test.js | 26 +++--- tests/browser/test/field_edits_test.js | 20 ++--- tests/browser/test/hooks.js | 25 ++++++ tests/browser/test/procedure_test.js | 51 ++++++----- tests/browser/test/test_setup.js | 41 +++++++-- 10 files changed, 156 insertions(+), 139 deletions(-) create mode 100644 tests/browser/test/hooks.js diff --git a/tests/browser/test/.mocharc.js b/tests/browser/test/.mocharc.js index 27fa880fbf8..58d3bf55eb4 100644 --- a/tests/browser/test/.mocharc.js +++ b/tests/browser/test/.mocharc.js @@ -2,4 +2,5 @@ module.exports = { ui: 'tdd', + require: 'tests/browser/test/hooks.js', }; diff --git a/tests/browser/test/basic_block_factory_test.js b/tests/browser/test/basic_block_factory_test.js index 84069f5df15..026f2565950 100644 --- a/tests/browser/test/basic_block_factory_test.js +++ b/tests/browser/test/basic_block_factory_test.js @@ -11,21 +11,20 @@ const chai = require('chai'); const {testSetup, testFileLocations} = require('./test_setup'); -let browser; suite('Testing Connecting Blocks', function (done) { // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test this.timeout(0); // Setup Selenium for all of the tests suiteSetup(async function () { - browser = await testSetup(testFileLocations.BLOCK_FACTORY); + this.browser = await testSetup(testFileLocations.BLOCK_FACTORY); }); test('Testing Block Drag', async function () { - const startingBlock = await browser.$( + const startingBlock = await this.browser.$( '#blockly > div > svg.blocklySvg > g > g.blocklyBlockCanvas > g:nth-child(2)', ); - const blocklyCanvas = await browser.$( + const blocklyCanvas = await this.browser.$( '#blockly > div > svg.blocklySvg > g > g.blocklyBlockCanvas', ); const firstPostion = await blocklyCanvas.getAttribute('transform'); @@ -34,8 +33,12 @@ suite('Testing Connecting Blocks', function (done) { chai.assert.notEqual(firstPostion, secondPosition); }); - // Teardown entire suite after test are done running suiteTeardown(async function () { - await browser.deleteSession(); + await this.browser.execute(() => { + // If you leave blocks on the workspace, the block factory pops up an alert asking + // if you really want to lose your work when you try to load a new page. + // Clearing blocks resolves this and is easier than waiting for the alert. + Blockly.getMainWorkspace().clear(); + }); }); }); diff --git a/tests/browser/test/basic_block_test.js b/tests/browser/test/basic_block_test.js index 31fea8fd958..7d594c50ede 100644 --- a/tests/browser/test/basic_block_test.js +++ b/tests/browser/test/basic_block_test.js @@ -18,8 +18,6 @@ const { } = require('./test_setup'); const {Key} = require('webdriverio'); -let browser; - suite('Basic block tests', function (done) { // Setting timeout to unlimited as the webdriver takes a longer time // to run than most mocha test @@ -27,20 +25,15 @@ suite('Basic block tests', function (done) { // Setup Selenium for all of the tests suiteSetup(async function () { - browser = await testSetup( + this.browser = await testSetup( testFileLocations.PLAYGROUND + '?toolbox=test-blocks', ); }); test('Drag three blocks into the workspace', async function () { for (let i = 1; i <= 3; i++) { - await dragNthBlockFromFlyout(browser, 'Align', 0, 250, 50 * i); - chai.assert.equal((await getAllBlocks(browser)).length, i); + await dragNthBlockFromFlyout(this.browser, 'Align', 0, 250, 50 * i); + chai.assert.equal((await getAllBlocks(this.browser)).length, i); } }); - - // Teardown entire suite after test are done running - suiteTeardown(async function () { - await browser.deleteSession(); - }); }); diff --git a/tests/browser/test/basic_playground_test.js b/tests/browser/test/basic_playground_test.js index e3a746f2186..8bed7dd6c99 100644 --- a/tests/browser/test/basic_playground_test.js +++ b/tests/browser/test/basic_playground_test.js @@ -37,25 +37,24 @@ async function getCommentText(browser, blockId) { }, blockId); } -let browser; suite('Testing Connecting Blocks', function () { // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test this.timeout(0); // Setup Selenium for all of the tests suiteSetup(async function () { - browser = await testSetup(testFileLocations.PLAYGROUND); + this.browser = await testSetup(testFileLocations.PLAYGROUND); }); test('Testing Block Flyout', async function () { - const logicButton = await browser.$('#blockly-0'); + const logicButton = await this.browser.$('#blockly-0'); logicButton.click(); - const ifDoBlock = await browser.$( + const ifDoBlock = await this.browser.$( '#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 - const blockOnWorkspace = await browser.execute(() => { + await new Promise((resolve) => setTimeout(resolve, 200)); + const blockOnWorkspace = await this.browser.execute(() => { const newBlock = Blockly.getMainWorkspace().getAllBlocks(false)[0]; if (newBlock.id) { return true; @@ -66,11 +65,6 @@ suite('Testing Connecting Blocks', function () { chai.assert.isTrue(blockOnWorkspace); }); - - // Teardown entire suite after test are done running - suiteTeardown(async function () { - await browser.deleteSession(); - }); }); /** @@ -83,45 +77,40 @@ suite('Right Clicking on Blocks', function () { // Setup Selenium for all of the tests suiteSetup(async function () { - browser = await testSetup(testFileLocations.PLAYGROUND); - this.block = await dragNthBlockFromFlyout(browser, 'Loops', 0, 20, 20); + this.browser = await testSetup(testFileLocations.PLAYGROUND); + this.block = await dragNthBlockFromFlyout(this.browser, 'Loops', 0, 20, 20); this.blockId = this.block.id; }); test('clicking the collapse option collapses the block', async function () { - await contextMenuSelect(browser, this.block, 'Collapse Block'); - chai.assert.isTrue(await getIsCollapsed(browser, this.blockId)); + await contextMenuSelect(this.browser, this.block, 'Collapse Block'); + chai.assert.isTrue(await getIsCollapsed(this.browser, this.blockId)); }); // Assumes that test('clicking the expand option expands the block', async function () { - await contextMenuSelect(browser, this.block, 'Expand Block'); - chai.assert.isFalse(await getIsCollapsed(browser, this.blockId)); + await contextMenuSelect(this.browser, this.block, 'Expand Block'); + chai.assert.isFalse(await getIsCollapsed(this.browser, this.blockId)); }); test('clicking the disable option disables the block', async function () { - await contextMenuSelect(browser, this.block, 'Disable Block'); - chai.assert.isTrue(await getIsDisabled(browser, this.blockId)); + await contextMenuSelect(this.browser, this.block, 'Disable Block'); + chai.assert.isTrue(await getIsDisabled(this.browser, this.blockId)); }); test('clicking the enable option enables the block', async function () { - await contextMenuSelect(browser, this.block, 'Enable Block'); - chai.assert.isFalse(await getIsDisabled(browser, this.block.id)); + await contextMenuSelect(this.browser, this.block, 'Enable Block'); + chai.assert.isFalse(await getIsDisabled(this.browser, this.block.id)); }); test('clicking the add comment option adds a comment to the block', async function () { - await contextMenuSelect(browser, this.block, 'Add Comment'); - chai.assert.equal(await getCommentText(browser, this.block.id), ''); + await contextMenuSelect(this.browser, this.block, 'Add Comment'); + chai.assert.equal(await getCommentText(this.browser, this.block.id), ''); }); test('clicking the remove comment option removes a comment from the block', async function () { - await contextMenuSelect(browser, this.block, 'Remove Comment'); - chai.assert.isNull(await getCommentText(browser, this.block.id)); - }); - - // Teardown entire suite after test are done running - suiteTeardown(async function () { - await browser.deleteSession(); + await contextMenuSelect(this.browser, this.block, 'Remove Comment'); + chai.assert.isNull(await getCommentText(this.browser, this.block.id)); }); }); @@ -131,11 +120,11 @@ suite('Disabling', function () { this.timeout(0); suiteSetup(async function () { - browser = await testSetup(testFileLocations.PLAYGROUND); + this.browser = await testSetup(testFileLocations.PLAYGROUND); }); setup(async function () { - await browser.refresh(); + await this.browser.refresh(); }); test( @@ -143,24 +132,24 @@ suite('Disabling', function () { 'parent is diabled', async function () { const parent = await dragBlockTypeFromFlyout( - browser, + this.browser, 'Logic', 'controls_if', 10, 10, ); const child = await dragBlockTypeFromFlyout( - browser, + this.browser, 'Logic', 'logic_boolean', 110, 110, ); - await connect(browser, child, 'OUTPUT', parent, 'IF0'); + await connect(this.browser, child, 'OUTPUT', parent, 'IF0'); - await contextMenuSelect(browser, parent, 'Disable Block'); + await contextMenuSelect(this.browser, parent, 'Disable Block'); - chai.assert.isTrue(await getIsDisabled(browser, child.id)); + chai.assert.isTrue(await getIsDisabled(this.browser, child.id)); }, ); @@ -169,24 +158,24 @@ suite('Disabling', function () { 'parent is disabled', async function () { const parent = await dragBlockTypeFromFlyout( - browser, + this.browser, 'Logic', 'controls_if', 10, 10, ); const child = await dragBlockTypeFromFlyout( - browser, + this.browser, 'Logic', 'controls_if', 110, 110, ); - await connect(browser, child, 'PREVIOUS', parent, 'DO0'); + await connect(this.browser, child, 'PREVIOUS', parent, 'DO0'); - await contextMenuSelect(browser, parent, 'Disable Block'); + await contextMenuSelect(this.browser, parent, 'Disable Block'); - chai.assert.isTrue(await getIsDisabled(browser, child.id)); + chai.assert.isTrue(await getIsDisabled(this.browser, child.id)); }, ); @@ -195,28 +184,24 @@ suite('Disabling', function () { 'parent is disabled', async function () { const parent = await dragBlockTypeFromFlyout( - browser, + this.browser, 'Logic', 'controls_if', 10, 10, ); const child = await dragBlockTypeFromFlyout( - browser, + this.browser, 'Logic', 'controls_if', 110, 110, ); - await connect(browser, child, 'PREVIOUS', parent, 'NEXT'); + await connect(this.browser, child, 'PREVIOUS', parent, 'NEXT'); - await contextMenuSelect(browser, parent, 'Disable Block'); + await contextMenuSelect(this.browser, parent, 'Disable Block'); - chai.assert.isFalse(await getIsDisabled(browser, child.id)); + chai.assert.isFalse(await getIsDisabled(this.browser, child.id)); }, ); - - suiteTeardown(async function () { - await browser.deleteSession(); - }); }); diff --git a/tests/browser/test/block_undo_test.js b/tests/browser/test/block_undo_test.js index 2f057d26f76..94f5a6f71ca 100644 --- a/tests/browser/test/block_undo_test.js +++ b/tests/browser/test/block_undo_test.js @@ -18,32 +18,26 @@ const { screenDirection, } = require('./test_setup'); -let browser; suite('Testing undo block movement', function (done) { // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test this.timeout(0); // Setup Selenium for all of the tests suiteSetup(async function () { - browser = await testSetup(testFileLocations.PLAYGROUND); + this.browser = await testSetup(testFileLocations.PLAYGROUND); }); test('Undoing Block Movement LTR', async function () { - await testUndoBlock(screenDirection.LTR); + await testUndoBlock(this.browser, screenDirection.LTR); }); test('Undoing Block Movement RTL', async function () { - await switchRTL(browser); - await testUndoBlock(screenDirection.RTL); - }); - - // Teardown entire suite after test are done running - suiteTeardown(async function () { - await browser.deleteSession(); + await switchRTL(this.browser); + await testUndoBlock(this.browser, screenDirection.RTL); }); }); -async function testUndoBlock(delta) { +async function testUndoBlock(browser, delta) { // Drag out first function const defReturnBlock = await dragBlockTypeFromFlyout( browser, diff --git a/tests/browser/test/extensive_test.js b/tests/browser/test/extensive_test.js index ed218a6321d..2dfb5dc8875 100644 --- a/tests/browser/test/extensive_test.js +++ b/tests/browser/test/extensive_test.js @@ -16,51 +16,45 @@ const { } = require('./test_setup'); const {Key} = require('webdriverio'); -let browser; suite('This tests loading Large Configuration and Deletion', function (done) { // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test this.timeout(0); // Setup Selenium for all of the tests suiteSetup(async function () { - browser = await testSetup(testFileLocations.PLAYGROUND); + this.browser = await testSetup(testFileLocations.PLAYGROUND); }); test('This test loading from JSON results in the correct number of blocks', async function () { - const blockNum = await testingJSONLoad(); + const blockNum = await testingJSONLoad(this.browser); chai.assert.equal(blockNum, 13); }); test('This test deleting block results in the correct number of blocks', async function () { const fourthRepeatDo = await getBlockElementById( - browser, + this.browser, 'E8bF[-r:B~cabGLP#QYd', ); await fourthRepeatDo.click({x: -100, y: -40}); - await browser.keys([Key.Delete]); - await browser.pause(100); - const blockNum = await browser.execute(() => { + await this.browser.keys([Key.Delete]); + await this.browser.pause(100); + const blockNum = await this.browser.execute(() => { return Blockly.getMainWorkspace().getAllBlocks(false).length; }); chai.assert.equal(blockNum, 10); }); test('This test undoing delete block results in the correct number of blocks', async function () { - await browser.keys([Key.Ctrl, 'z']); - await browser.pause(100); - const blockNum = await browser.execute(() => { + await this.browser.keys([Key.Ctrl, 'z']); + await this.browser.pause(100); + const blockNum = await this.browser.execute(() => { return Blockly.getMainWorkspace().getAllBlocks(false).length; }); chai.assert.equal(blockNum, 13); }); - - // Teardown entire suite after test are done running - suiteTeardown(async function () { - await browser.deleteSession(); - }); }); -async function testingJSONLoad() { +async function testingJSONLoad(browser) { return await browser.execute(() => { const myWorkspace = Blockly.getMainWorkspace(); const state = { diff --git a/tests/browser/test/field_edits_test.js b/tests/browser/test/field_edits_test.js index a507d860ea8..52e6ca60dcb 100644 --- a/tests/browser/test/field_edits_test.js +++ b/tests/browser/test/field_edits_test.js @@ -19,32 +19,26 @@ const { } = require('./test_setup'); const {Key} = require('webdriverio'); -let browser; suite('Testing Field Edits', function (done) { // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test this.timeout(0); // Setup Selenium for all of the tests suiteSetup(async function () { - browser = await testSetup(testFileLocations.PLAYGROUND); + this.browser = await testSetup(testFileLocations.PLAYGROUND); }); test('Testing Field Edits LTR', async function () { - await testFieldEdits(screenDirection.LTR); + await testFieldEdits(this.browser, screenDirection.LTR); }); test('Testing Field Edits RTL', async function () { - switchRTL(browser); - await testFieldEdits(screenDirection.RTL); - }); - - // Teardown entire suite after test are done running - suiteTeardown(async function () { - await browser.deleteSession(); + switchRTL(this.browser); + await testFieldEdits(this.browser, screenDirection.RTL); }); }); -async function testFieldEdits(delta) { +async function testFieldEdits(browser, delta) { const mathNumber = await dragBlockTypeFromFlyout( browser, 'Math', @@ -52,7 +46,7 @@ async function testFieldEdits(delta) { 50 * delta, 20, ); - await browser.pause(2000); + await browser.pause(200); // Click on the field to change the value const numeric = await getSelectedBlockElement(browser); @@ -63,7 +57,7 @@ async function testFieldEdits(delta) { // Click on the workspace const workspace = await browser.$('#blocklyDiv > div > svg.blocklySvg > g'); await workspace.click(); - await browser.pause(2000); + await browser.pause(200); // Get value of the number const numericText = await browser .$( diff --git a/tests/browser/test/hooks.js b/tests/browser/test/hooks.js new file mode 100644 index 00000000000..a7f08ed564e --- /dev/null +++ b/tests/browser/test/hooks.js @@ -0,0 +1,25 @@ +/** + * @license + * Copyright 2023 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Hooks to run before the first test and after the last test. + * These create a shared chromedriver instance, so we don't have to fire up + * a new one for every suite. + */ +const {driverSetup, driverTeardown} = require('./test_setup'); + +const mochaHooks = { + async beforeAll() { + // Set a long timeout for startup. + this.timeout(10000); + return await driverSetup(); + }, + async afterAll() { + return await driverTeardown(); + }, +}; + +module.exports = {mochaHooks}; diff --git a/tests/browser/test/procedure_test.js b/tests/browser/test/procedure_test.js index 8438fba21de..2e9fac69cb0 100644 --- a/tests/browser/test/procedure_test.js +++ b/tests/browser/test/procedure_test.js @@ -18,91 +18,90 @@ const { connect, } = require('./test_setup'); -let browser; - suite('Testing Connecting Blocks', function (done) { // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test this.timeout(0); // Setup Selenium for all of the tests suiteSetup(async function () { - browser = await testSetup(testFileLocations.CODE_DEMO); + this.browser = await testSetup(testFileLocations.CODE_DEMO); }); test('Testing Procedure', async function () { // Drag out first function let proceduresDefReturn = await getBlockTypeFromCategory( - browser, + this.browser, 'Functions', 'procedures_defreturn', ); await proceduresDefReturn.dragAndDrop({x: 50, y: 20}); - const doSomething = await getSelectedBlockElement(browser); + const doSomething = await getSelectedBlockElement(this.browser); // Drag out second function. proceduresDefReturn = await getBlockTypeFromCategory( - browser, + this.browser, 'Functions', 'procedures_defreturn', ); await proceduresDefReturn.dragAndDrop({x: 300, y: 200}); - const doSomething2 = await getSelectedBlockElement(browser); + const doSomething2 = await getSelectedBlockElement(this.browser); // Drag out numeric const mathNumeric = await getBlockTypeFromCategory( - browser, + this.browser, 'Math', 'math_number', ); await mathNumeric.dragAndDrop({x: 50, y: 20}); - const numeric = await getSelectedBlockElement(browser); + const numeric = await getSelectedBlockElement(this.browser); // Connect numeric to first procedure - await connect(browser, numeric, 'OUTPUT', doSomething, 'RETURN'); + await connect(this.browser, numeric, 'OUTPUT', doSomething, 'RETURN'); // Drag out doSomething caller from flyout. const doSomethingFlyout = await getNthBlockOfCategory( - browser, + this.browser, 'Functions', 3, ); await doSomethingFlyout.dragAndDrop({x: 50, y: 20}); - const doSomethingCaller = await getSelectedBlockElement(browser); + const doSomethingCaller = await getSelectedBlockElement(this.browser); // Connect the doSomething caller to doSomething2 - await connect(browser, doSomethingCaller, 'OUTPUT', doSomething2, 'RETURN'); + await connect( + this.browser, + doSomethingCaller, + 'OUTPUT', + doSomething2, + 'RETURN', + ); // Drag out print from flyout. const printFlyout = await getBlockTypeFromCategory( - browser, + this.browser, 'Text', 'text_print', ); await printFlyout.dragAndDrop({x: 50, y: 20}); - const print = await getSelectedBlockElement(browser); + const print = await getSelectedBlockElement(this.browser); // Drag out doSomething2 caller from flyout. const doSomething2Flyout = await getNthBlockOfCategory( - browser, + this.browser, 'Functions', 4, ); await doSomething2Flyout.dragAndDrop({x: 130, y: 20}); - const doSomething2Caller = await getSelectedBlockElement(browser); + const doSomething2Caller = await getSelectedBlockElement(this.browser); // Connect doSomething2 caller with print. - await connect(browser, doSomething2Caller, 'OUTPUT', print, 'TEXT'); + await connect(this.browser, doSomething2Caller, 'OUTPUT', print, 'TEXT'); // Click run button and verify the number is 123 - const runButton = await browser.$('#runButton'); + const runButton = await this.browser.$('#runButton'); runButton.click(); - await browser.pause(200); - const alertText = await browser.getAlertText(); // get the alert text + await this.browser.pause(200); + const alertText = await this.browser.getAlertText(); // get the alert text chai.assert.equal(alertText, '123'); }); - - // Teardown entire suite after test are done running - suiteTeardown(async function () { - await browser.deleteSession(); - }); }); diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index cfc051371cf..87af399748e 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -20,8 +20,14 @@ const webdriverio = require('webdriverio'); const path = require('path'); const {posixPath} = require('../../../scripts/helpers'); -let browser; -async function testSetup(url) { +let driver = null; + +/** + * Start up the test page. This should only be done once, to avoid + * constantly popping browser windows open and closed. + * @return A Promsie that resolves to a webdriverIO browser that tests can manipulate. + */ +async function driverSetup() { const options = { capabilities: { 'browserName': 'chrome', @@ -48,10 +54,31 @@ async function testSetup(url) { } // Use Selenium to bring up the page console.log('Starting webdriverio...'); - browser = await webdriverio.remote(options); - console.log('Loading URL: ' + url); - await browser.url(url); - return browser; + driver = await webdriverio.remote(options); + return driver; +} + +/** + * End the webdriverIO session. + * @return A Promise that resolves after the actions have been completed. + */ +async function driverTeardown() { + await driver.deleteSession(); + driver = null; + return; +} + +/** + * Navigate to the correct URL for the test, using the shared driver. + * @param {string} url The URL to open for the test. + * @return A Promsie that resolves to a webdriverIO browser that tests can manipulate. + */ +async function testSetup(url) { + if (!driver) { + await driverSetup(); + } + await driver.url(url); + return driver; } const testFileLocations = { @@ -382,6 +409,8 @@ async function getAllBlocks(browser) { module.exports = { testSetup, testFileLocations, + driverSetup, + driverTeardown, getSelectedBlockElement, getSelectedBlockId, getBlockElementById, From 3d9f3a9588dbcf156444702068dffd8c0f3e6f9e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Jul 2023 10:39:06 -0700 Subject: [PATCH 35/58] chore(deps): Bump @typescript-eslint/eslint-plugin from 5.59.11 to 6.1.0 (#7320) * chore(deps): Bump @typescript-eslint/eslint-plugin from 5.59.11 to 6.1.0 Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.59.11 to 6.1.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.1.0/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * chore: disable duplicate enum rule in keycodes file --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Beka Westberg --- core/utils/keycodes.ts | 2 + package-lock.json | 689 +++++++++++++---------------------------- package.json | 2 +- 3 files changed, 222 insertions(+), 471 deletions(-) diff --git a/core/utils/keycodes.ts b/core/utils/keycodes.ts index 1feef692fdd..5a59a63f4c7 100644 --- a/core/utils/keycodes.ts +++ b/core/utils/keycodes.ts @@ -7,6 +7,8 @@ import * as goog from '../../closure/goog/goog.js'; goog.declareModuleId('Blockly.utils.KeyCodes'); +/* eslint-disable @typescript-eslint/no-duplicate-enum-values */ + /** * Key codes for common characters. * diff --git a/package-lock.json b/package-lock.json index 08466c9406c..3f21d4f4f38 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "@hyperjump/json-schema": "^1.5.0", "@microsoft/api-documenter": "^7.22.4", "@microsoft/api-extractor": "^7.29.5", - "@typescript-eslint/eslint-plugin": "^5.33.1", + "@typescript-eslint/eslint-plugin": "^6.1.0", "@wdio/selenium-standalone-service": "^8.0.2", "async-done": "^2.0.0", "chai": "^4.2.0", @@ -286,9 +286,9 @@ } }, "node_modules/@eslint-community/eslint-utils": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.3.0.tgz", - "integrity": "sha512-v3oplH6FYCULtFuCeqyuTd9D2WKO937Dxdq+GmHOLL72TTRriLxz2VLlNfkZRsvj6PKnOPAtuT6dwrs/pA5DvA==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", "dev": true, "dependencies": { "eslint-visitor-keys": "^3.3.0" @@ -301,9 +301,9 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.4.0.tgz", - "integrity": "sha512-A9983Q0LnDGdLPjxyXQ00sbV+K+O+ko2Dr+CZigbHWtX9pNfxlaBkMR8X1CztI73zuEyEBXTVjx7CE+/VSwDiQ==", + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.6.0.tgz", + "integrity": "sha512-uiPeRISaglZnaZk8vwrjQZ1CxogZeY/4IYft6gBOTqu1WhVXWmCmZMWxUv2Q/pxSvPdp1JPaO62kLOcOkMqWrw==", "dev": true, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" @@ -1151,32 +1151,34 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.11.tgz", - "integrity": "sha512-XxuOfTkCUiOSyBWIvHlUraLw/JT/6Io1365RO6ZuI88STKMavJZPNMU0lFcUTeQXEhHiv64CbxYxBNoDVSmghg==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.1.0.tgz", + "integrity": "sha512-qg7Bm5TyP/I7iilGyp6DRqqkt8na00lI6HbjWZObgk3FFSzH5ypRwAHXJhJkwiRtTcfn+xYQIMOR5kJgpo6upw==", "dev": true, "dependencies": { - "@eslint-community/regexpp": "^4.4.0", - "@typescript-eslint/scope-manager": "5.59.11", - "@typescript-eslint/type-utils": "5.59.11", - "@typescript-eslint/utils": "5.59.11", + "@eslint-community/regexpp": "^4.5.1", + "@typescript-eslint/scope-manager": "6.1.0", + "@typescript-eslint/type-utils": "6.1.0", + "@typescript-eslint/utils": "6.1.0", + "@typescript-eslint/visitor-keys": "6.1.0", "debug": "^4.3.4", - "grapheme-splitter": "^1.0.4", - "ignore": "^5.2.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.4", + "natural-compare": "^1.4.0", "natural-compare-lite": "^1.4.0", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^5.0.0", - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", + "eslint": "^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -1184,74 +1186,43 @@ } } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.11.tgz", - "integrity": "sha512-dHFOsxoLFtrIcSj5h0QoBT/89hxQONwmn3FOQ0GOQcLOOXm+MIrS8zEAhs4tWl5MraxCY3ZJpaXQQdFMc2Tu+Q==", + "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.59.11", - "@typescript-eslint/visitor-keys": "5.59.11" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.11.tgz", - "integrity": "sha512-epoN6R6tkvBYSc+cllrz+c2sOFWkbisJZWkOE+y3xHtvYaOE6Wk6B8e114McRJwFRjGvYdJwLXQH5c9osME/AA==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "lru-cache": "^6.0.0" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.11.tgz", - "integrity": "sha512-KGYniTGG3AMTuKF9QBD7EIrvufkB6O6uX3knP73xbKLMpH+QRPcgnCxjWXSHjMRuOxFLovljqQgQpR0c7GvjoA==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.59.11", - "eslint-visitor-keys": "^3.3.0" + "bin": { + "semver": "bin/semver.js" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "node": ">=10" } }, "node_modules/@typescript-eslint/parser": { - "version": "5.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.33.1.tgz", - "integrity": "sha512-IgLLtW7FOzoDlmaMoXdxG8HOCByTBXrB1V2ZQYSEV1ggMmJfAkMWTwUjjzagS6OkfpySyhKFkBw7A9jYmcHpZA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.1.0.tgz", + "integrity": "sha512-hIzCPvX4vDs4qL07SYzyomamcs2/tQYXg5DtdAfj35AyJ5PIUqhsLf4YrEIFzZcND7R2E8tpQIZKayxg8/6Wbw==", "dev": true, "peer": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.33.1", - "@typescript-eslint/types": "5.33.1", - "@typescript-eslint/typescript-estree": "5.33.1", + "@typescript-eslint/scope-manager": "6.1.0", + "@typescript-eslint/types": "6.1.0", + "@typescript-eslint/typescript-estree": "6.1.0", + "@typescript-eslint/visitor-keys": "6.1.0", "debug": "^4.3.4" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "eslint": "^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -1260,17 +1231,16 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.33.1.tgz", - "integrity": "sha512-8ibcZSqy4c5m69QpzJn8XQq9NnqAToC8OdH/W6IXPXv83vRyEDPYLdjAlUx8h/rbusq6MkW4YdQzURGOqsn3CA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.1.0.tgz", + "integrity": "sha512-AxjgxDn27hgPpe2rQe19k0tXw84YCOsjDJ2r61cIebq1t+AIxbgiXKvD4999Wk49GVaAcdJ/d49FYel+Pp3jjw==", "dev": true, - "peer": true, "dependencies": { - "@typescript-eslint/types": "5.33.1", - "@typescript-eslint/visitor-keys": "5.33.1" + "@typescript-eslint/types": "6.1.0", + "@typescript-eslint/visitor-keys": "6.1.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -1278,65 +1248,25 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.11.tgz", - "integrity": "sha512-LZqVY8hMiVRF2a7/swmkStMYSoXMFlzL6sXV6U/2gL5cwnLWQgLEG8tjWPpaE4rMIdZ6VKWwcffPlo1jPfk43g==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.1.0.tgz", + "integrity": "sha512-kFXBx6QWS1ZZ5Ni89TyT1X9Ag6RXVIVhqDs0vZE/jUeWlBv/ixq2diua6G7ece6+fXw3TvNRxP77/5mOMusx2w==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.59.11", - "@typescript-eslint/utils": "5.59.11", + "@typescript-eslint/typescript-estree": "6.1.0", + "@typescript-eslint/utils": "6.1.0", "debug": "^4.3.4", - "tsutils": "^3.21.0" + "ts-api-utils": "^1.0.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "*" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.11.tgz", - "integrity": "sha512-epoN6R6tkvBYSc+cllrz+c2sOFWkbisJZWkOE+y3xHtvYaOE6Wk6B8e114McRJwFRjGvYdJwLXQH5c9osME/AA==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.11.tgz", - "integrity": "sha512-YupOpot5hJO0maupJXixi6l5ETdrITxeo5eBOeuV7RSKgYdU3G5cxO49/9WRnJq9EMrB7AuTSLH/bqOsXi7wPA==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.59.11", - "@typescript-eslint/visitor-keys": "5.59.11", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "eslint": "^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -1344,31 +1274,13 @@ } } }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.11.tgz", - "integrity": "sha512-KGYniTGG3AMTuKF9QBD7EIrvufkB6O6uX3knP73xbKLMpH+QRPcgnCxjWXSHjMRuOxFLovljqQgQpR0c7GvjoA==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.59.11", - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/types": { - "version": "5.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.33.1.tgz", - "integrity": "sha512-7K6MoQPQh6WVEkMrMW5QOA5FO+BOwzHSNd0j3+BlBwd6vtzfZceJ8xJ7Um2XDi/O3umS8/qDX6jdy2i7CijkwQ==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.1.0.tgz", + "integrity": "sha512-+Gfd5NHCpDoHDOaU/yIF3WWRI2PcBRKKpP91ZcVbL0t5tQpqYWBs3z/GGhvU+EV1D0262g9XCnyqQh19prU0JQ==", "dev": true, - "peer": true, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -1376,22 +1288,21 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.33.1.tgz", - "integrity": "sha512-JOAzJ4pJ+tHzA2pgsWQi4804XisPHOtbvwUyqsuuq8+y5B5GMZs7lI1xDWs6V2d7gE/Ez5bTGojSK12+IIPtXA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.1.0.tgz", + "integrity": "sha512-nUKAPWOaP/tQjU1IQw9sOPCDavs/iU5iYLiY/6u7gxS7oKQoi4aUxXS1nrrVGTyBBaGesjkcwwHkbkiD5eBvcg==", "dev": true, - "peer": true, "dependencies": { - "@typescript-eslint/types": "5.33.1", - "@typescript-eslint/visitor-keys": "5.33.1", + "@typescript-eslint/types": "6.1.0", + "@typescript-eslint/visitor-keys": "6.1.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -1403,131 +1314,72 @@ } } }, - "node_modules/@typescript-eslint/utils": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.11.tgz", - "integrity": "sha512-didu2rHSOMUdJThLk4aZ1Or8IcO3HzCw/ZvEjTTIfjIrcdd5cvSIwwDy2AOlE7htSNp7QIZ10fLMyRCveesMLg==", + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@types/json-schema": "^7.0.9", - "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.59.11", - "@typescript-eslint/types": "5.59.11", - "@typescript-eslint/typescript-estree": "5.59.11", - "eslint-scope": "^5.1.1", - "semver": "^7.3.7" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "lru-cache": "^6.0.0" }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.11.tgz", - "integrity": "sha512-dHFOsxoLFtrIcSj5h0QoBT/89hxQONwmn3FOQ0GOQcLOOXm+MIrS8zEAhs4tWl5MraxCY3ZJpaXQQdFMc2Tu+Q==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.59.11", - "@typescript-eslint/visitor-keys": "5.59.11" + "bin": { + "semver": "bin/semver.js" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.11.tgz", - "integrity": "sha512-epoN6R6tkvBYSc+cllrz+c2sOFWkbisJZWkOE+y3xHtvYaOE6Wk6B8e114McRJwFRjGvYdJwLXQH5c9osME/AA==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "node": ">=10" } }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.11.tgz", - "integrity": "sha512-YupOpot5hJO0maupJXixi6l5ETdrITxeo5eBOeuV7RSKgYdU3G5cxO49/9WRnJq9EMrB7AuTSLH/bqOsXi7wPA==", + "node_modules/@typescript-eslint/utils": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.1.0.tgz", + "integrity": "sha512-wp652EogZlKmQoMS5hAvWqRKplXvkuOnNzZSE0PVvsKjpexd/XznRVHAtrfHFYmqaJz0DFkjlDsGYC9OXw+OhQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.59.11", - "@typescript-eslint/visitor-keys": "5.59.11", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "6.1.0", + "@typescript-eslint/types": "6.1.0", + "@typescript-eslint/typescript-estree": "6.1.0", + "semver": "^7.5.4" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" } }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.11.tgz", - "integrity": "sha512-KGYniTGG3AMTuKF9QBD7EIrvufkB6O6uX3knP73xbKLMpH+QRPcgnCxjWXSHjMRuOxFLovljqQgQpR0c7GvjoA==", + "node_modules/@typescript-eslint/utils/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.59.11", - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "lru-cache": "^6.0.0" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" + "bin": { + "semver": "bin/semver.js" }, "engines": { - "node": ">=8.0.0" + "node": ">=10" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.33.1.tgz", - "integrity": "sha512-nwIxOK8Z2MPWltLKMLOEZwmfBZReqUdbEoHQXeCpa+sRVARe5twpJGHCB4dk9903Yaf0nMAlGbQfaAH92F60eg==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.1.0.tgz", + "integrity": "sha512-yQeh+EXhquh119Eis4k0kYhj9vmFzNpbhM3LftWQVwqVjipCkwHBQOZutcYW+JVkjtTG9k8nrZU1UoNedPDd1A==", "dev": true, - "peer": true, "dependencies": { - "@typescript-eslint/types": "5.33.1", - "eslint-visitor-keys": "^3.3.0" + "@typescript-eslint/types": "6.1.0", + "eslint-visitor-keys": "^3.4.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -4137,15 +3989,6 @@ "node": ">=4.0" } }, - "node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -4472,9 +4315,9 @@ "dev": true }, "node_modules/fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -6394,9 +6237,9 @@ ] }, "node_modules/ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", "dev": true, "engines": { "node": ">= 4" @@ -10838,27 +10681,24 @@ "tree-kill": "cli.js" } }, - "node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "node_modules/tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "node_modules/ts-api-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.1.tgz", + "integrity": "sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==", "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, "engines": { - "node": ">= 6" + "node": ">=16.13.0" }, "peerDependencies": { - "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + "typescript": ">=4.2.0" } }, + "node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, "node_modules/type": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", @@ -12112,18 +11952,18 @@ } }, "@eslint-community/eslint-utils": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.3.0.tgz", - "integrity": "sha512-v3oplH6FYCULtFuCeqyuTd9D2WKO937Dxdq+GmHOLL72TTRriLxz2VLlNfkZRsvj6PKnOPAtuT6dwrs/pA5DvA==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", "dev": true, "requires": { "eslint-visitor-keys": "^3.3.0" } }, "@eslint-community/regexpp": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.4.0.tgz", - "integrity": "sha512-A9983Q0LnDGdLPjxyXQ00sbV+K+O+ko2Dr+CZigbHWtX9pNfxlaBkMR8X1CztI73zuEyEBXTVjx7CE+/VSwDiQ==", + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.6.0.tgz", + "integrity": "sha512-uiPeRISaglZnaZk8vwrjQZ1CxogZeY/4IYft6gBOTqu1WhVXWmCmZMWxUv2Q/pxSvPdp1JPaO62kLOcOkMqWrw==", "dev": true }, "@eslint/eslintrc": { @@ -12816,221 +12656,138 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.11.tgz", - "integrity": "sha512-XxuOfTkCUiOSyBWIvHlUraLw/JT/6Io1365RO6ZuI88STKMavJZPNMU0lFcUTeQXEhHiv64CbxYxBNoDVSmghg==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.1.0.tgz", + "integrity": "sha512-qg7Bm5TyP/I7iilGyp6DRqqkt8na00lI6HbjWZObgk3FFSzH5ypRwAHXJhJkwiRtTcfn+xYQIMOR5kJgpo6upw==", "dev": true, "requires": { - "@eslint-community/regexpp": "^4.4.0", - "@typescript-eslint/scope-manager": "5.59.11", - "@typescript-eslint/type-utils": "5.59.11", - "@typescript-eslint/utils": "5.59.11", + "@eslint-community/regexpp": "^4.5.1", + "@typescript-eslint/scope-manager": "6.1.0", + "@typescript-eslint/type-utils": "6.1.0", + "@typescript-eslint/utils": "6.1.0", + "@typescript-eslint/visitor-keys": "6.1.0", "debug": "^4.3.4", - "grapheme-splitter": "^1.0.4", - "ignore": "^5.2.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.4", + "natural-compare": "^1.4.0", "natural-compare-lite": "^1.4.0", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" }, "dependencies": { - "@typescript-eslint/scope-manager": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.11.tgz", - "integrity": "sha512-dHFOsxoLFtrIcSj5h0QoBT/89hxQONwmn3FOQ0GOQcLOOXm+MIrS8zEAhs4tWl5MraxCY3ZJpaXQQdFMc2Tu+Q==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.59.11", - "@typescript-eslint/visitor-keys": "5.59.11" - } - }, - "@typescript-eslint/types": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.11.tgz", - "integrity": "sha512-epoN6R6tkvBYSc+cllrz+c2sOFWkbisJZWkOE+y3xHtvYaOE6Wk6B8e114McRJwFRjGvYdJwLXQH5c9osME/AA==", - "dev": true - }, - "@typescript-eslint/visitor-keys": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.11.tgz", - "integrity": "sha512-KGYniTGG3AMTuKF9QBD7EIrvufkB6O6uX3knP73xbKLMpH+QRPcgnCxjWXSHjMRuOxFLovljqQgQpR0c7GvjoA==", + "semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.59.11", - "eslint-visitor-keys": "^3.3.0" + "lru-cache": "^6.0.0" } } } }, "@typescript-eslint/parser": { - "version": "5.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.33.1.tgz", - "integrity": "sha512-IgLLtW7FOzoDlmaMoXdxG8HOCByTBXrB1V2ZQYSEV1ggMmJfAkMWTwUjjzagS6OkfpySyhKFkBw7A9jYmcHpZA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.1.0.tgz", + "integrity": "sha512-hIzCPvX4vDs4qL07SYzyomamcs2/tQYXg5DtdAfj35AyJ5PIUqhsLf4YrEIFzZcND7R2E8tpQIZKayxg8/6Wbw==", "dev": true, "peer": true, "requires": { - "@typescript-eslint/scope-manager": "5.33.1", - "@typescript-eslint/types": "5.33.1", - "@typescript-eslint/typescript-estree": "5.33.1", + "@typescript-eslint/scope-manager": "6.1.0", + "@typescript-eslint/types": "6.1.0", + "@typescript-eslint/typescript-estree": "6.1.0", + "@typescript-eslint/visitor-keys": "6.1.0", "debug": "^4.3.4" } }, "@typescript-eslint/scope-manager": { - "version": "5.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.33.1.tgz", - "integrity": "sha512-8ibcZSqy4c5m69QpzJn8XQq9NnqAToC8OdH/W6IXPXv83vRyEDPYLdjAlUx8h/rbusq6MkW4YdQzURGOqsn3CA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.1.0.tgz", + "integrity": "sha512-AxjgxDn27hgPpe2rQe19k0tXw84YCOsjDJ2r61cIebq1t+AIxbgiXKvD4999Wk49GVaAcdJ/d49FYel+Pp3jjw==", "dev": true, - "peer": true, "requires": { - "@typescript-eslint/types": "5.33.1", - "@typescript-eslint/visitor-keys": "5.33.1" + "@typescript-eslint/types": "6.1.0", + "@typescript-eslint/visitor-keys": "6.1.0" } }, "@typescript-eslint/type-utils": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.11.tgz", - "integrity": "sha512-LZqVY8hMiVRF2a7/swmkStMYSoXMFlzL6sXV6U/2gL5cwnLWQgLEG8tjWPpaE4rMIdZ6VKWwcffPlo1jPfk43g==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.1.0.tgz", + "integrity": "sha512-kFXBx6QWS1ZZ5Ni89TyT1X9Ag6RXVIVhqDs0vZE/jUeWlBv/ixq2diua6G7ece6+fXw3TvNRxP77/5mOMusx2w==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "5.59.11", - "@typescript-eslint/utils": "5.59.11", + "@typescript-eslint/typescript-estree": "6.1.0", + "@typescript-eslint/utils": "6.1.0", "debug": "^4.3.4", - "tsutils": "^3.21.0" - }, - "dependencies": { - "@typescript-eslint/types": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.11.tgz", - "integrity": "sha512-epoN6R6tkvBYSc+cllrz+c2sOFWkbisJZWkOE+y3xHtvYaOE6Wk6B8e114McRJwFRjGvYdJwLXQH5c9osME/AA==", - "dev": true - }, - "@typescript-eslint/typescript-estree": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.11.tgz", - "integrity": "sha512-YupOpot5hJO0maupJXixi6l5ETdrITxeo5eBOeuV7RSKgYdU3G5cxO49/9WRnJq9EMrB7AuTSLH/bqOsXi7wPA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.59.11", - "@typescript-eslint/visitor-keys": "5.59.11", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" - } - }, - "@typescript-eslint/visitor-keys": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.11.tgz", - "integrity": "sha512-KGYniTGG3AMTuKF9QBD7EIrvufkB6O6uX3knP73xbKLMpH+QRPcgnCxjWXSHjMRuOxFLovljqQgQpR0c7GvjoA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.59.11", - "eslint-visitor-keys": "^3.3.0" - } - } + "ts-api-utils": "^1.0.1" } }, "@typescript-eslint/types": { - "version": "5.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.33.1.tgz", - "integrity": "sha512-7K6MoQPQh6WVEkMrMW5QOA5FO+BOwzHSNd0j3+BlBwd6vtzfZceJ8xJ7Um2XDi/O3umS8/qDX6jdy2i7CijkwQ==", - "dev": true, - "peer": true + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.1.0.tgz", + "integrity": "sha512-+Gfd5NHCpDoHDOaU/yIF3WWRI2PcBRKKpP91ZcVbL0t5tQpqYWBs3z/GGhvU+EV1D0262g9XCnyqQh19prU0JQ==", + "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.33.1.tgz", - "integrity": "sha512-JOAzJ4pJ+tHzA2pgsWQi4804XisPHOtbvwUyqsuuq8+y5B5GMZs7lI1xDWs6V2d7gE/Ez5bTGojSK12+IIPtXA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.1.0.tgz", + "integrity": "sha512-nUKAPWOaP/tQjU1IQw9sOPCDavs/iU5iYLiY/6u7gxS7oKQoi4aUxXS1nrrVGTyBBaGesjkcwwHkbkiD5eBvcg==", "dev": true, - "peer": true, "requires": { - "@typescript-eslint/types": "5.33.1", - "@typescript-eslint/visitor-keys": "5.33.1", + "@typescript-eslint/types": "6.1.0", + "@typescript-eslint/visitor-keys": "6.1.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "dependencies": { + "semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } } }, "@typescript-eslint/utils": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.11.tgz", - "integrity": "sha512-didu2rHSOMUdJThLk4aZ1Or8IcO3HzCw/ZvEjTTIfjIrcdd5cvSIwwDy2AOlE7htSNp7QIZ10fLMyRCveesMLg==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.1.0.tgz", + "integrity": "sha512-wp652EogZlKmQoMS5hAvWqRKplXvkuOnNzZSE0PVvsKjpexd/XznRVHAtrfHFYmqaJz0DFkjlDsGYC9OXw+OhQ==", "dev": true, "requires": { - "@eslint-community/eslint-utils": "^4.2.0", - "@types/json-schema": "^7.0.9", - "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.59.11", - "@typescript-eslint/types": "5.59.11", - "@typescript-eslint/typescript-estree": "5.59.11", - "eslint-scope": "^5.1.1", - "semver": "^7.3.7" - }, - "dependencies": { - "@typescript-eslint/scope-manager": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.11.tgz", - "integrity": "sha512-dHFOsxoLFtrIcSj5h0QoBT/89hxQONwmn3FOQ0GOQcLOOXm+MIrS8zEAhs4tWl5MraxCY3ZJpaXQQdFMc2Tu+Q==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.59.11", - "@typescript-eslint/visitor-keys": "5.59.11" - } - }, - "@typescript-eslint/types": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.11.tgz", - "integrity": "sha512-epoN6R6tkvBYSc+cllrz+c2sOFWkbisJZWkOE+y3xHtvYaOE6Wk6B8e114McRJwFRjGvYdJwLXQH5c9osME/AA==", - "dev": true - }, - "@typescript-eslint/typescript-estree": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.11.tgz", - "integrity": "sha512-YupOpot5hJO0maupJXixi6l5ETdrITxeo5eBOeuV7RSKgYdU3G5cxO49/9WRnJq9EMrB7AuTSLH/bqOsXi7wPA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.59.11", - "@typescript-eslint/visitor-keys": "5.59.11", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" - } - }, - "@typescript-eslint/visitor-keys": { - "version": "5.59.11", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.11.tgz", - "integrity": "sha512-KGYniTGG3AMTuKF9QBD7EIrvufkB6O6uX3knP73xbKLMpH+QRPcgnCxjWXSHjMRuOxFLovljqQgQpR0c7GvjoA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.59.11", - "eslint-visitor-keys": "^3.3.0" - } - }, - "eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "6.1.0", + "@typescript-eslint/types": "6.1.0", + "@typescript-eslint/typescript-estree": "6.1.0", + "semver": "^7.5.4" + }, + "dependencies": { + "semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" + "lru-cache": "^6.0.0" } } } }, "@typescript-eslint/visitor-keys": { - "version": "5.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.33.1.tgz", - "integrity": "sha512-nwIxOK8Z2MPWltLKMLOEZwmfBZReqUdbEoHQXeCpa+sRVARe5twpJGHCB4dk9903Yaf0nMAlGbQfaAH92F60eg==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.1.0.tgz", + "integrity": "sha512-yQeh+EXhquh119Eis4k0kYhj9vmFzNpbhM3LftWQVwqVjipCkwHBQOZutcYW+JVkjtTG9k8nrZU1UoNedPDd1A==", "dev": true, - "peer": true, "requires": { - "@typescript-eslint/types": "5.33.1", - "eslint-visitor-keys": "^3.3.0" + "@typescript-eslint/types": "6.1.0", + "eslint-visitor-keys": "^3.4.1" } }, "@wdio/config": { @@ -15037,12 +14794,6 @@ } } }, - "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true - }, "esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -15311,9 +15062,9 @@ "dev": true }, "fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -16879,9 +16630,9 @@ "dev": true }, "ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", "dev": true }, "import-fresh": { @@ -20416,21 +20167,19 @@ "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", "dev": true }, + "ts-api-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.1.tgz", + "integrity": "sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==", + "dev": true, + "requires": {} + }, "tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, - "tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - }, "type": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", diff --git a/package.json b/package.json index d0788e79ce2..43e16ff1eac 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "@hyperjump/json-schema": "^1.5.0", "@microsoft/api-documenter": "^7.22.4", "@microsoft/api-extractor": "^7.29.5", - "@typescript-eslint/eslint-plugin": "^5.33.1", + "@typescript-eslint/eslint-plugin": "^6.1.0", "@wdio/selenium-standalone-service": "^8.0.2", "async-done": "^2.0.0", "chai": "^4.2.0", From 96c913ded83f31061eff6ae68bb8d800e409b4f3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 26 Jul 2023 13:56:01 -0700 Subject: [PATCH 36/58] chore(deps): Bump webdriverio from 8.11.2 to 8.13.10 (#7319) Bumps [webdriverio](https://github.com/webdriverio/webdriverio/tree/HEAD/packages/webdriverio) from 8.11.2 to 8.13.10. - [Release notes](https://github.com/webdriverio/webdriverio/releases) - [Changelog](https://github.com/webdriverio/webdriverio/blob/main/CHANGELOG.md) - [Commits](https://github.com/webdriverio/webdriverio/commits/v8.13.10/packages/webdriverio) --- updated-dependencies: - dependency-name: webdriverio dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 1053 ++++++++++++++++++++++++++++++++------------- 1 file changed, 742 insertions(+), 311 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3f21d4f4f38..2130ec98ecf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -57,33 +57,33 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.0.tgz", - "integrity": "sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.5.tgz", + "integrity": "sha512-Xmwn266vad+6DAqEB2A6V/CcZVp62BbwVmcOJc2RPuwih1kw02TjQvWVWlcKGbBPd+8/0V5DEkOcizRGYsspYQ==", "dev": true, "dependencies": { - "@babel/highlight": "^7.16.0" + "@babel/highlight": "^7.22.5" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", - "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz", + "integrity": "sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.0.tgz", - "integrity": "sha512-t8MH41kUQylBtu2+4IQA3atqevA2lRgqA2wyVB/YiWmsDSuylZZuXOUy9ric30hfzauEFfdsuk/eXTRrGrfd0g==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.5.tgz", + "integrity": "sha512-BSKlD1hgnedS5XRnGOljZawtag7H1yPfQp0tdNJCHoH6AZ+Pcm9VvkrK59/Yy593Ypg0zMxH2BxD1VPYUQ7UIw==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.15.7", + "@babel/helper-validator-identifier": "^7.22.5", "chalk": "^2.0.0", "js-tokens": "^4.0.0" }, @@ -129,13 +129,13 @@ "node_modules/@babel/highlight/node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, "node_modules/@babel/highlight/node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true, "engines": { "node": ">=0.8.0" @@ -144,7 +144,7 @@ "node_modules/@babel/highlight/node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "dev": true, "engines": { "node": ">=4" @@ -1426,22 +1426,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@wdio/config/node_modules/find-up": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", - "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", - "dev": true, - "dependencies": { - "locate-path": "^7.1.0", - "path-exists": "^5.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@wdio/config/node_modules/glob": { "version": "10.2.7", "resolved": "https://registry.npmjs.org/glob/-/glob-10.2.7.tgz", @@ -1464,21 +1448,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@wdio/config/node_modules/locate-path": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", - "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", - "dev": true, - "dependencies": { - "p-locate": "^6.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@wdio/config/node_modules/minimatch": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.1.tgz", @@ -1494,92 +1463,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@wdio/config/node_modules/p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^1.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@wdio/config/node_modules/p-locate": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", - "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", - "dev": true, - "dependencies": { - "p-limit": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@wdio/config/node_modules/path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, - "node_modules/@wdio/config/node_modules/read-pkg": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-7.1.0.tgz", - "integrity": "sha512-5iOehe+WF75IccPc30bWTbpdDQLOCc3Uu8bi3Dte3Eueij81yx1Mrufk8qBx/YAbR4uL1FdUr+7BKXDwEtisXg==", - "dev": true, - "dependencies": { - "@types/normalize-package-data": "^2.4.1", - "normalize-package-data": "^3.0.2", - "parse-json": "^5.2.0", - "type-fest": "^2.0.0" - }, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@wdio/config/node_modules/read-pkg-up": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-9.1.0.tgz", - "integrity": "sha512-vaMRR1AC1nrd5CQM0PhlRsO5oc2AAigqr7cCrZ/MW/Rsaflz4RlgzkpL4qoU/z1F6wrbd85iFv1OQj/y5RdGvg==", - "dev": true, - "dependencies": { - "find-up": "^6.3.0", - "read-pkg": "^7.1.0", - "type-fest": "^2.5.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@wdio/config/node_modules/yocto-queue": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", - "dev": true, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@wdio/logger": { "version": "8.11.0", "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-8.11.0.tgz", @@ -3490,17 +3373,17 @@ } }, "node_modules/devtools": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/devtools/-/devtools-8.11.0.tgz", - "integrity": "sha512-j1wXFQyjswJ6doAV1+h4Bxl8+Oeb8SMpWTpBVa0DurGsxfft8sU2OhDlMo5tx/zbX82X5sGyJDMnKHqBJ2XRvQ==", + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/devtools/-/devtools-8.12.1.tgz", + "integrity": "sha512-R72raQLN1lDSqbr2DVj9SRh07JRyojzmrcLa33VBa2nw3cf5ZyHOHe0DgxlJ/5c2Dfs1+wGNJy16gWKGBq+xgg==", "dev": true, "dependencies": { "@types/node": "^20.1.0", - "@wdio/config": "8.11.0", + "@wdio/config": "8.12.1", "@wdio/logger": "8.11.0", "@wdio/protocols": "8.11.0", "@wdio/types": "8.10.4", - "@wdio/utils": "8.11.0", + "@wdio/utils": "8.12.1", "chrome-launcher": "^0.15.0", "edge-paths": "^3.0.5", "import-meta-resolve": "^3.0.0", @@ -3515,11 +3398,103 @@ } }, "node_modules/devtools-protocol": { - "version": "0.0.1152884", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1152884.tgz", - "integrity": "sha512-9eP6OmCoU1cWArpXLuzyZQcBJ2PkINOh8Nwx8W5i8u6NDigDE5/mPlLLBAfshwn5YVvIz6ZQ9jbs0PZvKGccdQ==", + "version": "0.0.1170846", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1170846.tgz", + "integrity": "sha512-GFZiHgvL4JW7+8hIMQgwYNUaIRRCsqfXd11ZbOTdu2VzDeu0Le4l1c3u4FFRWCSvMg82OFip9k/sYyz4M/PJIA==", "dev": true }, + "node_modules/devtools/node_modules/@wdio/config": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.12.1.tgz", + "integrity": "sha512-6DfTU+5Ugg6HKMSqVNCLEgdFd7l+QnaMoDe2/tZ8zoYNdJlFu0NfClXLL4qnTCCjebmz3eu0/O+aRPJyxo6GGQ==", + "dev": true, + "dependencies": { + "@wdio/logger": "8.11.0", + "@wdio/types": "8.10.4", + "@wdio/utils": "8.12.1", + "decamelize": "^6.0.0", + "deepmerge-ts": "^5.0.0", + "glob": "^10.2.2", + "import-meta-resolve": "^3.0.0", + "read-pkg-up": "^9.1.0" + }, + "engines": { + "node": "^16.13 || >=18" + } + }, + "node_modules/devtools/node_modules/@wdio/utils": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.12.1.tgz", + "integrity": "sha512-VmF6O++84FTH3AKaVFyqn0MJA65/1G6dbm6p61KBqkD25LxaWo4398lCCbt264hzBIobtXRZoQ87bSxdfnlUKQ==", + "dev": true, + "dependencies": { + "@wdio/logger": "8.11.0", + "@wdio/types": "8.10.4", + "import-meta-resolve": "^3.0.0", + "p-iteration": "^1.1.8" + }, + "engines": { + "node": "^16.13 || >=18" + } + }, + "node_modules/devtools/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/devtools/node_modules/decamelize": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", + "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/devtools/node_modules/glob": { + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", + "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.0.3", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/devtools/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/devtools/node_modules/which": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/which/-/which-3.0.1.tgz", @@ -6109,9 +6084,9 @@ } }, "node_modules/hosted-git-info": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.0.2.tgz", - "integrity": "sha512-c9OGXbZ3guC/xOlCg1Ci/VgWlwsqDv1yMQL1CWqXDL0hDjXuNcq0zuR4xqPSuasI3kqFDhqSyTjREz5gzq0fXg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -7888,9 +7863,9 @@ } }, "node_modules/node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz", + "integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==", "dev": true, "dependencies": { "whatwg-url": "^5.0.0" @@ -7910,19 +7885,19 @@ "node_modules/node-fetch/node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", "dev": true }, "node_modules/node-fetch/node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", "dev": true }, "node_modules/node-fetch/node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "dev": true, "dependencies": { "tr46": "~0.0.3", @@ -8538,13 +8513,13 @@ } }, "node_modules/path-scurry": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.7.0.tgz", - "integrity": "sha512-UkZUeDjczjYRE495+9thsgcVgsaCPkaw80slmfVFgllxY+IO8ubTsOpFVjDPROBqJdHfVPUFRHPBV/WciOVfWg==", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", + "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", "dev": true, "dependencies": { - "lru-cache": "^9.0.0", - "minipass": "^5.0.0" + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "engines": { "node": ">=16 || 14 >=14.17" @@ -8554,9 +8529,9 @@ } }, "node_modules/path-scurry/node_modules/lru-cache": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-9.0.3.tgz", - "integrity": "sha512-cyjNRew29d4kbgnz1sjDqxg7qg8NW4s+HQzCGjeon7DV5T2yDije16W9HaUFV1dhVEMh+SjrOcK0TomBmf3Egg==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.0.tgz", + "integrity": "sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw==", "dev": true, "engines": { "node": "14 || >=16.14" @@ -8977,6 +8952,123 @@ "safe-buffer": "^5.1.0" } }, + "node_modules/read-pkg": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-7.1.0.tgz", + "integrity": "sha512-5iOehe+WF75IccPc30bWTbpdDQLOCc3Uu8bi3Dte3Eueij81yx1Mrufk8qBx/YAbR4uL1FdUr+7BKXDwEtisXg==", + "dev": true, + "dependencies": { + "@types/normalize-package-data": "^2.4.1", + "normalize-package-data": "^3.0.2", + "parse-json": "^5.2.0", + "type-fest": "^2.0.0" + }, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-9.1.0.tgz", + "integrity": "sha512-vaMRR1AC1nrd5CQM0PhlRsO5oc2AAigqr7cCrZ/MW/Rsaflz4RlgzkpL4qoU/z1F6wrbd85iFv1OQj/y5RdGvg==", + "dev": true, + "dependencies": { + "find-up": "^6.3.0", + "read-pkg": "^7.1.0", + "type-fest": "^2.5.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/find-up": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", + "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", + "dev": true, + "dependencies": { + "locate-path": "^7.1.0", + "path-exists": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/locate-path": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", + "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", + "dev": true, + "dependencies": { + "p-locate": "^6.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/p-locate": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", + "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", + "dev": true, + "dependencies": { + "p-limit": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/path-exists": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/read-pkg-up/node_modules/yocto-queue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "dev": true, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/readable-stream": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.4.0.tgz", @@ -11181,18 +11273,18 @@ } }, "node_modules/webdriver": { - "version": "8.11.1", - "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-8.11.1.tgz", - "integrity": "sha512-hSpUZYzUA65t4DDtKujCHUX6hpFTUleb7lWMcf5xjPz8sxWrK9R8NIw7pXt/GU6PVS331nGAaYkzoXrqz2VB8w==", + "version": "8.13.1", + "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-8.13.1.tgz", + "integrity": "sha512-v6EDyGEtZB8wpqd3kxEDOVU/Z21XY23SObHwoi4xe72sQeVbC8nIR0Y7Ri/gbQMv1bK58YIK01BAf7JmBZAcUw==", "dev": true, "dependencies": { "@types/node": "^20.1.0", "@types/ws": "^8.5.3", - "@wdio/config": "8.11.0", + "@wdio/config": "8.12.1", "@wdio/logger": "8.11.0", "@wdio/protocols": "8.11.0", "@wdio/types": "8.10.4", - "@wdio/utils": "8.11.0", + "@wdio/utils": "8.12.1", "deepmerge-ts": "^5.0.0", "got": "^ 12.6.1", "ky": "^0.33.0", @@ -11203,9 +11295,9 @@ } }, "node_modules/webdriver/node_modules/@sindresorhus/is": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-5.4.1.tgz", - "integrity": "sha512-axlrvsHlHlFmKKMEg4VyvMzFr93JWJj4eIfXY1STVuO2fsImCa7ncaiG5gC8HKOX590AW5RtRsC41/B+OfrSqw==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-5.6.0.tgz", + "integrity": "sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g==", "dev": true, "engines": { "node": ">=14.16" @@ -11226,6 +11318,49 @@ "node": ">=14.16" } }, + "node_modules/webdriver/node_modules/@wdio/config": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.12.1.tgz", + "integrity": "sha512-6DfTU+5Ugg6HKMSqVNCLEgdFd7l+QnaMoDe2/tZ8zoYNdJlFu0NfClXLL4qnTCCjebmz3eu0/O+aRPJyxo6GGQ==", + "dev": true, + "dependencies": { + "@wdio/logger": "8.11.0", + "@wdio/types": "8.10.4", + "@wdio/utils": "8.12.1", + "decamelize": "^6.0.0", + "deepmerge-ts": "^5.0.0", + "glob": "^10.2.2", + "import-meta-resolve": "^3.0.0", + "read-pkg-up": "^9.1.0" + }, + "engines": { + "node": "^16.13 || >=18" + } + }, + "node_modules/webdriver/node_modules/@wdio/utils": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.12.1.tgz", + "integrity": "sha512-VmF6O++84FTH3AKaVFyqn0MJA65/1G6dbm6p61KBqkD25LxaWo4398lCCbt264hzBIobtXRZoQ87bSxdfnlUKQ==", + "dev": true, + "dependencies": { + "@wdio/logger": "8.11.0", + "@wdio/types": "8.10.4", + "import-meta-resolve": "^3.0.0", + "p-iteration": "^1.1.8" + }, + "engines": { + "node": "^16.13 || >=18" + } + }, + "node_modules/webdriver/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, "node_modules/webdriver/node_modules/cacheable-lookup": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz", @@ -11236,9 +11371,9 @@ } }, "node_modules/webdriver/node_modules/cacheable-request": { - "version": "10.2.10", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.10.tgz", - "integrity": "sha512-v6WB+Epm/qO4Hdlio/sfUn69r5Shgh39SsE9DSd4bIezP0mblOlObI+I0kUEM7J0JFc+I7pSeMeYaOYtX1N/VQ==", + "version": "10.2.12", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.12.tgz", + "integrity": "sha512-qtWGB5kn2OLjx47pYUkWicyOpK1vy9XZhq8yRTXOy+KAmjjESSRLx6SiExnnaGGUP1NM6/vmygMu0fGylNh9tw==", "dev": true, "dependencies": { "@types/http-cache-semantics": "^4.0.1", @@ -11253,6 +11388,18 @@ "node": ">=14.16" } }, + "node_modules/webdriver/node_modules/decamelize": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", + "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/webdriver/node_modules/get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", @@ -11265,6 +11412,28 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/webdriver/node_modules/glob": { + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", + "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.0.3", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/webdriver/node_modules/got": { "version": "12.6.1", "resolved": "https://registry.npmjs.org/got/-/got-12.6.1.tgz", @@ -11327,6 +11496,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/webdriver/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/webdriver/node_modules/normalize-url": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.0.0.tgz", @@ -11364,24 +11548,24 @@ } }, "node_modules/webdriverio": { - "version": "8.11.2", - "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-8.11.2.tgz", - "integrity": "sha512-e/9WkdNTfWeoaSo2UzK0Giec/nQX3i7U9J8esimhozH/EpwSqIaEJ2pRRlxRVafEhe2OBG1QDhnLnDjdCC5Hxg==", + "version": "8.13.10", + "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-8.13.10.tgz", + "integrity": "sha512-pDcGPTOfr6TdSXudPDdpjd9xLxkzPHT8tTWimTXArecxtTaoXFDA3nwJWsVNp+QAT57fmrSeszgNfNZeu7F72Q==", "dev": true, "dependencies": { "@types/node": "^20.1.0", - "@wdio/config": "8.11.0", + "@wdio/config": "8.12.1", "@wdio/logger": "8.11.0", "@wdio/protocols": "8.11.0", "@wdio/repl": "8.10.1", "@wdio/types": "8.10.4", - "@wdio/utils": "8.11.0", + "@wdio/utils": "8.12.1", "archiver": "^5.0.0", "aria-query": "^5.0.0", "css-shorthand-properties": "^1.1.1", "css-value": "^0.0.1", - "devtools": "8.11.0", - "devtools-protocol": "^0.0.1152884", + "devtools": "8.12.1", + "devtools-protocol": "^0.0.1170846", "grapheme-splitter": "^1.0.2", "import-meta-resolve": "^3.0.0", "is-plain-obj": "^4.1.0", @@ -11393,7 +11577,41 @@ "resq": "^1.9.1", "rgb2hex": "0.2.5", "serialize-error": "^8.0.0", - "webdriver": "8.11.1" + "webdriver": "8.13.1" + }, + "engines": { + "node": "^16.13 || >=18" + } + }, + "node_modules/webdriverio/node_modules/@wdio/config": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.12.1.tgz", + "integrity": "sha512-6DfTU+5Ugg6HKMSqVNCLEgdFd7l+QnaMoDe2/tZ8zoYNdJlFu0NfClXLL4qnTCCjebmz3eu0/O+aRPJyxo6GGQ==", + "dev": true, + "dependencies": { + "@wdio/logger": "8.11.0", + "@wdio/types": "8.10.4", + "@wdio/utils": "8.12.1", + "decamelize": "^6.0.0", + "deepmerge-ts": "^5.0.0", + "glob": "^10.2.2", + "import-meta-resolve": "^3.0.0", + "read-pkg-up": "^9.1.0" + }, + "engines": { + "node": "^16.13 || >=18" + } + }, + "node_modules/webdriverio/node_modules/@wdio/utils": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.12.1.tgz", + "integrity": "sha512-VmF6O++84FTH3AKaVFyqn0MJA65/1G6dbm6p61KBqkD25LxaWo4398lCCbt264hzBIobtXRZoQ87bSxdfnlUKQ==", + "dev": true, + "dependencies": { + "@wdio/logger": "8.11.0", + "@wdio/types": "8.10.4", + "import-meta-resolve": "^3.0.0", + "p-iteration": "^1.1.8" }, "engines": { "node": "^16.13 || >=18" @@ -11408,6 +11626,40 @@ "balanced-match": "^1.0.0" } }, + "node_modules/webdriverio/node_modules/decamelize": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", + "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/webdriverio/node_modules/glob": { + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", + "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.0.3", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/webdriverio/node_modules/is-plain-obj": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", @@ -11421,9 +11673,9 @@ } }, "node_modules/webdriverio/node_modules/minimatch": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.0.tgz", - "integrity": "sha512-0jJj8AvgKqWN05mrwuqi8QYKx1WmYSUoKSxu5Qhs9prezTz10sxAHGNZe9J9cqIJzta8DWsleh2KaVaLl6Ru2w==", + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", "dev": true, "dependencies": { "brace-expansion": "^2.0.1" @@ -11785,27 +12037,27 @@ }, "dependencies": { "@babel/code-frame": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.0.tgz", - "integrity": "sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.5.tgz", + "integrity": "sha512-Xmwn266vad+6DAqEB2A6V/CcZVp62BbwVmcOJc2RPuwih1kw02TjQvWVWlcKGbBPd+8/0V5DEkOcizRGYsspYQ==", "dev": true, "requires": { - "@babel/highlight": "^7.16.0" + "@babel/highlight": "^7.22.5" } }, "@babel/helper-validator-identifier": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", - "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz", + "integrity": "sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==", "dev": true }, "@babel/highlight": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.0.tgz", - "integrity": "sha512-t8MH41kUQylBtu2+4IQA3atqevA2lRgqA2wyVB/YiWmsDSuylZZuXOUy9ric30hfzauEFfdsuk/eXTRrGrfd0g==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.5.tgz", + "integrity": "sha512-BSKlD1hgnedS5XRnGOljZawtag7H1yPfQp0tdNJCHoH6AZ+Pcm9VvkrK59/Yy593Ypg0zMxH2BxD1VPYUQ7UIw==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.15.7", + "@babel/helper-validator-identifier": "^7.22.5", "chalk": "^2.0.0", "js-tokens": "^4.0.0" }, @@ -11842,19 +12094,19 @@ "color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "dev": true }, "supports-color": { @@ -12821,16 +13073,6 @@ "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", "dev": true }, - "find-up": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", - "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", - "dev": true, - "requires": { - "locate-path": "^7.1.0", - "path-exists": "^5.0.0" - } - }, "glob": { "version": "10.2.7", "resolved": "https://registry.npmjs.org/glob/-/glob-10.2.7.tgz", @@ -12844,15 +13086,6 @@ "path-scurry": "^1.7.0" } }, - "locate-path": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", - "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", - "dev": true, - "requires": { - "p-locate": "^6.0.0" - } - }, "minimatch": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.1.tgz", @@ -12861,59 +13094,6 @@ "requires": { "brace-expansion": "^2.0.1" } - }, - "p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", - "dev": true, - "requires": { - "yocto-queue": "^1.0.0" - } - }, - "p-locate": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", - "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", - "dev": true, - "requires": { - "p-limit": "^4.0.0" - } - }, - "path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", - "dev": true - }, - "read-pkg": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-7.1.0.tgz", - "integrity": "sha512-5iOehe+WF75IccPc30bWTbpdDQLOCc3Uu8bi3Dte3Eueij81yx1Mrufk8qBx/YAbR4uL1FdUr+7BKXDwEtisXg==", - "dev": true, - "requires": { - "@types/normalize-package-data": "^2.4.1", - "normalize-package-data": "^3.0.2", - "parse-json": "^5.2.0", - "type-fest": "^2.0.0" - } - }, - "read-pkg-up": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-9.1.0.tgz", - "integrity": "sha512-vaMRR1AC1nrd5CQM0PhlRsO5oc2AAigqr7cCrZ/MW/Rsaflz4RlgzkpL4qoU/z1F6wrbd85iFv1OQj/y5RdGvg==", - "dev": true, - "requires": { - "find-up": "^6.3.0", - "read-pkg": "^7.1.0", - "type-fest": "^2.5.0" - } - }, - "yocto-queue": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", - "dev": true } } }, @@ -14396,17 +14576,17 @@ "dev": true }, "devtools": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/devtools/-/devtools-8.11.0.tgz", - "integrity": "sha512-j1wXFQyjswJ6doAV1+h4Bxl8+Oeb8SMpWTpBVa0DurGsxfft8sU2OhDlMo5tx/zbX82X5sGyJDMnKHqBJ2XRvQ==", + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/devtools/-/devtools-8.12.1.tgz", + "integrity": "sha512-R72raQLN1lDSqbr2DVj9SRh07JRyojzmrcLa33VBa2nw3cf5ZyHOHe0DgxlJ/5c2Dfs1+wGNJy16gWKGBq+xgg==", "dev": true, "requires": { "@types/node": "^20.1.0", - "@wdio/config": "8.11.0", + "@wdio/config": "8.12.1", "@wdio/logger": "8.11.0", "@wdio/protocols": "8.11.0", "@wdio/types": "8.10.4", - "@wdio/utils": "8.11.0", + "@wdio/utils": "8.12.1", "chrome-launcher": "^0.15.0", "edge-paths": "^3.0.5", "import-meta-resolve": "^3.0.0", @@ -14417,6 +14597,71 @@ "which": "^3.0.0" }, "dependencies": { + "@wdio/config": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.12.1.tgz", + "integrity": "sha512-6DfTU+5Ugg6HKMSqVNCLEgdFd7l+QnaMoDe2/tZ8zoYNdJlFu0NfClXLL4qnTCCjebmz3eu0/O+aRPJyxo6GGQ==", + "dev": true, + "requires": { + "@wdio/logger": "8.11.0", + "@wdio/types": "8.10.4", + "@wdio/utils": "8.12.1", + "decamelize": "^6.0.0", + "deepmerge-ts": "^5.0.0", + "glob": "^10.2.2", + "import-meta-resolve": "^3.0.0", + "read-pkg-up": "^9.1.0" + } + }, + "@wdio/utils": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.12.1.tgz", + "integrity": "sha512-VmF6O++84FTH3AKaVFyqn0MJA65/1G6dbm6p61KBqkD25LxaWo4398lCCbt264hzBIobtXRZoQ87bSxdfnlUKQ==", + "dev": true, + "requires": { + "@wdio/logger": "8.11.0", + "@wdio/types": "8.10.4", + "import-meta-resolve": "^3.0.0", + "p-iteration": "^1.1.8" + } + }, + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "decamelize": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", + "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", + "dev": true + }, + "glob": { + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", + "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", + "dev": true, + "requires": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.0.3", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + } + }, + "minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + }, "which": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/which/-/which-3.0.1.tgz", @@ -14429,9 +14674,9 @@ } }, "devtools-protocol": { - "version": "0.0.1152884", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1152884.tgz", - "integrity": "sha512-9eP6OmCoU1cWArpXLuzyZQcBJ2PkINOh8Nwx8W5i8u6NDigDE5/mPlLLBAfshwn5YVvIz6ZQ9jbs0PZvKGccdQ==", + "version": "0.0.1170846", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1170846.tgz", + "integrity": "sha512-GFZiHgvL4JW7+8hIMQgwYNUaIRRCsqfXd11ZbOTdu2VzDeu0Le4l1c3u4FFRWCSvMg82OFip9k/sYyz4M/PJIA==", "dev": true }, "dir-glob": { @@ -16540,9 +16785,9 @@ } }, "hosted-git-info": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.0.2.tgz", - "integrity": "sha512-c9OGXbZ3guC/xOlCg1Ci/VgWlwsqDv1yMQL1CWqXDL0hDjXuNcq0zuR4xqPSuasI3kqFDhqSyTjREz5gzq0fXg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -17956,9 +18201,9 @@ } }, "node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz", + "integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==", "dev": true, "requires": { "whatwg-url": "^5.0.0" @@ -17967,19 +18212,19 @@ "tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", "dev": true }, "webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", "dev": true }, "whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "dev": true, "requires": { "tr46": "~0.0.3", @@ -18445,19 +18690,19 @@ "dev": true }, "path-scurry": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.7.0.tgz", - "integrity": "sha512-UkZUeDjczjYRE495+9thsgcVgsaCPkaw80slmfVFgllxY+IO8ubTsOpFVjDPROBqJdHfVPUFRHPBV/WciOVfWg==", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", + "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", "dev": true, "requires": { - "lru-cache": "^9.0.0", - "minipass": "^5.0.0" + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "dependencies": { "lru-cache": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-9.0.3.tgz", - "integrity": "sha512-cyjNRew29d4kbgnz1sjDqxg7qg8NW4s+HQzCGjeon7DV5T2yDije16W9HaUFV1dhVEMh+SjrOcK0TomBmf3Egg==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.0.tgz", + "integrity": "sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw==", "dev": true } } @@ -18779,6 +19024,80 @@ "safe-buffer": "^5.1.0" } }, + "read-pkg": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-7.1.0.tgz", + "integrity": "sha512-5iOehe+WF75IccPc30bWTbpdDQLOCc3Uu8bi3Dte3Eueij81yx1Mrufk8qBx/YAbR4uL1FdUr+7BKXDwEtisXg==", + "dev": true, + "requires": { + "@types/normalize-package-data": "^2.4.1", + "normalize-package-data": "^3.0.2", + "parse-json": "^5.2.0", + "type-fest": "^2.0.0" + } + }, + "read-pkg-up": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-9.1.0.tgz", + "integrity": "sha512-vaMRR1AC1nrd5CQM0PhlRsO5oc2AAigqr7cCrZ/MW/Rsaflz4RlgzkpL4qoU/z1F6wrbd85iFv1OQj/y5RdGvg==", + "dev": true, + "requires": { + "find-up": "^6.3.0", + "read-pkg": "^7.1.0", + "type-fest": "^2.5.0" + }, + "dependencies": { + "find-up": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", + "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", + "dev": true, + "requires": { + "locate-path": "^7.1.0", + "path-exists": "^5.0.0" + } + }, + "locate-path": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", + "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", + "dev": true, + "requires": { + "p-locate": "^6.0.0" + } + }, + "p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dev": true, + "requires": { + "yocto-queue": "^1.0.0" + } + }, + "p-locate": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", + "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", + "dev": true, + "requires": { + "p-limit": "^4.0.0" + } + }, + "path-exists": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", + "dev": true + }, + "yocto-queue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "dev": true + } + } + }, "readable-stream": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.4.0.tgz", @@ -20570,18 +20889,18 @@ } }, "webdriver": { - "version": "8.11.1", - "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-8.11.1.tgz", - "integrity": "sha512-hSpUZYzUA65t4DDtKujCHUX6hpFTUleb7lWMcf5xjPz8sxWrK9R8NIw7pXt/GU6PVS331nGAaYkzoXrqz2VB8w==", + "version": "8.13.1", + "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-8.13.1.tgz", + "integrity": "sha512-v6EDyGEtZB8wpqd3kxEDOVU/Z21XY23SObHwoi4xe72sQeVbC8nIR0Y7Ri/gbQMv1bK58YIK01BAf7JmBZAcUw==", "dev": true, "requires": { "@types/node": "^20.1.0", "@types/ws": "^8.5.3", - "@wdio/config": "8.11.0", + "@wdio/config": "8.12.1", "@wdio/logger": "8.11.0", "@wdio/protocols": "8.11.0", "@wdio/types": "8.10.4", - "@wdio/utils": "8.11.0", + "@wdio/utils": "8.12.1", "deepmerge-ts": "^5.0.0", "got": "^ 12.6.1", "ky": "^0.33.0", @@ -20589,9 +20908,9 @@ }, "dependencies": { "@sindresorhus/is": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-5.4.1.tgz", - "integrity": "sha512-axlrvsHlHlFmKKMEg4VyvMzFr93JWJj4eIfXY1STVuO2fsImCa7ncaiG5gC8HKOX590AW5RtRsC41/B+OfrSqw==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-5.6.0.tgz", + "integrity": "sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g==", "dev": true }, "@szmarczak/http-timer": { @@ -20603,6 +20922,43 @@ "defer-to-connect": "^2.0.1" } }, + "@wdio/config": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.12.1.tgz", + "integrity": "sha512-6DfTU+5Ugg6HKMSqVNCLEgdFd7l+QnaMoDe2/tZ8zoYNdJlFu0NfClXLL4qnTCCjebmz3eu0/O+aRPJyxo6GGQ==", + "dev": true, + "requires": { + "@wdio/logger": "8.11.0", + "@wdio/types": "8.10.4", + "@wdio/utils": "8.12.1", + "decamelize": "^6.0.0", + "deepmerge-ts": "^5.0.0", + "glob": "^10.2.2", + "import-meta-resolve": "^3.0.0", + "read-pkg-up": "^9.1.0" + } + }, + "@wdio/utils": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.12.1.tgz", + "integrity": "sha512-VmF6O++84FTH3AKaVFyqn0MJA65/1G6dbm6p61KBqkD25LxaWo4398lCCbt264hzBIobtXRZoQ87bSxdfnlUKQ==", + "dev": true, + "requires": { + "@wdio/logger": "8.11.0", + "@wdio/types": "8.10.4", + "import-meta-resolve": "^3.0.0", + "p-iteration": "^1.1.8" + } + }, + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, "cacheable-lookup": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz", @@ -20610,9 +20966,9 @@ "dev": true }, "cacheable-request": { - "version": "10.2.10", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.10.tgz", - "integrity": "sha512-v6WB+Epm/qO4Hdlio/sfUn69r5Shgh39SsE9DSd4bIezP0mblOlObI+I0kUEM7J0JFc+I7pSeMeYaOYtX1N/VQ==", + "version": "10.2.12", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-10.2.12.tgz", + "integrity": "sha512-qtWGB5kn2OLjx47pYUkWicyOpK1vy9XZhq8yRTXOy+KAmjjESSRLx6SiExnnaGGUP1NM6/vmygMu0fGylNh9tw==", "dev": true, "requires": { "@types/http-cache-semantics": "^4.0.1", @@ -20624,12 +20980,31 @@ "responselike": "^3.0.0" } }, + "decamelize": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", + "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", + "dev": true + }, "get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", "dev": true }, + "glob": { + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", + "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", + "dev": true, + "requires": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.0.3", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + } + }, "got": { "version": "12.6.1", "resolved": "https://registry.npmjs.org/got/-/got-12.6.1.tgz", @@ -20671,6 +21046,15 @@ "integrity": "sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg==", "dev": true }, + "minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + }, "normalize-url": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.0.0.tgz", @@ -20695,24 +21079,24 @@ } }, "webdriverio": { - "version": "8.11.2", - "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-8.11.2.tgz", - "integrity": "sha512-e/9WkdNTfWeoaSo2UzK0Giec/nQX3i7U9J8esimhozH/EpwSqIaEJ2pRRlxRVafEhe2OBG1QDhnLnDjdCC5Hxg==", + "version": "8.13.10", + "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-8.13.10.tgz", + "integrity": "sha512-pDcGPTOfr6TdSXudPDdpjd9xLxkzPHT8tTWimTXArecxtTaoXFDA3nwJWsVNp+QAT57fmrSeszgNfNZeu7F72Q==", "dev": true, "requires": { "@types/node": "^20.1.0", - "@wdio/config": "8.11.0", + "@wdio/config": "8.12.1", "@wdio/logger": "8.11.0", "@wdio/protocols": "8.11.0", "@wdio/repl": "8.10.1", "@wdio/types": "8.10.4", - "@wdio/utils": "8.11.0", + "@wdio/utils": "8.12.1", "archiver": "^5.0.0", "aria-query": "^5.0.0", "css-shorthand-properties": "^1.1.1", "css-value": "^0.0.1", - "devtools": "8.11.0", - "devtools-protocol": "^0.0.1152884", + "devtools": "8.12.1", + "devtools-protocol": "^0.0.1170846", "grapheme-splitter": "^1.0.2", "import-meta-resolve": "^3.0.0", "is-plain-obj": "^4.1.0", @@ -20724,9 +21108,37 @@ "resq": "^1.9.1", "rgb2hex": "0.2.5", "serialize-error": "^8.0.0", - "webdriver": "8.11.1" + "webdriver": "8.13.1" }, "dependencies": { + "@wdio/config": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.12.1.tgz", + "integrity": "sha512-6DfTU+5Ugg6HKMSqVNCLEgdFd7l+QnaMoDe2/tZ8zoYNdJlFu0NfClXLL4qnTCCjebmz3eu0/O+aRPJyxo6GGQ==", + "dev": true, + "requires": { + "@wdio/logger": "8.11.0", + "@wdio/types": "8.10.4", + "@wdio/utils": "8.12.1", + "decamelize": "^6.0.0", + "deepmerge-ts": "^5.0.0", + "glob": "^10.2.2", + "import-meta-resolve": "^3.0.0", + "read-pkg-up": "^9.1.0" + } + }, + "@wdio/utils": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.12.1.tgz", + "integrity": "sha512-VmF6O++84FTH3AKaVFyqn0MJA65/1G6dbm6p61KBqkD25LxaWo4398lCCbt264hzBIobtXRZoQ87bSxdfnlUKQ==", + "dev": true, + "requires": { + "@wdio/logger": "8.11.0", + "@wdio/types": "8.10.4", + "import-meta-resolve": "^3.0.0", + "p-iteration": "^1.1.8" + } + }, "brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -20736,6 +21148,25 @@ "balanced-match": "^1.0.0" } }, + "decamelize": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-6.0.0.tgz", + "integrity": "sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==", + "dev": true + }, + "glob": { + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", + "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", + "dev": true, + "requires": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.0.3", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + } + }, "is-plain-obj": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", @@ -20743,9 +21174,9 @@ "dev": true }, "minimatch": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.0.tgz", - "integrity": "sha512-0jJj8AvgKqWN05mrwuqi8QYKx1WmYSUoKSxu5Qhs9prezTz10sxAHGNZe9J9cqIJzta8DWsleh2KaVaLl6Ru2w==", + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", "dev": true, "requires": { "brace-expansion": "^2.0.1" From 435e854b8e523c422e98a668dfa599e0aaefb125 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Wed, 26 Jul 2023 14:01:19 -0700 Subject: [PATCH 37/58] fix: make deserialization use the new render management system (#7306) * fix: make JSON use render queue * fix: updating disabled for JSON system * fix: make XML use render queue * chore: make flyout use render queue explicitly --- core/connection.ts | 2 +- core/contextmenu.ts | 2 +- core/flyout_base.ts | 10 ++++++++-- core/serialization/blocks.ts | 9 +++++++-- core/workspace_svg.ts | 2 +- core/xml.ts | 33 ++++++++++++++++++++++++++++----- tests/mocha/flyout_test.js | 3 ++- 7 files changed, 48 insertions(+), 13 deletions(-) diff --git a/core/connection.ts b/core/connection.ts index 5dd8f06b90f..7fc403073eb 100644 --- a/core/connection.ts +++ b/core/connection.ts @@ -651,7 +651,7 @@ export class Connection implements IASTNodeLocationWithBlock { } if (shadowDom) { - blockShadow = Xml.domToBlock(shadowDom, parentBlock.workspace); + blockShadow = Xml.domToBlockInternal(shadowDom, parentBlock.workspace); if (attemptToConnect) { if (this.type === ConnectionType.INPUT_VALUE) { if (!blockShadow.outputConnection) { diff --git a/core/contextmenu.ts b/core/contextmenu.ts index 5a0c159433c..b7e107e017e 100644 --- a/core/contextmenu.ts +++ b/core/contextmenu.ts @@ -235,7 +235,7 @@ export function callbackFactory(block: Block, xml: Element): () => void { eventUtils.disable(); let newBlock; try { - newBlock = Xml.domToBlock(xml, block.workspace!) as BlockSvg; + newBlock = Xml.domToBlockInternal(xml, block.workspace!) as BlockSvg; // Move the new block next to the old block. const xy = block.getRelativeToSurfaceXY(); if (block.RTL) { diff --git a/core/flyout_base.ts b/core/flyout_base.ts index e523c91a4c4..4a6dfb2b91f 100644 --- a/core/flyout_base.ts +++ b/core/flyout_base.ts @@ -36,6 +36,7 @@ import * as Variables from './variables.js'; import {WorkspaceSvg} from './workspace_svg.js'; import * as utilsXml from './utils/xml.js'; import * as Xml from './xml.js'; +import * as renderManagement from './render_management.js'; enum FlyoutItemType { BLOCK = 'block', @@ -626,6 +627,8 @@ export abstract class Flyout extends DeleteArea implements IFlyout { const parsedContent = toolbox.convertFlyoutDefToJsonArray(flyoutDef); const flyoutInfo = this.createFlyoutInfo(parsedContent); + renderManagement.triggerQueuedRenders(); + this.layout_(flyoutInfo.contents, flyoutInfo.gaps); if (this.horizontalLayout) { @@ -770,7 +773,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { ) as Element; block = this.getRecycledBlock(xml.getAttribute('type')!); if (!block) { - block = Xml.domToBlock(xml, this.workspace_); + block = Xml.domToBlockInternal(xml, this.workspace_); } } else { block = this.getRecycledBlock(blockInfo['type']!); @@ -779,7 +782,10 @@ export abstract class Flyout extends DeleteArea implements IFlyout { blockInfo['enabled'] = blockInfo['disabled'] !== 'true' && blockInfo['disabled'] !== true; } - block = blocks.append(blockInfo as blocks.State, this.workspace_); + block = blocks.appendInternal( + blockInfo as blocks.State, + this.workspace_ + ); } } diff --git a/core/serialization/blocks.ts b/core/serialization/blocks.ts index 194792ff668..c9c6395acf1 100644 --- a/core/serialization/blocks.ts +++ b/core/serialization/blocks.ts @@ -18,6 +18,7 @@ import * as registry from '../registry.js'; import * as utilsXml from '../utils/xml.js'; import type {Workspace} from '../workspace.js'; import * as Xml from '../xml.js'; +import * as renderManagement from '../render_management.js'; import { BadConnectionCheck, @@ -349,7 +350,9 @@ export function append( workspace: Workspace, {recordUndo = false}: {recordUndo?: boolean} = {}, ): Block { - return appendInternal(state, workspace, {recordUndo}); + const block = appendInternal(state, workspace, {recordUndo}); + if (workspace.rendered) renderManagement.triggerQueuedRenders(); + return block; } /** @@ -701,7 +704,9 @@ function initBlock(block: Block, rendered: boolean) { blockSvg.setConnectionTracking(false); blockSvg.initSvg(); - blockSvg.render(false); + blockSvg.queueRender(); + blockSvg.updateDisabled(); + // fixes #6076 JSO deserialization doesn't // set .iconXY_ property so here it will be set for (const icon of blockSvg.getIcons()) { diff --git a/core/workspace_svg.ts b/core/workspace_svg.ts index 0b7b7bb4a42..b426d278748 100644 --- a/core/workspace_svg.ts +++ b/core/workspace_svg.ts @@ -1349,7 +1349,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { let blockX = 0; let blockY = 0; if (xmlBlock) { - block = Xml.domToBlock(xmlBlock, this) as BlockSvg; + block = Xml.domToBlockInternal(xmlBlock, this) as BlockSvg; blockX = parseInt(xmlBlock.getAttribute('x') ?? '0'); if (this.RTL) { blockX = -blockX; diff --git a/core/xml.ts b/core/xml.ts index 1dc2d186277..8aeb9fb541a 100644 --- a/core/xml.ts +++ b/core/xml.ts @@ -23,6 +23,7 @@ import type {Workspace} from './workspace.js'; import {WorkspaceComment} from './workspace_comment.js'; import {WorkspaceCommentSvg} from './workspace_comment_svg.js'; import type {WorkspaceSvg} from './workspace_svg.js'; +import * as renderManagement from './render_management.js'; /** * Encode a block tree as XML. @@ -430,7 +431,7 @@ export function domToWorkspace(xml: Element, workspace: Workspace): string[] { // Allow top-level shadow blocks if recordUndo is disabled since // that means an undo is in progress. Such a block is expected // to be moved to a nested destination in the next operation. - const block = domToBlock(xmlChildElement, workspace); + const block = domToBlockInternal(xmlChildElement, workspace); newBlockIds.push(block.id); const blockX = parseInt(xmlChildElement.getAttribute('x') ?? '10', 10); const blockY = parseInt(xmlChildElement.getAttribute('y') ?? '10', 10); @@ -467,12 +468,13 @@ export function domToWorkspace(xml: Element, workspace: Workspace): string[] { } } finally { eventUtils.setGroup(existingGroup); + if ((workspace as WorkspaceSvg).setResizesEnabled) { + (workspace as WorkspaceSvg).setResizesEnabled(true); + } + if (workspace.rendered) renderManagement.triggerQueuedRenders(); dom.stopTextWidthCache(); } // Re-enable workspace resizing. - if ((workspace as WorkspaceSvg).setResizesEnabled) { - (workspace as WorkspaceSvg).setResizesEnabled(true); - } eventUtils.fire(new (eventUtils.get(eventUtils.FINISHED_LOADING))(workspace)); return newBlockIds; } @@ -545,6 +547,27 @@ export function appendDomToWorkspace( * @returns The root block created. */ export function domToBlock(xmlBlock: Element, workspace: Workspace): Block { + const block = domToBlockInternal(xmlBlock, workspace); + if (workspace.rendered) renderManagement.triggerQueuedRenders(); + return block; +} + +/** + * Decode an XML block tag and create a block (and possibly sub blocks) on the + * workspace. + * + * This is defined internally so that it doesn't trigger an immediate render, + * which we do want to happen for external calls. + * + * @param xmlBlock XML block element. + * @param workspace The workspace. + * @returns The root block created. + * @internal + */ +export function domToBlockInternal( + xmlBlock: Element, + workspace: Workspace +): Block { // Create top-level block. eventUtils.disable(); const variablesBeforeCreation = workspace.getAllVariables(); @@ -561,7 +584,7 @@ export function domToBlock(xmlBlock: Element, workspace: Workspace): Block { (blocks[i] as BlockSvg).initSvg(); } for (let i = blocks.length - 1; i >= 0; i--) { - (blocks[i] as BlockSvg).render(false); + (blocks[i] as BlockSvg).queueRender(); } // Populating the connection database may be deferred until after the // blocks have rendered. diff --git a/tests/mocha/flyout_test.js b/tests/mocha/flyout_test.js index 18b512b5d36..3c38d2552b2 100644 --- a/tests/mocha/flyout_test.js +++ b/tests/mocha/flyout_test.js @@ -27,7 +27,7 @@ import { suite('Flyout', function () { setup(function () { - sharedTestSetup.call(this); + this.clock = sharedTestSetup.call(this, {fireEventsNow: false}).clock; Blockly.defineBlocksWithJsonArray([ { 'type': 'basic_block', @@ -48,6 +48,7 @@ suite('Flyout', function () { }); teardown(function () { + this.clock.runAll(); sharedTestTeardown.call(this); }); From c8be2f25389cdc37de5abdd155c9d423cadd465d Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Wed, 26 Jul 2023 14:52:10 -0700 Subject: [PATCH 38/58] fix: make insertion markers use new render management system (#7307) --- core/insertion_marker_manager.ts | 22 +++++++++++----------- core/workspace_svg.ts | 7 +++++-- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/core/insertion_marker_manager.ts b/core/insertion_marker_manager.ts index 660cc0611f4..48be15c147d 100644 --- a/core/insertion_marker_manager.ts +++ b/core/insertion_marker_manager.ts @@ -25,6 +25,7 @@ import type {IDragTarget} from './interfaces/i_drag_target.js'; import type {RenderedConnection} from './rendered_connection.js'; import type {Coordinate} from './utils/coordinate.js'; import type {WorkspaceSvg} from './workspace_svg.js'; +import * as renderManagement from './render_management.js'; /** Represents a nearby valid connection. */ interface CandidateConnection { @@ -608,18 +609,17 @@ export class InsertionMarkerManager { // Render disconnected from everything else so that we have a valid // connection location. - insertionMarker.render(); - insertionMarker.rendered = true; - insertionMarker.getSvgRoot().setAttribute('visibility', 'visible'); + insertionMarker.queueRender(); + renderManagement.triggerQueuedRenders(); - if (imConn && closest) { - // Position so that the existing block doesn't move. - insertionMarker.positionNearConnection(imConn, closest); - } - if (closest) { - // Connect() also renders the insertion marker. - imConn.connect(closest); - } + // Position so that the existing block doesn't move. + insertionMarker.positionNearConnection(imConn, closest); + // Connect() also renders the insertion marker. + imConn.connect(closest); + + renderManagement.finishQueuedRenders().then(() => { + insertionMarker?.getSvgRoot().setAttribute('visibility', 'visible'); + }); this.markerConnection = imConn; } diff --git a/core/workspace_svg.ts b/core/workspace_svg.ts index b426d278748..86bfec5ea80 100644 --- a/core/workspace_svg.ts +++ b/core/workspace_svg.ts @@ -77,6 +77,7 @@ import {WorkspaceCommentSvg} from './workspace_comment_svg.js'; import * as Xml from './xml.js'; import {ZoomControls} from './zoom_controls.js'; import {ContextMenuOption} from './contextmenu_registry.js'; +import * as renderManagement from './render_management.js'; /** Margin around the top/bottom/left/right after a zoomToFit call. */ const ZOOM_TO_FIT_MARGIN = 20; @@ -1251,11 +1252,13 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { if (this.currentGesture_) { const imList = this.currentGesture_.getInsertionMarkers(); for (let i = 0; i < imList.length; i++) { - imList[i].render(false); + imList[i].queueRender(); } } - this.markerManager.updateMarkers(); + renderManagement + .finishQueuedRenders() + .then(() => void this.markerManager.updateMarkers()); } /** From 734b687f40f4f26de2e63c3f68c61d33b5b1f76f Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Wed, 26 Jul 2023 18:03:42 -0700 Subject: [PATCH 39/58] chore(tests): Update RTL tests and misc improvements to helpers (#7293) * chore(tests): make switch to rtl wait before continuing * chore: use browser.pause * chore: fix documentation * chore: format * fix: missing await --- core/flyout_base.ts | 2 +- core/xml.ts | 2 +- tests/browser/test/basic_playground_test.js | 2 +- tests/browser/test/field_edits_test.js | 2 +- tests/browser/test/test_setup.js | 22 +++++++-------------- 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/core/flyout_base.ts b/core/flyout_base.ts index 4a6dfb2b91f..e9797df4ff9 100644 --- a/core/flyout_base.ts +++ b/core/flyout_base.ts @@ -784,7 +784,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { } block = blocks.appendInternal( blockInfo as blocks.State, - this.workspace_ + this.workspace_, ); } } diff --git a/core/xml.ts b/core/xml.ts index 8aeb9fb541a..b74e6e71964 100644 --- a/core/xml.ts +++ b/core/xml.ts @@ -566,7 +566,7 @@ export function domToBlock(xmlBlock: Element, workspace: Workspace): Block { */ export function domToBlockInternal( xmlBlock: Element, - workspace: Workspace + workspace: Workspace, ): Block { // Create top-level block. eventUtils.disable(); diff --git a/tests/browser/test/basic_playground_test.js b/tests/browser/test/basic_playground_test.js index 8bed7dd6c99..9f0e320ac2f 100644 --- a/tests/browser/test/basic_playground_test.js +++ b/tests/browser/test/basic_playground_test.js @@ -53,7 +53,7 @@ suite('Testing Connecting Blocks', function () { '#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, 200)); + await this.browser.pause(200); const blockOnWorkspace = await this.browser.execute(() => { const newBlock = Blockly.getMainWorkspace().getAllBlocks(false)[0]; if (newBlock.id) { diff --git a/tests/browser/test/field_edits_test.js b/tests/browser/test/field_edits_test.js index 52e6ca60dcb..925347779a6 100644 --- a/tests/browser/test/field_edits_test.js +++ b/tests/browser/test/field_edits_test.js @@ -33,7 +33,7 @@ suite('Testing Field Edits', function (done) { }); test('Testing Field Edits RTL', async function () { - switchRTL(this.browser); + await switchRTL(this.browser); await testFieldEdits(this.browser, screenDirection.RTL); }); }); diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index 87af399748e..386c94b4df8 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -148,18 +148,10 @@ async function getBlockElementById(browser, id) { * @throws If the category cannot be found. */ async function getCategory(browser, categoryName) { - const categories = await browser.$$('.blocklyTreeLabel'); - - let category; - for (const c of categories) { - const text = await c.getText(); - if (text === categoryName) { - category = c; - } - } - if (!category) throw Error(); + const category = browser.$(`.blocklyToolboxCategory*=${categoryName}`); + category.waitForExist(); - return category; + return await category; } /** @@ -171,7 +163,7 @@ async function getCategory(browser, categoryName) { */ async function getNthBlockOfCategory(browser, categoryName, n) { const category = await getCategory(browser, categoryName); - category.click(); + await category.click(); await browser.pause(100); const block = await browser.$( `.blocklyFlyout .blocklyBlockCanvas > g:nth-child(${3 + n * 2})`, @@ -190,8 +182,7 @@ async function getNthBlockOfCategory(browser, categoryName, n) { async function getBlockTypeFromCategory(browser, categoryName, blockType) { if (categoryName) { const category = await getCategory(browser, categoryName); - category.click(); - await browser.pause(100); + await category.click(); } const id = await browser.execute((blockType) => { @@ -312,6 +303,7 @@ async function connect( async function switchRTL(browser) { const ltrForm = await browser.$('#options > select:nth-child(1)'); await ltrForm.selectByIndex(1); + await browser.pause(500); } /** @@ -379,9 +371,9 @@ async function contextMenuSelect(browser, block, itemText) { const yOffset = -Math.round(blockHeight * 0.5) + 10; await block.click({button: 2, x: xOffset, y: yOffset}); - await browser.pause(100); const item = await browser.$(`div=${itemText}`); + await item.waitForExist(); await item.click(); await browser.pause(100); From 5151889f13a960fdfc36851c19ee823431170640 Mon Sep 17 00:00:00 2001 From: ericblackmonGoogle <129398736+ericblackmonGoogle@users.noreply.github.com> Date: Thu, 27 Jul 2023 15:34:42 +0000 Subject: [PATCH 40/58] chore: create test for mutator (#7278) * chore: create mutator test * chore: create test for undo block movements and editing a field * chore: create test for mutator * chore: creating test for mutator * chore: create test for undo block movements and editing a field * chore: create mutator test * chore: create mutator test * chore: create mutator test * chore: create mutator test * chore: create mutator test --- tests/browser/test/mutator_test.js | 96 ++++++++++++++++++++++++++++++ tests/browser/test/test_setup.js | 70 +++++++++++++++++----- 2 files changed, 151 insertions(+), 15 deletions(-) create mode 100644 tests/browser/test/mutator_test.js diff --git a/tests/browser/test/mutator_test.js b/tests/browser/test/mutator_test.js new file mode 100644 index 00000000000..f4f4b20154c --- /dev/null +++ b/tests/browser/test/mutator_test.js @@ -0,0 +1,96 @@ +/** + * @license + * Copyright 2023 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Node.js script to run Automated tests in Chrome, via webdriver. + */ + +const chai = require('chai'); +const { + testSetup, + testFileLocations, + connect, + switchRTL, + dragBlockTypeFromFlyout, + getSelectedBlockId, + screenDirection, +} = require('./test_setup'); + +suite('This tests mutating a Blockly block', function (done) { + // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test + this.timeout(0); + + // Setup Selenium for all of the tests + suiteSetup(async function () { + this.browser = await testSetup(testFileLocations.PLAYGROUND); + }); + + test('This test mutating a block creates more inputs', async function () { + await testingMutator(this.browser, screenDirection.LTR); + }); +}); + +async function testingMutator(browser, delta) { + // Drag out print from flyout. + const controlIfFlyout = await dragBlockTypeFromFlyout( + browser, + 'Logic', + 'controls_if', + delta * 50, + 50, + ); + // Click on the mutator and drag out else ig block + const mutatorWheel = await browser.$( + '#blocklyDiv > div > svg.blocklySvg > g > g.blocklyBlockCanvas > g.blocklyDraggable.blocklySelected > g.blocklyIconGroup', + ); + await mutatorWheel.click(); + await browser.pause(100); + const elseIfFlyout = await browser.$( + '#blocklyDiv > div > svg.blocklySvg > g > g.blocklyBubbleCanvas > g > g:nth-child(2) > svg:nth-child(1) > g > g.blocklyFlyout > g > g.blocklyBlockCanvas > g:nth-child(3)', + ); + await elseIfFlyout.dragAndDrop({x: delta * 50, y: 42}); + await browser.pause(100); + + await browser.pause(100); + // Get the ids for the blocks in the mutator + const blockIds = await browser.execute(() => { + const mutatorBlock = Blockly.getMainWorkspace().getAllBlocks()[0]; + // Adding the first element in the array is the original block id, the second is the first mutator block, and the third is the second mutator block + const blockIds = [ + mutatorBlock.id, + mutatorBlock.mutator.getWorkspace().getAllBlocks()[0].id, + mutatorBlock.mutator.getWorkspace().getAllBlocks()[1].id, + ]; + return blockIds; + }); + + // The flyout block and the workspace block have the same id, so to get around that I pass in the selector to the connect function + const dragBlockSelector = await browser.$( + '#blocklyDiv > div > svg.blocklySvg > g > g.blocklyBubbleCanvas > g > g:nth-child(2) > svg:nth-child(1) > g > g.blocklyBlockCanvas > g.blocklyDraggable', + ); + // For some reason this needs a lot more time + await browser.pause(2000); + // Connect the mutator blocks + await connect( + browser, + blockIds[2], + 'PREVIOUS', + blockIds[1], + 'NEXT', + blockIds[0], + dragBlockSelector, + ); + await browser.pause(200); + + // Get the ids for block after mutating + const afterInputs = await browser.execute(() => { + const afterInputs = + Blockly.getMainWorkspace().getAllBlocks()[0].inputList.length; + return afterInputs; + }); + + chai.assert.equal(afterInputs, 4); +} diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index 386c94b4df8..9376db984f2 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -220,13 +220,27 @@ async function getBlockTypeFromWorkspace(browser, blockType, position) { * @param connectionName Which connection to return. An input name to * get a value or statement connection, and otherwise the type of * the connection. + * @param mutatorBlockId The block that holds the mutator icon or null if the target block is on the main workspace * @return A Promise that resolves to the location of the specific * connection in screen coordinates. */ -async function getLocationOfBlockConnection(browser, id, connectionName) { +async function getLocationOfBlockConnection( + browser, + id, + connectionName, + mutatorBlockId, +) { return await browser.execute( - (id, connectionName) => { - const block = Blockly.getMainWorkspace().getBlockById(id); + (id, connectionName, mutatorBlockId) => { + let block; + if (mutatorBlockId) { + block = Blockly.getMainWorkspace() + .getBlockById(mutatorBlockId) + .mutator.getWorkspace() + .getBlockById(id); + } else { + block = Blockly.getMainWorkspace().getBlockById(id); + } let connection; switch (connectionName) { @@ -255,6 +269,7 @@ async function getLocationOfBlockConnection(browser, id, connectionName) { }, id, connectionName, + mutatorBlockId, ); } @@ -266,6 +281,8 @@ async function getLocationOfBlockConnection(browser, id, connectionName) { * @param draggedConnection The active connection on the block being dragged. * @param targetBlock The block to drag to. * @param targetConnection The connection to connect to on the target block. + * @param mutatorBlockId The block that holds the mutator icon or null if the target block is on the main workspace + * @param dragBlockSelector The selector of the block to drag * @return A Promise that resolves when the actions are completed. */ async function connect( @@ -274,24 +291,47 @@ async function connect( draggedConnection, targetBlock, targetConnection, + mutatorBlockId, + dragBlockSelector, ) { - const draggedLocation = await getLocationOfBlockConnection( - browser, - draggedBlock.id, - draggedConnection, - ); - const targetLocation = await getLocationOfBlockConnection( - browser, - targetBlock.id, - targetConnection, - ); + let draggedLocation; + let targetLocation; + + if (mutatorBlockId) { + draggedLocation = await getLocationOfBlockConnection( + browser, + draggedBlock, + draggedConnection, + mutatorBlockId, + ); + targetLocation = await getLocationOfBlockConnection( + browser, + targetBlock, + targetConnection, + mutatorBlockId, + ); + } else { + draggedLocation = await getLocationOfBlockConnection( + browser, + draggedBlock.id, + draggedConnection, + ); + targetLocation = await getLocationOfBlockConnection( + browser, + targetBlock.id, + targetConnection, + ); + } const delta = { x: targetLocation.x - draggedLocation.x, y: targetLocation.y - draggedLocation.y, }; - await draggedBlock.dragAndDrop(delta); - await browser.pause(200); + if (mutatorBlockId) { + await dragBlockSelector.dragAndDrop(delta); + } else { + await draggedBlock.dragAndDrop(delta); + } } /** From 7118dd3e4fb0e0ec23823b4e832b01e0bb948a70 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Thu, 27 Jul 2023 16:08:45 -0700 Subject: [PATCH 41/58] chore: remove old render management system (#7308) --- core/block_svg.ts | 46 ++++++++----------------------------------- core/workspace_svg.ts | 23 ++++++++++------------ 2 files changed, 18 insertions(+), 51 deletions(-) diff --git a/core/block_svg.ts b/core/block_svg.ts index ebcf2bb2595..e4053de0a9c 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -1549,44 +1549,14 @@ export class BlockSvg * Immediately lays out and reflows a block based on its contents and * settings. * - * @param opt_bubble If false, just render this block. - * If true, also render block's parent, grandparent, etc. Defaults to true. - */ - render(opt_bubble?: boolean) { - if (this.renderIsInProgress_) { - return; // Don't allow recursive renders. - } - this.renderIsInProgress_ = true; - try { - this.rendered = true; - dom.startTextWidthCache(); - - if (!this.isEnabled()) { - // Apply disabled styles if needed. - this.updateDisabled(); - } - - if (this.isCollapsed()) { - this.updateCollapsed_(); - } - this.workspace.getRenderer().render(this); - this.updateConnectionAndIconLocations(); - - if (opt_bubble !== false) { - const parentBlock = this.getParent(); - if (parentBlock) { - parentBlock.render(true); - } else { - // Top-most block. Fire an event to allow scrollbars to resize. - this.workspace.resizeContents(); - } - } - - dom.stopTextWidthCache(); - this.updateMarkers_(); - } finally { - this.renderIsInProgress_ = false; - } + * @deprecated Renders are triggered automatically when the block is modified + * (e.g. fields are modified or inputs are added). Any calls to render() + * are no longer necessary. To be removed in v11. + */ + render() { + deprecation.warn('Blockly.BlockSvg.prototype.render', 'v10', 'v11'); + this.queueRender(); + renderManagement.triggerQueuedRenders(); } /** diff --git a/core/workspace_svg.ts b/core/workspace_svg.ts index 86bfec5ea80..01888e55f69 100644 --- a/core/workspace_svg.ts +++ b/core/workspace_svg.ts @@ -78,6 +78,7 @@ import * as Xml from './xml.js'; import {ZoomControls} from './zoom_controls.js'; import {ContextMenuOption} from './contextmenu_registry.js'; import * as renderManagement from './render_management.js'; +import * as deprecation from './utils/deprecation.js'; /** Margin around the top/bottom/left/right after a zoomToFit call. */ const ZOOM_TO_FIT_MARGIN = 20; @@ -1224,24 +1225,20 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { // Currently does not support toolboxes in mutators. this.toolbox_.setVisible(isVisible); } - if (isVisible) { - const blocks = this.getAllBlocks(false); - // Tell each block on the workspace to mark its fields as dirty. - for (let i = blocks.length - 1; i >= 0; i--) { - blocks[i].markDirty(); - } - - this.render(); - if (this.toolbox_) { - this.toolbox_.position(); - } - } else { + if (!isVisible) { this.hideChaff(true); } } - /** Render all blocks in workspace. */ + /** + * Render all blocks in workspace. + * + * @deprecated Renders are triggered automatically when the block is modified + * (e.g. fields are modified or inputs are added). Any calls to render() + * are no longer necessary. To be removed in v11. + */ render() { + deprecation.warn('Blockly.WorkspaceSvg.prototype.render', 'v10', 'v11'); // Generate list of all blocks. const blocks = this.getAllBlocks(false); // Render each block. From 9dc293b76256596afe7c616eb26ee62f8babcd37 Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Thu, 27 Jul 2023 17:12:13 -0700 Subject: [PATCH 42/58] chore(tests): add basic delete tests (#7285) * chore(tests): add basic delete tests * chore: fixes from rebase, comments, and format --- tests/browser/test/delete_blocks_test.js | 223 +++++++++++++++++++++++ 1 file changed, 223 insertions(+) create mode 100644 tests/browser/test/delete_blocks_test.js diff --git a/tests/browser/test/delete_blocks_test.js b/tests/browser/test/delete_blocks_test.js new file mode 100644 index 00000000000..921ac9782fd --- /dev/null +++ b/tests/browser/test/delete_blocks_test.js @@ -0,0 +1,223 @@ +/** + * @license + * Copyright 2023 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +const chai = require('chai'); +const { + testSetup, + testFileLocations, + getAllBlocks, + getBlockElementById, + contextMenuSelect, +} = require('./test_setup'); +const {Key} = require('webdriverio'); + +const firstBlockId = 'root_block'; +const startBlocks = { + blocks: { + languageVersion: 0, + blocks: [ + { + type: 'text_print', + id: firstBlockId, + x: 63, + y: 88, + inputs: { + TEXT: { + shadow: { + type: 'text', + id: 'text_shadow', + fields: { + TEXT: '1', + }, + }, + }, + }, + next: { + block: { + type: 'text_print', + id: 'second_block', + inputs: { + TEXT: { + shadow: { + type: 'text', + id: 'second_text_shadow', + fields: { + TEXT: '2', + }, + }, + block: { + type: 'text_trim', + id: 'trim_block', + fields: { + MODE: 'BOTH', + }, + inputs: { + TEXT: { + shadow: { + type: 'text', + id: 'text_to_trim_shadow', + fields: { + TEXT: 'abc', + }, + }, + block: { + type: 'text', + id: 'text_to_trim_real', + fields: { + TEXT: 'hello', + }, + }, + }, + }, + }, + }, + }, + next: { + block: { + type: 'text_print', + id: 'third_block', + inputs: { + TEXT: { + shadow: { + type: 'text', + id: 'third_text_shadow', + fields: { + TEXT: '3', + }, + }, + }, + }, + }, + }, + }, + }, + }, + ], + }, +}; +const pauseLength = 20; + +suite('Delete blocks', function (done) { + // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test + this.timeout(0); + + // Setup Selenium for all of the tests + suiteSetup(async function () { + this.browser = await testSetup(testFileLocations.PLAYGROUND); + }); + + // Clear the workspace and load the start blocks before each test + setup(async function () { + await this.browser.execute(() => { + // Clear the workspace manually so we can ensure it's clear before moving on to the next test. + Blockly.getMainWorkspace().clear(); + }); + // Wait for the workspace to be cleared of blocks (no blocks found on main workspace) + await this.browser + .$( + '.blocklySvg .blocklyWorkspace > .blocklyBlockCanvas > .blocklyDraggable', + ) + .waitForExist({timeout: 2000, reverse: true}); + + // Load the start blocks + await this.browser.execute((blocks) => { + Blockly.serialization.workspaces.load(blocks, Blockly.getMainWorkspace()); + }, startBlocks); + // Wait for there to be a block on the main workspace before continuing + (await getBlockElementById(this.browser, firstBlockId)).waitForExist({ + timeout: 2000, + }); + }); + + test('Delete block using backspace key', async function () { + const before = (await getAllBlocks(this.browser)).length; + // Get first print block, click to select it, and delete it using backspace key. + const block = (await getBlockElementById(this.browser, firstBlockId)).$( + '.blocklyPath', + ); + await block.click(); + await this.browser.keys([Key.Backspace]); + const after = (await getAllBlocks(this.browser)).length; + chai.assert.equal( + before - 2, + after, + 'Expected there to be two fewer blocks after deletion of block and shadow', + ); + }); + + test('Delete block using delete key', async function () { + const before = (await getAllBlocks(this.browser)).length; + // Get first print block, click to select it, and delete it using delete key. + const block = (await getBlockElementById(this.browser, firstBlockId)).$( + '.blocklyPath', + ); + await block.click(); + await this.browser.keys([Key.Delete]); + const after = (await getAllBlocks(this.browser)).length; + chai.assert.equal( + before - 2, + after, + 'Expected there to be two fewer blocks after deletion of block and shadow', + ); + }); + + test('Delete block using context menu', async function () { + const before = (await getAllBlocks(this.browser)).length; + // Get first print block, click to select it, and delete it using context menu. + const block = (await getBlockElementById(this.browser, firstBlockId)).$( + '.blocklyPath', + ); + await contextMenuSelect(this.browser, block, 'Delete 2 Blocks'); + const after = (await getAllBlocks(this.browser)).length; + chai.assert.equal( + before - 2, + after, + 'Expected there to be two fewer blocks after deletion of block and shadow', + ); + }); + + test('Undo block deletion', async function () { + const before = (await getAllBlocks(this.browser)).length; + // Get first print block, click to select it, and delete it using backspace key. + const block = (await getBlockElementById(this.browser, firstBlockId)).$( + '.blocklyPath', + ); + await block.click(); + await this.browser.keys([Key.Backspace]); + await this.browser.pause(pauseLength); + // Undo + await this.browser.keys([Key.Ctrl, 'Z']); + const after = (await getAllBlocks(this.browser)).length; + chai.assert.equal( + before, + after, + 'Expected there to be the original number of blocks after undoing a delete', + ); + }); + + test('Redo block deletion', async function () { + const before = (await getAllBlocks(this.browser)).length; + // Get first print block, click to select it, and delete it using backspace key. + const block = (await getBlockElementById(this.browser, firstBlockId)).$( + '.blocklyPath', + ); + await block.click(); + await this.browser.keys([Key.Backspace]); + await this.browser.pause(pauseLength); + // Undo + await this.browser.keys([Key.Ctrl, 'Z']); + await this.browser.pause(pauseLength); + // Redo + await this.browser.keys([Key.Ctrl, Key.Shift, 'Z']); + await this.browser.pause(pauseLength); + const after = (await getAllBlocks(this.browser)).length; + chai.assert.equal( + before - 2, + after, + 'Expected there to be fewer blocks after undoing and redoing a delete', + ); + }); +}); From c3aa97010788c2890709bb05859ed0db05d9b29c Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Fri, 28 Jul 2023 08:35:29 -0700 Subject: [PATCH 43/58] feat: add the ability to toggle scrollbar visibility (#7314) --- core/scrollbar.ts | 18 +++++++++++++++--- core/scrollbar_pair.ts | 10 ++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/core/scrollbar.ts b/core/scrollbar.ts index 2a7984a72ea..b1209c5f49f 100644 --- a/core/scrollbar.ts +++ b/core/scrollbar.ts @@ -657,13 +657,25 @@ export class Scrollbar { * @param visible True if visible. */ setVisible(visible: boolean) { - const visibilityChanged = visible !== this.isVisible(); - // Ideally this would also apply to scrollbar pairs, but that's a bigger - // headache (due to interactions with the corner square). + // headache (due to interactions with the corner square), and the fact + // that telling the pair to resize itself would cause circular dependencies. if (this.pair) { throw Error('Unable to toggle visibility of paired scrollbars.'); } + this.setVisibleInternal(visible); + } + + /** + * Set whether the scrollbar is visible. Bypasses checking whether this + * scrollbar is part of a pair so that it can be toggled by the scrollbar + * pair. + * + * @param visible True if visible. + * @internal + */ + setVisibleInternal(visible: boolean) { + const visibilityChanged = visible !== this.isVisible(); this.isHandleVisible = visible; if (visibilityChanged) { this.updateDisplay_(); diff --git a/core/scrollbar_pair.ts b/core/scrollbar_pair.ts index 5b8ede4e7d6..8bb2b3d3a16 100644 --- a/core/scrollbar_pair.ts +++ b/core/scrollbar_pair.ts @@ -306,6 +306,16 @@ export class ScrollbarPair { return isVisible; } + /** + * Sets the visibility of any existing scrollbars. + * + * @param visible True if visible. + */ + setVisible(visible: boolean) { + if (this.hScroll) this.hScroll.setVisibleInternal(visible); + if (this.vScroll) this.vScroll.setVisibleInternal(visible); + } + /** * Recalculates the scrollbars' locations within their path and length. * This should be called when the contents of the workspace have changed. From 9c24848039facb328284e8f21e2145cb0fd7a609 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Fri, 28 Jul 2023 09:04:07 -0700 Subject: [PATCH 44/58] chore(tests): update generator test blocks to use forBlock (#7311) --- tests/generators/unittest_dart.js | 16 ++++++++-------- tests/generators/unittest_javascript.js | 16 ++++++++-------- tests/generators/unittest_lua.js | 16 ++++++++-------- tests/generators/unittest_php.js | 16 ++++++++-------- tests/generators/unittest_python.js | 16 ++++++++-------- 5 files changed, 40 insertions(+), 40 deletions(-) diff --git a/tests/generators/unittest_dart.js b/tests/generators/unittest_dart.js index 079fb556cee..312a8fcc28b 100644 --- a/tests/generators/unittest_dart.js +++ b/tests/generators/unittest_dart.js @@ -9,7 +9,7 @@ */ 'use strict'; -dartGenerator['unittest_main'] = function(block) { +dartGenerator.forBlock['unittest_main'] = function(block) { // Container for unit tests. var resultsVar = dartGenerator.nameDB_.getName('unittestResults', Blockly.Names.DEVELOPER_VARIABLE_TYPE); @@ -59,7 +59,7 @@ dartGenerator['unittest_main'] = function(block) { return code; }; -dartGenerator['unittest_main'].defineAssert_ = function() { +function dartDefineAssert() { var resultsVar = dartGenerator.nameDB_.getName('unittestResults', Blockly.Names.DEVELOPER_VARIABLE_TYPE); var functionName = dartGenerator.provideFunction_( @@ -96,7 +96,7 @@ dartGenerator['unittest_main'].defineAssert_ = function() { return functionName; }; -dartGenerator['unittest_assertequals'] = function(block) { +dartGenerator.forBlock['unittest_assertequals'] = function(block) { // Asserts that a value equals another value. var message = dartGenerator.valueToCode(block, 'MESSAGE', dartGenerator.ORDER_NONE) || ''; @@ -104,11 +104,11 @@ dartGenerator['unittest_assertequals'] = function(block) { dartGenerator.ORDER_NONE) || 'null'; var expected = dartGenerator.valueToCode(block, 'EXPECTED', dartGenerator.ORDER_NONE) || 'null'; - return dartGenerator['unittest_main'].defineAssert_() + + return dartDefineAssert() + '(' + actual + ', ' + expected + ', ' + message + ');\n'; }; -dartGenerator['unittest_assertvalue'] = function(block) { +dartGenerator.forBlock['unittest_assertvalue'] = function(block) { // Asserts that a value is true, false, or null. var message = dartGenerator.valueToCode(block, 'MESSAGE', dartGenerator.ORDER_NONE) || ''; @@ -122,11 +122,11 @@ dartGenerator['unittest_assertvalue'] = function(block) { } else if (expected === 'NULL') { expected = 'null'; } - return dartGenerator['unittest_main'].defineAssert_() + + return dartDefineAssert() + '(' + actual + ', ' + expected + ', ' + message + ');\n'; }; -dartGenerator['unittest_fail'] = function(block) { +dartGenerator.forBlock['unittest_fail'] = function(block) { // Always assert an error. var resultsVar = dartGenerator.nameDB_.getName('unittestResults', Blockly.Names.DEVELOPER_VARIABLE_TYPE); @@ -144,7 +144,7 @@ dartGenerator['unittest_fail'] = function(block) { return functionName + '(' + message + ');\n'; }; -dartGenerator['unittest_adjustindex'] = function(block) { +dartGenerator.forBlock['unittest_adjustindex'] = function(block) { var index = dartGenerator.valueToCode(block, 'INDEX', dartGenerator.ORDER_ADDITIVE) || '0'; // Adjust index if using one-based indexing. diff --git a/tests/generators/unittest_javascript.js b/tests/generators/unittest_javascript.js index ed91a3e6413..279244eb22e 100644 --- a/tests/generators/unittest_javascript.js +++ b/tests/generators/unittest_javascript.js @@ -9,7 +9,7 @@ */ 'use strict'; -javascriptGenerator['unittest_main'] = function(block) { +javascriptGenerator.forBlock['unittest_main'] = function(block) { // Container for unit tests. var resultsVar = javascriptGenerator.nameDB_.getName('unittestResults', Blockly.Names.DEVELOPER_VARIABLE_TYPE); @@ -60,7 +60,7 @@ javascriptGenerator['unittest_main'] = function(block) { return code; }; -javascriptGenerator['unittest_main'].defineAssert_ = function(block) { +function javascriptDefineAssert() { var resultsVar = javascriptGenerator.nameDB_.getName('unittestResults', Blockly.Names.DEVELOPER_VARIABLE_TYPE); var functionName = javascriptGenerator.provideFunction_( @@ -100,7 +100,7 @@ javascriptGenerator['unittest_main'].defineAssert_ = function(block) { return functionName; }; -javascriptGenerator['unittest_assertequals'] = function(block) { +javascriptGenerator.forBlock['unittest_assertequals'] = function(block) { // Asserts that a value equals another value. var message = javascriptGenerator.valueToCode(block, 'MESSAGE', javascriptGenerator.ORDER_NONE) || ''; @@ -108,11 +108,11 @@ javascriptGenerator['unittest_assertequals'] = function(block) { javascriptGenerator.ORDER_NONE) || 'null'; var expected = javascriptGenerator.valueToCode(block, 'EXPECTED', javascriptGenerator.ORDER_NONE) || 'null'; - return javascriptGenerator['unittest_main'].defineAssert_() + + return javascriptDefineAssert() + '(' + actual + ', ' + expected + ', ' + message + ');\n'; }; -javascriptGenerator['unittest_assertvalue'] = function(block) { +javascriptGenerator.forBlock['unittest_assertvalue'] = function(block) { // Asserts that a value is true, false, or null. var message = javascriptGenerator.valueToCode(block, 'MESSAGE', javascriptGenerator.ORDER_NONE) || ''; @@ -126,11 +126,11 @@ javascriptGenerator['unittest_assertvalue'] = function(block) { } else if (expected === 'NULL') { expected = 'null'; } - return javascriptGenerator['unittest_main'].defineAssert_() + + return javascriptDefineAssert() + '(' + actual + ', ' + expected + ', ' + message + ');\n'; }; -javascriptGenerator['unittest_fail'] = function(block) { +javascriptGenerator.forBlock['unittest_fail'] = function(block) { // Always assert an error. var resultsVar = javascriptGenerator.nameDB_.getName('unittestResults', Blockly.Names.DEVELOPER_VARIABLE_TYPE); @@ -148,7 +148,7 @@ javascriptGenerator['unittest_fail'] = function(block) { return functionName + '(' + message + ');\n'; }; -javascriptGenerator['unittest_adjustindex'] = function(block) { +javascriptGenerator.forBlock['unittest_adjustindex'] = function(block) { var index = javascriptGenerator.valueToCode(block, 'INDEX', javascriptGenerator.ORDER_ADDITION) || '0'; // Adjust index if using one-based indexing. diff --git a/tests/generators/unittest_lua.js b/tests/generators/unittest_lua.js index e38b82acc71..bd36e04ed16 100644 --- a/tests/generators/unittest_lua.js +++ b/tests/generators/unittest_lua.js @@ -9,7 +9,7 @@ */ 'use strict'; -luaGenerator['unittest_main'] = function(block) { +luaGenerator.forBlock['unittest_main'] = function(block) { // Container for unit tests. var resultsVar = luaGenerator.nameDB_.getName('unittestResults', Blockly.Names.DEVELOPER_VARIABLE_TYPE); @@ -58,7 +58,7 @@ luaGenerator['unittest_main'] = function(block) { return code; }; -luaGenerator['unittest_main'].defineAssert_ = function(block) { +function luaDefineAssert() { var resultsVar = luaGenerator.nameDB_.getName('unittestResults', Blockly.Names.DEVELOPER_VARIABLE_TYPE); var functionName = luaGenerator.provideFunction_( @@ -106,7 +106,7 @@ luaGenerator['unittest_main'].defineAssert_ = function(block) { return functionName; }; -luaGenerator['unittest_assertequals'] = function(block) { +luaGenerator.forBlock['unittest_assertequals'] = function(block) { // Asserts that a value equals another value. var message = luaGenerator.valueToCode(block, 'MESSAGE', luaGenerator.ORDER_NONE) || ''; @@ -114,11 +114,11 @@ luaGenerator['unittest_assertequals'] = function(block) { luaGenerator.ORDER_NONE) || 'nil'; var expected = luaGenerator.valueToCode(block, 'EXPECTED', luaGenerator.ORDER_NONE) || 'nil'; - return luaGenerator['unittest_main'].defineAssert_() + + return luaDefineAssert() + '(' + actual + ', ' + expected + ', ' + message + ')\n'; }; -luaGenerator['unittest_assertvalue'] = function(block) { +luaGenerator.forBlock['unittest_assertvalue'] = function(block) { // Asserts that a value is true, false, or null. var message = luaGenerator.valueToCode(block, 'MESSAGE', luaGenerator.ORDER_NONE) || ''; @@ -132,11 +132,11 @@ luaGenerator['unittest_assertvalue'] = function(block) { } else if (expected == 'NULL') { expected = 'nil'; } - return luaGenerator.unittest_main.defineAssert_() + + return luaDefineAssert() + '(' + actual + ', ' + expected + ', ' + message + ')\n'; }; -luaGenerator['unittest_fail'] = function(block) { +luaGenerator.forBlock['unittest_fail'] = function(block) { // Always assert an error. var resultsVar = luaGenerator.nameDB_.getName('unittestResults', Blockly.Names.DEVELOPER_VARIABLE_TYPE); @@ -153,7 +153,7 @@ luaGenerator['unittest_fail'] = function(block) { return functionName + '(' + message + ')\n'; }; -luaGenerator['unittest_adjustindex'] = function(block) { +luaGenerator.forBlock['unittest_adjustindex'] = function(block) { var index = luaGenerator.valueToCode(block, 'INDEX', luaGenerator.ORDER_ADDITIVE) || '0'; if (Blockly.utils.string.isNumber(index)) { diff --git a/tests/generators/unittest_php.js b/tests/generators/unittest_php.js index ceb2bd0c90a..408960d8235 100644 --- a/tests/generators/unittest_php.js +++ b/tests/generators/unittest_php.js @@ -9,7 +9,7 @@ */ 'use strict'; -phpGenerator['unittest_main'] = function(block) { +phpGenerator.forBlock['unittest_main'] = function(block) { // Container for unit tests. var resultsVar = phpGenerator.nameDB_.getName('unittestResults', Blockly.Names.DEVELOPER_VARIABLE_TYPE); @@ -60,7 +60,7 @@ phpGenerator['unittest_main'] = function(block) { return code; }; -phpGenerator['unittest_main'].defineAssert_ = function(block) { +function phpDefineAssert() { var resultsVar = phpGenerator.nameDB_.getName('unittestResults', Blockly.Names.DEVELOPER_VARIABLE_TYPE); var functionName = phpGenerator.provideFunction_( @@ -86,7 +86,7 @@ phpGenerator['unittest_main'].defineAssert_ = function(block) { return functionName; }; -phpGenerator['unittest_assertequals'] = function(block) { +phpGenerator.forBlock['unittest_assertequals'] = function(block) { // Asserts that a value equals another value. var message = phpGenerator.valueToCode(block, 'MESSAGE', phpGenerator.ORDER_NONE) || ''; @@ -94,11 +94,11 @@ phpGenerator['unittest_assertequals'] = function(block) { phpGenerator.ORDER_NONE) || 'null'; var expected = phpGenerator.valueToCode(block, 'EXPECTED', phpGenerator.ORDER_NONE) || 'null'; - return phpGenerator['unittest_main'].defineAssert_() + + return phpDefineAssert() + '(' + actual + ', ' + expected + ', ' + message + ');\n'; }; -phpGenerator['unittest_assertvalue'] = function(block) { +phpGenerator.forBlock['unittest_assertvalue'] = function(block) { // Asserts that a value is true, false, or null. var message = phpGenerator.valueToCode(block, 'MESSAGE', phpGenerator.ORDER_NONE) || ''; @@ -112,11 +112,11 @@ phpGenerator['unittest_assertvalue'] = function(block) { } else if (expected == 'NULL') { expected = 'null'; } - return phpGenerator['unittest_main'].defineAssert_() + + return phpDefineAssert() + '(' + actual + ', ' + expected + ', ' + message + ');\n'; }; -phpGenerator['unittest_fail'] = function(block) { +phpGenerator.forBlock['unittest_fail'] = function(block) { // Always assert an error. var resultsVar = phpGenerator.nameDB_.getName('unittestResults', Blockly.Names.DEVELOPER_VARIABLE_TYPE); @@ -135,7 +135,7 @@ phpGenerator['unittest_fail'] = function(block) { return functionName + '(' + message + ');\n'; }; -phpGenerator['unittest_adjustindex'] = function(block) { +phpGenerator.forBlock['unittest_adjustindex'] = function(block) { var index = phpGenerator.valueToCode(block, 'INDEX', phpGenerator.ORDER_ADDITION) || '0'; // Adjust index if using one-based indexing. diff --git a/tests/generators/unittest_python.js b/tests/generators/unittest_python.js index bc623f347ce..ba29015f9a0 100644 --- a/tests/generators/unittest_python.js +++ b/tests/generators/unittest_python.js @@ -9,7 +9,7 @@ */ 'use strict'; -pythonGenerator['unittest_main'] = function(block) { +pythonGenerator.forBlock['unittest_main'] = function(block) { // Container for unit tests. var resultsVar = pythonGenerator.nameDB_.getName('unittestResults', Blockly.Names.DEVELOPER_VARIABLE_TYPE); @@ -56,7 +56,7 @@ pythonGenerator['unittest_main'] = function(block) { return code; }; -pythonGenerator['unittest_main'].defineAssert_ = function() { +function pythonDefineAssert() { var resultsVar = pythonGenerator.nameDB_.getName('unittestResults', Blockly.Names.DEVELOPER_VARIABLE_TYPE); var functionName = pythonGenerator.provideFunction_( @@ -74,7 +74,7 @@ pythonGenerator['unittest_main'].defineAssert_ = function() { return functionName; }; -pythonGenerator['unittest_assertequals'] = function(block) { +pythonGenerator.forBlock['unittest_assertequals'] = function(block) { // Asserts that a value equals another value. var message = pythonGenerator.valueToCode(block, 'MESSAGE', pythonGenerator.ORDER_NONE) || ''; @@ -82,11 +82,11 @@ pythonGenerator['unittest_assertequals'] = function(block) { pythonGenerator.ORDER_NONE) || 'None'; var expected = pythonGenerator.valueToCode(block, 'EXPECTED', pythonGenerator.ORDER_NONE) || 'None'; - return pythonGenerator['unittest_main'].defineAssert_() + + return pythonDefineAssert() + '(' + actual + ', ' + expected + ', ' + message + ')\n'; }; -pythonGenerator['unittest_assertvalue'] = function(block) { +pythonGenerator.forBlock['unittest_assertvalue'] = function(block) { // Asserts that a value is true, false, or null. var message = pythonGenerator.valueToCode(block, 'MESSAGE', pythonGenerator.ORDER_NONE) || ''; @@ -100,11 +100,11 @@ pythonGenerator['unittest_assertvalue'] = function(block) { } else if (expected == 'NULL') { expected = 'None'; } - return pythonGenerator['unittest_main'].defineAssert_() + + return pythonDefineAssert() + '(' + actual + ', ' + expected + ', ' + message + ')\n'; }; -pythonGenerator['unittest_fail'] = function(block) { +pythonGenerator.forBlock['unittest_fail'] = function(block) { // Always assert an error. var resultsVar = pythonGenerator.nameDB_.getName('unittestResults', Blockly.Names.DEVELOPER_VARIABLE_TYPE); @@ -119,7 +119,7 @@ pythonGenerator['unittest_fail'] = function(block) { return functionName + '(' + message + ')\n'; }; -pythonGenerator['unittest_adjustindex'] = function(block) { +pythonGenerator.forBlock['unittest_adjustindex'] = function(block) { var index = pythonGenerator.valueToCode(block, 'INDEX', pythonGenerator.ORDER_ADDITIVE) || '0'; // Adjust index if using one-based indexing. From 1fe82b23545b9a344d5365f15b01dd7bbea2bcbc Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Fri, 28 Jul 2023 09:42:28 -0700 Subject: [PATCH 45/58] chore(tests): fix disable block tests (#7330) * chore(tests): fix disable block tests * chore: add comment --- tests/browser/test/basic_playground_test.js | 2 ++ tests/browser/test/test_setup.js | 16 +++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/browser/test/basic_playground_test.js b/tests/browser/test/basic_playground_test.js index 9f0e320ac2f..0c0bb221abc 100644 --- a/tests/browser/test/basic_playground_test.js +++ b/tests/browser/test/basic_playground_test.js @@ -125,6 +125,8 @@ suite('Disabling', function () { setup(async function () { await this.browser.refresh(); + // Pause to allow refresh time to work. + await this.browser.pause(200); }); test( diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index 9376db984f2..634286a337f 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -396,7 +396,8 @@ async function dragBlockTypeFromFlyout(browser, categoryName, type, x, y) { * context menu item. * * @param browser The active WebdriverIO Browser object. - * @param block The block to click, as an interactable element. + * @param block The block to click, as an interactable element. This block must + * have text on it, because we use the text element as the click target. * @param itemText The display text of the context menu item to click. * @return A Promise that resolves when the actions are completed. */ @@ -404,13 +405,14 @@ async function contextMenuSelect(browser, block, itemText) { // Clicking will always happen in the middle of the block's bounds // (including children) by default, which causes problems if it has holes // (e.g. statement inputs). - // Instead we want to click 10px from the left and 10px from the top. - const blockWidth = await block.getSize('width'); - const blockHeight = await block.getSize('height'); - const xOffset = -Math.round(blockWidth * 0.5) + 10; - const yOffset = -Math.round(blockHeight * 0.5) + 10; + // Instead, we'll click directly on the first bit of text on the block. + const clickEl = block.$('.blocklyText'); - await block.click({button: 2, x: xOffset, y: yOffset}); + // Even though the element should definitely already exist, + // one specific test breaks if you remove this... + await clickEl.waitForExist(); + + await clickEl.click({button: 2}); const item = await browser.$(`div=${itemText}`); await item.waitForExist(); From 889310726eed808a84a4a22c94b897516e1b2195 Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Mon, 31 Jul 2023 08:54:19 +0100 Subject: [PATCH 46/58] fix(tests): Make .mocharc.js CWD-independent (#7329) Move tests/browser/test/.mocharc.js to tests/browser and use __dirname to make the require directive work regardless of where mocha is invoked from. Simplify the browser:test script accordingly, taking advantage also of the mocha default of running all tests in the test/ subdirectory. --- package.json | 2 +- tests/browser/{test => }/.mocharc.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename tests/browser/{test => }/.mocharc.js (54%) diff --git a/package.json b/package.json index 43e16ff1eac..4c0b7df5e35 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "start": "npm run build && concurrently -n tsc,server \"tsc --watch --preserveWatchOutput --outDir 'build/src' --declarationDir 'build/declarations'\" \"http-server ./ -s -o /tests/playground.html -c-1\"", "tsc": "gulp tsc", "test": "gulp test", - "test:browser": "npx mocha ./tests/browser/test --config ./tests/browser/test/.mocharc.js", + "test:browser": "cd tests/browser && npx mocha", "test:generators": "gulp testGenerators", "test:mocha:interactive": "http-server ./ -o /tests/mocha/index.html -c-1", "test:compile:advanced": "gulp buildAdvancedCompilationTest --debug", diff --git a/tests/browser/test/.mocharc.js b/tests/browser/.mocharc.js similarity index 54% rename from tests/browser/test/.mocharc.js rename to tests/browser/.mocharc.js index 58d3bf55eb4..b11a846fb5a 100644 --- a/tests/browser/test/.mocharc.js +++ b/tests/browser/.mocharc.js @@ -2,5 +2,5 @@ module.exports = { ui: 'tdd', - require: 'tests/browser/test/hooks.js', + require: __dirname + '/test/hooks.js', }; From f3899e21a52867dbcec37ca66c0e129908096471 Mon Sep 17 00:00:00 2001 From: FangQiJun Date: Tue, 1 Aug 2023 01:39:57 +0800 Subject: [PATCH 47/58] fix(blocks): boolean variable block wrong shape for zelos (#7335) * fix(blocks): boolean variable block wrong shape for zelos * fixup! fix(blocks): boolean variable block wrong shape for zelos --- core/rendered_connection.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/rendered_connection.ts b/core/rendered_connection.ts index f6a60627995..4d358eae909 100644 --- a/core/rendered_connection.ts +++ b/core/rendered_connection.ts @@ -625,6 +625,22 @@ export class RenderedConnection extends Connection { this.sourceBlock_.bumpNeighbours(); } } + + /** + * Change a connection's compatibility. + * Rerender blocks as needed. + * + * @param check Compatible value type or list of value types. Null if all + * types are compatible. + * @returns The connection being modified (to allow chaining). + */ + override setCheck(check: string | string[] | null): RenderedConnection { + super.setCheck(check); + if (this.sourceBlock_.rendered) { + this.sourceBlock_.queueRender(); + } + return this; + } } export namespace RenderedConnection { From 5e0390b3ec0e6d2a307fed321c747b6ba357b113 Mon Sep 17 00:00:00 2001 From: Abdul Al-Hasany Date: Thu, 3 Aug 2023 02:27:04 +1000 Subject: [PATCH 48/58] fix(build): support running Blocky locally on Windows machines (#7281) * fix: update build path for windows When using single quote on windows, e.g. 'build/src', the folder are created with a single quote at the beginning `'build` and end `src'`. This commit fixes this issue. * fix: update python command and folder separator Ensure that when running on windows, python command is python and not python3. Also, separators are normalized to posix style `/` even on windows system * fix: add global PYTHON constant to run python command * fix: simplify `path.sep` to forwadslash since it is cross-platform * fix(syntax): replace double quote with single quote --- package.json | 2 +- scripts/gulpfiles/build_tasks.js | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 4c0b7df5e35..2f07c228e14 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "publish:beta": "npm ci && gulp publishBeta", "recompile": "gulp recompile", "release": "gulp gitCreateRC", - "start": "npm run build && concurrently -n tsc,server \"tsc --watch --preserveWatchOutput --outDir 'build/src' --declarationDir 'build/declarations'\" \"http-server ./ -s -o /tests/playground.html -c-1\"", + "start": "npm run build && concurrently -n tsc,server \"tsc --watch --preserveWatchOutput --outDir \"build/src\" --declarationDir \"build/declarations\"\" \"http-server ./ -s -o /tests/playground.html -c-1\"", "tsc": "gulp tsc", "test": "gulp test", "test:browser": "cd tests/browser && npx mocha", diff --git a/scripts/gulpfiles/build_tasks.js b/scripts/gulpfiles/build_tasks.js index 4b84bbf5900..4479c0be74d 100644 --- a/scripts/gulpfiles/build_tasks.js +++ b/scripts/gulpfiles/build_tasks.js @@ -30,6 +30,13 @@ const {posixPath} = require('../helpers'); // Build // //////////////////////////////////////////////////////////// +/** + * Path to the python runtime. + * This will normalize the command across platforms (e.g. python3 on Linux and + * Mac, python on Windows). + */ +const PYTHON = process.platform === 'win32' ? 'python' : 'python3'; + /** * Suffix to add to compiled output files. */ @@ -380,7 +387,7 @@ error message above, try running: */ function generateMessages(done) { // Run js_to_json.py - const jsToJsonCmd = `python3 scripts/i18n/js_to_json.py \ + const jsToJsonCmd = `${PYTHON} scripts/i18n/js_to_json.py \ --input_file ${path.join('msg', 'messages.js')} \ --output_dir ${path.join('msg', 'json')} \ --quiet`; @@ -418,7 +425,8 @@ function buildLangfiles(done) { json_files = json_files.filter(file => file.endsWith('json') && !(new RegExp(/(keys|synonyms|qqq|constants)\.json$/).test(file))); json_files = json_files.map(file => path.join('msg', 'json', file)); - const createMessagesCmd = `python3 ./scripts/i18n/create_messages.py \ + + const createMessagesCmd = `${PYTHON} ./scripts/i18n/create_messages.py \ --source_lang_file ${path.join('msg', 'json', 'en.json')} \ --source_synonym_file ${path.join('msg', 'json', 'synonyms.json')} \ --source_constants_file ${path.join('msg', 'json', 'constants.json')} \ @@ -559,7 +567,10 @@ function getChunkOptions() { // Figure out which chunk this is by looking for one of the // known chunk entrypoints in chunkFiles. N.B.: O(n*m). :-( const chunk = chunks.find( - chunk => chunkFiles.find(f => f.endsWith(path.sep + chunk.entry))); + chunk => chunkFiles.find(f => { + return f.endsWith('/' + chunk.entry.replaceAll('\\', '/')); + } + )); if (!chunk) throw new Error('Unable to identify chunk'); // Replace nicknames with the names we chose. From 18e0d530e2a430e5393fe25692d1ca056c22b307 Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Wed, 2 Aug 2023 10:10:18 -0700 Subject: [PATCH 49/58] chore(tests): fix delete tests (#7351) * fix(tests): context menu delete test * fix(tests): try increasing pause length after keys --- tests/browser/test/delete_blocks_test.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/browser/test/delete_blocks_test.js b/tests/browser/test/delete_blocks_test.js index 921ac9782fd..eeaa8162d35 100644 --- a/tests/browser/test/delete_blocks_test.js +++ b/tests/browser/test/delete_blocks_test.js @@ -98,7 +98,7 @@ const startBlocks = { ], }, }; -const pauseLength = 20; +const pauseLength = 200; suite('Delete blocks', function (done) { // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test @@ -167,9 +167,7 @@ suite('Delete blocks', function (done) { test('Delete block using context menu', async function () { const before = (await getAllBlocks(this.browser)).length; // Get first print block, click to select it, and delete it using context menu. - const block = (await getBlockElementById(this.browser, firstBlockId)).$( - '.blocklyPath', - ); + const block = await getBlockElementById(this.browser, firstBlockId); await contextMenuSelect(this.browser, block, 'Delete 2 Blocks'); const after = (await getAllBlocks(this.browser)).length; chai.assert.equal( From 8241fca23f9b86913da9623c1a8d386003c8d1f8 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Wed, 2 Aug 2023 17:31:51 -0700 Subject: [PATCH 50/58] chore(tests): cleanup and toolbox drag tests (#7350) * chore(tests): use helpers for the basic drag test in the playground * chore(tests): miscellaneous test cleanup * chore: format * feat(tests): add test that drags out every block from the toolbox * feat(tests): add RTL version of toolbox drag tests * chore: lint * chore(tests): respond to PR feedback --- tests/browser/test/basic_playground_test.js | 21 +- tests/browser/test/block_undo_test.js | 23 +-- tests/browser/test/extensive_test.js | 19 +- tests/browser/test/field_edits_test.js | 39 ++-- tests/browser/test/test_setup.js | 29 ++- tests/browser/test/toolbox_drag_test.js | 208 ++++++++++++++++++++ 6 files changed, 273 insertions(+), 66 deletions(-) create mode 100644 tests/browser/test/toolbox_drag_test.js diff --git a/tests/browser/test/basic_playground_test.js b/tests/browser/test/basic_playground_test.js index 0c0bb221abc..7d1de3b6387 100644 --- a/tests/browser/test/basic_playground_test.js +++ b/tests/browser/test/basic_playground_test.js @@ -46,24 +46,13 @@ suite('Testing Connecting Blocks', function () { this.browser = await testSetup(testFileLocations.PLAYGROUND); }); - test('Testing Block Flyout', async function () { - const logicButton = await this.browser.$('#blockly-0'); - logicButton.click(); - const ifDoBlock = await this.browser.$( - '#blocklyDiv > div > svg:nth-child(7) > g > g.blocklyBlockCanvas > g:nth-child(3)', - ); - await ifDoBlock.dragAndDrop({x: 20, y: 20}); - await this.browser.pause(200); - const blockOnWorkspace = await this.browser.execute(() => { - const newBlock = Blockly.getMainWorkspace().getAllBlocks(false)[0]; - if (newBlock.id) { - return true; - } else { - return false; - } + test('dragging a block from the flyout results in a block on the workspace', async function () { + await dragBlockTypeFromFlyout(this.browser, 'Logic', 'controls_if', 20, 20); + const blockCount = await this.browser.execute(() => { + return Blockly.getMainWorkspace().getAllBlocks(false).length; }); - chai.assert.isTrue(blockOnWorkspace); + chai.assert.equal(blockCount, 1); }); }); diff --git a/tests/browser/test/block_undo_test.js b/tests/browser/test/block_undo_test.js index 94f5a6f71ca..3dc5babc5ea 100644 --- a/tests/browser/test/block_undo_test.js +++ b/tests/browser/test/block_undo_test.js @@ -13,45 +13,38 @@ const {Key} = require('webdriverio'); const { testSetup, testFileLocations, - switchRTL, dragBlockTypeFromFlyout, screenDirection, + getAllBlocks, } = require('./test_setup'); suite('Testing undo block movement', function (done) { // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test this.timeout(0); - // Setup Selenium for all of the tests - suiteSetup(async function () { - this.browser = await testSetup(testFileLocations.PLAYGROUND); - }); - test('Undoing Block Movement LTR', async function () { + this.browser = await testSetup(testFileLocations.PLAYGROUND); await testUndoBlock(this.browser, screenDirection.LTR); }); test('Undoing Block Movement RTL', async function () { - await switchRTL(this.browser); + this.browser = await testSetup(testFileLocations.PLAYGROUND_RTL); await testUndoBlock(this.browser, screenDirection.RTL); }); }); -async function testUndoBlock(browser, delta) { +async function testUndoBlock(browser, direction) { // Drag out first function - const defReturnBlock = await dragBlockTypeFromFlyout( + await dragBlockTypeFromFlyout( browser, 'Functions', 'procedures_defreturn', - 50 * delta, + 50 * direction, 20, ); await browser.keys([Key.Ctrl, 'z']); - const blockOnWorkspace = await browser.execute(() => { - return !!Blockly.getMainWorkspace().getAllBlocks(false)[0]; - }); - - chai.assert.isFalse(blockOnWorkspace); + const allBlocks = await getAllBlocks(browser); + chai.assert.equal(allBlocks.length, 0); } diff --git a/tests/browser/test/extensive_test.js b/tests/browser/test/extensive_test.js index 2dfb5dc8875..578ed85c960 100644 --- a/tests/browser/test/extensive_test.js +++ b/tests/browser/test/extensive_test.js @@ -13,6 +13,7 @@ const { testSetup, testFileLocations, getBlockElementById, + getAllBlocks, } = require('./test_setup'); const {Key} = require('webdriverio'); @@ -25,12 +26,12 @@ suite('This tests loading Large Configuration and Deletion', function (done) { this.browser = await testSetup(testFileLocations.PLAYGROUND); }); - test('This test loading from JSON results in the correct number of blocks', async function () { + test('loading from JSON results in the correct number of blocks', async function () { const blockNum = await testingJSONLoad(this.browser); chai.assert.equal(blockNum, 13); }); - test('This test deleting block results in the correct number of blocks', async function () { + test('deleting block results in the correct number of blocks', async function () { const fourthRepeatDo = await getBlockElementById( this.browser, 'E8bF[-r:B~cabGLP#QYd', @@ -38,19 +39,15 @@ suite('This tests loading Large Configuration and Deletion', function (done) { await fourthRepeatDo.click({x: -100, y: -40}); await this.browser.keys([Key.Delete]); await this.browser.pause(100); - const blockNum = await this.browser.execute(() => { - return Blockly.getMainWorkspace().getAllBlocks(false).length; - }); - chai.assert.equal(blockNum, 10); + const allBlocks = await getAllBlocks(this.browser); + chai.assert.equal(allBlocks.length, 10); }); - test('This test undoing delete block results in the correct number of blocks', async function () { + test('undoing delete block results in the correct number of blocks', async function () { await this.browser.keys([Key.Ctrl, 'z']); await this.browser.pause(100); - const blockNum = await this.browser.execute(() => { - return Blockly.getMainWorkspace().getAllBlocks(false).length; - }); - chai.assert.equal(blockNum, 13); + const allBlocks = await getAllBlocks(this.browser); + chai.assert.equal(allBlocks.length, 13); }); }); diff --git a/tests/browser/test/field_edits_test.js b/tests/browser/test/field_edits_test.js index 925347779a6..cd720b0f309 100644 --- a/tests/browser/test/field_edits_test.js +++ b/tests/browser/test/field_edits_test.js @@ -12,8 +12,6 @@ const chai = require('chai'); const { testSetup, testFileLocations, - getSelectedBlockElement, - switchRTL, dragBlockTypeFromFlyout, screenDirection, } = require('./test_setup'); @@ -23,47 +21,42 @@ suite('Testing Field Edits', function (done) { // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test this.timeout(0); - // Setup Selenium for all of the tests - suiteSetup(async function () { - this.browser = await testSetup(testFileLocations.PLAYGROUND); - }); - test('Testing Field Edits LTR', async function () { + this.browser = await testSetup(testFileLocations.PLAYGROUND); await testFieldEdits(this.browser, screenDirection.LTR); }); test('Testing Field Edits RTL', async function () { - await switchRTL(this.browser); + this.browser = await testSetup(testFileLocations.PLAYGROUND_RTL); await testFieldEdits(this.browser, screenDirection.RTL); }); }); -async function testFieldEdits(browser, delta) { - const mathNumber = await dragBlockTypeFromFlyout( +async function testFieldEdits(browser, direction) { + const numberBlock = await dragBlockTypeFromFlyout( browser, 'Math', 'math_number', - 50 * delta, + 50 * direction, 20, ); - await browser.pause(200); // Click on the field to change the value - const numeric = await getSelectedBlockElement(browser); - await numeric.doubleClick(); + await numberBlock.click(); await browser.keys([Key.Delete]); - await numeric.doubleClick(); + await numberBlock.click(); await browser.keys(['1093']); - // Click on the workspace + // Click on the workspace to exit the field editor const workspace = await browser.$('#blocklyDiv > div > svg.blocklySvg > g'); await workspace.click(); await browser.pause(200); - // Get value of the number - const numericText = await browser - .$( - '#blocklyDiv > div > svg.blocklySvg > g > g.blocklyBlockCanvas > g.blocklyDraggable > g > text', - ) - .getHTML(); - chai.assert.isTrue(numericText.includes('1093')); + const fieldValue = await browser.execute((id) => { + return Blockly.getMainWorkspace() + .getBlockById(id) + .getField('NUM') + .getValue(); + }, numberBlock.id); + + chai.assert.equal(fieldValue, '1093'); } diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.js index 634286a337f..ef2dd02c397 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.js @@ -94,6 +94,10 @@ const testFileLocations = { 'file://' + posixPath(path.join(__dirname, '..', '..')) + '/playground.html', + PLAYGROUND_RTL: + 'file://' + + posixPath(path.join(__dirname, '..', '..')) + + '/playground.html?dir=rtl', }; /** @@ -164,7 +168,6 @@ async function getCategory(browser, categoryName) { async function getNthBlockOfCategory(browser, categoryName, n) { const category = await getCategory(browser, categoryName); await category.click(); - await browser.pause(100); const block = await browser.$( `.blocklyFlyout .blocklyBlockCanvas > g:nth-child(${3 + n * 2})`, ); @@ -440,6 +443,29 @@ async function getAllBlocks(browser) { }); } +/** + * Find the flyout's scrollbar and scroll by the specified amount. + * This makes several assumptions: + * - A flyout with a valid scrollbar exists, is open, and is in view. + * - The workspace has a trash can, which means it has a second (hidden) flyout. + * @param browser The active WebdriverIO Browser object. + * @param xDelta How far to drag the flyout in the x direction. Positive is right. + * @param yDelta How far to drag thte flyout in the y direction. Positive is down. + * @return A Promise that resolves when the actions are completed. + */ +async function scrollFlyout(browser, xDelta, yDelta) { + // There are two flyouts on the playground workspace: one for the trash can + // and one for the toolbox. We want the second one. + // This assumes there is only one scrollbar handle in the flyout, but it could + // be either horizontal or vertical. + await browser.pause(50); + const scrollbarHandle = await browser + .$$(`.blocklyFlyoutScrollbar`)[1] + .$(`rect.blocklyScrollbarHandle`); + await scrollbarHandle.dragAndDrop({x: xDelta, y: yDelta}); + await browser.pause(50); +} + module.exports = { testSetup, testFileLocations, @@ -459,4 +485,5 @@ module.exports = { screenDirection, getBlockTypeFromWorkspace, getAllBlocks, + scrollFlyout, }; diff --git a/tests/browser/test/toolbox_drag_test.js b/tests/browser/test/toolbox_drag_test.js new file mode 100644 index 00000000000..1e277efc859 --- /dev/null +++ b/tests/browser/test/toolbox_drag_test.js @@ -0,0 +1,208 @@ +/** + * @license + * Copyright 2023 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Tests for the dragging out of the toolbox and flyout. + */ + +const chai = require('chai'); +const { + testSetup, + testFileLocations, + getCategory, + scrollFlyout, + screenDirection, +} = require('./test_setup'); + +const PAUSE_TIME = 50; + +// Categories in the basic toolbox. +const basicCategories = [ + 'Logic', + 'Loops', + 'Math', + 'Text', + 'Lists', + 'Colour', + 'Variables', + 'Functions', +]; + +// Categories in the test blocks toolbox. +const testCategories = [ + 'Align', + 'Basic', + // Skip connections because it's an accordion that is already open. + // 'Connections', + 'Row', + 'Stack', + 'Statement', + 'Drag', + // Skip fields because it's an accordion that is already open. + // 'Fields', + 'Defaults', + 'Numbers', + 'Angles', + 'Drop-downs', + // Note: images has a block that has a bad image source, but still builds and renders + // just fine. + 'Images', + 'Emoji! o((*^ᴗ^*))o', + 'Validators', + 'Mutators', + 'Style', + 'Serialization', +]; + +/** + * Check whether an element is fully inside the bounds of the Blockly div. You can use this + * to determine whether a block on the workspace or flyout is inside the Blockly div. + * This does not check whether there are other Blockly elements (such as a toolbox or + * flyout) on top of the element. A partially visible block is considered out of bounds. + * @param browser The active WebdriverIO Browser object. + * @param element The element to look for. + * @returns A Promise resolving to true if the element is in bounds and false otherwise. + */ +async function elementInBounds(browser, element) { + return await browser.execute((elem) => { + const rect = elem.getBoundingClientRect(); + + const blocklyDiv = document.getElementById('blocklyDiv'); + const blocklyRect = blocklyDiv.getBoundingClientRect(); + + const vertInView = + rect.top >= blocklyRect.top && rect.bottom <= blocklyRect.bottom; + const horInView = + rect.left >= blocklyRect.left && rect.right <= blocklyRect.right; + + return vertInView && horInView; + }, element); +} + +/** + * Get how many top-level blocks there are in the specified category. + * @param browser The active WebdriverIO Browser object. + * @param categoryName The name of the category to inspect. + * @returns A Promise resolving to the number of top-level blocks in the specified + * category's flyout. + */ +async function getBlockCount(browser, categoryName) { + const category = await getCategory(browser, categoryName); + await category.click(); + await browser.pause(PAUSE_TIME); + + const blockCount = await browser.execute(() => { + return Blockly.getMainWorkspace() + .getFlyout() + .getWorkspace() + .getTopBlocks(false).length; + }); + + // Unicode escape to close flyout. + await browser.keys(['\uE00C']); + await browser.pause(PAUSE_TIME); + return blockCount; +} + +/** + * Check whether the block at the given index in the flyout is disabled. + * @param browser The active WebdriverIO Browser object. + * @param i The index of the block in the currently open flyout. + * @returns A Promise resolving to true if the ith block in the flyout is + * disabled, and false otherwise. + */ +async function isBlockDisabled(browser, i) { + return await browser.execute((n) => { + return !Blockly.getMainWorkspace() + .getFlyout() + .getWorkspace() + .getTopBlocks() + [n].isEnabled(); + }, i); +} + +/** + * Loop over a list of categories and click on each one to open it. + * @param browser The WebdriverIO Browser instance for this test. + * @param categoryList An array of category names, as strings. + * @param directionMultiplier 1 for LTR and -1 for RTL. + * @returns A Promise that resolves when all actions have finished. + */ +async function openCategories(browser, categoryList, directionMultiplier) { + let failureCount = 0; + for (const categoryName of categoryList) { + const blockCount = await getBlockCount(browser, categoryName); + + try { + for (let i = 0; i < blockCount; i++) { + const category = await getCategory(browser, categoryName); + await category.click(); + if (await isBlockDisabled(browser, i)) { + // Unicode escape to close flyout. + await browser.keys(['\uE00C']); + await browser.pause(PAUSE_TIME); + } else { + const flyoutBlock = await browser.$( + `.blocklyFlyout .blocklyBlockCanvas > g:nth-child(${3 + i * 2})`, + ); + if (!(await elementInBounds(browser, flyoutBlock))) { + await scrollFlyout(browser, 0, 500); + } + + await flyoutBlock.dragAndDrop({x: directionMultiplier * 50, y: 0}); + await browser.pause(PAUSE_TIME); + // Should be one top level block on the workspace. + const topBlockCount = await browser.execute(() => { + return Blockly.getMainWorkspace().getTopBlocks(false).length; + }); + + if (topBlockCount != 1) { + failureCount++; + console.log(`fail: block ${i} in category ${categoryName}`); + } + + // Clean up between blocks so they can't interact with each other. + await browser.execute(() => { + Blockly.getMainWorkspace().clear(); + }); + await browser.pause(PAUSE_TIME); + } + } + } catch (e) { + failureCount++; + throw e; + } + } + chai.assert.equal(failureCount, 0); +} + +suite.skip('Open toolbox categories', function () { + this.timeout(0); + + test('opening every toolbox category in the category toolbox in LTR', async function () { + this.browser = await testSetup(testFileLocations.PLAYGROUND); + await openCategories(this.browser, basicCategories, screenDirection.LTR); + }); + + test('opening every toolbox category in the category toolbox in RTL', async function () { + this.browser = await testSetup(testFileLocations.PLAYGROUND_RTL); + await openCategories(this.browser, basicCategories, screenDirection.RTL); + }); + + test('opening every toolbox category in the test toolbox in LTR', async function () { + this.browser = await testSetup( + testFileLocations.PLAYGROUND + '?toolbox=test-blocks', + ); + await openCategories(this.browser, testCategories, screenDirection.LTR); + }); + + test('opening every toolbox category in the test toolbox in RTL', async function () { + this.browser = await testSetup( + testFileLocations.PLAYGROUND + '?toolbox=test-blocks&dir=rtl', + ); + await openCategories(this.browser, testCategories, screenDirection.RTL); + }); +}); From dbe926db4af5d8b1e722b1f0c1869d72ff24968b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=A6=E0=A5=87=E0=A4=B5=E0=A4=BE=E0=A4=82=E0=A4=B6=20?= =?UTF-8?q?=E0=A4=B5=E0=A4=BE=E0=A4=B0=E0=A5=8D=E0=A4=B7=E0=A5=8D=E0=A4=A3?= =?UTF-8?q?=E0=A5=87=E0=A4=AF?= Date: Fri, 4 Aug 2023 21:17:30 +0530 Subject: [PATCH 51/58] fix: removed X & Y from toolbox.ts and replaced movBy to moveTo (#7333) * fix: removed X & Y from toolbox.ts and replaced movBy to moveTo in Horizontal/ Vertical flyout * forget to run npm lint and format * removed the mistakenly added comment --- core/flyout_horizontal.ts | 5 +++-- core/flyout_vertical.ts | 8 +++++--- core/utils/toolbox.ts | 2 -- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/core/flyout_horizontal.ts b/core/flyout_horizontal.ts index ad27ca1dcf5..019570493c3 100644 --- a/core/flyout_horizontal.ts +++ b/core/flyout_horizontal.ts @@ -19,7 +19,7 @@ import type {FlyoutButton} from './flyout_button.js'; import type {Options} from './options.js'; import * as registry from './registry.js'; import {Scrollbar} from './scrollbar.js'; -import type {Coordinate} from './utils/coordinate.js'; +import {Coordinate} from './utils/coordinate.js'; import {Rect} from './utils/rect.js'; import * as toolbox from './utils/toolbox.js'; import * as WidgetDiv from './widgetdiv.js'; @@ -285,7 +285,8 @@ export class HorizontalFlyout extends Flyout { } else { moveX = cursorX - tab; } - block!.moveBy(moveX, cursorY); + // No 'reason' provided since events are disabled. + block!.moveTo(new Coordinate(moveX, cursorY)); const rect = this.createRect_(block!, moveX, cursorY, blockHW, i); cursorX += blockHW.width + gaps[i]; diff --git a/core/flyout_vertical.ts b/core/flyout_vertical.ts index d0c4a5d585e..9dac14d7313 100644 --- a/core/flyout_vertical.ts +++ b/core/flyout_vertical.ts @@ -19,7 +19,7 @@ import type {FlyoutButton} from './flyout_button.js'; import type {Options} from './options.js'; import * as registry from './registry.js'; import {Scrollbar} from './scrollbar.js'; -import type {Coordinate} from './utils/coordinate.js'; +import {Coordinate} from './utils/coordinate.js'; import {Rect} from './utils/rect.js'; import * as toolbox from './utils/toolbox.js'; import * as WidgetDiv from './widgetdiv.js'; @@ -246,7 +246,8 @@ export class VerticalFlyout extends Flyout { const moveX = block!.outputConnection ? cursorX - this.tabWidth_ : cursorX; - block!.moveBy(moveX, cursorY); + // No 'reason' provided since events are disabled. + block!.moveTo(new Coordinate(moveX, cursorY)); const rect = this.createRect_( block!, @@ -357,7 +358,8 @@ export class VerticalFlyout extends Flyout { if (!block.outputConnection) { newX -= this.tabWidth_; } - block.moveBy(newX - oldX, 0); + // No 'reason' provided since events are disabled. + block.moveTo(new Coordinate(newX - oldX, 0)); } if (this.rectMap_.has(block)) { this.moveRectToBlock_(this.rectMap_.get(block)!, block); diff --git a/core/utils/toolbox.ts b/core/utils/toolbox.ts index b2d71e3b6fe..c192d40792c 100644 --- a/core/utils/toolbox.ts +++ b/core/utils/toolbox.ts @@ -24,8 +24,6 @@ export interface BlockInfo { disabled?: string | boolean; enabled?: boolean; id?: string; - x?: number; - y?: number; collapsed?: boolean; inline?: boolean; data?: string; From 2ac13b5a28adc24d6a56b445fff9e749f474d7d2 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Fri, 4 Aug 2023 08:57:33 -0700 Subject: [PATCH 52/58] feat: have the trashcan hide scrollbars when the flyout opens (#7357) --- core/trashcan.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/trashcan.ts b/core/trashcan.ts index 58046f4667b..762fbe44cbe 100644 --- a/core/trashcan.ts +++ b/core/trashcan.ts @@ -306,6 +306,7 @@ export class Trashcan setTimeout(() => { this.flyout?.show(contents); blocklyStyle.cursor = ''; + this.workspace.scrollbar?.setVisible(false); }, 10); this.fireUiEvent(true); } @@ -316,6 +317,7 @@ export class Trashcan return; } this.flyout?.hide(); + this.workspace.scrollbar?.setVisible(true); this.fireUiEvent(false); this.workspace.recordDragTargets(); } From 2a2b3b3ac506e58896c1a8a215c566f9739329a0 Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Fri, 4 Aug 2023 16:41:24 -0700 Subject: [PATCH 53/58] chore: change the way we look for upstream remote (#7230) * chore: change the way we look for upstream remote * chore: use js instead of shell thanks christopher Co-authored-by: Christopher Allen * chore: store the found upstream name --------- Co-authored-by: Christopher Allen --- scripts/gulpfiles/git_tasks.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/gulpfiles/git_tasks.js b/scripts/gulpfiles/git_tasks.js index a1a133449d3..ebf9bb356a2 100644 --- a/scripts/gulpfiles/git_tasks.js +++ b/scripts/gulpfiles/git_tasks.js @@ -36,9 +36,8 @@ let upstream = null; function getUpstream() { if (upstream) return upstream; for (const line of String(execSync('git remote -v')).split('\n')) { - const [remote, url] = line.split('\t'); - if (url.includes('github.com/google/blockly')) { - upstream = remote; + if (line.includes('google/blockly')) { + upstream = line.split('\t')[0]; return upstream; } } From 826510f2420636fac0f5967425a93b531151b6e1 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Mon, 7 Aug 2023 20:22:21 +0200 Subject: [PATCH 54/58] fix: Preemptively fix API change in NDB. (#7361) Glockenspiel broke due to 'query' now being required within a client context. This change fixed Glockenspiel. Blockly samples doesn't appear to be broken yet, but Glokenspeil broke at midnight yesterday. Similar change being made to Blockly Games. --- appengine/storage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appengine/storage.py b/appengine/storage.py index e90375bf1e7..7e5073d3dd7 100644 --- a/appengine/storage.py +++ b/appengine/storage.py @@ -44,9 +44,9 @@ def xmlToKey(xml_content): # Store XML and return a generated key. xml_hash = int(hashlib.sha1(xml_content.encode("utf-8")).hexdigest(), 16) xml_hash = int(xml_hash % (2 ** 64) - (2 ** 63)) - lookup_query = Xml.query(Xml.xml_hash == xml_hash) client = ndb.Client() with client.context(): + lookup_query = Xml.query(Xml.xml_hash == xml_hash) lookup_result = lookup_query.get() if lookup_result: xml_key = lookup_result.key.string_id() From 0ac86c7e6814e344d855470eece732f0225d29f3 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 8 Aug 2023 10:06:03 -0700 Subject: [PATCH 55/58] fix: dedeprecate render functions (#7359) --- core/block_svg.ts | 5 ----- core/workspace_svg.ts | 6 ------ 2 files changed, 11 deletions(-) diff --git a/core/block_svg.ts b/core/block_svg.ts index e4053de0a9c..81dd63ded58 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -1548,13 +1548,8 @@ export class BlockSvg /** * Immediately lays out and reflows a block based on its contents and * settings. - * - * @deprecated Renders are triggered automatically when the block is modified - * (e.g. fields are modified or inputs are added). Any calls to render() - * are no longer necessary. To be removed in v11. */ render() { - deprecation.warn('Blockly.BlockSvg.prototype.render', 'v10', 'v11'); this.queueRender(); renderManagement.triggerQueuedRenders(); } diff --git a/core/workspace_svg.ts b/core/workspace_svg.ts index 01888e55f69..e9134aec085 100644 --- a/core/workspace_svg.ts +++ b/core/workspace_svg.ts @@ -78,7 +78,6 @@ import * as Xml from './xml.js'; import {ZoomControls} from './zoom_controls.js'; import {ContextMenuOption} from './contextmenu_registry.js'; import * as renderManagement from './render_management.js'; -import * as deprecation from './utils/deprecation.js'; /** Margin around the top/bottom/left/right after a zoomToFit call. */ const ZOOM_TO_FIT_MARGIN = 20; @@ -1232,13 +1231,8 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { /** * Render all blocks in workspace. - * - * @deprecated Renders are triggered automatically when the block is modified - * (e.g. fields are modified or inputs are added). Any calls to render() - * are no longer necessary. To be removed in v11. */ render() { - deprecation.warn('Blockly.WorkspaceSvg.prototype.render', 'v10', 'v11'); // Generate list of all blocks. const blocks = this.getAllBlocks(false); // Render each block. From a0b565724b4726e7a31f0770acad6b124c09a02b Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Tue, 8 Aug 2023 10:18:51 -0700 Subject: [PATCH 56/58] feat: make field `initView` and `initModel` more accessible (#7345) * chore: update loop style to remove any type * feat: make initView protected and initModel public * feat: make image element in image field protected --- core/block.ts | 4 ++-- core/field.ts | 6 +----- core/field_angle.ts | 2 -- core/field_checkbox.ts | 2 -- core/field_colour.ts | 2 -- core/field_dropdown.ts | 2 -- core/field_image.ts | 6 ++---- core/field_input.ts | 1 - core/field_label.ts | 2 -- core/field_multilineinput.ts | 2 -- core/field_variable.ts | 2 -- 11 files changed, 5 insertions(+), 26 deletions(-) diff --git a/core/block.ts b/core/block.ts index 7c7de425aae..3e279f79885 100644 --- a/core/block.ts +++ b/core/block.ts @@ -366,8 +366,8 @@ export class Block implements IASTNodeLocation, IDeletable { * change). */ initModel() { - for (let i = 0, input; (input = this.inputList[i]); i++) { - for (let j = 0, field; (field = input.fieldRow[j]); j++) { + for (const input of this.inputList) { + for (const field of input.fieldRow) { if (field.initModel) { field.initModel(); } diff --git a/core/field.ts b/core/field.ts index ba547800822..08aa28486bf 100644 --- a/core/field.ts +++ b/core/field.ts @@ -321,10 +321,8 @@ export abstract class Field /** * Create the block UI for this field. - * - * @internal */ - initView() { + protected initView() { this.createBorderRect_(); this.createTextElement_(); } @@ -332,8 +330,6 @@ export abstract class Field /** * Initializes the model of the field after it has been installed on a block. * No-op by default. - * - * @internal */ initModel() {} diff --git a/core/field_angle.ts b/core/field_angle.ts index 918b885da0b..49eb03b9825 100644 --- a/core/field_angle.ts +++ b/core/field_angle.ts @@ -165,8 +165,6 @@ export class FieldAngle extends FieldInput { /** * Create the block UI for this field. - * - * @internal */ override initView() { super.initView(); diff --git a/core/field_checkbox.ts b/core/field_checkbox.ts index 44dea25fa1c..1b865feef1a 100644 --- a/core/field_checkbox.ts +++ b/core/field_checkbox.ts @@ -110,8 +110,6 @@ export class FieldCheckbox extends Field { /** * Create the block UI for this checkbox. - * - * @internal */ override initView() { super.initView(); diff --git a/core/field_colour.ts b/core/field_colour.ts index d5ea7ee8047..359c9d713ae 100644 --- a/core/field_colour.ts +++ b/core/field_colour.ts @@ -163,8 +163,6 @@ export class FieldColour extends Field { /** * Create the block UI for this colour field. - * - * @internal */ override initView() { this.size_ = new Size( diff --git a/core/field_dropdown.ts b/core/field_dropdown.ts index 3f94657624f..0390a1031e1 100644 --- a/core/field_dropdown.ts +++ b/core/field_dropdown.ts @@ -185,8 +185,6 @@ export class FieldDropdown extends Field { /** * Create the block UI for this dropdown. - * - * @internal */ override initView() { if (this.shouldAddBorderRect_()) { diff --git a/core/field_image.ts b/core/field_image.ts index 752ef3e787d..7476498c9cd 100644 --- a/core/field_image.ts +++ b/core/field_image.ts @@ -29,13 +29,13 @@ export class FieldImage extends Field { */ private static readonly Y_PADDING = 1; protected override size_: Size; - private readonly imageHeight: number; + protected readonly imageHeight: number; /** The function to be called when this field is clicked. */ private clickHandler: ((p1: FieldImage) => void) | null = null; /** The rendered field's image element. */ - private imageElement: SVGImageElement | null = null; + protected imageElement: SVGImageElement | null = null; /** * Editable fields usually show some sort of UI indicating they are @@ -135,8 +135,6 @@ export class FieldImage extends Field { /** * Create the block UI for this image. - * - * @internal */ override initView() { this.imageElement = dom.createSvgElement( diff --git a/core/field_input.ts b/core/field_input.ts index ee6f669157e..eb64d4493f7 100644 --- a/core/field_input.ts +++ b/core/field_input.ts @@ -141,7 +141,6 @@ export abstract class FieldInput extends Field< } } - /** @internal */ override initView() { const block = this.getSourceBlock(); if (!block) { diff --git a/core/field_label.ts b/core/field_label.ts index 9d3d987446f..b67a10990e3 100644 --- a/core/field_label.ts +++ b/core/field_label.ts @@ -69,8 +69,6 @@ export class FieldLabel extends Field { /** * Create block UI for this label. - * - * @internal */ override initView() { this.createTextElement_(); diff --git a/core/field_multilineinput.ts b/core/field_multilineinput.ts index cb812b428e9..df7d0f3317a 100644 --- a/core/field_multilineinput.ts +++ b/core/field_multilineinput.ts @@ -152,8 +152,6 @@ export class FieldMultilineInput extends FieldTextInput { /** * Create the block UI for this field. - * - * @internal */ override initView() { this.createBorderRect_(); diff --git a/core/field_variable.ts b/core/field_variable.ts index 8c1fa54b6a5..419881fa4a6 100644 --- a/core/field_variable.ts +++ b/core/field_variable.ts @@ -130,8 +130,6 @@ export class FieldVariable extends FieldDropdown { * Initialize the model for this field if it has not already been initialized. * If the value has not been set to a variable by the first render, we make up * a variable rather than let the value be invalid. - * - * @internal */ override initModel() { const block = this.getSourceBlock(); From 84215386fb4f71c6facb2d5e8a7336820fb9a9d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Devansh=20Varshney=20=28=E0=A4=A6=E0=A5=87=E0=A4=B5?= =?UTF-8?q?=E0=A4=BE=E0=A4=82=E0=A4=B6=20=E0=A4=B5=E0=A4=BE=E0=A4=B0?= =?UTF-8?q?=E0=A5=8D=E0=A4=B7=E0=A5=8D=E0=A4=A3=E0=A5=87=E0=A4=AF=29?= Date: Wed, 9 Aug 2023 21:03:22 +0530 Subject: [PATCH 57/58] feat: Insertion marker json deserialization 7316 (#7364) * fix: insertion markers to use JSON deserialization * removed the const DUPLICATE_BLOCK_ERROR * modified to import module instead of referencing * removed coments for better readability --- core/insertion_marker_manager.ts | 54 ++++---------------------------- 1 file changed, 6 insertions(+), 48 deletions(-) diff --git a/core/insertion_marker_manager.ts b/core/insertion_marker_manager.ts index 48be15c147d..35e46dc019a 100644 --- a/core/insertion_marker_manager.ts +++ b/core/insertion_marker_manager.ts @@ -18,11 +18,11 @@ import type {BlockSvg} from './block_svg.js'; import * as common from './common.js'; import {ComponentManager} from './component_manager.js'; import {config} from './config.js'; -import * as constants from './constants.js'; import * as eventUtils from './events/utils.js'; import type {IDeleteArea} from './interfaces/i_delete_area.js'; import type {IDragTarget} from './interfaces/i_drag_target.js'; import type {RenderedConnection} from './rendered_connection.js'; +import * as blocks from './serialization/blocks.js'; import type {Coordinate} from './utils/coordinate.js'; import type {WorkspaceSvg} from './workspace_svg.js'; import * as renderManagement from './render_management.js'; @@ -43,16 +43,6 @@ interface CandidateConnection { radius: number; } -/** - * An error message to throw if the block created by createMarkerBlock_ is - * missing any components. - */ -const DUPLICATE_BLOCK_ERROR = - 'The insertion marker ' + - 'manager tried to create a marker but the result is missing %1. If ' + - 'you are using a mutator, make sure your domToMutation method is ' + - 'properly defined.'; - /** * Class that controls updates to connections during drags. It is primarily * responsible for finding the closest eligible connection and highlighting or @@ -232,48 +222,16 @@ export class InsertionMarkerManager { * @returns The insertion marker that represents the given block. */ private createMarkerBlock(sourceBlock: BlockSvg): BlockSvg { - const imType = sourceBlock.type; - eventUtils.disable(); let result: BlockSvg; try { - result = this.workspace.newBlock(imType); - result.setInsertionMarker(true); - if (sourceBlock.saveExtraState) { - const state = sourceBlock.saveExtraState(); - if (state && result.loadExtraState) { - result.loadExtraState(state); - } - } else if (sourceBlock.mutationToDom) { - const oldMutationDom = sourceBlock.mutationToDom(); - if (oldMutationDom && result.domToMutation) { - result.domToMutation(oldMutationDom); - } - } - // Copy field values from the other block. These values may impact the - // rendered size of the insertion marker. Note that we do not care about - // child blocks here. - for (let i = 0; i < sourceBlock.inputList.length; i++) { - const sourceInput = sourceBlock.inputList[i]; - if (sourceInput.name === constants.COLLAPSED_INPUT_NAME) { - continue; // Ignore the collapsed input. - } - const resultInput = result.inputList[i]; - if (!resultInput) { - throw new Error(DUPLICATE_BLOCK_ERROR.replace('%1', 'an input')); - } - for (let j = 0; j < sourceInput.fieldRow.length; j++) { - const sourceField = sourceInput.fieldRow[j]; - const resultField = resultInput.fieldRow[j]; - if (!resultField) { - throw new Error(DUPLICATE_BLOCK_ERROR.replace('%1', 'a field')); - } - resultField.setValue(sourceField.getValue()); - } + const blockJson = blocks.save(sourceBlock); + if (!blockJson) { + throw new Error('Failed to serialize source block.'); } + result = blocks.append(blockJson, this.workspace) as BlockSvg; - result.setCollapsed(sourceBlock.isCollapsed()); - result.setInputsInline(sourceBlock.getInputsInline()); + result.setInsertionMarker(true); result.initSvg(); result.getSvgRoot().setAttribute('visibility', 'hidden'); From 80b1b4454026b540f72a1c5e13070662e95f7ea4 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Wed, 9 Aug 2023 12:46:09 -0700 Subject: [PATCH 58/58] fix: connect animation persisting (#7365) * fix: connect animation * chore: format --- core/block_animations.ts | 49 ++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/core/block_animations.ts b/core/block_animations.ts index 7e0ec7b742d..833c1c4e56b 100644 --- a/core/block_animations.ts +++ b/core/block_animations.ts @@ -122,27 +122,36 @@ export function connectionUiEffect(block: BlockSvg) { }, workspace.getParentSvg(), ); - // Start the animation. - connectionUiStep(ripple, new Date(), scale); -} -/** - * Expand a ripple around a connection. - * - * @param ripple Element to animate. - * @param start Date of animation's start. - * @param scale Scale of workspace. - */ -function connectionUiStep(ripple: SVGElement, start: Date, scale: number) { - const ms = new Date().getTime() - start.getTime(); - const percent = ms / 150; - if (percent > 1) { - dom.removeNode(ripple); - } else { - ripple.setAttribute('r', String(percent * 25 * scale)); - ripple.style.opacity = String(1 - percent); - disconnectPid = setTimeout(connectionUiStep, 10, ripple, start, scale); - } + const scaleAnimation = dom.createSvgElement( + Svg.ANIMATE, + { + 'id': 'animationCircle', + 'begin': 'indefinite', + 'attributeName': 'r', + 'dur': '150ms', + 'from': 0, + 'to': 25 * scale, + }, + ripple, + ); + const opacityAnimation = dom.createSvgElement( + Svg.ANIMATE, + { + 'id': 'animationOpacity', + 'begin': 'indefinite', + 'attributeName': 'opacity', + 'dur': '150ms', + 'from': 1, + 'to': 0, + }, + ripple, + ); + + scaleAnimation.beginElement(); + opacityAnimation.beginElement(); + + setTimeout(() => void dom.removeNode(ripple), 150); } /**