From 5881ce32c1c1ebccedab7a31e31722093265004f Mon Sep 17 00:00:00 2001 From: Mark Friedman Date: Fri, 31 May 2024 15:19:46 -0700 Subject: [PATCH 001/129] fix: change which element keydown is bound to from document to injection div (#8188) * Change which element keydown is bound to * Modify keydown tests * Use browserEvents.conditionalBind() * Remove commented out code. --- core/inject.ts | 5 ++--- tests/mocha/keydown_test.js | 29 +++++++++++++++-------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/core/inject.ts b/core/inject.ts index 323191817ac..55409b7f3d2 100644 --- a/core/inject.ts +++ b/core/inject.ts @@ -77,6 +77,8 @@ export function inject( common.setMainWorkspace(workspace); }); + browserEvents.conditionalBind(subContainer, 'keydown', null, onKeyDown); + return workspace; } @@ -320,8 +322,6 @@ let documentEventsBound = false; * Most of these events should be bound to the SVG's surface. * However, 'mouseup' has to be on the whole document so that a block dragged * out of bounds and released will know that it has been released. - * Also, 'keydown' has to be on the whole document since the browser doesn't - * understand a concept of focus on the SVG image. */ function bindDocumentEvents() { if (!documentEventsBound) { @@ -333,7 +333,6 @@ function bindDocumentEvents() { } } }); - browserEvents.conditionalBind(document, 'keydown', null, onKeyDown); // longStop needs to run to stop the context menu from showing up. It // should run regardless of what other touch event handlers have run. browserEvents.bind(document, 'touchend', null, Touch.longStop); diff --git a/tests/mocha/keydown_test.js b/tests/mocha/keydown_test.js index 0483d72c13e..077aff55efc 100644 --- a/tests/mocha/keydown_test.js +++ b/tests/mocha/keydown_test.js @@ -16,6 +16,7 @@ suite('Key Down', function () { setup(function () { sharedTestSetup.call(this); this.workspace = Blockly.inject('blocklyDiv', {}); + this.injectionDiv = this.workspace.getInjectionDiv(); }); teardown(function () { sharedTestTeardown.call(this); @@ -42,7 +43,7 @@ suite('Key Down', function () { const name = opt_name ? opt_name : 'Not called when readOnly is true'; test(name, function () { this.workspace.options.readOnly = true; - document.dispatchEvent(keyEvent); + this.injectionDiv.dispatchEvent(keyEvent); sinon.assert.notCalled(this.hideChaffSpy); }); } @@ -56,7 +57,7 @@ suite('Key Down', function () { ); }); test('Simple', function () { - document.dispatchEvent(this.event); + this.injectionDiv.dispatchEvent(this.event); sinon.assert.calledOnce(this.hideChaffSpy); }); runReadOnlyTest(createKeyDownEvent(Blockly.utils.KeyCodes.ESC)); @@ -68,7 +69,7 @@ suite('Key Down', function () { }); test('Not called on hidden workspaces', function () { this.workspace.isVisible_ = false; - document.dispatchEvent(this.event); + this.injectionDiv.dispatchEvent(this.event); sinon.assert.notCalled(this.hideChaffSpy); }); }); @@ -92,7 +93,7 @@ suite('Key Down', function () { const testCaseName = testCase[0]; const keyEvent = testCase[1]; test(testCaseName, function () { - document.dispatchEvent(keyEvent); + this.injectionDiv.dispatchEvent(keyEvent); sinon.assert.calledOnce(this.hideChaffSpy); sinon.assert.calledOnce(this.deleteSpy); }); @@ -143,7 +144,7 @@ suite('Key Down', function () { const testCaseName = testCase[0]; const keyEvent = testCase[1]; test(testCaseName, function () { - document.dispatchEvent(keyEvent); + this.injectionDiv.dispatchEvent(keyEvent); sinon.assert.calledOnce(this.copySpy); sinon.assert.calledOnce(this.hideChaffSpy); }); @@ -164,7 +165,7 @@ suite('Key Down', function () { const keyEvent = testCase[1]; test(testCaseName, function () { sinon.stub(Blockly.Gesture, 'inProgress').returns(true); - document.dispatchEvent(keyEvent); + this.injectionDiv.dispatchEvent(keyEvent); sinon.assert.notCalled(this.copySpy); sinon.assert.notCalled(this.hideChaffSpy); }); @@ -179,7 +180,7 @@ suite('Key Down', function () { sinon .stub(Blockly.common.getSelected(), 'isDeletable') .returns(false); - document.dispatchEvent(keyEvent); + this.injectionDiv.dispatchEvent(keyEvent); sinon.assert.notCalled(this.copySpy); sinon.assert.notCalled(this.hideChaffSpy); }); @@ -192,7 +193,7 @@ suite('Key Down', function () { const keyEvent = testCase[1]; test(testCaseName, function () { sinon.stub(Blockly.common.getSelected(), 'isMovable').returns(false); - document.dispatchEvent(keyEvent); + this.injectionDiv.dispatchEvent(keyEvent); sinon.assert.notCalled(this.copySpy); sinon.assert.notCalled(this.hideChaffSpy); }); @@ -234,7 +235,7 @@ suite('Key Down', function () { const testCaseName = testCase[0]; const keyEvent = testCase[1]; test(testCaseName, function () { - document.dispatchEvent(keyEvent); + this.injectionDiv.dispatchEvent(keyEvent); sinon.assert.calledOnce(this.undoSpy); sinon.assert.calledWith(this.undoSpy, false); sinon.assert.calledOnce(this.hideChaffSpy); @@ -248,7 +249,7 @@ suite('Key Down', function () { const keyEvent = testCase[1]; test(testCaseName, function () { sinon.stub(Blockly.Gesture, 'inProgress').returns(true); - document.dispatchEvent(keyEvent); + this.injectionDiv.dispatchEvent(keyEvent); sinon.assert.notCalled(this.undoSpy); sinon.assert.notCalled(this.hideChaffSpy); }); @@ -301,7 +302,7 @@ suite('Key Down', function () { const testCaseName = testCase[0]; const keyEvent = testCase[1]; test(testCaseName, function () { - document.dispatchEvent(keyEvent); + this.injectionDiv.dispatchEvent(keyEvent); sinon.assert.calledOnce(this.redoSpy); sinon.assert.calledWith(this.redoSpy, true); sinon.assert.calledOnce(this.hideChaffSpy); @@ -315,7 +316,7 @@ suite('Key Down', function () { const keyEvent = testCase[1]; test(testCaseName, function () { sinon.stub(Blockly.Gesture, 'inProgress').returns(true); - document.dispatchEvent(keyEvent); + this.injectionDiv.dispatchEvent(keyEvent); sinon.assert.notCalled(this.redoSpy); sinon.assert.notCalled(this.hideChaffSpy); }); @@ -343,14 +344,14 @@ suite('Key Down', function () { ); }); test('Simple', function () { - document.dispatchEvent(this.ctrlYEvent); + this.injectionDiv.dispatchEvent(this.ctrlYEvent); sinon.assert.calledOnce(this.undoSpy); sinon.assert.calledWith(this.undoSpy, true); sinon.assert.calledOnce(this.hideChaffSpy); }); test('Not called when a gesture is in progress', function () { sinon.stub(Blockly.Gesture, 'inProgress').returns(true); - document.dispatchEvent(this.ctrlYEvent); + this.injectionDiv.dispatchEvent(this.ctrlYEvent); sinon.assert.notCalled(this.undoSpy); sinon.assert.notCalled(this.hideChaffSpy); }); From af907bf98ee8523ca6f8da6134e43d2af6b65b41 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 08:17:39 -0700 Subject: [PATCH 002/129] chore(deps): bump @microsoft/api-documenter from 7.23.14 to 7.25.2 (#8190) Bumps [@microsoft/api-documenter](https://github.com/microsoft/rushstack/tree/HEAD/apps/api-documenter) from 7.23.14 to 7.25.2. - [Changelog](https://github.com/microsoft/rushstack/blob/main/apps/api-documenter/CHANGELOG.md) - [Commits](https://github.com/microsoft/rushstack/commits/@microsoft/api-documenter_v7.25.2/apps/api-documenter) --- updated-dependencies: - dependency-name: "@microsoft/api-documenter" 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 | 293 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 248 insertions(+), 45 deletions(-) diff --git a/package-lock.json b/package-lock.json index f17ef841e42..b4e8b55f940 100644 --- a/package-lock.json +++ b/package-lock.json @@ -539,16 +539,16 @@ } }, "node_modules/@microsoft/api-documenter": { - "version": "7.23.14", - "resolved": "https://registry.npmjs.org/@microsoft/api-documenter/-/api-documenter-7.23.14.tgz", - "integrity": "sha512-D9cX3sS/6xN8SFbrR6I1ZTKvGl5UIPFZKYqTLg8YBUKJtFbUSDLrzRLWOcjxwxjnu+gCHAHyaNpG4G//CQivLw==", + "version": "7.25.2", + "resolved": "https://registry.npmjs.org/@microsoft/api-documenter/-/api-documenter-7.25.2.tgz", + "integrity": "sha512-5srpPYawzGkSqjP25gopOZvH6/T8IYZN55L8NelZxck77nShOjZJt+qPZUaMy34qtL7GAWXhSDuKXEtZWurZsQ==", "dev": true, "dependencies": { - "@microsoft/api-extractor-model": "7.28.3", - "@microsoft/tsdoc": "0.14.2", - "@rushstack/node-core-library": "3.62.0", - "@rushstack/ts-command-line": "4.17.1", - "colors": "~1.2.1", + "@microsoft/api-extractor-model": "7.29.2", + "@microsoft/tsdoc": "~0.15.0", + "@rushstack/node-core-library": "5.4.1", + "@rushstack/terminal": "0.13.0", + "@rushstack/ts-command-line": "4.22.0", "js-yaml": "~3.13.1", "resolve": "~1.22.1" }, @@ -556,6 +556,30 @@ "api-documenter": "bin/api-documenter" } }, + "node_modules/@microsoft/api-documenter/node_modules/@microsoft/tsdoc": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.15.0.tgz", + "integrity": "sha512-HZpPoABogPvjeJOdzCOSJsXeL/SMCBgBZMVC3X3d7YYp2gf31MfxhUoYUNwf1ERPJOnQc0wkFn9trqI6ZEdZuA==", + "dev": true + }, + "node_modules/@microsoft/api-documenter/node_modules/@rushstack/terminal": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@rushstack/terminal/-/terminal-0.13.0.tgz", + "integrity": "sha512-Ou44Q2s81BqJu3dpYedAX54am9vn245F0HzqVrfJCMQk5pGgoKKOBOjkbfZC9QKcGNaECh6pwH2s5noJt7X6ew==", + "dev": true, + "dependencies": { + "@rushstack/node-core-library": "5.4.1", + "supports-color": "~8.1.1" + }, + "peerDependencies": { + "@types/node": "*" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, "node_modules/@microsoft/api-documenter/node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -578,6 +602,21 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/@microsoft/api-documenter/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, "node_modules/@microsoft/api-extractor": { "version": "7.43.0", "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.43.0.tgz", @@ -603,16 +642,56 @@ } }, "node_modules/@microsoft/api-extractor-model": { - "version": "7.28.3", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.28.3.tgz", - "integrity": "sha512-wT/kB2oDbdZXITyDh2SQLzaWwTOFbV326fP0pUwNW00WeliARs0qjmXBWmGWardEzp2U3/axkO3Lboqun6vrig==", + "version": "7.29.2", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.29.2.tgz", + "integrity": "sha512-hAYajOjQan3uslhKJRwvvHIdLJ+ZByKqdSsJ/dgHFxPtEbdKpzMDO8zuW4K5gkSMYl5D0LbNwxkhxr51P2zsmw==", "dev": true, "dependencies": { - "@microsoft/tsdoc": "0.14.2", - "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.62.0" + "@microsoft/tsdoc": "~0.15.0", + "@microsoft/tsdoc-config": "~0.17.0", + "@rushstack/node-core-library": "5.4.1" + } + }, + "node_modules/@microsoft/api-extractor-model/node_modules/@microsoft/tsdoc": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.15.0.tgz", + "integrity": "sha512-HZpPoABogPvjeJOdzCOSJsXeL/SMCBgBZMVC3X3d7YYp2gf31MfxhUoYUNwf1ERPJOnQc0wkFn9trqI6ZEdZuA==", + "dev": true + }, + "node_modules/@microsoft/api-extractor-model/node_modules/@microsoft/tsdoc-config": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.17.0.tgz", + "integrity": "sha512-v/EYRXnCAIHxOHW+Plb6OWuUoMotxTN0GLatnpOb1xq0KuTNw/WI3pamJx/UbsoJP5k9MCw1QxvvhPcF9pH3Zg==", + "dev": true, + "dependencies": { + "@microsoft/tsdoc": "0.15.0", + "ajv": "~8.12.0", + "jju": "~1.4.0", + "resolve": "~1.22.2" } }, + "node_modules/@microsoft/api-extractor-model/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@microsoft/api-extractor-model/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, "node_modules/@microsoft/api-extractor/node_modules/@microsoft/api-extractor-model": { "version": "7.28.13", "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.28.13.tgz", @@ -839,18 +918,19 @@ } }, "node_modules/@rushstack/node-core-library": { - "version": "3.62.0", - "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.62.0.tgz", - "integrity": "sha512-88aJn2h8UpSvdwuDXBv1/v1heM6GnBf3RjEy6ZPP7UnzHNCqOHA2Ut+ScYUbXcqIdfew9JlTAe3g+cnX9xQ/Aw==", + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-5.4.1.tgz", + "integrity": "sha512-WNnwdS8r9NZ/2K3u29tNoSRldscFa7SxU0RT+82B6Dy2I4Hl2MeCSKm4EXLXPKeNzLGvJ1cqbUhTLviSF8E6iA==", "dev": true, "dependencies": { - "colors": "~1.2.1", + "ajv": "~8.13.0", + "ajv-draft-04": "~1.0.0", + "ajv-formats": "~3.0.1", "fs-extra": "~7.0.1", "import-lazy": "~4.0.0", "jju": "~1.4.0", "resolve": "~1.22.1", - "semver": "~7.5.4", - "z-schema": "~5.0.2" + "semver": "~7.5.4" }, "peerDependencies": { "@types/node": "*" @@ -861,6 +941,42 @@ } } }, + "node_modules/@rushstack/node-core-library/node_modules/ajv": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.13.0.tgz", + "integrity": "sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.4.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@rushstack/node-core-library/node_modules/ajv-draft-04": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ajv-draft-04/-/ajv-draft-04-1.0.0.tgz", + "integrity": "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==", + "dev": true, + "peerDependencies": { + "ajv": "^8.5.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/@rushstack/node-core-library/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, "node_modules/@rushstack/rig-package": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.5.2.tgz", @@ -927,17 +1043,35 @@ } }, "node_modules/@rushstack/ts-command-line": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.17.1.tgz", - "integrity": "sha512-2jweO1O57BYP5qdBGl6apJLB+aRIn5ccIRTPDyULh0KMwVzFqWtw6IZWt1qtUoZD/pD2RNkIOosH6Cq45rIYeg==", + "version": "4.22.0", + "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.22.0.tgz", + "integrity": "sha512-Qj28t6MO3HRgAZ72FDeFsrpdE6wBWxF3VENgvrXh7JF2qIT+CrXiOJIesW80VFZB9QwObSpkB1ilx794fGQg6g==", "dev": true, "dependencies": { + "@rushstack/terminal": "0.13.0", "@types/argparse": "1.0.38", "argparse": "~1.0.9", - "colors": "~1.2.1", "string-argv": "~0.3.1" } }, + "node_modules/@rushstack/ts-command-line/node_modules/@rushstack/terminal": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@rushstack/terminal/-/terminal-0.13.0.tgz", + "integrity": "sha512-Ou44Q2s81BqJu3dpYedAX54am9vn245F0HzqVrfJCMQk5pGgoKKOBOjkbfZC9QKcGNaECh6pwH2s5noJt7X6ew==", + "dev": true, + "dependencies": { + "@rushstack/node-core-library": "5.4.1", + "supports-color": "~8.1.1" + }, + "peerDependencies": { + "@types/node": "*" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, "node_modules/@rushstack/ts-command-line/node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -947,6 +1081,21 @@ "sprintf-js": "~1.0.2" } }, + "node_modules/@rushstack/ts-command-line/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, "node_modules/@sindresorhus/is": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-5.6.0.tgz", @@ -1616,6 +1765,45 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/ajv-formats": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz", + "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==", + "dev": true, + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ajv-formats/node_modules/ajv": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.14.0.tgz", + "integrity": "sha512-oYs1UUtO97ZO2lJ4bwnWeQW8/zvOIQLGKcvPTsWmvc2SYgBb+upuNS5NxoLaMU4h8Ju3Nbj6Cq8mD2LQoqVKFA==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.4.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, "node_modules/ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -2923,15 +3111,6 @@ "color-support": "bin.js" } }, - "node_modules/colors": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.2.5.tgz", - "integrity": "sha512-erNRLao/Y3Fv54qUa0LBB+//Uf3YwMUmdJinN20yMXm9zdKKqH9wt7R9IIVZ+K7ShzfpLV/Zg8+VyrBJYB4lpg==", - "dev": true, - "engines": { - "node": ">=0.1.90" - } - }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -4895,10 +5074,13 @@ } }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/geckodriver": { "version": "4.3.2", @@ -6390,6 +6572,18 @@ "node": ">=0.10.0" } }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", @@ -6711,12 +6905,12 @@ } }, "node_modules/is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "dev": true, "dependencies": { - "has": "^1.0.3" + "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -9517,6 +9711,15 @@ "node": ">=0.10.0" } }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/require-main-filename": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", @@ -9529,12 +9732,12 @@ "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" }, "node_modules/resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", "dev": true, "dependencies": { - "is-core-module": "^2.9.0", + "is-core-module": "^2.13.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, From c94d8c2ca00be108a58cf5dfbff041c30796f991 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Jun 2024 17:05:46 +0000 Subject: [PATCH 003/129] chore(deps): bump webdriverio from 8.32.2 to 8.38.2 (#8195) Bumps [webdriverio](https://github.com/webdriverio/webdriverio/tree/HEAD/packages/webdriverio) from 8.32.2 to 8.38.2. - [Release notes](https://github.com/webdriverio/webdriverio/releases) - [Changelog](https://github.com/webdriverio/webdriverio/blob/v8.38.2/CHANGELOG.md) - [Commits](https://github.com/webdriverio/webdriverio/commits/v8.38.2/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 | 1088 +++++++++++++++++++++++++++++---------------- 1 file changed, 712 insertions(+), 376 deletions(-) diff --git a/package-lock.json b/package-lock.json index b4e8b55f940..ba428bab7f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -856,6 +856,42 @@ "node": ">=14" } }, + "node_modules/@promptbook/utils": { + "version": "0.50.0-10", + "resolved": "https://registry.npmjs.org/@promptbook/utils/-/utils-0.50.0-10.tgz", + "integrity": "sha512-Z94YoY/wcZb5m1QoXgmIC1rVeDguGK5bWmUTYdWCqh/LHVifRdJ1C+tBzS0h+HMOD0XzMjZhBQ/mBgTZ/QNW/g==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://buymeacoffee.com/hejny" + }, + { + "type": "github", + "url": "https://github.com/webgptorg/promptbook/blob/main/README.md#%EF%B8%8F-contributing" + } + ], + "dependencies": { + "moment": "2.30.1", + "prettier": "2.8.1", + "spacetrim": "0.11.25" + } + }, + "node_modules/@promptbook/utils/node_modules/prettier": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.1.tgz", + "integrity": "sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/@puppeteer/browsers": { "version": "1.4.6", "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-1.4.6.tgz", @@ -1479,14 +1515,14 @@ "dev": true }, "node_modules/@wdio/config": { - "version": "8.32.2", - "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.32.2.tgz", - "integrity": "sha512-ubqe4X+TgcERzXKIpMfisquNxPZNtRU5uPeV7hvas++mD75QyNpmWHCtea2+TjoXKxlZd1MVrtZAwtmqMmyhPw==", + "version": "8.38.2", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-8.38.2.tgz", + "integrity": "sha512-xlnapTr1vOA0h5HsHTIqj47729FbG3WjxmgHweDEQvcT4C1g9l+WKf+N3FM7DNNoIsAqxKi6rOHG02rJADQJtw==", "dev": true, "dependencies": { - "@wdio/logger": "8.28.0", - "@wdio/types": "8.32.2", - "@wdio/utils": "8.32.2", + "@wdio/logger": "8.38.0", + "@wdio/types": "8.38.2", + "@wdio/utils": "8.38.2", "decamelize": "^6.0.0", "deepmerge-ts": "^5.0.0", "glob": "^10.2.2", @@ -1509,9 +1545,9 @@ } }, "node_modules/@wdio/logger": { - "version": "8.28.0", - "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-8.28.0.tgz", - "integrity": "sha512-/s6zNCqwy1hoc+K4SJypis0Ud0dlJ+urOelJFO1x0G0rwDRWyFiUP6ijTaCcFxAm29jYEcEPWijl2xkVIHwOyA==", + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-8.38.0.tgz", + "integrity": "sha512-kcHL86RmNbcQP+Gq/vQUGlArfU6IIcbbnNp32rRIraitomZow+iEoc519rdQmSVusDozMS5DZthkgDdxK+vz6Q==", "dev": true, "dependencies": { "chalk": "^5.1.2", @@ -1563,9 +1599,9 @@ } }, "node_modules/@wdio/protocols": { - "version": "8.32.0", - "resolved": "https://registry.npmjs.org/@wdio/protocols/-/protocols-8.32.0.tgz", - "integrity": "sha512-inLJRrtIGdTz/YPbcsvpSvPlYQFTVtF3OYBwAXhG2FiP1ZwE1CQNLP/xgRGye1ymdGCypGkexRqIx3KBGm801Q==", + "version": "8.38.0", + "resolved": "https://registry.npmjs.org/@wdio/protocols/-/protocols-8.38.0.tgz", + "integrity": "sha512-7BPi7aXwUtnXZPeWJRmnCNFjyDvGrXlBmN9D4Pi58nILkyjVRQKEY9/qv/pcdyB0cvmIvw++Kl/1Lg+RxG++UA==", "dev": true }, "node_modules/@wdio/repl": { @@ -1581,9 +1617,9 @@ } }, "node_modules/@wdio/types": { - "version": "8.32.2", - "resolved": "https://registry.npmjs.org/@wdio/types/-/types-8.32.2.tgz", - "integrity": "sha512-jq8LcBBQpBP9ZF5kECKEpXv8hN7irCGCjLFAN0Bd5ScRR6qu6MGWvwkDkau2sFPr0b++sKDCEaMzQlwrGFjZXg==", + "version": "8.38.2", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-8.38.2.tgz", + "integrity": "sha512-+wj1c1OSLdnN4WO5b44Ih4263dTl/eSwMGSI4/pCgIyXIuYQH38JQ+6WRa+c8vJEskUzboq2cSgEQumVZ39ozQ==", "dev": true, "dependencies": { "@types/node": "^20.1.0" @@ -1593,17 +1629,17 @@ } }, "node_modules/@wdio/utils": { - "version": "8.32.2", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.32.2.tgz", - "integrity": "sha512-PJcP4d1Fr8Zp+YIfGN93G0fjDj/6J0I6Gf6p0IpJk8qKQpdFDm4gB+lc202iv2YkyC+oT6b4Ik2W9LzvpSKNoQ==", + "version": "8.38.2", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-8.38.2.tgz", + "integrity": "sha512-y5AnBwsGcu/XuCBGCgKmlvKdwEIFyzLA+Cr+denySxY3jbWDONtPUcGaVdFALwsIa5jcIjcATqGmZcCPGnkd7g==", "dev": true, "dependencies": { "@puppeteer/browsers": "^1.6.0", - "@wdio/logger": "8.28.0", - "@wdio/types": "8.32.2", + "@wdio/logger": "8.38.0", + "@wdio/types": "8.38.2", "decamelize": "^6.0.0", "deepmerge-ts": "^5.1.0", - "edgedriver": "^5.3.5", + "edgedriver": "^5.5.0", "geckodriver": "^4.3.1", "get-port": "^7.0.0", "import-meta-resolve": "^4.0.0", @@ -1649,32 +1685,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@wdio/utils/node_modules/http-proxy-agent": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", - "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", - "dev": true, - "dependencies": { - "agent-base": "^7.1.0", - "debug": "^4.3.4" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/@wdio/utils/node_modules/https-proxy-agent": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz", - "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", - "dev": true, - "dependencies": { - "agent-base": "^7.0.2", - "debug": "4" - }, - "engines": { - "node": ">= 14" - } - }, "node_modules/@wdio/utils/node_modules/lru-cache": { "version": "7.18.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", @@ -1709,6 +1719,17 @@ "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==", "dev": true }, + "node_modules/@zip.js/zip.js": { + "version": "2.7.45", + "resolved": "https://registry.npmjs.org/@zip.js/zip.js/-/zip.js-2.7.45.tgz", + "integrity": "sha512-Mm2EXF33DJQ/3GWWEWeP1UCqzpQ5+fiMvT3QWspsXY05DyqqxWu7a9awSzU4/spHMHVFrTjani1PR0vprgZpow==", + "dev": true, + "engines": { + "bun": ">=0.7.0", + "deno": ">=1.0.0", + "node": ">=16.5.0" + } + }, "node_modules/abab": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", @@ -1717,6 +1738,18 @@ "dev": true, "peer": true }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dev": true, + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, "node_modules/acorn": { "version": "8.11.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", @@ -1890,78 +1923,186 @@ } }, "node_modules/archiver": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/archiver/-/archiver-6.0.1.tgz", - "integrity": "sha512-CXGy4poOLBKptiZH//VlWdFuUC1RESbdZjGjILwBuZ73P7WkAUN0htfSfBq/7k6FRFlpu7bg4JOkj1vU9G6jcQ==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/archiver/-/archiver-7.0.1.tgz", + "integrity": "sha512-ZcbTaIqJOfCc03QwD468Unz/5Ir8ATtvAHsK+FdXbDIbGfihqh9mrvdcYunQzqn4HrvWWaFyaxJhGZagaJJpPQ==", "dev": true, "dependencies": { - "archiver-utils": "^4.0.1", + "archiver-utils": "^5.0.2", "async": "^3.2.4", - "buffer-crc32": "^0.2.1", - "readable-stream": "^3.6.0", + "buffer-crc32": "^1.0.0", + "readable-stream": "^4.0.0", "readdir-glob": "^1.1.2", "tar-stream": "^3.0.0", - "zip-stream": "^5.0.1" + "zip-stream": "^6.0.1" }, "engines": { - "node": ">= 12.0.0" + "node": ">= 14" } }, "node_modules/archiver-utils": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-4.0.1.tgz", - "integrity": "sha512-Q4Q99idbvzmgCTEAAhi32BkOyq8iVI5EwdO0PmBDSGIzzjYNdcFn7Q7k3OzbLy4kLUPXfJtG6fO2RjftXbobBg==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-5.0.2.tgz", + "integrity": "sha512-wuLJMmIBQYCsGZgYLTy5FIB2pF6Lfb6cXMSF8Qywwk3t20zWnAi7zLcQFdKQmIB8wyZpY5ER38x08GbwtR2cLA==", "dev": true, "dependencies": { - "glob": "^8.0.0", + "glob": "^10.0.0", "graceful-fs": "^4.2.0", + "is-stream": "^2.0.1", "lazystream": "^1.0.0", "lodash": "^4.17.15", "normalize-path": "^3.0.0", - "readable-stream": "^3.6.0" + "readable-stream": "^4.0.0" }, "engines": { - "node": ">= 12.0.0" + "node": ">= 14" } }, - "node_modules/archiver-utils/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==", + "node_modules/archiver-utils/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], "dependencies": { - "balanced-match": "^1.0.0" + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" } }, - "node_modules/archiver-utils/node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "node_modules/archiver-utils/node_modules/readable-stream": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", + "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", "dev": true, "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" }, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/archiver-utils/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "node_modules/archiver-utils/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/archiver-utils/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "dev": true, "dependencies": { - "brace-expansion": "^2.0.1" + "safe-buffer": "~5.2.0" + } + }, + "node_modules/archiver/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/archiver/node_modules/buffer-crc32": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-1.0.0.tgz", + "integrity": "sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w==", + "dev": true, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/archiver/node_modules/readable-stream": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", + "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", + "dev": true, + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" }, "engines": { - "node": ">=10" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/archiver/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/archiver/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.2.0" } }, "node_modules/archy": { @@ -2175,9 +2316,9 @@ "dev": true }, "node_modules/async": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", - "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", + "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==", "dev": true }, "node_modules/async-done": { @@ -2300,6 +2441,52 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/bare-events": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.3.1.tgz", + "integrity": "sha512-sJnSOTVESURZ61XgEleqmP255T6zTYwHPwE4r6SssIh0U9/uDvfpdoJYpVUerJJZH2fueO+CdT8ZT+OC/7aZDA==", + "dev": true, + "optional": true + }, + "node_modules/bare-fs": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-2.3.1.tgz", + "integrity": "sha512-W/Hfxc/6VehXlsgFtbB5B4xFcsCl+pAh30cYhoFyXErf6oGrwjh8SwiPAdHgpmWonKuYpZgGywN0SXt7dgsADA==", + "dev": true, + "optional": true, + "dependencies": { + "bare-events": "^2.0.0", + "bare-path": "^2.0.0", + "bare-stream": "^2.0.0" + } + }, + "node_modules/bare-os": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-2.3.0.tgz", + "integrity": "sha512-oPb8oMM1xZbhRQBngTgpcQ5gXw6kjOaRsSWsIeNyRxGed2w/ARyP7ScBYpWR1qfX2E5rS3gBw6OWcSQo+s+kUg==", + "dev": true, + "optional": true + }, + "node_modules/bare-path": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/bare-path/-/bare-path-2.1.3.tgz", + "integrity": "sha512-lh/eITfU8hrj9Ru5quUp0Io1kJWIk1bTjzo7JH1P5dWmQ2EL4hFUlfI8FonAhSlgIfhn63p84CDY/x+PisgcXA==", + "dev": true, + "optional": true, + "dependencies": { + "bare-os": "^2.1.0" + } + }, + "node_modules/bare-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.0.1.tgz", + "integrity": "sha512-ubLyoDqPnUf5o0kSFp709HC0WRZuxVuh4pbte5eY95Xvx5bdvz07c2JFmXBfqqe60q+9PJ8S4X5GRvmcNSKMxg==", + "dev": true, + "optional": true, + "dependencies": { + "streamx": "^2.18.0" + } + }, "node_modules/base": { "version": "0.11.2", "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", @@ -2371,28 +2558,6 @@ "node": ">=10.0.0" } }, - "node_modules/big-integer": { - "version": "1.6.52", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.52.tgz", - "integrity": "sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==", - "dev": true, - "engines": { - "node": ">=0.6" - } - }, - "node_modules/binary": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz", - "integrity": "sha512-D4H1y5KYwpJgK8wk1Cue5LLPgmwHKYSChkbspQg5JtVuR5ulGckxfR62H3AE9UDkdMC8yyXlqYihuz3Aqg2XZg==", - "dev": true, - "dependencies": { - "buffers": "~0.1.1", - "chainsaw": "~0.1.0" - }, - "engines": { - "node": "*" - } - }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -2584,12 +2749,6 @@ "node": ">=12" } }, - "node_modules/bluebird": { - "version": "3.4.7", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz", - "integrity": "sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA==", - "dev": true - }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -2666,24 +2825,6 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, - "node_modules/buffer-indexof-polyfill": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/buffer-indexof-polyfill/-/buffer-indexof-polyfill-1.0.2.tgz", - "integrity": "sha512-I7wzHwA3t1/lwXQh+A5PbNvJxgfo5r3xulgpYDB5zckTu/Z9oUK9biouBKQUjEqzaz3HnAT6TYoovmE+GqSf7A==", - "dev": true, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/buffers": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz", - "integrity": "sha512-9q/rDEGSb/Qsvv2qvzIzdluL5k7AaJOTrw23z9reQthrbF7is4CtlT0DXyO1oei2DCp4uojjzQ7igaSHp1kAEQ==", - "dev": true, - "engines": { - "node": ">=0.2.0" - } - }, "node_modules/builtin-modules": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", @@ -2804,18 +2945,6 @@ "node": ">=4" } }, - "node_modules/chainsaw": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", - "integrity": "sha512-75kWfWt6MEKNC8xYXIdRpDehRYY/tNSgwKaJq+dbbDcxORuVrrQ+SEHoWsniVn9XPYfP4gmdWIeDk/4YNp1rNQ==", - "dev": true, - "dependencies": { - "traverse": ">=0.3.0 <0.4" - }, - "engines": { - "node": "*" - } - }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -3147,18 +3276,88 @@ "dev": true }, "node_modules/compress-commons": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-5.0.1.tgz", - "integrity": "sha512-MPh//1cERdLtqwO3pOFLeXtpuai0Y2WCd5AhtKxznqM7WtaMYaOEMSgn45d9D10sIHSfIKE603HlOp8OPGrvag==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-6.0.2.tgz", + "integrity": "sha512-6FqVXeETqWPoGcfzrXb37E50NP0LXT8kAMu5ooZayhWWdgEY4lBEEcbQNXtkuKQsGduxiIcI4gOTsxTmuq/bSg==", "dev": true, "dependencies": { "crc-32": "^1.2.0", - "crc32-stream": "^5.0.0", + "crc32-stream": "^6.0.0", + "is-stream": "^2.0.1", "normalize-path": "^3.0.0", - "readable-stream": "^3.6.0" + "readable-stream": "^4.0.0" }, "engines": { - "node": ">= 12.0.0" + "node": ">= 14" + } + }, + "node_modules/compress-commons/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/compress-commons/node_modules/readable-stream": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", + "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", + "dev": true, + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/compress-commons/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/compress-commons/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.2.0" } }, "node_modules/concat-map": { @@ -3322,16 +3521,85 @@ } }, "node_modules/crc32-stream": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-5.0.0.tgz", - "integrity": "sha512-B0EPa1UK+qnpBZpG+7FgPCu0J2ETLpXq09o9BkLkEAhdB6Z61Qo4pJ3JYu0c+Qi+/SAL7QThqnzS06pmSSyZaw==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-6.0.0.tgz", + "integrity": "sha512-piICUB6ei4IlTv1+653yq5+KoqfBYmj9bw6LqXoOneTMDXk5nM1qt12mFW1caG3LlJXEKW1Bp0WggEmIfQB34g==", "dev": true, "dependencies": { "crc-32": "^1.2.0", - "readable-stream": "^3.4.0" + "readable-stream": "^4.0.0" }, "engines": { - "node": ">= 12.0.0" + "node": ">= 14" + } + }, + "node_modules/crc32-stream/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/crc32-stream/node_modules/readable-stream": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", + "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", + "dev": true, + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/crc32-stream/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/crc32-stream/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.2.0" } }, "node_modules/cross-fetch": { @@ -3685,9 +3953,9 @@ } }, "node_modules/devtools-protocol": { - "version": "0.0.1261483", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1261483.tgz", - "integrity": "sha512-7vJvejpzA5DTfZVkr7a8sGpEAzEiAqcgmRTB0LSUrWeOicwL09lMQTzxHtFNVhJ1OOJkgYdH6Txvy9E5j3VOUQ==", + "version": "0.0.1302984", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1302984.tgz", + "integrity": "sha512-Rgh2Sk5fUSCtEx4QGH9iwTyECdFPySG2nlz5J8guGh2Wlha6uzSOCq/DCEC8faHlLaMPZJMuZ4ovgcX4LvOkKA==", "dev": true }, "node_modules/dir-glob": { @@ -3731,34 +3999,10 @@ "dev": true, "peer": true, "dependencies": { - "webidl-conversions": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/duplexer2": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", - "integrity": "sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA==", - "dev": true, - "dependencies": { - "readable-stream": "^2.0.2" - } - }, - "node_modules/duplexer2/node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", - "dev": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" } }, "node_modules/duplexify": { @@ -3833,17 +4077,17 @@ } }, "node_modules/edgedriver": { - "version": "5.3.10", - "resolved": "https://registry.npmjs.org/edgedriver/-/edgedriver-5.3.10.tgz", - "integrity": "sha512-RFSHYMNtcF1PjaGZCA2rdQQ8hSTLPZgcYgeY1V6dC+tR4NhZXwFAku+8hCbRYh7ZlwKKrTbVu9FwknjFddIuuw==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/edgedriver/-/edgedriver-5.6.0.tgz", + "integrity": "sha512-IeJXEczG+DNYBIa9gFgVYTqrawlxmc9SUqUsWU2E98jOsO/amA7wzabKOS8Bwgr/3xWoyXCJ6yGFrbFKrilyyQ==", "dev": true, "hasInstallScript": true, "dependencies": { "@wdio/logger": "^8.28.0", + "@zip.js/zip.js": "^2.7.44", "decamelize": "^6.0.0", "edge-paths": "^3.0.5", "node-fetch": "^3.3.2", - "unzipper": "^0.10.14", "which": "^4.0.0" }, "bin": { @@ -4278,12 +4522,30 @@ "es5-ext": "~0.10.14" } }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", "dev": true }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "dev": true, + "engines": { + "node": ">=0.8.x" + } + }, "node_modules/expand-brackets": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", @@ -5026,53 +5288,6 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, - "node_modules/fstream": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", - "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" - }, - "engines": { - "node": ">=0.6" - } - }, - "node_modules/fstream/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/fstream/node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -5083,19 +5298,19 @@ } }, "node_modules/geckodriver": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/geckodriver/-/geckodriver-4.3.2.tgz", - "integrity": "sha512-TNOoy+ULXJWI5XOq7CXD3PAD9TJa4NjMe7nKUXjlIsf+vezuaRsFgPwcgYdEem1K7106wabYsqr7Kqn51g0sJg==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/geckodriver/-/geckodriver-4.4.1.tgz", + "integrity": "sha512-nnAdIrwLkMcDu4BitWXF23pEMeZZ0Cj7HaWWFdSpeedBP9z6ft150JYiGO2mwzw6UiR823Znk1JeIf07RyzloA==", "dev": true, "hasInstallScript": true, "dependencies": { "@wdio/logger": "^8.28.0", + "@zip.js/zip.js": "^2.7.44", "decamelize": "^6.0.0", - "http-proxy-agent": "^7.0.0", - "https-proxy-agent": "^7.0.2", + "http-proxy-agent": "^7.0.2", + "https-proxy-agent": "^7.0.4", "node-fetch": "^3.3.2", - "tar-fs": "^3.0.4", - "unzipper": "^0.10.14", + "tar-fs": "^3.0.6", "which": "^4.0.0" }, "bin": { @@ -5126,32 +5341,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/geckodriver/node_modules/http-proxy-agent": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", - "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", - "dev": true, - "dependencies": { - "agent-base": "^7.1.0", - "debug": "^4.3.4" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/geckodriver/node_modules/https-proxy-agent": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz", - "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", - "dev": true, - "dependencies": { - "agent-base": "^7.0.2", - "debug": "4" - }, - "engines": { - "node": ">= 14" - } - }, "node_modules/geckodriver/node_modules/isexe": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", @@ -5179,6 +5368,20 @@ "url": "https://opencollective.com/node-fetch" } }, + "node_modules/geckodriver/node_modules/tar-fs": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.6.tgz", + "integrity": "sha512-iokBDQQkUyeXhgPYaZxmczGPhnhXZ0CmrqI+MOb/WFGS9DW5wnfrLgtjUJBvz50vQ3qfRwJ62QVoCFu8mPVu5w==", + "dev": true, + "dependencies": { + "pump": "^3.0.0", + "tar-stream": "^3.1.5" + }, + "optionalDependencies": { + "bare-fs": "^2.1.1", + "bare-path": "^2.1.0" + } + }, "node_modules/geckodriver/node_modules/which": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", @@ -5227,9 +5430,9 @@ } }, "node_modules/get-port": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/get-port/-/get-port-7.0.0.tgz", - "integrity": "sha512-mDHFgApoQd+azgMdwylJrv2DX47ywGq1i5VFJE7fZ0dttNq3iQMfsU4IvEgBHojA3KqEudyu7Vq+oN8kNaNkWw==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/get-port/-/get-port-7.1.0.tgz", + "integrity": "sha512-QB9NKEeDg3xxVwCCwJQ9+xycaz6pBB6iQ76wiWMl1927n0Kir6alPiP+yuiICLLU4jpMe08dXfpebuQppFA2zw==", "dev": true, "engines": { "node": ">=16" @@ -6638,9 +6841,9 @@ } }, "node_modules/http-proxy-agent": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", - "integrity": "sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", "dependencies": { "agent-base": "^7.1.0", "debug": "^4.3.4" @@ -6690,9 +6893,9 @@ } }, "node_modules/https-proxy-agent": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", - "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz", + "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", "dependencies": { "agent-base": "^7.0.2", "debug": "4" @@ -6741,6 +6944,12 @@ "node": ">= 4" } }, + "node_modules/immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", + "dev": true + }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -6767,9 +6976,9 @@ } }, "node_modules/import-meta-resolve": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.0.0.tgz", - "integrity": "sha512-okYUR7ZQPH+efeuMJGlq4f8ubUgO50kByRPyt/Cy1Io4PSRsPjxME+YlVaCOx+NIToW7hCsZNFJyTPFFKepRSA==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.1.0.tgz", + "integrity": "sha512-I6fiaX09Xivtk+THaMfAwnA3MVA5Big1WHF1Dfx9hFuvNIWpXnorlkzhcQf6ehrqQiiZECRt1poOAkPmer3ruw==", "dev": true, "funding": { "type": "github", @@ -7103,6 +7312,18 @@ "node": ">=0.10.0" } }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-unc-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", @@ -7412,6 +7633,33 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/jszip": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", + "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", + "dev": true, + "dependencies": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + } + }, + "node_modules/jszip/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, "node_modules/just-curry-it": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/just-curry-it/-/just-curry-it-5.3.0.tgz", @@ -7546,6 +7794,15 @@ "node": ">= 0.8.0" } }, + "node_modules/lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "dev": true, + "dependencies": { + "immediate": "~3.0.5" + } + }, "node_modules/liftoff": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-3.1.0.tgz", @@ -7577,12 +7834,6 @@ "node": ">=0.10.0" } }, - "node_modules/listenercount": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/listenercount/-/listenercount-1.0.1.tgz", - "integrity": "sha512-3mk/Zag0+IJxeDrxSgaDPy4zZ3w05PRZeJNnlWhzFz5OkX49J4krc+A8X2d2M69vGMBEX0uyl8M+W+8gH+kBqQ==", - "dev": true - }, "node_modules/load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -7612,12 +7863,22 @@ } }, "node_modules/locate-app": { - "version": "2.2.19", - "resolved": "https://registry.npmjs.org/locate-app/-/locate-app-2.2.19.tgz", - "integrity": "sha512-mjhvrYRHnLAVwreShl8NTwq9EUyfRoCqB0UsOlMKXo2KBmtb4dhlHbZH4mcfDsoNoLkHZ1Rq4TsWP/59Ix62Ww==", + "version": "2.4.15", + "resolved": "https://registry.npmjs.org/locate-app/-/locate-app-2.4.15.tgz", + "integrity": "sha512-oAGHATXPUHSQ74Om+3dXBRNYtCzU7Wzuhlj/WIZchqHb/5/TGJRzLEtHipMDOak0UZG9U365RMXyBzgV/fhOww==", "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://buymeacoffee.com/hejny" + }, + { + "type": "github", + "url": "https://github.com/hejny/locate-app/blob/main/README.md#%EF%B8%8F-contributing" + } + ], "dependencies": { - "n12": "1.8.22", + "@promptbook/utils": "0.50.0-10", "type-fest": "2.13.0", "userhome": "1.0.0" } @@ -8293,6 +8554,15 @@ "node": ">=10" } }, + "node_modules/moment": { + "version": "2.30.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", + "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/monaco-editor": { "version": "0.20.0", "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.20.0.tgz", @@ -8313,12 +8583,6 @@ "node": ">= 0.10" } }, - "node_modules/n12": { - "version": "1.8.22", - "resolved": "https://registry.npmjs.org/n12/-/n12-1.8.22.tgz", - "integrity": "sha512-nzPCOuLOIoUuninAMRXfrbkB7O9XkWS7iv7fzDW1pRUaQhMpatj8iX55evwcNRWnm0UF29uuoHpwubYbsV7OGw==", - "dev": true - }, "node_modules/nanoid": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", @@ -8445,9 +8709,9 @@ } }, "node_modules/normalize-url": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.0.0.tgz", - "integrity": "sha512-uVFpKhj5MheNBJRTiMZ9pE/7hD1QTeEvugSJW/OmLzAp78PB5O6adfMNTvmfKhXBkvCzC+rqifWcVYpGFwTjnw==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.0.1.tgz", + "integrity": "sha512-IO9QvjUMWxPQQhs60oOu10CRkWCiZzSUkzbXGGV9pviYl1fXYcvkzQ5jV9z8Y6un8ARoVRl4EtC6v6jNqbaJ/w==", "dev": true, "engines": { "node": ">=14.16" @@ -8836,6 +9100,12 @@ "node": ">= 14" } }, + "node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "dev": true + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -9290,6 +9560,15 @@ "node": ">= 0.8" } }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "dev": true, + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -10404,6 +10683,22 @@ "integrity": "sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==", "dev": true }, + "node_modules/spacetrim": { + "version": "0.11.25", + "resolved": "https://registry.npmjs.org/spacetrim/-/spacetrim-0.11.25.tgz", + "integrity": "sha512-SWxXDROciuJs9YEYXUBjot5k/cqNGPPbT3QmkInFne4AGc1y+76It+jqU8rfsXKt57RRiunzZn1m9+KfuuNklw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://buymeacoffee.com/hejny" + }, + { + "type": "github", + "url": "https://github.com/hejny/spacetrim/blob/main/README.md#%EF%B8%8F-contributing" + } + ] + }, "node_modules/sparkles": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.1.tgz", @@ -10632,13 +10927,17 @@ "dev": true }, "node_modules/streamx": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.1.tgz", - "integrity": "sha512-fQMzy2O/Q47rgwErk/eGeLu/roaFWV0jVsogDmrszM9uIw8L5OA+t+V93MgYlufNptfjmYR1tOMWhei/Eh7TQA==", + "version": "2.18.0", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.18.0.tgz", + "integrity": "sha512-LLUC1TWdjVdn1weXGcSxyTR3T4+acB6tVGXT95y0nGbca4t4o/ng1wKAGTljm9VicuCVLvRlqFYXYy5GwgM7sQ==", "dev": true, "dependencies": { - "fast-fifo": "^1.1.0", - "queue-tick": "^1.0.1" + "fast-fifo": "^1.3.2", + "queue-tick": "^1.0.1", + "text-decoder": "^1.1.0" + }, + "optionalDependencies": { + "bare-events": "^2.2.0" } }, "node_modules/string_decoder": { @@ -10825,6 +11124,15 @@ "streamx": "^2.15.0" } }, + "node_modules/text-decoder": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.1.0.tgz", + "integrity": "sha512-TmLJNj6UgX8xcUZo4UDStGQtDiTzF7BzWlzn9g7UWrjkpHr5uJTK1ld16wZ3LXb2vb6jH8qU89dW5whuMdXYdw==", + "dev": true, + "dependencies": { + "b4a": "^1.6.4" + } + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -11053,15 +11361,6 @@ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", "dev": true }, - "node_modules/traverse": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", - "integrity": "sha512-iawgk0hLP3SxGKDfnDJf8wTz4p2qImnyihM5Hh/sGvQ3K37dPi/w8sRhdNIxYA1TwFwc5mDhIJq+O0RsvXBKdQ==", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/tree-kill": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", @@ -11317,39 +11616,6 @@ "node": ">=0.10.0" } }, - "node_modules/unzipper": { - "version": "0.10.14", - "resolved": "https://registry.npmjs.org/unzipper/-/unzipper-0.10.14.tgz", - "integrity": "sha512-ti4wZj+0bQTiX2KmKWuwj7lhV+2n//uXEotUmGuQqrbVZSEGFMbI68+c6JCQ8aAmUWYvtHEz2A8K6wXvueR/6g==", - "dev": true, - "dependencies": { - "big-integer": "^1.6.17", - "binary": "~0.3.0", - "bluebird": "~3.4.1", - "buffer-indexof-polyfill": "~1.0.0", - "duplexer2": "~0.1.4", - "fstream": "^1.0.12", - "graceful-fs": "^4.2.2", - "listenercount": "~1.0.1", - "readable-stream": "~2.3.6", - "setimmediate": "~1.0.4" - } - }, - "node_modules/unzipper/node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", - "dev": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, "node_modules/upath": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", @@ -11620,18 +11886,18 @@ } }, "node_modules/webdriver": { - "version": "8.32.2", - "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-8.32.2.tgz", - "integrity": "sha512-uyCT2QzCqoz+EsMLTApG5/+RvHJR9MVbdEnjMoxpJDt+IeZCG2Vy/Gq9oNgNQfpxrvZme/EY+PtBsltZi7BAyg==", + "version": "8.38.2", + "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-8.38.2.tgz", + "integrity": "sha512-NGfjW0BDYwFgOIzeojOcWGn3tYloQdvHr+Y2xKKYVqa9Rs0x1mzlTjU1kWtC4DaV8DltskwaPa7o+s8hTNpuyA==", "dev": true, "dependencies": { "@types/node": "^20.1.0", "@types/ws": "^8.5.3", - "@wdio/config": "8.32.2", - "@wdio/logger": "8.28.0", - "@wdio/protocols": "8.32.0", - "@wdio/types": "8.32.2", - "@wdio/utils": "8.32.2", + "@wdio/config": "8.38.2", + "@wdio/logger": "8.38.0", + "@wdio/protocols": "8.38.0", + "@wdio/types": "8.38.2", + "@wdio/utils": "8.38.2", "deepmerge-ts": "^5.1.0", "got": "^12.6.1", "ky": "^0.33.0", @@ -11642,26 +11908,27 @@ } }, "node_modules/webdriverio": { - "version": "8.32.2", - "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-8.32.2.tgz", - "integrity": "sha512-Z0Wc/dHFfWGWJZpaQ8u910/LG0E9EIVTO7J5yjqWx2XtXz2LzQMxYwNRnvNLhY/1tI4y/cZxI6kFMWr8wD2TtA==", + "version": "8.38.2", + "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-8.38.2.tgz", + "integrity": "sha512-r09y5UfivyYh5JOzT2SpJJ1zDmQl/R4OTH12opUqkjvp21BibCQm/uu1mrxGy4lzSHljrvqSVrrcGI+6UA1O8w==", "dev": true, "dependencies": { "@types/node": "^20.1.0", - "@wdio/config": "8.32.2", - "@wdio/logger": "8.28.0", - "@wdio/protocols": "8.32.0", + "@wdio/config": "8.38.2", + "@wdio/logger": "8.38.0", + "@wdio/protocols": "8.38.0", "@wdio/repl": "8.24.12", - "@wdio/types": "8.32.2", - "@wdio/utils": "8.32.2", - "archiver": "^6.0.0", + "@wdio/types": "8.38.2", + "@wdio/utils": "8.38.2", + "archiver": "^7.0.0", "aria-query": "^5.0.0", "css-shorthand-properties": "^1.1.1", "css-value": "^0.0.1", - "devtools-protocol": "^0.0.1261483", + "devtools-protocol": "^0.0.1302984", "grapheme-splitter": "^1.0.2", "import-meta-resolve": "^4.0.0", "is-plain-obj": "^4.1.0", + "jszip": "^3.10.1", "lodash.clonedeep": "^4.5.0", "lodash.zip": "^4.2.0", "minimatch": "^9.0.0", @@ -11670,7 +11937,7 @@ "resq": "^1.9.1", "rgb2hex": "0.2.5", "serialize-error": "^11.0.1", - "webdriver": "8.32.2" + "webdriver": "8.38.2" }, "engines": { "node": "^16.13 || >=18" @@ -12038,17 +12305,86 @@ "optional": true }, "node_modules/zip-stream": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-5.0.1.tgz", - "integrity": "sha512-UfZ0oa0C8LI58wJ+moL46BDIMgCQbnsb+2PoiJYtonhBsMh2bq1eRBVkvjfVsqbEHd9/EgKPUuL9saSSsec8OA==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-6.0.1.tgz", + "integrity": "sha512-zK7YHHz4ZXpW89AHXUPbQVGKI7uvkd3hzusTdotCg1UxyaVtg0zFJSTfW/Dq5f7OBBVnq6cZIaC8Ti4hb6dtCA==", "dev": true, "dependencies": { - "archiver-utils": "^4.0.1", - "compress-commons": "^5.0.1", - "readable-stream": "^3.6.0" + "archiver-utils": "^5.0.0", + "compress-commons": "^6.0.2", + "readable-stream": "^4.0.0" }, "engines": { - "node": ">= 12.0.0" + "node": ">= 14" + } + }, + "node_modules/zip-stream/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/zip-stream/node_modules/readable-stream": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", + "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", + "dev": true, + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/zip-stream/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/zip-stream/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.2.0" } } } From dc91c3ab546a6c8eb91c42b0eb33cafb176b7a2e Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 11 Jun 2024 18:21:48 +0000 Subject: [PATCH 004/129] fix: c-blocks disappearing (#8203) --- core/dragging/block_drag_strategy.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/core/dragging/block_drag_strategy.ts b/core/dragging/block_drag_strategy.ts index fadba28fb69..dc136d814c9 100644 --- a/core/dragging/block_drag_strategy.ts +++ b/core/dragging/block_drag_strategy.ts @@ -99,6 +99,7 @@ export class BlockDragStrategy implements IDragStrategy { this.startLoc = this.block.getRelativeToSurfaceXY(); + this.connectionCandidate = null; const previewerConstructor = registry.getClassFromOptions( registry.Type.CONNECTION_PREVIEWER, this.workspace.options, From 5a9a31ad1d36b57e0c0051e52f4e95bd689f4892 Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Wed, 12 Jun 2024 18:29:47 +0100 Subject: [PATCH 005/129] feat(scripts): Create script to help with CJS -> ESM migration (#8197) * feat(scripts): Create script to help with CJS -> ESM migration This is based on js2ts, but considerably simplified since we no longer need to deal with goog.module IDs. * feat(scripts): Add support for module.exports = {...} Support (optionally renaming) assignments to module.exports, in addition to the existing support for simple exports property assignmenets. * fix(scripts): Typo corrections + other improvments for PR #8197 * chore(scripts): Format --- scripts/migration/cjs2esm | 162 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100755 scripts/migration/cjs2esm diff --git a/scripts/migration/cjs2esm b/scripts/migration/cjs2esm new file mode 100755 index 00000000000..99a0e222322 --- /dev/null +++ b/scripts/migration/cjs2esm @@ -0,0 +1,162 @@ +#!/usr/bin/env node + +const fs = require('fs'); +const path = require('path'); + +const filenames = process.argv.slice(2); // Trim off node and script name. + +/** Absolute path of repository root. */ +const repoPath = path.resolve(__dirname, '..', '..'); + +////////////////////////////////////////////////////////////////////// +// Process files mentioned on the command line. +////////////////////////////////////////////////////////////////////// + +/** RegExp matching require statements. */ +const requireRE = + /(?:const\s+(?:([$\w]+)|(\{[^}]*\}))\s*=\s*)?require\('([^']+)'\);/g; + +/** RegExp matching key: value pairs in destructuring assignments. */ +const keyValueRE = /([$\w]+)\s*:\s*([$\w]+)\s*(?=,|})/g; + +/** Prefix for RegExp matching a top-level declaration. */ +const declPrefix = '(?:const|let|var|(?:async\\s+)?function(?:\\s*\\*)?|class)'; + +for (const filename of filenames) { + let contents = null; + try { + contents = String(fs.readFileSync(filename)); + } catch (e) { + console.error(`error while reading ${filename}: ${e.message}`); + continue; + } + console.log(`Converting ${filename} from CJS to ESM...`); + + // Remove "use strict". + contents = contents.replace(/^\s*["']use strict["']\s*; *\n/m, ''); + + // Migrate from require to import. + contents = contents.replace( + requireRE, + function ( + orig, // Whole statement to be replaced. + name, // Name of named import of whole module (if applicable). + names, // {}-enclosed list of destructured imports. + moduleName, // Imported module name or path. + ) { + if (moduleName[0] === '.') { + // Relative path. Could check and add '.mjs' suffix if desired. + } + if (name) { + return `import * as ${name} from '${moduleName}';`; + } else if (names) { + names = names.replace(keyValueRE, '$1 as $2'); + return `import ${names} from '${moduleName}';`; + } else { + // Side-effect only require. + return `import '${moduleName}';`; + } + }, + ); + + // Find and update or remove old-style single-export assignments + // like: + // + // exports.bar = foo; // becomes export {foo as bar}; + // exports.foo = foo; // remove the export and export at declaration + // // instead, if possible. + /** @type {!Array<{name: string, re: RegExp>}>} */ + const easyExports = []; + contents = contents.replace( + /^\s*exports\.([$\w]+)\s*=\s*([$\w]+)\s*;\n/gm, + function ( + orig, // Whole statement to be replaced. + exportName, // Name to export item as. + declName, // Already-declared name for item being exported. + ) { + // Renamed exports have to be translated as-is. + if (exportName !== declName) { + return `export {${declName} as ${exportName}};\n`; + } + // OK, we're doing "export.foo = foo;". Can we update the + // declaration? We can't actualy modify it yet as we're in + // the middle of a search-and-replace on contents already, but + // we can delete the old export and later update the + // declaration into an export. + const declRE = new RegExp( + `^(\\s*)(${declPrefix}\\s+${declName})\\b`, + 'gm', + ); + if (contents.match(declRE)) { + easyExports.push({exportName, declRE}); + return ''; // Delete existing export assignment. + } else { + return `export ${exportName};\n`; // Safe fallback. + } + }, + ); + + // Find and update or remove old-style module.exports assignment + // like: + // + // module.exports = {foo, bar: baz, quux}; + // + // which becomes export {baz as bar}, with foo and quux exported at + // declaration instead, if possible. + contents = contents.replace( + /^module\.exports\s*=\s*\{([^\}]+)\};?(\n?)/m, + function ( + orig, // Whole statement to be replaced. + items, // List of items to be exported. + ) { + items = items.replace( + /( *)([$\w]+)\s*(?::\s*([$\w]+)\s*)?,?(\s*?\n?)/gm, + function ( + origItem, // Whole item being replaced. + indent, // Optional leading whitespace. + exportName, // Name to export item as. + declName, // Already-declared name being exported, if different. + newline, // Optional trailing whitespace. + ) { + if (!declName) declName = exportName; + + // Renamed exports have to be translated as-is. + if (exportName !== declName) { + return `${indent}${declName} as ${exportName},${newline}`; + } + // OK, this item has no rename. Can we update the + // declaration? We can't actualy modify it yet as we're in + // the middle of a search-and-replace on contents already, + // but we can delete the item and later update the + // declaration into an export. + const declRE = new RegExp( + `^(\\s*)(${declPrefix}\\s+${declName})\\b`, + 'gm', + ); + if (contents.match(declRE)) { + easyExports.push({exportName, declRE}); + return ''; // Delete existing item. + } else { + return `${indent}${exportName},${newline}`; // Safe fallback. + } + }, + ); + if (/^\s*$/s.test(items)) { + // No items left? + return ''; // Delete entire module.export assignment. + } else { + return `export {${items}};\n`; + } + }, + ); + + // Add 'export' to existing declarations where appropriate. + for (const {exportName, declRE} of easyExports) { + contents = contents.replace(declRE, '$1export $2'); + } + + // Write converted file with new extension. + const newFilename = filename.replace(/.c?js$/, '.mjs'); + fs.writeFileSync(newFilename, contents); + console.log(`Wrote ${newFilename}.`); +} From 5e2c7ca4dd19b467bb7fea692dcbdafa74ae313e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Jun 2024 15:25:27 +0100 Subject: [PATCH 006/129] chore(deps): bump glob from 10.3.10 to 10.4.1 (#8199) Bumps [glob](https://github.com/isaacs/node-glob) from 10.3.10 to 10.4.1. - [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md) - [Commits](https://github.com/isaacs/node-glob/compare/v10.3.10...v10.4.1) --- updated-dependencies: - dependency-name: glob 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 | 52 +++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/package-lock.json b/package-lock.json index ba428bab7f6..d5fb1a5a631 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5513,22 +5513,22 @@ } }, "node_modules/glob": { - "version": "10.3.10", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", - "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", + "version": "10.4.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.1.tgz", + "integrity": "sha512-2jelhlq3E4ho74ZyVLN03oKdAZVUa6UDZzFLVH1H7dnoax+y9qyaq8zBkfDIggjniU19z0wU18y16jMB2eyVIw==", "dev": true, "dependencies": { "foreground-child": "^3.1.0", - "jackspeak": "^2.3.5", - "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", - "path-scurry": "^1.10.1" + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": ">=16 || 14 >=14.18" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -5854,9 +5854,9 @@ } }, "node_modules/glob/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", + "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", "dev": true, "dependencies": { "brace-expansion": "^2.0.1" @@ -7422,9 +7422,9 @@ } }, "node_modules/jackspeak": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", - "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.0.tgz", + "integrity": "sha512-JVYhQnN59LVPFCEcVa2C3CrEKYacvjRfqIQl+h8oi91aLYQVWRYbxjPcv1bUiUy/kLmQaANrYfNMCO3kuEDHfw==", "dev": true, "dependencies": { "@isaacs/cliui": "^8.0.2" @@ -8349,12 +8349,12 @@ "dev": true }, "node_modules/minipass": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", - "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", "dev": true, "engines": { - "node": ">=8" + "node": ">=16 || 14 >=14.17" } }, "node_modules/mitt": { @@ -9317,25 +9317,25 @@ } }, "node_modules/path-scurry": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", - "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", "dev": true, "dependencies": { - "lru-cache": "^9.1.1 || ^10.0.0", + "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": ">=16 || 14 >=14.18" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/path-scurry/node_modules/lru-cache": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.0.tgz", - "integrity": "sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz", + "integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==", "dev": true, "engines": { "node": "14 || >=16.14" From e455a94ae3a1b242506bd43ff9ea6058f0717464 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Jun 2024 15:26:25 +0100 Subject: [PATCH 007/129] chore(deps): bump @typescript-eslint/eslint-plugin from 7.3.1 to 7.12.0 (#8200) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 7.3.1 to 7.12.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/v7.12.0/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" 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 | 331 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 286 insertions(+), 45 deletions(-) diff --git a/package-lock.json b/package-lock.json index d5fb1a5a631..c797446b58a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -204,9 +204,9 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.8.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.8.0.tgz", - "integrity": "sha512-JylOEEzDiOryeUnFbQz+oViCXS0KsvR1mvHkoMiu5+UiBvy+RYX7tzlIIIEstF/gVa2tj9AQXk3dgnxv6KxhFg==", + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.1.tgz", + "integrity": "sha512-Zm2NGpWELsQAD1xsJzGQpYfvICSsFkEpU0jxBjfdC6uNEWXcHnfs9hScFWtXVDVl+rBQJGrl4g1vcKIejpH9dA==", "dev": true, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" @@ -1240,24 +1240,12 @@ "integrity": "sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==", "dev": true }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true - }, "node_modules/@types/node": { "version": "20.3.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.0.tgz", "integrity": "sha512-cumHmIAf6On83X7yP+LrsEyUOf/YlociZelmpRYaGFydoaPdxdt80MAbu6vWerQT2COCp2nPvHdsbD7tHn/YlQ==", "dev": true }, - "node_modules/@types/semver": { - "version": "7.5.8", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", - "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", - "dev": true - }, "node_modules/@types/vinyl": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/vinyl/-/vinyl-2.0.6.tgz", @@ -1294,22 +1282,20 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.3.1.tgz", - "integrity": "sha512-STEDMVQGww5lhCuNXVSQfbfuNII5E08QWkvAw5Qwf+bj2WT+JkG1uc+5/vXA3AOYMDHVOSpL+9rcbEUiHIm2dw==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.12.0.tgz", + "integrity": "sha512-7F91fcbuDf/d3S8o21+r3ZncGIke/+eWk0EpO21LXhDfLahriZF9CGj4fbAetEjlaBdjdSm9a6VeXbpbT6Z40Q==", "dev": true, "dependencies": { - "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "7.3.1", - "@typescript-eslint/type-utils": "7.3.1", - "@typescript-eslint/utils": "7.3.1", - "@typescript-eslint/visitor-keys": "7.3.1", - "debug": "^4.3.4", + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "7.12.0", + "@typescript-eslint/type-utils": "7.12.0", + "@typescript-eslint/utils": "7.12.0", + "@typescript-eslint/visitor-keys": "7.12.0", "graphemer": "^1.4.0", - "ignore": "^5.2.4", + "ignore": "^5.3.1", "natural-compare": "^1.4.0", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" + "ts-api-utils": "^1.3.0" }, "engines": { "node": "^18.18.0 || >=20.0.0" @@ -1328,6 +1314,53 @@ } } }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.12.0.tgz", + "integrity": "sha512-itF1pTnN6F3unPak+kutH9raIkL3lhH1YRPGgt7QQOh43DQKVJXmWkpb+vpc/TiDHs6RSd9CTbDsc/Y+Ygq7kg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.12.0", + "@typescript-eslint/visitor-keys": "7.12.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.12.0.tgz", + "integrity": "sha512-o+0Te6eWp2ppKY3mLCU+YA9pVJxhUJE15FV7kxuD9jgwIAa+w/ycGJBMrYDTpVGUM/tgpa9SeMOugSabWFq7bg==", + "dev": true, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.12.0.tgz", + "integrity": "sha512-uZk7DevrQLL3vSnfFl5bj4sL75qC9D6EdjemIdbtkuUmIheWpuiiylSY01JxJE7+zGrOWDZrp1WxOuDntvKrHQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.12.0", + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@typescript-eslint/parser": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.3.1.tgz", @@ -1362,6 +1395,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.3.1.tgz", "integrity": "sha512-fVS6fPxldsKY2nFvyT7IP78UO1/I2huG+AYu5AMjCT9wtl6JFiDnsv4uad4jQ0GTFzcUV5HShVeN96/17bTBag==", "dev": true, + "peer": true, "dependencies": { "@typescript-eslint/types": "7.3.1", "@typescript-eslint/visitor-keys": "7.3.1" @@ -1375,15 +1409,15 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.3.1.tgz", - "integrity": "sha512-iFhaysxFsMDQlzJn+vr3OrxN8NmdQkHks4WaqD4QBnt5hsq234wcYdyQ9uquzJJIDAj5W4wQne3yEsYA6OmXGw==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.12.0.tgz", + "integrity": "sha512-lib96tyRtMhLxwauDWUp/uW3FMhLA6D0rJ8T7HmH7x23Gk1Gwwu8UZ94NMXBvOELn6flSPiBrCKlehkiXyaqwA==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "7.3.1", - "@typescript-eslint/utils": "7.3.1", + "@typescript-eslint/typescript-estree": "7.12.0", + "@typescript-eslint/utils": "7.12.0", "debug": "^4.3.4", - "ts-api-utils": "^1.0.1" + "ts-api-utils": "^1.3.0" }, "engines": { "node": "^18.18.0 || >=20.0.0" @@ -1401,11 +1435,106 @@ } } }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.12.0.tgz", + "integrity": "sha512-o+0Te6eWp2ppKY3mLCU+YA9pVJxhUJE15FV7kxuD9jgwIAa+w/ycGJBMrYDTpVGUM/tgpa9SeMOugSabWFq7bg==", + "dev": true, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.12.0.tgz", + "integrity": "sha512-5bwqLsWBULv1h6pn7cMW5dXX/Y2amRqLaKqsASVwbBHMZSnHqE/HN4vT4fE0aFsiwxYvr98kqOWh1a8ZKXalCQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.12.0", + "@typescript-eslint/visitor-keys": "7.12.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.12.0.tgz", + "integrity": "sha512-uZk7DevrQLL3vSnfFl5bj4sL75qC9D6EdjemIdbtkuUmIheWpuiiylSY01JxJE7+zGrOWDZrp1WxOuDntvKrHQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.12.0", + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/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/@typescript-eslint/type-utils/node_modules/minimatch": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", + "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/semver": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@typescript-eslint/types": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.3.1.tgz", "integrity": "sha512-2tUf3uWggBDl4S4183nivWQ2HqceOZh1U4hhu4p1tPiIJoRRXrab7Y+Y0p+dozYwZVvLPRI6r5wKe9kToF9FIw==", "dev": true, + "peer": true, "engines": { "node": "^18.18.0 || >=20.0.0" }, @@ -1419,6 +1548,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.3.1.tgz", "integrity": "sha512-tLpuqM46LVkduWP7JO7yVoWshpJuJzxDOPYIVWUUZbW+4dBpgGeUdl/fQkhuV0A8eGnphYw3pp8d2EnvPOfxmQ==", "dev": true, + "peer": true, "dependencies": { "@typescript-eslint/types": "7.3.1", "@typescript-eslint/visitor-keys": "7.3.1", @@ -1447,6 +1577,7 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, + "peer": true, "dependencies": { "balanced-match": "^1.0.0" } @@ -1456,6 +1587,7 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", "dev": true, + "peer": true, "dependencies": { "brace-expansion": "^2.0.1" }, @@ -1467,18 +1599,15 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.3.1.tgz", - "integrity": "sha512-jIERm/6bYQ9HkynYlNZvXpzmXWZGhMbrOvq3jJzOSOlKXsVjrrolzWBjDW6/TvT5Q3WqaN4EkmcfdQwi9tDjBQ==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.12.0.tgz", + "integrity": "sha512-Y6hhwxwDx41HNpjuYswYp6gDbkiZ8Hin9Bf5aJQn1bpTs3afYY4GX+MPYxma8jtoIV2GRwTM/UJm/2uGCVv+DQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@types/json-schema": "^7.0.12", - "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "7.3.1", - "@typescript-eslint/types": "7.3.1", - "@typescript-eslint/typescript-estree": "7.3.1", - "semver": "^7.5.4" + "@typescript-eslint/scope-manager": "7.12.0", + "@typescript-eslint/types": "7.12.0", + "@typescript-eslint/typescript-estree": "7.12.0" }, "engines": { "node": "^18.18.0 || >=20.0.0" @@ -1491,11 +1620,123 @@ "eslint": "^8.56.0" } }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.12.0.tgz", + "integrity": "sha512-itF1pTnN6F3unPak+kutH9raIkL3lhH1YRPGgt7QQOh43DQKVJXmWkpb+vpc/TiDHs6RSd9CTbDsc/Y+Ygq7kg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.12.0", + "@typescript-eslint/visitor-keys": "7.12.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.12.0.tgz", + "integrity": "sha512-o+0Te6eWp2ppKY3mLCU+YA9pVJxhUJE15FV7kxuD9jgwIAa+w/ycGJBMrYDTpVGUM/tgpa9SeMOugSabWFq7bg==", + "dev": true, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.12.0.tgz", + "integrity": "sha512-5bwqLsWBULv1h6pn7cMW5dXX/Y2amRqLaKqsASVwbBHMZSnHqE/HN4vT4fE0aFsiwxYvr98kqOWh1a8ZKXalCQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.12.0", + "@typescript-eslint/visitor-keys": "7.12.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.12.0.tgz", + "integrity": "sha512-uZk7DevrQLL3vSnfFl5bj4sL75qC9D6EdjemIdbtkuUmIheWpuiiylSY01JxJE7+zGrOWDZrp1WxOuDntvKrHQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.12.0", + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/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/@typescript-eslint/utils/node_modules/minimatch": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", + "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/semver": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@typescript-eslint/visitor-keys": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.3.1.tgz", "integrity": "sha512-9RMXwQF8knsZvfv9tdi+4D/j7dMG28X/wMJ8Jj6eOHyHWwDW4ngQJcqEczSsqIKKjFiLFr40Mnr7a5ulDD3vmw==", "dev": true, + "peer": true, "dependencies": { "@typescript-eslint/types": "7.3.1", "eslint-visitor-keys": "^3.4.1" @@ -6936,9 +7177,9 @@ ] }, "node_modules/ignore": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", + "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", "dev": true, "engines": { "node": ">= 4" From 24fe13f0c9ec6ddd06e1e70cd7b5ba4d6a3f9977 Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Thu, 13 Jun 2024 08:13:17 -0700 Subject: [PATCH 008/129] fix: only initSvg on rendered blocks (#8215) --- demos/blockfactory/blocks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/blockfactory/blocks.js b/demos/blockfactory/blocks.js index 15c8ac864d6..34313cad14f 100644 --- a/demos/blockfactory/blocks.js +++ b/demos/blockfactory/blocks.js @@ -85,8 +85,8 @@ Blockly.Blocks['factory_base'] = { var type = this.workspace.newBlock('type_null'); type.setShadow(true); type.outputConnection.connect(this.getInput(outputType).connection); - type.initSvg(); if (this.rendered) { + type.initSvg(); type.render(); } }, From 3fa46f45fe6963ea2e5a97e6d0de5a4c54b9e2a9 Mon Sep 17 00:00:00 2001 From: Maribeth Bottorff Date: Thu, 13 Jun 2024 17:07:24 -0700 Subject: [PATCH 009/129] chore: tsdoc for generator exceptions (#8214) * chore: tsdoc for generator exceptions * chore: missed a period --- core/generator.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/generator.ts b/core/generator.ts index 7bb509f8ba3..869e29a6a7c 100644 --- a/core/generator.ts +++ b/core/generator.ts @@ -295,8 +295,8 @@ export class CodeGenerator { * @param name The name of the input. * @param outerOrder The maximum binding strength (minimum order value) of any * operators adjacent to "block". - * @returns Generated code or '' if no blocks are connected or the specified - * input does not exist. + * @returns Generated code or '' if no blocks are connected. + * @throws ReferenceError if the specified input does not exist. */ valueToCode(block: Block, name: string, outerOrder: number): string { if (isNaN(outerOrder)) { @@ -381,6 +381,7 @@ export class CodeGenerator { * @param block The block containing the input. * @param name The name of the input. * @returns Generated code or '' if no blocks are connected. + * @throws ReferenceError if the specified input does not exist. */ statementToCode(block: Block, name: string): string { const targetBlock = block.getInputTargetBlock(name); From bfb5b1dd4908ba0bd2869e1198a0faa6c22fc68a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jun 2024 16:48:21 +0100 Subject: [PATCH 010/129] chore(deps): Bump chai from 4.3.10 to 5.1.1 (#8092) * chore(deps): Bump chai from 4.3.10 to 5.1.1 Bumps [chai](https://github.com/chaijs/chai) from 4.3.10 to 5.1.1. - [Release notes](https://github.com/chaijs/chai/releases) - [Changelog](https://github.com/chaijs/chai/blob/main/History.md) - [Commits](https://github.com/chaijs/chai/compare/v4.3.10...v5.1.1) --- updated-dependencies: - dependency-name: chai dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * fix(tests): Migrate all usage of chai to ESM (#8216) * fix(tests): Migrate node tests from CJS to ESM This allows us to import (rather than require) chai, fixing failures caused by that package dropping suppport for CJS in chai v5.0.0. * fix(tests): Have mocha tests directly import chai Previously they relied on obtaining it from the global scope, but it's better if imports are explicit. * fix(tests): Remove broken load of chai as script Chai v5.0.0 no longer supports being loaded as a script, so this did nothing but emit an syntax error message on the console. * fix(tests): Migrate browser tests from CJS to ESM This allows us to import (rather than require) chai, fixing failures caused by chai no longer supporting CJS. * chore(tests): format --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Christopher Allen --- package-lock.json | 133 +++- package.json | 2 +- tests/browser/.mocharc.js | 2 +- ...y_test.js => basic_block_factory_test.mjs} | 4 +- ...sic_block_test.js => basic_block_test.mjs} | 8 +- ...ound_test.js => basic_playground_test.mjs} | 6 +- ...block_undo_test.js => block_undo_test.mjs} | 8 +- ..._blocks_test.js => delete_blocks_test.mjs} | 8 +- .../{extensive_test.js => extensive_test.mjs} | 8 +- ...eld_edits_test.js => field_edits_test.mjs} | 8 +- tests/browser/test/{hooks.js => hooks.mjs} | 6 +- .../{mutator_test.js => mutator_test.mjs} | 6 +- .../{procedure_test.js => procedure_test.mjs} | 6 +- .../test/{test_setup.js => test_setup.mjs} | 103 ++- ...box_drag_test.js => toolbox_drag_test.mjs} | 6 +- ...ent_test.js => workspace_comment_test.mjs} | 8 +- tests/mocha/astnode_test.js | 230 +++--- tests/mocha/block_json_test.js | 31 +- tests/mocha/block_test.js | 688 +++++++++--------- tests/mocha/blocks/lists_test.js | 13 +- tests/mocha/blocks/logic_ternary_test.js | 53 +- tests/mocha/blocks/loops_test.js | 5 +- tests/mocha/blocks/procedures_test.js | 268 ++++--- tests/mocha/blocks/variables_test.js | 39 +- tests/mocha/clipboard_test.js | 9 +- tests/mocha/comment_deserialization_test.js | 21 +- tests/mocha/comment_test.js | 21 +- tests/mocha/comment_view_test.js | 51 +- tests/mocha/connection_checker_test.js | 27 +- tests/mocha/connection_db_test.js | 64 +- tests/mocha/connection_test.js | 307 ++++---- tests/mocha/contextmenu_items_test.js | 119 ++- tests/mocha/contextmenu_test.js | 13 +- tests/mocha/cursor_test.js | 14 +- tests/mocha/dropdowndiv_test.js | 41 +- tests/mocha/event_block_change_test.js | 11 +- tests/mocha/event_block_create_test.js | 7 +- tests/mocha/event_block_delete_test.js | 5 +- tests/mocha/event_block_drag_test.js | 3 +- ...nt_block_field_intermediate_change_test.js | 13 +- tests/mocha/event_block_move_test.js | 3 +- tests/mocha/event_bubble_open_test.js | 3 +- tests/mocha/event_click_test.js | 3 +- tests/mocha/event_comment_change_test.js | 3 +- tests/mocha/event_comment_collapse_test.js | 3 +- tests/mocha/event_comment_create_test.js | 3 +- tests/mocha/event_comment_delete_test.js | 3 +- tests/mocha/event_comment_move_test.js | 3 +- tests/mocha/event_marker_move_test.js | 3 +- tests/mocha/event_selected_test.js | 3 +- tests/mocha/event_test.js | 163 ++--- tests/mocha/event_theme_change_test.js | 3 +- tests/mocha/event_toolbox_item_select_test.js | 3 +- tests/mocha/event_trashcan_open_test.js | 3 +- tests/mocha/event_var_create_test.js | 5 +- tests/mocha/event_var_delete_test.js | 5 +- tests/mocha/event_var_rename_test.js | 3 +- tests/mocha/event_viewport_test.js | 3 +- tests/mocha/extensions_test.js | 115 +-- tests/mocha/field_checkbox_test.js | 12 +- tests/mocha/field_colour_test.js | 9 +- tests/mocha/field_dropdown_test.js | 3 +- tests/mocha/field_image_test.js | 29 +- tests/mocha/field_label_serializable_test.js | 11 +- tests/mocha/field_label_test.js | 9 +- tests/mocha/field_number_test.js | 15 +- tests/mocha/field_registry_test.js | 21 +- tests/mocha/field_test.js | 83 +-- tests/mocha/field_textinput_test.js | 7 +- tests/mocha/field_variable_test.js | 97 ++- tests/mocha/flyout_test.js | 67 +- tests/mocha/generator_test.js | 22 +- tests/mocha/gesture_test.js | 18 +- tests/mocha/icon_test.js | 39 +- tests/mocha/index.html | 1 - tests/mocha/input_test.js | 55 +- tests/mocha/insertion_marker_manager_test.js | 59 +- tests/mocha/insertion_marker_test.js | 5 +- tests/mocha/jso_deserialization_test.js | 25 +- tests/mocha/jso_serialization_test.js | 73 +- tests/mocha/json_test.js | 111 +-- tests/mocha/layering_test.js | 9 +- tests/mocha/metrics_test.js | 9 +- tests/mocha/mutator_test.js | 3 +- tests/mocha/names_test.js | 83 +-- tests/mocha/old_workspace_comment_test.js | 85 +-- tests/mocha/procedure_map_test.js | 7 +- tests/mocha/registry_test.js | 69 +- tests/mocha/render_management_test.js | 18 +- tests/mocha/serializer_test.js | 3 +- tests/mocha/shortcut_registry_test.js | 108 ++- tests/mocha/test_helpers/code_generation.js | 7 +- tests/mocha/test_helpers/events.js | 28 +- tests/mocha/test_helpers/fields.js | 11 +- tests/mocha/test_helpers/procedures.js | 33 +- tests/mocha/test_helpers/serialization.js | 5 +- tests/mocha/test_helpers/variables.js | 10 +- tests/mocha/test_helpers/warnings.js | 6 +- tests/mocha/test_helpers/workspace.js | 252 +++---- tests/mocha/theme_test.js | 7 +- tests/mocha/toolbox_test.js | 130 ++-- tests/mocha/tooltip_test.js | 13 +- tests/mocha/touch_test.js | 27 +- tests/mocha/trashcan_test.js | 47 +- tests/mocha/utils_test.js | 279 ++++--- tests/mocha/variable_map_test.js | 67 +- tests/mocha/variable_model_test.js | 29 +- tests/mocha/widget_div_test.js | 7 +- tests/mocha/workspace_svg_test.js | 37 +- tests/mocha/xml_test.js | 157 ++-- tests/mocha/zoom_controls_test.js | 7 +- .../{run_node_test.js => run_node_test.mjs} | 6 +- 112 files changed, 2419 insertions(+), 2619 deletions(-) rename tests/browser/test/{basic_block_factory_test.js => basic_block_factory_test.mjs} (93%) rename tests/browser/test/{basic_block_test.js => basic_block_test.mjs} (89%) rename tests/browser/test/{basic_playground_test.js => basic_playground_test.mjs} (98%) rename tests/browser/test/{block_undo_test.js => block_undo_test.mjs} (91%) rename tests/browser/test/{delete_blocks_test.js => delete_blocks_test.mjs} (98%) rename tests/browser/test/{extensive_test.js => extensive_test.mjs} (98%) rename tests/browser/test/{field_edits_test.js => field_edits_test.mjs} (93%) rename tests/browser/test/{hooks.js => hooks.mjs} (80%) rename tests/browser/test/{mutator_test.js => mutator_test.mjs} (97%) rename tests/browser/test/{procedure_test.js => procedure_test.mjs} (97%) rename tests/browser/test/{test_setup.js => test_setup.mjs} (90%) rename tests/browser/test/{toolbox_drag_test.js => toolbox_drag_test.mjs} (98%) rename tests/browser/test/{workspace_comment_test.js => workspace_comment_test.mjs} (97%) rename tests/node/{run_node_test.js => run_node_test.mjs} (94%) diff --git a/package-lock.json b/package-lock.json index c797446b58a..1a68ab82b58 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "@microsoft/api-extractor": "^7.29.5", "@typescript-eslint/eslint-plugin": "^7.3.1", "async-done": "^2.0.0", - "chai": "^4.2.0", + "chai": "^5.1.1", "concurrently": "^8.0.1", "eslint": "^8.4.1", "eslint-config-google": "^0.14.0", @@ -114,6 +114,75 @@ "blockly": "^10.0.0" } }, + "node_modules/@blockly/dev-tools/node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/@blockly/dev-tools/node_modules/chai": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", + "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", + "dev": true, + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.0.8" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@blockly/dev-tools/node_modules/check-error": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "dev": true, + "dependencies": { + "get-func-name": "^2.0.2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@blockly/dev-tools/node_modules/deep-eql": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.4.tgz", + "integrity": "sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==", + "dev": true, + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@blockly/dev-tools/node_modules/loupe": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", + "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", + "dev": true, + "dependencies": { + "get-func-name": "^2.0.1" + } + }, + "node_modules/@blockly/dev-tools/node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/@blockly/theme-dark": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/@blockly/theme-dark/-/theme-dark-6.0.5.tgz", @@ -2521,12 +2590,12 @@ } }, "node_modules/assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", "dev": true, "engines": { - "node": "*" + "node": ">=12" } }, "node_modules/assign-symbols": { @@ -3169,21 +3238,19 @@ } }, "node_modules/chai": { - "version": "4.3.10", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz", - "integrity": "sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/chai/-/chai-5.1.1.tgz", + "integrity": "sha512-pT1ZgP8rPNqUgieVaEY+ryQr6Q4HXNg8Ei9UnLUrjN4IA7dvQC5JB+/kxVcPNDHyBcc/26CXPkbNzq3qwrOEKA==", "dev": true, "dependencies": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.3", - "deep-eql": "^4.1.3", - "get-func-name": "^2.0.2", - "loupe": "^2.3.6", - "pathval": "^1.1.1", - "type-detect": "^4.0.8" + "assertion-error": "^2.0.1", + "check-error": "^2.1.1", + "deep-eql": "^5.0.1", + "loupe": "^3.1.0", + "pathval": "^2.0.0" }, "engines": { - "node": ">=4" + "node": ">=12" } }, "node_modules/chalk": { @@ -3203,15 +3270,12 @@ } }, "node_modules/check-error": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", - "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", + "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", "dev": true, - "dependencies": { - "get-func-name": "^2.0.2" - }, "engines": { - "node": "*" + "node": ">= 16" } }, "node_modules/chokidar": { @@ -4072,13 +4136,10 @@ } }, "node_modules/deep-eql": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", + "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", "dev": true, - "dependencies": { - "type-detect": "^4.0.0" - }, "engines": { "node": ">=6" } @@ -8242,9 +8303,9 @@ "dev": true }, "node_modules/loupe": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", - "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.1.tgz", + "integrity": "sha512-edNu/8D5MKVfGVFRhFf8aAxiTM6Wumfz5XsaatSxlD3w4R1d/WEKUTydCdPGbl9K7QG/Ca3GnDV2sIKIpXRQcw==", "dev": true, "dependencies": { "get-func-name": "^2.0.1" @@ -9612,12 +9673,12 @@ } }, "node_modules/pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz", + "integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==", "dev": true, "engines": { - "node": "*" + "node": ">= 14.16" } }, "node_modules/pend": { diff --git a/package.json b/package.json index f7f7f124a35..a972f4e1e7f 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,7 @@ "@microsoft/api-extractor": "^7.29.5", "@typescript-eslint/eslint-plugin": "^7.3.1", "async-done": "^2.0.0", - "chai": "^4.2.0", + "chai": "^5.1.1", "concurrently": "^8.0.1", "eslint": "^8.4.1", "eslint-config-google": "^0.14.0", diff --git a/tests/browser/.mocharc.js b/tests/browser/.mocharc.js index b11a846fb5a..879bb462378 100644 --- a/tests/browser/.mocharc.js +++ b/tests/browser/.mocharc.js @@ -2,5 +2,5 @@ module.exports = { ui: 'tdd', - require: __dirname + '/test/hooks.js', + require: __dirname + '/test/hooks.mjs', }; diff --git a/tests/browser/test/basic_block_factory_test.js b/tests/browser/test/basic_block_factory_test.mjs similarity index 93% rename from tests/browser/test/basic_block_factory_test.js rename to tests/browser/test/basic_block_factory_test.mjs index 026f2565950..e20892471a5 100644 --- a/tests/browser/test/basic_block_factory_test.js +++ b/tests/browser/test/basic_block_factory_test.mjs @@ -8,8 +8,8 @@ * @fileoverview Node.js script to run Automated tests in Chrome, via webdriver. */ -const chai = require('chai'); -const {testSetup, testFileLocations} = require('./test_setup'); +import * as chai from 'chai'; +import {testSetup, testFileLocations} from './test_setup.mjs'; suite('Testing Connecting Blocks', function (done) { // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test diff --git a/tests/browser/test/basic_block_test.js b/tests/browser/test/basic_block_test.mjs similarity index 89% rename from tests/browser/test/basic_block_test.js rename to tests/browser/test/basic_block_test.mjs index 7d594c50ede..515cf5668b4 100644 --- a/tests/browser/test/basic_block_test.js +++ b/tests/browser/test/basic_block_test.mjs @@ -9,14 +9,14 @@ * webdriver, of basic Blockly block functionality. */ -const chai = require('chai'); -const { +import * as chai from 'chai'; +import { testSetup, testFileLocations, getAllBlocks, dragNthBlockFromFlyout, -} = require('./test_setup'); -const {Key} = require('webdriverio'); +} from './test_setup.mjs'; +import {Key} from 'webdriverio'; suite('Basic block tests', function (done) { // Setting timeout to unlimited as the webdriver takes a longer time diff --git a/tests/browser/test/basic_playground_test.js b/tests/browser/test/basic_playground_test.mjs similarity index 98% rename from tests/browser/test/basic_playground_test.js rename to tests/browser/test/basic_playground_test.mjs index 091f2f6b5ce..11ad7a368c1 100644 --- a/tests/browser/test/basic_playground_test.js +++ b/tests/browser/test/basic_playground_test.mjs @@ -8,8 +8,8 @@ * @fileoverview Node.js script to run Automated tests in Chrome, via webdriver. */ -const chai = require('chai'); -const { +import * as chai from 'chai'; +import { testSetup, testFileLocations, dragNthBlockFromFlyout, @@ -17,7 +17,7 @@ const { connect, contextMenuSelect, PAUSE_TIME, -} = require('./test_setup'); +} from './test_setup.mjs'; async function getIsCollapsed(browser, blockId) { return await browser.execute((blockId) => { diff --git a/tests/browser/test/block_undo_test.js b/tests/browser/test/block_undo_test.mjs similarity index 91% rename from tests/browser/test/block_undo_test.js rename to tests/browser/test/block_undo_test.mjs index 3dc5babc5ea..1c96422dc24 100644 --- a/tests/browser/test/block_undo_test.js +++ b/tests/browser/test/block_undo_test.mjs @@ -8,15 +8,15 @@ * @fileoverview Node.js script to run Automated tests in Chrome, via webdriver. */ -const chai = require('chai'); -const {Key} = require('webdriverio'); -const { +import * as chai from 'chai'; +import {Key} from 'webdriverio'; +import { testSetup, testFileLocations, dragBlockTypeFromFlyout, screenDirection, getAllBlocks, -} = require('./test_setup'); +} from './test_setup.mjs'; suite('Testing undo block movement', function (done) { // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test diff --git a/tests/browser/test/delete_blocks_test.js b/tests/browser/test/delete_blocks_test.mjs similarity index 98% rename from tests/browser/test/delete_blocks_test.js rename to tests/browser/test/delete_blocks_test.mjs index b25c096a1ec..1e560dccee4 100644 --- a/tests/browser/test/delete_blocks_test.js +++ b/tests/browser/test/delete_blocks_test.mjs @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -const chai = require('chai'); -const { +import * as chai from 'chai'; +import { testSetup, testFileLocations, getAllBlocks, @@ -13,8 +13,8 @@ const { clickBlock, contextMenuSelect, PAUSE_TIME, -} = require('./test_setup'); -const {Key} = require('webdriverio'); +} from './test_setup.mjs'; +import {Key} from 'webdriverio'; const firstBlockId = 'root_block'; const startBlocks = { diff --git a/tests/browser/test/extensive_test.js b/tests/browser/test/extensive_test.mjs similarity index 98% rename from tests/browser/test/extensive_test.js rename to tests/browser/test/extensive_test.mjs index b16a06bbce2..2b1245d2a3e 100644 --- a/tests/browser/test/extensive_test.js +++ b/tests/browser/test/extensive_test.mjs @@ -8,15 +8,15 @@ * @fileoverview Node.js script to run Automated tests in Chrome, via webdriver. */ -const chai = require('chai'); -const { +import * as chai from 'chai'; +import { testSetup, testFileLocations, getBlockElementById, getAllBlocks, PAUSE_TIME, -} = require('./test_setup'); -const {Key} = require('webdriverio'); +} from './test_setup.mjs'; +import {Key} from 'webdriverio'; 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 diff --git a/tests/browser/test/field_edits_test.js b/tests/browser/test/field_edits_test.mjs similarity index 93% rename from tests/browser/test/field_edits_test.js rename to tests/browser/test/field_edits_test.mjs index bad2e10eda0..a4dbbb823b6 100644 --- a/tests/browser/test/field_edits_test.js +++ b/tests/browser/test/field_edits_test.mjs @@ -8,15 +8,15 @@ * @fileoverview Node.js script to run Automated tests in Chrome, via webdriver. */ -const chai = require('chai'); -const { +import * as chai from 'chai'; +import { testSetup, testFileLocations, dragBlockTypeFromFlyout, screenDirection, clickWorkspace, -} = require('./test_setup'); -const {Key} = require('webdriverio'); +} from './test_setup.mjs'; +import {Key} from 'webdriverio'; suite('Testing Field Edits', function (done) { // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test diff --git a/tests/browser/test/hooks.js b/tests/browser/test/hooks.mjs similarity index 80% rename from tests/browser/test/hooks.js rename to tests/browser/test/hooks.mjs index a7f08ed564e..5b86150060d 100644 --- a/tests/browser/test/hooks.js +++ b/tests/browser/test/hooks.mjs @@ -9,9 +9,9 @@ * 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'); +import {driverSetup, driverTeardown} from './test_setup.mjs'; -const mochaHooks = { +export const mochaHooks = { async beforeAll() { // Set a long timeout for startup. this.timeout(10000); @@ -21,5 +21,3 @@ const mochaHooks = { return await driverTeardown(); }, }; - -module.exports = {mochaHooks}; diff --git a/tests/browser/test/mutator_test.js b/tests/browser/test/mutator_test.mjs similarity index 97% rename from tests/browser/test/mutator_test.js rename to tests/browser/test/mutator_test.mjs index 93e698af635..46bc2abbef5 100644 --- a/tests/browser/test/mutator_test.js +++ b/tests/browser/test/mutator_test.mjs @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -const chai = require('chai'); -const { +import * as chai from 'chai'; +import { testSetup, testFileLocations, connect, @@ -15,7 +15,7 @@ const { getBlockElementById, dragBlockFromMutatorFlyout, openMutatorForBlock, -} = require('./test_setup'); +} from './test_setup.mjs'; suite('Mutating a block', function (done) { this.timeout(0); diff --git a/tests/browser/test/procedure_test.js b/tests/browser/test/procedure_test.mjs similarity index 97% rename from tests/browser/test/procedure_test.js rename to tests/browser/test/procedure_test.mjs index c36cb918592..4c0e0897c39 100644 --- a/tests/browser/test/procedure_test.js +++ b/tests/browser/test/procedure_test.mjs @@ -8,8 +8,8 @@ * @fileoverview Node.js script to run Automated tests in Chrome, via webdriver. */ -const chai = require('chai'); -const { +import * as chai from 'chai'; +import { testSetup, testFileLocations, getSelectedBlockElement, @@ -17,7 +17,7 @@ const { getBlockTypeFromCategory, connect, PAUSE_TIME, -} = require('./test_setup'); +} from './test_setup.mjs'; suite('Testing Connecting Blocks', function (done) { // Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test diff --git a/tests/browser/test/test_setup.js b/tests/browser/test/test_setup.mjs similarity index 90% rename from tests/browser/test/test_setup.js rename to tests/browser/test/test_setup.mjs index a07b274e4d1..3888815df2d 100644 --- a/tests/browser/test/test_setup.js +++ b/tests/browser/test/test_setup.mjs @@ -16,9 +16,10 @@ * identifiers that Selenium can use to find those elements. */ -const webdriverio = require('webdriverio'); -const path = require('path'); -const {posixPath} = require('../../../scripts/helpers'); +import * as webdriverio from 'webdriverio'; +import * as path from 'path'; +import {fileURLToPath} from 'url'; +import {posixPath} from '../../../scripts/helpers.js'; let driver = null; @@ -26,14 +27,14 @@ let driver = null; * The default amount of time to wait during a test. Increase this to make * tests easier to watch; decrease it to make tests run faster. */ -const PAUSE_TIME = 50; +export const PAUSE_TIME = 50; /** * 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() { +export async function driverSetup() { const options = { capabilities: { 'browserName': 'chrome', @@ -67,7 +68,7 @@ async function driverSetup() { * End the webdriverIO session. * @return A Promise that resolves after the actions have been completed. */ -async function driverTeardown() { +export async function driverTeardown() { await driver.deleteSession(); driver = null; return; @@ -79,7 +80,7 @@ async function driverTeardown() { * a Blockly playground with a workspace. * @return A Promsie that resolves to a webdriverIO browser that tests can manipulate. */ -async function testSetup(playgroundUrl) { +export async function testSetup(playgroundUrl) { if (!driver) { await driverSetup(); } @@ -91,7 +92,9 @@ async function testSetup(playgroundUrl) { return driver; } -const testFileLocations = { +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + +export const testFileLocations = { BLOCK_FACTORY: 'file://' + posixPath(path.join(__dirname, '..', '..', '..', 'demos', 'blockfactory')) + @@ -116,7 +119,7 @@ const testFileLocations = { * @readonly * @enum {number} */ -const screenDirection = { +export const screenDirection = { RTL: -1, LTR: 1, }; @@ -125,7 +128,7 @@ const screenDirection = { * @param browser The active WebdriverIO Browser object. * @return A Promise that resolves to the ID of the currently selected block. */ -async function getSelectedBlockId(browser) { +export 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; @@ -137,7 +140,7 @@ async function getSelectedBlockId(browser) { * @return A Promise that resolves to the selected block's root SVG element, * as an interactable browser element. */ -async function getSelectedBlockElement(browser) { +export async function getSelectedBlockElement(browser) { const id = await getSelectedBlockId(browser); return getBlockElementById(browser, id); } @@ -148,7 +151,7 @@ async function getSelectedBlockElement(browser) { * @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) { +export async function getBlockElementById(browser, id) { const elem = await browser.$(`[data-id="${id}"]`); elem['id'] = id; return elem; @@ -165,7 +168,7 @@ async function getBlockElementById(browser, id) { * @param clickOptions The options to pass to webdriverio's element.click function. * @return A Promise that resolves when the actions are completed. */ -async function clickBlock(browser, block, clickOptions) { +export async function clickBlock(browser, block, clickOptions) { const findableId = 'clickTargetElement'; // In the browser context, find the element that we want and give it a findable ID. await browser.execute( @@ -203,7 +206,7 @@ async function clickBlock(browser, block, clickOptions) { * @param browser The active WebdriverIO Browser object. * @return A Promise that resolves when the actions are completed. */ -async function clickWorkspace(browser) { +export async function clickWorkspace(browser) { const workspace = await browser.$('#blocklyDiv > div > svg.blocklySvg > g'); await workspace.click(); await browser.pause(PAUSE_TIME); @@ -215,7 +218,7 @@ async function clickWorkspace(browser) { * @return A Promise that resolves when the actions are completed. * @throws If the mutator workspace cannot be found. */ -async function clickMutatorWorkspace(browser) { +export async function clickMutatorWorkspace(browser) { const hasMutator = await browser.$('.blocklyMutatorBackground'); if (!hasMutator) { throw new Error('No mutator workspace found'); @@ -234,7 +237,7 @@ async function clickMutatorWorkspace(browser) { * category with the given name, as an interactable browser element. * @throws If the category cannot be found. */ -async function getCategory(browser, categoryName) { +export async function getCategory(browser, categoryName) { const category = browser.$(`.blocklyToolboxCategory*=${categoryName}`); category.waitForExist(); @@ -248,7 +251,7 @@ async function getCategory(browser, categoryName) { * @return A Promise that resolves to the root element of the nth * block in the given category. */ -async function getNthBlockOfCategory(browser, categoryName, n) { +export async function getNthBlockOfCategory(browser, categoryName, n) { const category = await getCategory(browser, categoryName); await category.click(); const block = await browser.$( @@ -265,7 +268,11 @@ async function getNthBlockOfCategory(browser, categoryName, n) { * @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) { +export async function getBlockTypeFromCategory( + browser, + categoryName, + blockType, +) { if (categoryName) { const category = await getCategory(browser, categoryName); await category.click(); @@ -287,7 +294,7 @@ async function getBlockTypeFromCategory(browser, categoryName, blockType) { * @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) { +export async function getBlockTypeFromWorkspace(browser, blockType, position) { const id = await browser.execute( (blockType, position) => { return Blockly.getMainWorkspace().getBlocksByType(blockType, true)[ @@ -372,7 +379,7 @@ async function getLocationOfBlockConnection( * @param dragBlockSelector The selector of the block to drag * @return A Promise that resolves when the actions are completed. */ -async function connect( +export async function connect( browser, draggedBlock, draggedConnection, @@ -411,7 +418,7 @@ async function connect( * @param browser The active WebdriverIO Browser object. * @return A Promise that resolves when the actions are completed. */ -async function switchRTL(browser) { +export async function switchRTL(browser) { const ltrForm = await browser.$('#options > select:nth-child(1)'); await ltrForm.selectByIndex(1); await browser.pause(PAUSE_TIME + 450); @@ -431,7 +438,7 @@ async function switchRTL(browser) { * @return A Promise that resolves to the root element of the newly * created block. */ -async function dragNthBlockFromFlyout(browser, categoryName, n, x, y) { +export 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); @@ -452,7 +459,13 @@ async function dragNthBlockFromFlyout(browser, categoryName, n, x, y) { * @return A Promise that resolves to the root element of the newly * created block. */ -async function dragBlockTypeFromFlyout(browser, categoryName, type, x, y) { +export async function dragBlockTypeFromFlyout( + browser, + categoryName, + type, + x, + y, +) { const flyoutBlock = await getBlockTypeFromCategory( browser, categoryName, @@ -477,7 +490,13 @@ async function dragBlockTypeFromFlyout(browser, categoryName, type, x, y) { * @return A Promise that resolves to the root element of the newly * created block. */ -async function dragBlockFromMutatorFlyout(browser, mutatorBlock, type, x, y) { +export async function dragBlockFromMutatorFlyout( + browser, + mutatorBlock, + type, + x, + y, +) { const id = await browser.execute( (mutatorBlockId, blockType) => { return Blockly.getMainWorkspace() @@ -505,7 +524,7 @@ async function dragBlockFromMutatorFlyout(browser, mutatorBlock, type, x, y) { * @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) { +export async function contextMenuSelect(browser, block, itemText) { await clickBlock(browser, block, {button: 2}); const item = await browser.$(`div=${itemText}`); @@ -522,7 +541,7 @@ async function contextMenuSelect(browser, block, itemText) { * @param block The block to click, as an interactable element. * @return A Promise that resolves when the actions are complete. */ -async function openMutatorForBlock(browser, block) { +export async function openMutatorForBlock(browser, block) { const icon = await browser.$(`[data-id="${block.id}"] > g.blocklyIconGroup`); await icon.click(); } @@ -535,7 +554,7 @@ async function openMutatorForBlock(browser, block) { * @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) { +export async function getAllBlocks(browser) { return browser.execute(() => { return Blockly.getMainWorkspace() .getAllBlocks(false) @@ -556,7 +575,7 @@ async function getAllBlocks(browser) { * @param yDelta How far to drag the flyout in the y direction. Positive is down. * @return A Promise that resolves when the actions are completed. */ -async function scrollFlyout(browser, xDelta, yDelta) { +export 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 @@ -568,31 +587,3 @@ async function scrollFlyout(browser, xDelta, yDelta) { await scrollbarHandle.dragAndDrop({x: xDelta, y: yDelta}); await browser.pause(PAUSE_TIME); } - -module.exports = { - testSetup, - testFileLocations, - driverSetup, - driverTeardown, - getSelectedBlockElement, - getSelectedBlockId, - getBlockElementById, - clickBlock, - clickWorkspace, - clickMutatorWorkspace, - getCategory, - getNthBlockOfCategory, - getBlockTypeFromCategory, - dragNthBlockFromFlyout, - dragBlockTypeFromFlyout, - dragBlockFromMutatorFlyout, - connect, - switchRTL, - contextMenuSelect, - openMutatorForBlock, - screenDirection, - getBlockTypeFromWorkspace, - getAllBlocks, - scrollFlyout, - PAUSE_TIME, -}; diff --git a/tests/browser/test/toolbox_drag_test.js b/tests/browser/test/toolbox_drag_test.mjs similarity index 98% rename from tests/browser/test/toolbox_drag_test.js rename to tests/browser/test/toolbox_drag_test.mjs index 14a9f0836db..ab0fa828ff5 100644 --- a/tests/browser/test/toolbox_drag_test.js +++ b/tests/browser/test/toolbox_drag_test.mjs @@ -8,15 +8,15 @@ * @fileoverview Tests for the dragging out of the toolbox and flyout. */ -const chai = require('chai'); -const { +import * as chai from 'chai'; +import { testSetup, testFileLocations, getCategory, scrollFlyout, screenDirection, PAUSE_TIME, -} = require('./test_setup'); +} from './test_setup.mjs'; // Categories in the basic toolbox. const basicCategories = [ diff --git a/tests/browser/test/workspace_comment_test.js b/tests/browser/test/workspace_comment_test.mjs similarity index 97% rename from tests/browser/test/workspace_comment_test.js rename to tests/browser/test/workspace_comment_test.mjs index b6adfebcd20..0a7b12bf719 100644 --- a/tests/browser/test/workspace_comment_test.js +++ b/tests/browser/test/workspace_comment_test.mjs @@ -4,10 +4,10 @@ * SPDX-License-Identifier: Apache-2.0 */ -const chai = require('chai'); -const sinon = require('sinon'); -const {Key} = require('webdriverio'); -const {testSetup, testFileLocations} = require('./test_setup'); +import * as chai from 'chai'; +import * as sinon from 'sinon'; +import {Key} from 'webdriverio'; +import {testSetup, testFileLocations} from './test_setup.mjs'; suite('Workspace comments', function () { // Setting timeout to unlimited as the webdriver takes a longer time diff --git a/tests/mocha/astnode_test.js b/tests/mocha/astnode_test.js index a9f0de0d33c..4c449b7fa81 100644 --- a/tests/mocha/astnode_test.js +++ b/tests/mocha/astnode_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import {ASTNode} from '../../build/src/core/keyboard_nav/ast_node.js'; import { sharedTestSetup, @@ -110,7 +111,7 @@ suite('ASTNode', function () { const connection = input.connection; const node = ASTNode.createConnectionNode(connection); const newASTNode = node.findNextForInput(input); - chai.assert.equal(newASTNode.getLocation(), input2.connection); + assert.equal(newASTNode.getLocation(), input2.connection); }); test('findPrevForInput', function () { @@ -119,7 +120,7 @@ suite('ASTNode', function () { const connection = input2.connection; const node = ASTNode.createConnectionNode(connection); const newASTNode = node.findPrevForInput(input2); - chai.assert.equal(newASTNode.getLocation(), input.connection); + assert.equal(newASTNode.getLocation(), input.connection); }); test('findNextForField', function () { @@ -127,7 +128,7 @@ suite('ASTNode', function () { const field2 = this.blocks.statementInput1.inputList[0].fieldRow[1]; const node = ASTNode.createFieldNode(field); const newASTNode = node.findNextForField(field); - chai.assert.equal(newASTNode.getLocation(), field2); + assert.equal(newASTNode.getLocation(), field2); }); test('findPrevForField', function () { @@ -135,7 +136,7 @@ suite('ASTNode', function () { const field2 = this.blocks.statementInput1.inputList[0].fieldRow[1]; const node = ASTNode.createFieldNode(field2); const newASTNode = node.findPrevForField(field2); - chai.assert.equal(newASTNode.getLocation(), field); + assert.equal(newASTNode.getLocation(), field); }); test('navigateBetweenStacks_Forward', function () { @@ -144,7 +145,7 @@ suite('ASTNode', function () { this.blocks.statementInput1.nextConnection, ); const newASTNode = node.navigateBetweenStacks(true); - chai.assert.equal(newASTNode.getLocation(), this.blocks.statementInput4); + assert.equal(newASTNode.getLocation(), this.blocks.statementInput4); }); test('navigateBetweenStacks_Backward', function () { @@ -153,7 +154,7 @@ suite('ASTNode', function () { this.blocks.statementInput4, ); const newASTNode = node.navigateBetweenStacks(false); - chai.assert.equal(newASTNode.getLocation(), this.blocks.statementInput1); + assert.equal(newASTNode.getLocation(), this.blocks.statementInput1); }); test('getOutAstNodeForBlock', function () { const node = new ASTNode( @@ -163,7 +164,7 @@ suite('ASTNode', function () { const newASTNode = node.getOutAstNodeForBlock( this.blocks.statementInput2, ); - chai.assert.equal(newASTNode.getLocation(), this.blocks.statementInput1); + assert.equal(newASTNode.getLocation(), this.blocks.statementInput1); }); test('getOutAstNodeForBlock_OneBlock', function () { const node = new ASTNode( @@ -173,7 +174,7 @@ suite('ASTNode', function () { const newASTNode = node.getOutAstNodeForBlock( this.blocks.statementInput4, ); - chai.assert.equal(newASTNode.getLocation(), this.blocks.statementInput4); + assert.equal(newASTNode.getLocation(), this.blocks.statementInput4); }); test('findFirstFieldOrInput_', function () { const node = new ASTNode( @@ -184,7 +185,7 @@ suite('ASTNode', function () { const newASTNode = node.findFirstFieldOrInput( this.blocks.statementInput4, ); - chai.assert.equal(newASTNode.getLocation(), field); + assert.equal(newASTNode.getLocation(), field); }); }); @@ -345,31 +346,31 @@ suite('ASTNode', function () { const prevConnection = this.blocks.statementInput1.previousConnection; const node = ASTNode.createConnectionNode(prevConnection); const nextNode = node.next(); - chai.assert.equal(nextNode.getLocation(), this.blocks.statementInput1); + assert.equal(nextNode.getLocation(), this.blocks.statementInput1); }); test('fromBlockToNext', function () { const nextConnection = this.blocks.statementInput1.nextConnection; const node = ASTNode.createBlockNode(this.blocks.statementInput1); const nextNode = node.next(); - chai.assert.equal(nextNode.getLocation(), nextConnection); + assert.equal(nextNode.getLocation(), nextConnection); }); test('fromBlockToNull', function () { const node = ASTNode.createBlockNode(this.blocks.noNextConnection); const nextNode = node.next(); - chai.assert.isNull(nextNode); + assert.isNull(nextNode); }); test('fromNextToPrevious', function () { const nextConnection = this.blocks.statementInput1.nextConnection; const prevConnection = this.blocks.statementInput2.previousConnection; const node = ASTNode.createConnectionNode(nextConnection); const nextNode = node.next(); - chai.assert.equal(nextNode.getLocation(), prevConnection); + assert.equal(nextNode.getLocation(), prevConnection); }); test('fromNextToNull', function () { const nextConnection = this.blocks.statementInput2.nextConnection; const node = ASTNode.createConnectionNode(nextConnection); const nextNode = node.next(); - chai.assert.isNull(nextNode); + assert.isNull(nextNode); }); test('fromInputToInput', function () { const input = this.blocks.statementInput1.inputList[0]; @@ -377,7 +378,7 @@ suite('ASTNode', function () { this.blocks.statementInput1.inputList[1].connection; const node = ASTNode.createInputNode(input); const nextNode = node.next(); - chai.assert.equal(nextNode.getLocation(), inputConnection); + assert.equal(nextNode.getLocation(), inputConnection); }); test('fromInputToStatementInput', function () { const input = this.blocks.fieldAndInputs2.inputList[1]; @@ -385,26 +386,26 @@ suite('ASTNode', function () { this.blocks.fieldAndInputs2.inputList[2].connection; const node = ASTNode.createInputNode(input); const nextNode = node.next(); - chai.assert.equal(nextNode.getLocation(), inputConnection); + assert.equal(nextNode.getLocation(), inputConnection); }); test('fromInputToField', function () { const input = this.blocks.fieldAndInputs2.inputList[0]; const field = this.blocks.fieldAndInputs2.inputList[1].fieldRow[0]; const node = ASTNode.createInputNode(input); const nextNode = node.next(); - chai.assert.equal(nextNode.getLocation(), field); + assert.equal(nextNode.getLocation(), field); }); test('fromInputToNull', function () { const input = this.blocks.fieldAndInputs2.inputList[2]; const node = ASTNode.createInputNode(input); const nextNode = node.next(); - chai.assert.isNull(nextNode); + assert.isNull(nextNode); }); test('fromOutputToBlock', function () { const output = this.blocks.fieldWithOutput.outputConnection; const node = ASTNode.createConnectionNode(output); const nextNode = node.next(); - chai.assert.equal(nextNode.getLocation(), this.blocks.fieldWithOutput); + assert.equal(nextNode.getLocation(), this.blocks.fieldWithOutput); }); test('fromFieldToInput', function () { const field = this.blocks.statementInput1.inputList[0].fieldRow[1]; @@ -412,31 +413,31 @@ suite('ASTNode', function () { this.blocks.statementInput1.inputList[0].connection; const node = ASTNode.createFieldNode(field); const nextNode = node.next(); - chai.assert.equal(nextNode.getLocation(), inputConnection); + assert.equal(nextNode.getLocation(), inputConnection); }); test('fromFieldToField', function () { const field = this.blocks.fieldAndInputs.inputList[0].fieldRow[0]; const node = ASTNode.createFieldNode(field); const field2 = this.blocks.fieldAndInputs.inputList[1].fieldRow[0]; const nextNode = node.next(); - chai.assert.equal(nextNode.getLocation(), field2); + assert.equal(nextNode.getLocation(), field2); }); test('fromFieldToNull', function () { const field = this.blocks.twoFields.inputList[0].fieldRow[0]; const node = ASTNode.createFieldNode(field); const nextNode = node.next(); - chai.assert.isNull(nextNode); + assert.isNull(nextNode); }); test('fromStackToStack', function () { const node = ASTNode.createStackNode(this.blocks.statementInput1); const nextNode = node.next(); - chai.assert.equal(nextNode.getLocation(), this.blocks.statementInput4); - chai.assert.equal(nextNode.getType(), ASTNode.types.STACK); + assert.equal(nextNode.getLocation(), this.blocks.statementInput4); + assert.equal(nextNode.getType(), ASTNode.types.STACK); }); test('fromStackToNull', function () { const node = ASTNode.createStackNode(this.blocks.singleBlock); const nextNode = node.next(); - chai.assert.isNull(nextNode); + assert.isNull(nextNode); }); }); @@ -445,55 +446,55 @@ suite('ASTNode', function () { const prevConnection = this.blocks.statementInput1.previousConnection; const node = ASTNode.createConnectionNode(prevConnection); const prevNode = node.prev(); - chai.assert.isNull(prevNode); + assert.isNull(prevNode); }); test('fromPreviousToNext', function () { const prevConnection = this.blocks.statementInput2.previousConnection; const node = ASTNode.createConnectionNode(prevConnection); const prevNode = node.prev(); const nextConnection = this.blocks.statementInput1.nextConnection; - chai.assert.equal(prevNode.getLocation(), nextConnection); + assert.equal(prevNode.getLocation(), nextConnection); }); test('fromPreviousToInput', function () { const prevConnection = this.blocks.statementInput3.previousConnection; const node = ASTNode.createConnectionNode(prevConnection); const prevNode = node.prev(); - chai.assert.isNull(prevNode); + assert.isNull(prevNode); }); test('fromBlockToPrevious', function () { const node = ASTNode.createBlockNode(this.blocks.statementInput1); const prevNode = node.prev(); const prevConnection = this.blocks.statementInput1.previousConnection; - chai.assert.equal(prevNode.getLocation(), prevConnection); + assert.equal(prevNode.getLocation(), prevConnection); }); test('fromBlockToNull', function () { const node = ASTNode.createBlockNode(this.blocks.noPrevConnection); const prevNode = node.prev(); - chai.assert.isNull(prevNode); + assert.isNull(prevNode); }); test('fromBlockToOutput', function () { const node = ASTNode.createBlockNode(this.blocks.fieldWithOutput); const prevNode = node.prev(); const outputConnection = this.blocks.fieldWithOutput.outputConnection; - chai.assert.equal(prevNode.getLocation(), outputConnection); + assert.equal(prevNode.getLocation(), outputConnection); }); test('fromNextToBlock', function () { const nextConnection = this.blocks.statementInput1.nextConnection; const node = ASTNode.createConnectionNode(nextConnection); const prevNode = node.prev(); - chai.assert.equal(prevNode.getLocation(), this.blocks.statementInput1); + assert.equal(prevNode.getLocation(), this.blocks.statementInput1); }); test('fromInputToField', function () { const input = this.blocks.statementInput1.inputList[0]; const node = ASTNode.createInputNode(input); const prevNode = node.prev(); - chai.assert.equal(prevNode.getLocation(), input.fieldRow[1]); + assert.equal(prevNode.getLocation(), input.fieldRow[1]); }); test('fromInputToNull', function () { const input = this.blocks.fieldAndInputs2.inputList[0]; const node = ASTNode.createInputNode(input); const prevNode = node.prev(); - chai.assert.isNull(prevNode); + assert.isNull(prevNode); }); test('fromInputToInput', function () { const input = this.blocks.fieldAndInputs2.inputList[2]; @@ -501,19 +502,19 @@ suite('ASTNode', function () { this.blocks.fieldAndInputs2.inputList[1].connection; const node = ASTNode.createInputNode(input); const prevNode = node.prev(); - chai.assert.equal(prevNode.getLocation(), inputConnection); + assert.equal(prevNode.getLocation(), inputConnection); }); test('fromOutputToNull', function () { const output = this.blocks.fieldWithOutput.outputConnection; const node = ASTNode.createConnectionNode(output); const prevNode = node.prev(); - chai.assert.isNull(prevNode); + assert.isNull(prevNode); }); test('fromFieldToNull', function () { const field = this.blocks.statementInput1.inputList[0].fieldRow[0]; const node = ASTNode.createFieldNode(field); const prevNode = node.prev(); - chai.assert.isNull(prevNode); + assert.isNull(prevNode); }); test('fromFieldToInput', function () { const field = this.blocks.fieldAndInputs2.inputList[1].fieldRow[0]; @@ -521,20 +522,20 @@ suite('ASTNode', function () { this.blocks.fieldAndInputs2.inputList[0].connection; const node = ASTNode.createFieldNode(field); const prevNode = node.prev(); - chai.assert.equal(prevNode.getLocation(), inputConnection); + assert.equal(prevNode.getLocation(), inputConnection); }); test('fromFieldToField', function () { const field = this.blocks.fieldAndInputs.inputList[1].fieldRow[0]; const field2 = this.blocks.fieldAndInputs.inputList[0].fieldRow[0]; const node = ASTNode.createFieldNode(field); const prevNode = node.prev(); - chai.assert.equal(prevNode.getLocation(), field2); + assert.equal(prevNode.getLocation(), field2); }); test('fromStackToStack', function () { const node = ASTNode.createStackNode(this.blocks.statementInput4); const prevNode = node.prev(); - chai.assert.equal(prevNode.getLocation(), this.blocks.statementInput1); - chai.assert.equal(prevNode.getType(), ASTNode.types.STACK); + assert.equal(prevNode.getLocation(), this.blocks.statementInput1); + assert.equal(prevNode.getType(), ASTNode.types.STACK); }); }); @@ -551,13 +552,13 @@ suite('ASTNode', function () { const node = ASTNode.createInputNode(input); const inNode = node.in(); const outputConnection = this.blocks.fieldWithOutput.outputConnection; - chai.assert.equal(inNode.getLocation(), outputConnection); + assert.equal(inNode.getLocation(), outputConnection); }); test('fromInputToNull', function () { const input = this.blocks.statementInput2.inputList[0]; const node = ASTNode.createInputNode(input); const inNode = node.in(); - chai.assert.isNull(inNode); + assert.isNull(inNode); }); test('fromInputToPrevious', function () { const input = this.blocks.statementInput2.inputList[1]; @@ -565,60 +566,57 @@ suite('ASTNode', function () { this.blocks.statementInput3.previousConnection; const node = ASTNode.createInputNode(input); const inNode = node.in(); - chai.assert.equal(inNode.getLocation(), previousConnection); + assert.equal(inNode.getLocation(), previousConnection); }); test('fromBlockToInput', function () { const input = this.blocks.valueInput.inputList[0]; const node = ASTNode.createBlockNode(this.blocks.valueInput); const inNode = node.in(); - chai.assert.equal(inNode.getLocation(), input.connection); + assert.equal(inNode.getLocation(), input.connection); }); test('fromBlockToField', function () { const node = ASTNode.createBlockNode(this.blocks.statementInput1); const inNode = node.in(); const field = this.blocks.statementInput1.inputList[0].fieldRow[0]; - chai.assert.equal(inNode.getLocation(), field); + assert.equal(inNode.getLocation(), field); }); test('fromBlockToPrevious', function () { const prevConnection = this.blocks.statementInput4.previousConnection; const node = ASTNode.createStackNode(this.blocks.statementInput4); const inNode = node.in(); - chai.assert.equal(inNode.getLocation(), prevConnection); - chai.assert.equal(inNode.getType(), ASTNode.types.PREVIOUS); + assert.equal(inNode.getLocation(), prevConnection); + assert.equal(inNode.getType(), ASTNode.types.PREVIOUS); }); test('fromBlockToNull_DummyInput', function () { const node = ASTNode.createBlockNode(this.blocks.dummyInput); const inNode = node.in(); - chai.assert.isNull(inNode); + assert.isNull(inNode); }); test('fromBlockToInput_DummyInputValue', function () { const node = ASTNode.createBlockNode(this.blocks.dummyInputValue); const inputConnection = this.blocks.dummyInputValue.inputList[1].connection; const inNode = node.in(); - chai.assert.equal(inNode.getLocation(), inputConnection); + assert.equal(inNode.getLocation(), inputConnection); }); test('fromOuputToNull', function () { const output = this.blocks.fieldWithOutput.outputConnection; const node = ASTNode.createConnectionNode(output); const inNode = node.in(); - chai.assert.isNull(inNode); + assert.isNull(inNode); }); test('fromFieldToNull', function () { const field = this.blocks.statementInput1.inputList[0].fieldRow[0]; const node = ASTNode.createFieldNode(field); const inNode = node.in(); - chai.assert.isNull(inNode); + assert.isNull(inNode); }); test('fromWorkspaceToStack', function () { const coordinate = new Blockly.utils.Coordinate(100, 100); const node = ASTNode.createWorkspaceNode(this.workspace, coordinate); const inNode = node.in(); - chai.assert.equal( - inNode.getLocation(), - this.workspace.getTopBlocks()[0], - ); - chai.assert.equal(inNode.getType(), ASTNode.types.STACK); + assert.equal(inNode.getLocation(), this.workspace.getTopBlocks()[0]); + assert.equal(inNode.getType(), ASTNode.types.STACK); }); test('fromWorkspaceToNull', function () { const coordinate = new Blockly.utils.Coordinate(100, 100); @@ -627,27 +625,27 @@ suite('ASTNode', function () { coordinate, ); const inNode = node.in(); - chai.assert.isNull(inNode); + assert.isNull(inNode); }); test('fromStackToPrevious', function () { const node = ASTNode.createStackNode(this.blocks.statementInput1); const previous = this.blocks.statementInput1.previousConnection; const inNode = node.in(); - chai.assert.equal(inNode.getLocation(), previous); - chai.assert.equal(inNode.getType(), ASTNode.types.PREVIOUS); + assert.equal(inNode.getLocation(), previous); + assert.equal(inNode.getType(), ASTNode.types.PREVIOUS); }); test('fromStackToOutput', function () { const node = ASTNode.createStackNode(this.blocks.fieldWithOutput2); const output = this.blocks.fieldWithOutput2.outputConnection; const inNode = node.in(); - chai.assert.equal(inNode.getLocation(), output); - chai.assert.equal(inNode.getType(), ASTNode.types.OUTPUT); + assert.equal(inNode.getLocation(), output); + assert.equal(inNode.getType(), ASTNode.types.OUTPUT); }); test('fromStackToBlock', function () { const node = ASTNode.createStackNode(this.blocks.dummyInput); const inNode = node.in(); - chai.assert.equal(inNode.getLocation(), this.blocks.dummyInput); - chai.assert.equal(inNode.getType(), ASTNode.types.BLOCK); + assert.equal(inNode.getLocation(), this.blocks.dummyInput); + assert.equal(inNode.getType(), ASTNode.types.BLOCK); }); }); @@ -667,15 +665,15 @@ suite('ASTNode', function () { const input = this.blocks.statementInput1.inputList[0]; const node = ASTNode.createInputNode(input); const outNode = node.out(); - chai.assert.equal(outNode.getType(), ASTNode.types.BLOCK); - chai.assert.equal(outNode.getLocation(), this.blocks.statementInput1); + assert.equal(outNode.getType(), ASTNode.types.BLOCK); + assert.equal(outNode.getLocation(), this.blocks.statementInput1); }); test('fromOutputToInput', function () { const output = this.blocks.fieldWithOutput.outputConnection; const node = ASTNode.createConnectionNode(output); const outNode = node.out(); - chai.assert.equal(outNode.getType(), ASTNode.types.INPUT); - chai.assert.equal( + assert.equal(outNode.getType(), ASTNode.types.INPUT); + assert.equal( outNode.getLocation(), this.blocks.statementInput1.inputList[0].connection, ); @@ -684,15 +682,15 @@ suite('ASTNode', function () { const output = this.blocks.fieldWithOutput2.outputConnection; const node = ASTNode.createConnectionNode(output); const outNode = node.out(); - chai.assert.equal(outNode.getType(), ASTNode.types.STACK); - chai.assert.equal(outNode.getLocation(), this.blocks.fieldWithOutput2); + assert.equal(outNode.getType(), ASTNode.types.STACK); + assert.equal(outNode.getLocation(), this.blocks.fieldWithOutput2); }); test('fromFieldToBlock', function () { const field = this.blocks.statementInput1.inputList[0].fieldRow[0]; const node = ASTNode.createFieldNode(field); const outNode = node.out(); - chai.assert.equal(outNode.getType(), ASTNode.types.BLOCK); - chai.assert.equal(outNode.getLocation(), this.blocks.statementInput1); + assert.equal(outNode.getType(), ASTNode.types.BLOCK); + assert.equal(outNode.getLocation(), this.blocks.statementInput1); }); test('fromStackToWorkspace', function () { const stub = sinon @@ -700,9 +698,9 @@ suite('ASTNode', function () { .returns({x: 10, y: 10}); const node = ASTNode.createStackNode(this.blocks.statementInput4); const outNode = node.out(); - chai.assert.equal(outNode.getType(), ASTNode.types.WORKSPACE); - chai.assert.equal(outNode.wsCoordinate.x, 10); - chai.assert.equal(outNode.wsCoordinate.y, -10); + assert.equal(outNode.getType(), ASTNode.types.WORKSPACE); + assert.equal(outNode.wsCoordinate.x, 10); + assert.equal(outNode.wsCoordinate.y, -10); stub.restore(); }); test('fromPreviousToInput', function () { @@ -711,15 +709,15 @@ suite('ASTNode', function () { this.blocks.statementInput2.inputList[1].connection; const node = ASTNode.createConnectionNode(previous); const outNode = node.out(); - chai.assert.equal(outNode.getType(), ASTNode.types.INPUT); - chai.assert.equal(outNode.getLocation(), inputConnection); + assert.equal(outNode.getType(), ASTNode.types.INPUT); + assert.equal(outNode.getLocation(), inputConnection); }); test('fromPreviousToStack', function () { const previous = this.blocks.statementInput2.previousConnection; const node = ASTNode.createConnectionNode(previous); const outNode = node.out(); - chai.assert.equal(outNode.getType(), ASTNode.types.STACK); - chai.assert.equal(outNode.getLocation(), this.blocks.statementInput1); + assert.equal(outNode.getType(), ASTNode.types.STACK); + assert.equal(outNode.getLocation(), this.blocks.statementInput1); }); test('fromNextToInput', function () { const next = this.blocks.statementInput3.nextConnection; @@ -727,22 +725,22 @@ suite('ASTNode', function () { this.blocks.statementInput2.inputList[1].connection; const node = ASTNode.createConnectionNode(next); const outNode = node.out(); - chai.assert.equal(outNode.getType(), ASTNode.types.INPUT); - chai.assert.equal(outNode.getLocation(), inputConnection); + assert.equal(outNode.getType(), ASTNode.types.INPUT); + assert.equal(outNode.getLocation(), inputConnection); }); test('fromNextToStack', function () { const next = this.blocks.statementInput2.nextConnection; const node = ASTNode.createConnectionNode(next); const outNode = node.out(); - chai.assert.equal(outNode.getType(), ASTNode.types.STACK); - chai.assert.equal(outNode.getLocation(), this.blocks.statementInput1); + assert.equal(outNode.getType(), ASTNode.types.STACK); + assert.equal(outNode.getLocation(), this.blocks.statementInput1); }); test('fromNextToStack_NoPreviousConnection', function () { const next = this.blocks.secondBlock.nextConnection; const node = ASTNode.createConnectionNode(next); const outNode = node.out(); - chai.assert.equal(outNode.getType(), ASTNode.types.STACK); - chai.assert.equal(outNode.getLocation(), this.blocks.noPrevConnection); + assert.equal(outNode.getType(), ASTNode.types.STACK); + assert.equal(outNode.getLocation(), this.blocks.noPrevConnection); }); /** * This is where there is a block with both an output connection and a @@ -752,8 +750,8 @@ suite('ASTNode', function () { const next = this.blocks.outputNextBlock.nextConnection; const node = ASTNode.createConnectionNode(next); const outNode = node.out(); - chai.assert.equal(outNode.getType(), ASTNode.types.INPUT); - chai.assert.equal( + assert.equal(outNode.getType(), ASTNode.types.INPUT); + assert.equal( outNode.getLocation(), this.blocks.secondBlock.inputList[0].connection, ); @@ -761,34 +759,34 @@ suite('ASTNode', function () { test('fromBlockToStack', function () { const node = ASTNode.createBlockNode(this.blocks.statementInput2); const outNode = node.out(); - chai.assert.equal(outNode.getType(), ASTNode.types.STACK); - chai.assert.equal(outNode.getLocation(), this.blocks.statementInput1); + assert.equal(outNode.getType(), ASTNode.types.STACK); + assert.equal(outNode.getLocation(), this.blocks.statementInput1); }); test('fromBlockToInput', function () { const input = this.blocks.statementInput2.inputList[1].connection; const node = ASTNode.createBlockNode(this.blocks.statementInput3); const outNode = node.out(); - chai.assert.equal(outNode.getType(), ASTNode.types.INPUT); - chai.assert.equal(outNode.getLocation(), input); + assert.equal(outNode.getType(), ASTNode.types.INPUT); + assert.equal(outNode.getLocation(), input); }); test('fromTopBlockToStack', function () { const node = ASTNode.createBlockNode(this.blocks.statementInput1); const outNode = node.out(); - chai.assert.equal(outNode.getType(), ASTNode.types.STACK); - chai.assert.equal(outNode.getLocation(), this.blocks.statementInput1); + assert.equal(outNode.getType(), ASTNode.types.STACK); + assert.equal(outNode.getLocation(), this.blocks.statementInput1); }); test('fromBlockToStack_OutputConnection', function () { const node = ASTNode.createBlockNode(this.blocks.fieldWithOutput2); const outNode = node.out(); - chai.assert.equal(outNode.getType(), ASTNode.types.STACK); - chai.assert.equal(outNode.getLocation(), this.blocks.fieldWithOutput2); + assert.equal(outNode.getType(), ASTNode.types.STACK); + assert.equal(outNode.getLocation(), this.blocks.fieldWithOutput2); }); test('fromBlockToInput_OutputConnection', function () { const node = ASTNode.createBlockNode(this.blocks.outputNextBlock); const inputConnection = this.blocks.secondBlock.inputList[0].connection; const outNode = node.out(); - chai.assert.equal(outNode.getType(), ASTNode.types.INPUT); - chai.assert.equal(outNode.getLocation(), inputConnection); + assert.equal(outNode.getType(), ASTNode.types.INPUT); + assert.equal(outNode.getLocation(), inputConnection); }); }); @@ -796,31 +794,31 @@ suite('ASTNode', function () { test('createFieldNode', function () { const field = this.blocks.statementInput1.inputList[0].fieldRow[0]; const node = ASTNode.createFieldNode(field); - chai.assert.equal(node.getLocation(), field); - chai.assert.equal(node.getType(), ASTNode.types.FIELD); - chai.assert.isFalse(node.isConnection()); + assert.equal(node.getLocation(), field); + assert.equal(node.getType(), ASTNode.types.FIELD); + assert.isFalse(node.isConnection()); }); test('createConnectionNode', function () { const prevConnection = this.blocks.statementInput4.previousConnection; const node = ASTNode.createConnectionNode(prevConnection); - chai.assert.equal(node.getLocation(), prevConnection); - chai.assert.equal(node.getType(), ASTNode.types.PREVIOUS); - chai.assert.isTrue(node.isConnection()); + assert.equal(node.getLocation(), prevConnection); + assert.equal(node.getType(), ASTNode.types.PREVIOUS); + assert.isTrue(node.isConnection()); }); test('createInputNode', function () { const input = this.blocks.statementInput1.inputList[0]; const node = ASTNode.createInputNode(input); - chai.assert.equal(node.getLocation(), input.connection); - chai.assert.equal(node.getType(), ASTNode.types.INPUT); - chai.assert.isTrue(node.isConnection()); + assert.equal(node.getLocation(), input.connection); + assert.equal(node.getType(), ASTNode.types.INPUT); + assert.isTrue(node.isConnection()); }); test('createWorkspaceNode', function () { const coordinate = new Blockly.utils.Coordinate(100, 100); const node = ASTNode.createWorkspaceNode(this.workspace, coordinate); - chai.assert.equal(node.getLocation(), this.workspace); - chai.assert.equal(node.getType(), ASTNode.types.WORKSPACE); - chai.assert.equal(node.getWsCoordinate(), coordinate); - chai.assert.isFalse(node.isConnection()); + assert.equal(node.getLocation(), this.workspace); + assert.equal(node.getType(), ASTNode.types.WORKSPACE); + assert.equal(node.getWsCoordinate(), coordinate); + assert.isFalse(node.isConnection()); }); test('createStatementConnectionNode', function () { const nextConnection = @@ -828,24 +826,24 @@ suite('ASTNode', function () { const inputConnection = this.blocks.statementInput1.inputList[1].connection; const node = ASTNode.createConnectionNode(nextConnection); - chai.assert.equal(node.getLocation(), inputConnection); - chai.assert.equal(node.getType(), ASTNode.types.INPUT); - chai.assert.isTrue(node.isConnection()); + assert.equal(node.getLocation(), inputConnection); + assert.equal(node.getType(), ASTNode.types.INPUT); + assert.isTrue(node.isConnection()); }); test('createTopNode-previous', function () { const block = this.blocks.statementInput1; const topNode = ASTNode.createTopNode(block); - chai.assert.equal(topNode.getLocation(), block.previousConnection); + assert.equal(topNode.getLocation(), block.previousConnection); }); test('createTopNode-block', function () { const block = this.blocks.noPrevConnection; const topNode = ASTNode.createTopNode(block); - chai.assert.equal(topNode.getLocation(), block); + assert.equal(topNode.getLocation(), block); }); test('createTopNode-output', function () { const block = this.blocks.outputNextBlock; const topNode = ASTNode.createTopNode(block); - chai.assert.equal(topNode.getLocation(), block.outputConnection); + assert.equal(topNode.getLocation(), block.outputConnection); }); }); }); diff --git a/tests/mocha/block_json_test.js b/tests/mocha/block_json_test.js index e89c68e7c1d..9d6dfb738f0 100644 --- a/tests/mocha/block_json_test.js +++ b/tests/mocha/block_json_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import {Align} from '../../build/src/core/inputs/align.js'; import { sharedTestSetup, @@ -27,7 +28,7 @@ suite('Block JSON initialization', function () { type: 'test', validateTokens_: Blockly.Block.prototype.validateTokens_, }; - chai.assert.throws(function () { + assert.throws(function () { block.validateTokens_(tokens, count); }, error); }; @@ -37,7 +38,7 @@ suite('Block JSON initialization', function () { type: 'test', validateTokens_: Blockly.Block.prototype.validateTokens_, }; - chai.assert.doesNotThrow(function () { + assert.doesNotThrow(function () { block.validateTokens_(tokens, count); }); }; @@ -105,7 +106,7 @@ suite('Block JSON initialization', function () { stringToFieldJson_: Blockly.Block.prototype.stringToFieldJson_, isInputKeyword_: Blockly.Block.prototype.isInputKeyword_, }; - chai.assert.deepEqual( + assert.deepEqual( block.interpolateArguments_(tokens, args, lastAlign), elements, ); @@ -405,7 +406,7 @@ suite('Block JSON initialization', function () { fieldFromJson_: Blockly.Block.prototype.fieldFromJson_, stringToFieldJson_: Blockly.Block.prototype.stringToFieldJson_, }; - chai.assert.strictEqual(block.fieldFromJson_(json), expectedType); + assert.strictEqual(block.fieldFromJson_(json), expectedType); }; }); @@ -573,34 +574,34 @@ suite('Block JSON initialization', function () { const input = block.inputFromJson_(json); switch (type) { case 'input_dummy': - chai.assert.isTrue( + assert.isTrue( block.appendDummyInput.calledOnce, 'Expected a dummy input to be created.', ); break; case 'input_value': - chai.assert.isTrue( + assert.isTrue( block.appendValueInput.calledOnce, 'Expected a value input to be created.', ); break; case 'input_statement': - chai.assert.isTrue( + assert.isTrue( block.appendStatementInput.calledOnce, 'Expected a statement input to be created.', ); break; default: - chai.assert.isNull(input, 'Expected input to be null'); - chai.assert.isTrue( + assert.isNull(input, 'Expected input to be null'); + assert.isTrue( block.appendDummyInput.notCalled, 'Expected no input to be created', ); - chai.assert.isTrue( + assert.isTrue( block.appendValueInput.notCalled, 'Expected no input to be created', ); - chai.assert.isTrue( + assert.isTrue( block.appendStatementInput.notCalled, 'Expected no input to be created', ); @@ -608,13 +609,13 @@ suite('Block JSON initialization', function () { } if (check) { if (Array.isArray(check)) { - chai.assert.deepEqual(check, input.connection.getCheck()); + assert.deepEqual(check, input.connection.getCheck()); } else { - chai.assert.deepEqual([check], input.connection.getCheck()); + assert.deepEqual([check], input.connection.getCheck()); } } if (align !== undefined) { - chai.assert.equal(align, input.align); + assert.equal(align, input.align); } }; }); @@ -667,7 +668,7 @@ suite('Block JSON initialization', function () { ); const block = this.workspace.newBlock('test_basic_empty'); block.inputFromJson_({'type': 'custom'}); - chai.assert.instanceOf( + assert.instanceOf( block.inputList[0], CustomInput, 'Expected the registered input to be constructed', diff --git a/tests/mocha/block_test.js b/tests/mocha/block_test.js index e158391fc12..dd070f86cbb 100644 --- a/tests/mocha/block_test.js +++ b/tests/mocha/block_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import {ConnectionType} from '../../build/src/core/connection_type.js'; import {createDeprecationWarningStub} from './test_helpers/warnings.js'; import {createRenderedBlock} from './test_helpers/block_definitions.js'; @@ -80,7 +81,7 @@ suite('Blocks', function () { blockB.nextConnection.connect(blockC.previousConnection); } - chai.assert.equal(blockC.getParent(), blockB); + assert.equal(blockC.getParent(), blockB); return { A: blockA /* Parent */, @@ -92,30 +93,30 @@ suite('Blocks', function () { suite('Unplug', function () { function assertUnpluggedNoheal(blocks) { // A has nothing connected to it. - chai.assert.equal(blocks.A.getChildren().length, 0); + assert.equal(blocks.A.getChildren().length, 0); // B and C are still connected. - chai.assert.equal(blocks.C.getParent(), blocks.B); + assert.equal(blocks.C.getParent(), blocks.B); // B is the top of its stack. - chai.assert.isNull(blocks.B.getParent()); + assert.isNull(blocks.B.getParent()); } function assertUnpluggedHealed(blocks) { // A and C are connected. - chai.assert.equal(blocks.A.getChildren().length, 1); - chai.assert.equal(blocks.C.getParent(), blocks.A); + assert.equal(blocks.A.getChildren().length, 1); + assert.equal(blocks.C.getParent(), blocks.A); // B has nothing connected to it. - chai.assert.equal(blocks.B.getChildren().length, 0); + assert.equal(blocks.B.getChildren().length, 0); // B is the top of its stack. - chai.assert.isNull(blocks.B.getParent()); + assert.isNull(blocks.B.getParent()); } function assertUnpluggedHealFailed(blocks) { // A has nothing connected to it. - chai.assert.equal(blocks.A.getChildren().length, 0); + assert.equal(blocks.A.getChildren().length, 0); // B has nothing connected to it. - chai.assert.equal(blocks.B.getChildren().length, 0); + assert.equal(blocks.B.getChildren().length, 0); // B is the top of its stack. - chai.assert.isNull(blocks.B.getParent()); + assert.isNull(blocks.B.getParent()); // C is the top of its stack. - chai.assert.isNull(blocks.C.getParent()); + assert.isNull(blocks.C.getParent()); } suite('Row', function () { @@ -232,7 +233,7 @@ suite('Blocks', function () { this.block.dispose(); - chai.assert.isTrue(spy.calledOnce, 'Expected destroy to be called.'); + assert.isTrue(spy.calledOnce, 'Expected destroy to be called.'); }); test('disposing is set before destroy', function () { @@ -243,7 +244,7 @@ suite('Blocks', function () { this.block.dispose(); - chai.assert.isTrue( + assert.isTrue( disposing, 'Expected disposing to be set to true before destroy is called.', ); @@ -257,7 +258,7 @@ suite('Blocks', function () { this.block.dispose(); - chai.assert.isFalse( + assert.isFalse( disposed, 'Expected disposed to be false when destroy is called', ); @@ -273,7 +274,7 @@ suite('Blocks', function () { this.block.dispose(); this.clock.runAll(); - chai.assert.isTrue( + assert.isTrue( spy.calledWith(mockEvent), 'Expected to be able to fire events from destroy', ); @@ -293,7 +294,7 @@ suite('Blocks', function () { this.block.dispose(); this.clock.runAll(); - chai.assert.isTrue( + assert.isTrue( spy.calledWith(mockEvent), 'Expected to be able to fire events from destroy', ); @@ -302,34 +303,34 @@ suite('Blocks', function () { suite('stack/row healing', function () { function assertDisposedNoheal(blocks) { - chai.assert.isFalse(blocks.A.disposed); + assert.isFalse(blocks.A.disposed); // A has nothing connected to it. - chai.assert.equal(blocks.A.getChildren().length, 0); + assert.equal(blocks.A.getChildren().length, 0); // B is disposed. - chai.assert.isTrue(blocks.B.disposed); + assert.isTrue(blocks.B.disposed); // And C is disposed. - chai.assert.isTrue(blocks.C.disposed); + assert.isTrue(blocks.C.disposed); } function assertDisposedHealed(blocks) { - chai.assert.isFalse(blocks.A.disposed); - chai.assert.isFalse(blocks.C.disposed); + assert.isFalse(blocks.A.disposed); + assert.isFalse(blocks.C.disposed); // A and C are connected. - chai.assert.equal(blocks.A.getChildren().length, 1); - chai.assert.equal(blocks.C.getParent(), blocks.A); + assert.equal(blocks.A.getChildren().length, 1); + assert.equal(blocks.C.getParent(), blocks.A); // B is disposed. - chai.assert.isTrue(blocks.B.disposed); + assert.isTrue(blocks.B.disposed); } function assertDisposedHealFailed(blocks) { - chai.assert.isFalse(blocks.A.disposed); - chai.assert.isFalse(blocks.C.disposed); + assert.isFalse(blocks.A.disposed); + assert.isFalse(blocks.C.disposed); // A has nothing connected to it. - chai.assert.equal(blocks.A.getChildren().length, 0); + assert.equal(blocks.A.getChildren().length, 0); // B is disposed. - chai.assert.isTrue(blocks.B.disposed); + assert.isTrue(blocks.B.disposed); // C is the top of its stack. - chai.assert.isNull(blocks.C.getParent()); + assert.isNull(blocks.C.getParent()); } suite('Row', function () { @@ -469,7 +470,7 @@ suite('Blocks', function () { test('No Connected', function () { this.blockA.removeInput('VALUE'); - chai.assert.isNull(this.blockA.getInput('VALUE')); + assert.isNull(this.blockA.getInput('VALUE')); }); test('Block Connected', function () { const blockB = this.workspace.newBlock('row_block'); @@ -478,8 +479,8 @@ suite('Blocks', function () { .connection.connect(blockB.outputConnection); this.blockA.removeInput('VALUE'); - chai.assert.isFalse(blockB.disposed); - chai.assert.equal(this.blockA.getChildren().length, 0); + assert.isFalse(blockB.disposed); + assert.equal(this.blockA.getChildren().length, 0); }); test('Shadow Connected', function () { const blockB = this.workspace.newBlock('row_block'); @@ -489,8 +490,8 @@ suite('Blocks', function () { .connection.connect(blockB.outputConnection); this.blockA.removeInput('VALUE'); - chai.assert.isTrue(blockB.disposed); - chai.assert.equal(this.blockA.getChildren().length, 0); + assert.isTrue(blockB.disposed); + assert.equal(this.blockA.getChildren().length, 0); }); }); suite('Statement', function () { @@ -500,7 +501,7 @@ suite('Blocks', function () { test('No Connected', function () { this.blockA.removeInput('STATEMENT'); - chai.assert.isNull(this.blockA.getInput('STATEMENT')); + assert.isNull(this.blockA.getInput('STATEMENT')); }); test('Block Connected', function () { const blockB = this.workspace.newBlock('stack_block'); @@ -509,8 +510,8 @@ suite('Blocks', function () { .connection.connect(blockB.previousConnection); this.blockA.removeInput('STATEMENT'); - chai.assert.isFalse(blockB.disposed); - chai.assert.equal(this.blockA.getChildren().length, 0); + assert.isFalse(blockB.disposed); + assert.equal(this.blockA.getChildren().length, 0); }); test('Shadow Connected', function () { const blockB = this.workspace.newBlock('stack_block'); @@ -520,8 +521,8 @@ suite('Blocks', function () { .connection.connect(blockB.previousConnection); this.blockA.removeInput('STATEMENT'); - chai.assert.isTrue(blockB.disposed); - chai.assert.equal(this.blockA.getChildren().length, 0); + assert.isTrue(blockB.disposed); + assert.equal(this.blockA.getChildren().length, 0); }); }); }); @@ -549,10 +550,10 @@ suite('Blocks', function () { }; this.assertConnectionsEmpty = function () { - chai.assert.isEmpty(this.getInputs()); - chai.assert.isEmpty(this.getOutputs()); - chai.assert.isEmpty(this.getNext()); - chai.assert.isEmpty(this.getPrevious()); + assert.isEmpty(this.getInputs()); + assert.isEmpty(this.getOutputs()); + assert.isEmpty(this.getNext()); + assert.isEmpty(this.getPrevious()); }; }); teardown(function () { @@ -572,8 +573,8 @@ suite('Blocks', function () { this.deserializationHelper( '' + ' ' + '', ); - chai.assert.equal(this.getPrevious().length, 1); - chai.assert.equal(this.getNext().length, 1); + assert.equal(this.getPrevious().length, 1); + assert.equal(this.getNext().length, 1); }); test('Multi-Stack', function () { this.deserializationHelper( @@ -589,15 +590,15 @@ suite('Blocks', function () { ' ' + '', ); - chai.assert.equal(this.getPrevious().length, 3); - chai.assert.equal(this.getNext().length, 3); + assert.equal(this.getPrevious().length, 3); + 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); + assert.equal(this.getPrevious().length, 1); + assert.equal(this.getNext().length, 1); }); test('Collapsed Multi-Stack', function () { this.deserializationHelper( @@ -613,15 +614,15 @@ suite('Blocks', function () { ' ' + '', ); - chai.assert.equal(this.getPrevious().length, 3); - chai.assert.equal(this.getNext().length, 3); + assert.equal(this.getPrevious().length, 3); + 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); + assert.equal(this.getOutputs().length, 1); + assert.equal(this.getInputs().length, 1); }); test('Multi-Row', function () { this.deserializationHelper( @@ -637,15 +638,15 @@ suite('Blocks', function () { ' ' + '', ); - chai.assert.equal(this.getOutputs().length, 3); - chai.assert.equal(this.getInputs().length, 3); + assert.equal(this.getOutputs().length, 3); + 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); + assert.equal(this.getOutputs().length, 1); + assert.equal(this.getInputs().length, 0); }); test('Collapsed Multi-Row', function () { this.deserializationHelper( @@ -661,8 +662,8 @@ suite('Blocks', function () { ' ' + '', ); - chai.assert.equal(this.getOutputs().length, 1); - chai.assert.equal(this.getInputs().length, 0); + assert.equal(this.getOutputs().length, 1); + assert.equal(this.getInputs().length, 0); }); test('Collapsed Multi-Row Middle', function () { Blockly.Xml.appendDomToWorkspace( @@ -683,15 +684,15 @@ suite('Blocks', function () { ); this.assertConnectionsEmpty(); this.clock.runAll(); - chai.assert.equal(this.getOutputs().length, 2); - chai.assert.equal(this.getInputs().length, 1); + assert.equal(this.getOutputs().length, 2); + assert.equal(this.getInputs().length, 1); }); test('Statement', function () { this.deserializationHelper( '' + ' ' + '', ); - chai.assert.equal(this.getPrevious().length, 1); - chai.assert.equal(this.getNext().length, 2); + assert.equal(this.getPrevious().length, 1); + assert.equal(this.getNext().length, 2); }); test('Multi-Statement', function () { this.deserializationHelper( @@ -707,8 +708,8 @@ suite('Blocks', function () { ' ' + '', ); - chai.assert.equal(this.getPrevious().length, 3); - chai.assert.equal(this.getNext().length, 6); + assert.equal(this.getPrevious().length, 3); + assert.equal(this.getNext().length, 6); }); test('Collapsed Statement', function () { this.deserializationHelper( @@ -716,8 +717,8 @@ suite('Blocks', function () { ' ' + '', ); - chai.assert.equal(this.getPrevious().length, 1); - chai.assert.equal(this.getNext().length, 1); + assert.equal(this.getPrevious().length, 1); + assert.equal(this.getNext().length, 1); }); test('Collapsed Multi-Statement', function () { this.deserializationHelper( @@ -733,8 +734,8 @@ suite('Blocks', function () { ' ' + '', ); - chai.assert.equal(this.getPrevious().length, 1); - chai.assert.equal(this.getNext().length, 1); + assert.equal(this.getPrevious().length, 1); + assert.equal(this.getNext().length, 1); }); test('Collapsed Multi-Statement Middle', function () { this.deserializationHelper( @@ -750,8 +751,8 @@ suite('Blocks', function () { ' ' + '', ); - chai.assert.equal(this.getPrevious().length, 2); - chai.assert.equal(this.getNext().length, 3); + assert.equal(this.getPrevious().length, 2); + assert.equal(this.getNext().length, 3); }); }); suite('Programmatic Block Creation', function () { @@ -761,8 +762,8 @@ suite('Blocks', function () { block.initSvg(); block.render(); - chai.assert.equal(this.getPrevious().length, 1); - chai.assert.equal(this.getNext().length, 1); + assert.equal(this.getPrevious().length, 1); + assert.equal(this.getNext().length, 1); }); test('Row', function () { const block = this.workspace.newBlock('row_block'); @@ -770,8 +771,8 @@ suite('Blocks', function () { block.initSvg(); block.render(); - chai.assert.equal(this.getOutputs().length, 1); - chai.assert.equal(this.getInputs().length, 1); + assert.equal(this.getOutputs().length, 1); + assert.equal(this.getInputs().length, 1); }); test('Statement', function () { const block = this.workspace.newBlock('statement_block'); @@ -779,8 +780,8 @@ suite('Blocks', function () { block.initSvg(); block.render(); - chai.assert.equal(this.getPrevious().length, 1); - chai.assert.equal(this.getNext().length, 2); + assert.equal(this.getPrevious().length, 1); + assert.equal(this.getNext().length, 2); }); }); suite('setCollapsed', function () { @@ -790,16 +791,16 @@ suite('Blocks', function () { this.workspace, ); this.clock.runAll(); - chai.assert.equal(this.getPrevious().length, 1); - chai.assert.equal(this.getNext().length, 1); + assert.equal(this.getPrevious().length, 1); + assert.equal(this.getNext().length, 1); block.setCollapsed(true); - chai.assert.equal(this.getPrevious().length, 1); - chai.assert.equal(this.getNext().length, 1); + assert.equal(this.getPrevious().length, 1); + assert.equal(this.getNext().length, 1); block.setCollapsed(false); - chai.assert.equal(this.getPrevious().length, 1); - chai.assert.equal(this.getNext().length, 1); + assert.equal(this.getPrevious().length, 1); + assert.equal(this.getNext().length, 1); }); test('Multi-Stack', function () { const block = Blockly.Xml.domToBlock( @@ -818,16 +819,16 @@ suite('Blocks', function () { ); this.assertConnectionsEmpty(); this.clock.runAll(); - chai.assert.equal(this.getPrevious().length, 3); - chai.assert.equal(this.getNext().length, 3); + assert.equal(this.getPrevious().length, 3); + assert.equal(this.getNext().length, 3); block.setCollapsed(true); - chai.assert.equal(this.getPrevious().length, 3); - chai.assert.equal(this.getNext().length, 3); + assert.equal(this.getPrevious().length, 3); + assert.equal(this.getNext().length, 3); block.setCollapsed(false); - chai.assert.equal(this.getPrevious().length, 3); - chai.assert.equal(this.getNext().length, 3); + assert.equal(this.getPrevious().length, 3); + assert.equal(this.getNext().length, 3); }); test('Row', function () { const block = Blockly.Xml.domToBlock( @@ -835,16 +836,16 @@ suite('Blocks', function () { this.workspace, ); this.clock.runAll(); - chai.assert.equal(this.getOutputs().length, 1); - chai.assert.equal(this.getInputs().length, 1); + assert.equal(this.getOutputs().length, 1); + assert.equal(this.getInputs().length, 1); block.setCollapsed(true); - chai.assert.equal(this.getOutputs().length, 1); - chai.assert.equal(this.getInputs().length, 0); + assert.equal(this.getOutputs().length, 1); + assert.equal(this.getInputs().length, 0); block.setCollapsed(false); - chai.assert.equal(this.getOutputs().length, 1); - chai.assert.equal(this.getInputs().length, 1); + assert.equal(this.getOutputs().length, 1); + assert.equal(this.getInputs().length, 1); }); test('Multi-Row', function () { const block = Blockly.Xml.domToBlock( @@ -862,16 +863,16 @@ suite('Blocks', function () { this.workspace, ); this.clock.runAll(); - chai.assert.equal(this.getOutputs().length, 3); - chai.assert.equal(this.getInputs().length, 3); + assert.equal(this.getOutputs().length, 3); + assert.equal(this.getInputs().length, 3); block.setCollapsed(true); - chai.assert.equal(this.getOutputs().length, 1); - chai.assert.equal(this.getInputs().length, 0); + assert.equal(this.getOutputs().length, 1); + assert.equal(this.getInputs().length, 0); block.setCollapsed(false); - chai.assert.equal(this.getOutputs().length, 3); - chai.assert.equal(this.getInputs().length, 3); + assert.equal(this.getOutputs().length, 3); + assert.equal(this.getInputs().length, 3); }); test('Multi-Row Middle', function () { let block = Blockly.Xml.domToBlock( @@ -889,17 +890,17 @@ suite('Blocks', function () { this.workspace, ); this.clock.runAll(); - chai.assert.equal(this.getOutputs().length, 3); - chai.assert.equal(this.getInputs().length, 3); + assert.equal(this.getOutputs().length, 3); + assert.equal(this.getInputs().length, 3); block = block.getInputTargetBlock('INPUT'); block.setCollapsed(true); - chai.assert.equal(this.getOutputs().length, 2); - chai.assert.equal(this.getInputs().length, 1); + assert.equal(this.getOutputs().length, 2); + assert.equal(this.getInputs().length, 1); block.setCollapsed(false); - chai.assert.equal(this.getOutputs().length, 3); - chai.assert.equal(this.getInputs().length, 3); + assert.equal(this.getOutputs().length, 3); + assert.equal(this.getInputs().length, 3); }); test('Multi-Row Double Collapse', function () { // Collapse middle -> Collapse top -> @@ -919,25 +920,25 @@ suite('Blocks', function () { this.workspace, ); this.clock.runAll(); - chai.assert.equal(this.getOutputs().length, 3); - chai.assert.equal(this.getInputs().length, 3); + assert.equal(this.getOutputs().length, 3); + assert.equal(this.getInputs().length, 3); const middleBlock = block.getInputTargetBlock('INPUT'); middleBlock.setCollapsed(true); - chai.assert.equal(this.getOutputs().length, 2); - chai.assert.equal(this.getInputs().length, 1); + assert.equal(this.getOutputs().length, 2); + assert.equal(this.getInputs().length, 1); block.setCollapsed(true); - chai.assert.equal(this.getOutputs().length, 1); - chai.assert.equal(this.getInputs().length, 0); + assert.equal(this.getOutputs().length, 1); + assert.equal(this.getInputs().length, 0); block.setCollapsed(false); - chai.assert.equal(this.getOutputs().length, 2); - chai.assert.equal(this.getInputs().length, 1); + assert.equal(this.getOutputs().length, 2); + assert.equal(this.getInputs().length, 1); middleBlock.setCollapsed(false); - chai.assert.equal(this.getOutputs().length, 3); - chai.assert.equal(this.getInputs().length, 3); + assert.equal(this.getOutputs().length, 3); + assert.equal(this.getInputs().length, 3); }); test('Statement', function () { const block = Blockly.Xml.domToBlock( @@ -945,16 +946,16 @@ suite('Blocks', function () { this.workspace, ); this.clock.runAll(); - chai.assert.equal(this.getPrevious().length, 1); - chai.assert.equal(this.getNext().length, 2); + assert.equal(this.getPrevious().length, 1); + assert.equal(this.getNext().length, 2); block.setCollapsed(true); - chai.assert.equal(this.getPrevious().length, 1); - chai.assert.equal(this.getNext().length, 1); + assert.equal(this.getPrevious().length, 1); + assert.equal(this.getNext().length, 1); block.setCollapsed(false); - chai.assert.equal(this.getPrevious().length, 1); - chai.assert.equal(this.getNext().length, 2); + assert.equal(this.getPrevious().length, 1); + assert.equal(this.getNext().length, 2); }); test('Multi-Statement', function () { const block = Blockly.Xml.domToBlock( @@ -973,16 +974,16 @@ suite('Blocks', function () { ); this.assertConnectionsEmpty(); this.clock.runAll(); - chai.assert.equal(this.getPrevious().length, 3); - chai.assert.equal(this.getNext().length, 6); + assert.equal(this.getPrevious().length, 3); + assert.equal(this.getNext().length, 6); block.setCollapsed(true); - chai.assert.equal(this.getPrevious().length, 1); - chai.assert.equal(this.getNext().length, 1); + assert.equal(this.getPrevious().length, 1); + assert.equal(this.getNext().length, 1); block.setCollapsed(false); - chai.assert.equal(this.getPrevious().length, 3); - chai.assert.equal(this.getNext().length, 6); + assert.equal(this.getPrevious().length, 3); + assert.equal(this.getNext().length, 6); }); test('Multi-Statement Middle', function () { let block = Blockly.Xml.domToBlock( @@ -1001,17 +1002,17 @@ suite('Blocks', function () { ); this.assertConnectionsEmpty(); this.clock.runAll(); - chai.assert.equal(this.getPrevious().length, 3); - chai.assert.equal(this.getNext().length, 6); + assert.equal(this.getPrevious().length, 3); + assert.equal(this.getNext().length, 6); block = block.getInputTargetBlock('STATEMENT'); block.setCollapsed(true); - chai.assert.equal(this.getPrevious().length, 2); - chai.assert.equal(this.getNext().length, 3); + assert.equal(this.getPrevious().length, 2); + assert.equal(this.getNext().length, 3); block.setCollapsed(false); - chai.assert.equal(this.getPrevious().length, 3); - chai.assert.equal(this.getNext().length, 6); + assert.equal(this.getPrevious().length, 3); + assert.equal(this.getNext().length, 6); }); test('Multi-Statement Double Collapse', function () { const block = Blockly.Xml.domToBlock( @@ -1030,25 +1031,25 @@ suite('Blocks', function () { ); this.assertConnectionsEmpty(); this.clock.runAll(); - chai.assert.equal(this.getPrevious().length, 3); - chai.assert.equal(this.getNext().length, 6); + assert.equal(this.getPrevious().length, 3); + assert.equal(this.getNext().length, 6); const middleBlock = block.getInputTargetBlock('STATEMENT'); middleBlock.setCollapsed(true); - chai.assert.equal(this.getPrevious().length, 2); - chai.assert.equal(this.getNext().length, 3); + assert.equal(this.getPrevious().length, 2); + assert.equal(this.getNext().length, 3); block.setCollapsed(true); - chai.assert.equal(this.getPrevious().length, 1); - chai.assert.equal(this.getNext().length, 1); + assert.equal(this.getPrevious().length, 1); + assert.equal(this.getNext().length, 1); block.setCollapsed(false); - chai.assert.equal(this.getPrevious().length, 2); - chai.assert.equal(this.getNext().length, 3); + assert.equal(this.getPrevious().length, 2); + assert.equal(this.getNext().length, 3); middleBlock.setCollapsed(false); - chai.assert.equal(this.getPrevious().length, 3); - chai.assert.equal(this.getNext().length, 6); + assert.equal(this.getPrevious().length, 3); + assert.equal(this.getNext().length, 6); }); }); suite('Setting Parent Block', function () { @@ -1074,14 +1075,14 @@ suite('Blocks', function () { }); function assertBlockIsOnlyChild(parent, child, inputName) { - chai.assert.equal(parent.getChildren().length, 1); - chai.assert.equal(parent.getInputTargetBlock(inputName), child); - chai.assert.equal(child.getParent(), parent); + assert.equal(parent.getChildren().length, 1); + assert.equal(parent.getInputTargetBlock(inputName), child); + assert.equal(child.getParent(), parent); } function assertNonParentAndOrphan(nonParent, orphan, inputName) { - chai.assert.equal(nonParent.getChildren().length, 0); - chai.assert.isNull(nonParent.getInputTargetBlock('TEXT')); - chai.assert.isNull(orphan.getParent()); + assert.equal(nonParent.getChildren().length, 0); + assert.isNull(nonParent.getInputTargetBlock('TEXT')); + assert.isNull(orphan.getParent()); } function assertOriginalSetup() { assertBlockIsOnlyChild(this.printBlock, this.textJoinBlock, 'TEXT'); @@ -1089,7 +1090,7 @@ suite('Blocks', function () { } test('Setting to connected parent', function () { - chai.assert.doesNotThrow( + assert.doesNotThrow( this.textJoinBlock.setParent.bind( this.textJoinBlock, this.printBlock, @@ -1102,19 +1103,19 @@ suite('Blocks', function () { this.textBlock.outputConnection.connect( this.printBlock.getInput('TEXT').connection, ); - chai.assert.doesNotThrow( + assert.doesNotThrow( 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( + assert.throws( this.textBlock.setParent.bind(this.textBlock, this.printBlock), ); this.textJoinBlock.outputConnection.disconnect(); // Setting to block with available input connection. - chai.assert.throws( + assert.throws( this.textBlock.setParent.bind(this.textBlock, this.printBlock), ); assertNonParentAndOrphan(this.printBlock, this.textJoinBlock, 'TEXT'); @@ -1122,7 +1123,7 @@ suite('Blocks', function () { }); test('Setting to same parent after disconnecting from it', function () { this.textJoinBlock.outputConnection.disconnect(); - chai.assert.throws( + assert.throws( this.textJoinBlock.setParent.bind( this.textJoinBlock, this.printBlock, @@ -1133,12 +1134,12 @@ suite('Blocks', function () { test('Setting to new parent when orphan', function () { this.textBlock.outputConnection.disconnect(); // When new parent has no available input connection. - chai.assert.throws( + assert.throws( this.textBlock.setParent.bind(this.textBlock, this.printBlock), ); this.textJoinBlock.outputConnection.disconnect(); // When new parent has available input connection. - chai.assert.throws( + assert.throws( this.textBlock.setParent.bind(this.textBlock, this.printBlock), ); @@ -1148,13 +1149,13 @@ suite('Blocks', function () { }); test('Setting parent to null after disconnecting', function () { this.textBlock.outputConnection.disconnect(); - chai.assert.doesNotThrow( + assert.doesNotThrow( this.textBlock.setParent.bind(this.textBlock, null), ); assertNonParentAndOrphan(this.textJoinBlock, this.textBlock, 'ADD0'); }); test('Setting parent to null without disconnecting', function () { - chai.assert.throws(this.textBlock.setParent.bind(this.textBlock, null)); + assert.throws(this.textBlock.setParent.bind(this.textBlock, null)); assertOriginalSetup.call(this); }); }); @@ -1164,40 +1165,40 @@ suite('Blocks', function () { block.setOutput(false); - chai.assert.equal(this.getOutputs().length, 0); - chai.assert.equal(this.getInputs().length, 1); + assert.equal(this.getOutputs().length, 0); + assert.equal(this.getInputs().length, 1); }); test('Value', function () { const block = createRenderedBlock(this.workspace, 'row_block'); block.removeInput('INPUT'); - chai.assert.equal(this.getOutputs().length, 1); - chai.assert.equal(this.getInputs().length, 0); + assert.equal(this.getOutputs().length, 1); + assert.equal(this.getInputs().length, 0); }); test('Previous', function () { const block = createRenderedBlock(this.workspace, 'stack_block'); block.setPreviousStatement(false); - chai.assert.equal(this.getPrevious().length, 0); - chai.assert.equal(this.getNext().length, 1); + assert.equal(this.getPrevious().length, 0); + assert.equal(this.getNext().length, 1); }); test('Next', function () { const block = createRenderedBlock(this.workspace, 'stack_block'); block.setNextStatement(false); - chai.assert.equal(this.getPrevious().length, 1); - chai.assert.equal(this.getNext().length, 0); + assert.equal(this.getPrevious().length, 1); + assert.equal(this.getNext().length, 0); }); test('Statement', function () { const block = createRenderedBlock(this.workspace, 'statement_block'); block.removeInput('STATEMENT'); - chai.assert.equal(this.getPrevious().length, 1); - chai.assert.equal(this.getNext().length, 1); + assert.equal(this.getPrevious().length, 1); + assert.equal(this.getNext().length, 1); }); }); suite('Add Connections Programmatically', function () { @@ -1208,7 +1209,7 @@ suite('Blocks', function () { this.clock.runAll(); this.clock.runAll(); - chai.assert.equal(this.getOutputs().length, 1); + assert.equal(this.getOutputs().length, 1); }); test('Value', function () { const block = createRenderedBlock(this.workspace, 'empty_block'); @@ -1216,7 +1217,7 @@ suite('Blocks', function () { block.appendValueInput('INPUT'); this.clock.runAll(); - chai.assert.equal(this.getInputs().length, 1); + assert.equal(this.getInputs().length, 1); }); test('Previous', function () { const block = createRenderedBlock(this.workspace, 'empty_block'); @@ -1225,7 +1226,7 @@ suite('Blocks', function () { this.clock.runAll(); this.clock.runAll(); - chai.assert.equal(this.getPrevious().length, 1); + assert.equal(this.getPrevious().length, 1); }); test('Next', function () { const block = createRenderedBlock(this.workspace, 'empty_block'); @@ -1234,7 +1235,7 @@ suite('Blocks', function () { this.clock.runAll(); this.clock.runAll(); - chai.assert.equal(this.getNext().length, 1); + assert.equal(this.getNext().length, 1); }); test('Statement', function () { const block = createRenderedBlock(this.workspace, 'empty_block'); @@ -1242,7 +1243,7 @@ suite('Blocks', function () { block.appendStatementInput('STATEMENT'); this.clock.runAll(); - chai.assert.equal(this.getNext().length, 1); + assert.equal(this.getNext().length, 1); }); }); }); @@ -1252,18 +1253,18 @@ suite('Blocks', function () { function assertCommentEvent(eventSpy, oldValue, newValue) { const calls = eventSpy.getCalls(); const event = calls[calls.length - 1].args[0]; - chai.assert.equal(event.type, eventUtils.BLOCK_CHANGE); - chai.assert.equal( + assert.equal(event.type, eventUtils.BLOCK_CHANGE); + assert.equal( event.element, 'comment', 'Expected the element to be a comment', ); - chai.assert.equal( + assert.equal( event.oldValue, oldValue, 'Expected the old values to match', ); - chai.assert.equal( + assert.equal( event.newValue, newValue, 'Expected the new values to match', @@ -1272,7 +1273,7 @@ suite('Blocks', function () { function assertNoCommentEvent(eventSpy) { const calls = eventSpy.getCalls(); const event = calls[calls.length - 1].args[0]; - chai.assert.notEqual(event.type, eventUtils.BLOCK_CHANGE); + assert.notEqual(event.type, eventUtils.BLOCK_CHANGE); } setup(function () { this.eventsFireSpy = sinon.spy(eventUtils.TEST_ONLY, 'fireInternal'); @@ -1289,24 +1290,24 @@ suite('Blocks', function () { }); test('Text', function () { this.block.setCommentText('test text'); - chai.assert.equal(this.block.getCommentText(), 'test text'); + assert.equal(this.block.getCommentText(), 'test text'); assertCommentEvent(this.eventsFireSpy, null, 'test text'); }); test('Text Empty', function () { this.block.setCommentText(''); - chai.assert.equal(this.block.getCommentText(), ''); + assert.equal(this.block.getCommentText(), ''); assertCommentEvent(this.eventsFireSpy, null, ''); }); test('Text Null', function () { this.block.setCommentText(null); - chai.assert.isNull(this.block.getCommentText()); + assert.isNull(this.block.getCommentText()); assertNoCommentEvent(this.eventsFireSpy); }); test('Text -> Null', function () { this.block.setCommentText('first text'); this.block.setCommentText(null); - chai.assert.isNull(this.block.getCommentText()); + assert.isNull(this.block.getCommentText()); assertCommentEvent(this.eventsFireSpy, 'first text', null); }); }); @@ -1326,24 +1327,24 @@ suite('Blocks', function () { }); test('Text', function () { this.block.setCommentText('test text'); - chai.assert.equal(this.block.getCommentText(), 'test text'); + assert.equal(this.block.getCommentText(), 'test text'); assertCommentEvent(this.eventsFireSpy, null, 'test text'); }); test('Text Empty', function () { this.block.setCommentText(''); - chai.assert.equal(this.block.getCommentText(), ''); + assert.equal(this.block.getCommentText(), ''); assertCommentEvent(this.eventsFireSpy, null, ''); }); test('Text Null', function () { this.block.setCommentText(null); - chai.assert.isNull(this.block.getCommentText()); + assert.isNull(this.block.getCommentText()); assertNoCommentEvent(this.eventsFireSpy); }); test('Text -> Null', function () { this.block.setCommentText('first text'); this.block.setCommentText(null); - chai.assert.isNull(this.block.getCommentText()); + assert.isNull(this.block.getCommentText()); assertCommentEvent(this.eventsFireSpy, 'first text', null); }); test('Set While Visible - Editable', function () { @@ -1352,7 +1353,7 @@ suite('Blocks', function () { icon.setBubbleVisible(true); this.block.setCommentText('test2'); - chai.assert.equal(this.block.getCommentText(), 'test2'); + assert.equal(this.block.getCommentText(), 'test2'); assertCommentEvent(this.eventsFireSpy, 'test1', 'test2'); }); test('Set While Visible - NonEditable', function () { @@ -1363,7 +1364,7 @@ suite('Blocks', function () { icon.setBubbleVisible(true); this.block.setCommentText('test2'); - chai.assert.equal(this.block.getCommentText(), 'test2'); + assert.equal(this.block.getCommentText(), 'test2'); assertCommentEvent(this.eventsFireSpy, 'test1', 'test2'); }); }); @@ -1431,7 +1432,7 @@ suite('Blocks', function () { this.block.setCommentText('test text'); - chai.assert.instanceOf( + assert.instanceOf( this.block.getIcon(Blockly.icons.IconType.COMMENT), MockComment, ); @@ -1442,7 +1443,7 @@ suite('Blocks', function () { Blockly.icons.IconType.COMMENT.toString(), ); - chai.assert.throws(() => { + assert.throws(() => { this.block.setCommentText('test text'); }, 'No comment icon class is registered, so a comment cannot be set'); }); @@ -1456,7 +1457,7 @@ suite('Blocks', function () { MockIcon, ); - chai.assert.throws(() => { + assert.throws(() => { this.block.setCommentText('test text'); }, 'The class registered as a comment icon does not conform to the ICommentIcon interface'); }); @@ -1479,13 +1480,13 @@ suite('Blocks', function () { }); test('Getting Field', function () { - chai.assert.instanceOf(this.block.getField('TEXT'), Blockly.Field); + assert.instanceOf(this.block.getField('TEXT'), Blockly.Field); }); test('Getting Field without Name', function () { - chai.assert.throws(this.block.getField.bind(this.block), TypeError); + assert.throws(this.block.getField.bind(this.block), TypeError); }); test('Getting Value of Field without Name', function () { - chai.assert.throws(this.block.getFieldValue.bind(this.block), TypeError); + assert.throws(this.block.getFieldValue.bind(this.block), TypeError); }); test('Getting Field with Wrong Type', function () { const testFunction = function () { @@ -1499,7 +1500,7 @@ suite('Blocks', function () { ['TEXT'], ]; for (let i = 0; i < inputs.length; i++) { - chai.assert.throws( + assert.throws( this.block.getField.bind(this.block, inputs[i]), TypeError, ); @@ -1517,19 +1518,19 @@ suite('Blocks', function () { ['TEXT'], ]; for (let i = 0; i < inputs.length; i++) { - chai.assert.throws( + assert.throws( this.block.getFieldValue.bind(this.block, inputs[i]), TypeError, ); } }); test('Getting/Setting Field Value', function () { - chai.assert.equal(this.block.getFieldValue('TEXT'), 'test'); + assert.equal(this.block.getFieldValue('TEXT'), 'test'); this.block.setFieldValue('abc', 'TEXT'); - chai.assert.equal(this.block.getFieldValue('TEXT'), 'abc'); + assert.equal(this.block.getFieldValue('TEXT'), 'abc'); }); test('Setting Field without Name', function () { - chai.assert.throws(this.block.setFieldValue.bind(this.block, 'test')); + assert.throws(this.block.setFieldValue.bind(this.block, 'test')); }); test('Setting Field with Wrong Type', function () { const testFunction = function () { @@ -1543,7 +1544,7 @@ suite('Blocks', function () { ['TEXT'], ]; for (let i = 0; i < inputs.length; i++) { - chai.assert.throws( + assert.throws( this.block.setFieldValue.bind(this.block, 'test', inputs[i]), TypeError, ); @@ -1589,15 +1590,12 @@ suite('Blocks', function () { test('icons get added to the block', function () { this.block.addIcon(new MockIconA()); - chai.assert.isTrue( - this.block.hasIcon('A'), - 'Expected the icon to be added', - ); + assert.isTrue(this.block.hasIcon('A'), 'Expected the icon to be added'); }); test('adding two icons of the same type throws', function () { this.block.addIcon(new MockIconA()); - chai.assert.throws( + assert.throws( () => { this.block.addIcon(new MockIconA()); }, @@ -1610,7 +1608,7 @@ suite('Blocks', function () { test('adding an icon triggers a render', function () { this.renderSpy.resetHistory(); this.block.addIcon(new MockIconA()); - chai.assert.isTrue( + assert.isTrue( this.renderSpy.calledOnce, 'Expected adding an icon to trigger a render', ); @@ -1634,18 +1632,18 @@ suite('Blocks', function () { test('icons get removed from the block', function () { this.block.addIcon(new MockIconA()); - chai.assert.isTrue( + assert.isTrue( this.block.removeIcon(new Blockly.icons.IconType('A')), 'Expected removeIcon to return true', ); - chai.assert.isFalse( + assert.isFalse( this.block.hasIcon('A'), 'Expected the icon to be removed', ); }); test('removing an icon that does not exist returns false', function () { - chai.assert.isFalse( + assert.isFalse( this.block.removeIcon(new Blockly.icons.IconType('B')), 'Expected removeIcon to return false', ); @@ -1655,7 +1653,7 @@ suite('Blocks', function () { this.block.addIcon(new MockIconA()); this.renderSpy.resetHistory(); this.block.removeIcon(new Blockly.icons.IconType('A')); - chai.assert.isTrue( + assert.isTrue( this.renderSpy.calledOnce, 'Expected removing an icon to trigger a render', ); @@ -1672,7 +1670,7 @@ suite('Blocks', function () { const iconB = new MockIconB(); this.block.addIcon(iconB); this.block.addIcon(iconA); - chai.assert.sameOrderedMembers( + assert.sameOrderedMembers( this.block.getIcons(), [iconA, iconB], 'Expected getIcon to return both icons in order of weight', @@ -1680,7 +1678,7 @@ suite('Blocks', function () { }); test('if there are no icons, getIcons returns an empty array', function () { - chai.assert.isEmpty( + assert.isEmpty( this.block.getIcons(), 'Expected getIcons to return an empty array ' + 'for a block with no icons', @@ -1688,7 +1686,7 @@ suite('Blocks', function () { }); test('if there are no icons, getIcons returns an empty array', function () { - chai.assert.isEmpty( + assert.isEmpty( this.block.getIcons(), 'Expected getIcons to return an empty array ' + 'for a block with no icons', @@ -1700,7 +1698,7 @@ suite('Blocks', function () { const iconB = new MockIconB(); this.block.addIcon(iconA); this.block.addIcon(iconB); - chai.assert.equal( + assert.equal( this.block.getIcon('B'), iconB, 'Expected getIcon to return the icon with the given type', @@ -1709,7 +1707,7 @@ suite('Blocks', function () { test('if there is no matching icon, getIcon returns undefined', function () { this.block.addIcon(new MockIconA()); - chai.assert.isUndefined( + assert.isUndefined( this.block.getIcon('B'), 'Expected getIcon to return null if there is no ' + 'icon with a matching type', @@ -1733,7 +1731,7 @@ suite('Blocks', function () { test('Block with no warning text does not have warning icon', function () { const icon = this.block.getIcon(Blockly.icons.WarningIcon.TYPE); - chai.assert.isUndefined( + assert.isUndefined( icon, 'Block with no warning should not have warning icon', ); @@ -1745,7 +1743,7 @@ suite('Blocks', function () { this.block.setWarningText(text); const icon = this.block.getIcon(Blockly.icons.WarningIcon.TYPE); - chai.assert.equal( + assert.equal( icon.getText(), text, 'Expected warning icon text to be set', @@ -1760,7 +1758,7 @@ suite('Blocks', function () { this.block.setWarningText(text2, '2'); const icon = this.block.getIcon(Blockly.icons.WarningIcon.TYPE); - chai.assert.equal(icon.getText(), `${text1}\n${text2}`); + assert.equal(icon.getText(), `${text1}\n${text2}`); }); test('Clearing all warning text deletes the warning icon', function () { @@ -1770,7 +1768,7 @@ suite('Blocks', function () { this.block.setWarningText(null); const icon = this.block.getIcon(Blockly.icons.WarningIcon.TYPE); - chai.assert.isUndefined( + assert.isUndefined( icon, 'Expected warning icon to be undefined after deleting all warning text', ); @@ -1785,7 +1783,7 @@ suite('Blocks', function () { this.block.setWarningText(null, '1'); const icon = this.block.getIcon(Blockly.icons.WarningIcon.TYPE); - chai.assert.equal( + assert.equal( icon.getText(), text2, 'Expected first warning text to be deleted', @@ -1802,7 +1800,7 @@ suite('Blocks', function () { this.block.setWarningText(null, '2'); const icon = this.block.getIcon(Blockly.icons.WarningIcon.TYPE); - chai.assert.isUndefined( + assert.isUndefined( icon, 'Expected warning icon to be deleted after all warning text is cleared', ); @@ -1839,7 +1837,7 @@ suite('Blocks', function () { parentBlock.setCollapsed(true); - chai.assert.isFalse( + assert.isFalse( icon.bubbleIsVisible(), "Expected collapsing the parent block to hide the child block's " + "icon's bubble", @@ -1865,7 +1863,7 @@ suite('Blocks', function () { parentBlock.setCollapsed(true); - chai.assert.isTrue( + assert.isTrue( icon.bubbleIsVisible(), 'Expected collapsing the parent block to not hide the next ' + "block's bubble", @@ -1876,45 +1874,45 @@ suite('Blocks', function () { suite('Collapsing and Expanding', function () { function assertCollapsed(block, opt_string) { - chai.assert.isTrue(block.isCollapsed()); + assert.isTrue(block.isCollapsed()); for (let i = 0, input; (input = block.inputList[i]); i++) { if (input.name == Blockly.Block.COLLAPSED_INPUT_NAME) { continue; } - chai.assert.isFalse(input.isVisible()); + assert.isFalse(input.isVisible()); for (let j = 0, field; (field = input.fieldRow[j]); j++) { - chai.assert.isFalse(field.isVisible()); + assert.isFalse(field.isVisible()); } } const icons = block.getIcons(); for (let i = 0, icon; (icon = icons[i]); i++) { - chai.assert.isFalse(icon.bubbleIsVisible()); + assert.isFalse(icon.bubbleIsVisible()); } const input = block.getInput(Blockly.Block.COLLAPSED_INPUT_NAME); - chai.assert.isNotNull(input); - chai.assert.isTrue(input.isVisible()); + assert.isNotNull(input); + assert.isTrue(input.isVisible()); const field = block.getField(Blockly.Block.COLLAPSED_FIELD_NAME); - chai.assert.isNotNull(field); - chai.assert.isTrue(field.isVisible()); + assert.isNotNull(field); + assert.isTrue(field.isVisible()); if (opt_string) { - chai.assert.equal(field.getText(), opt_string); + assert.equal(field.getText(), opt_string); } } function assertNotCollapsed(block) { - chai.assert.isFalse(block.isCollapsed()); + assert.isFalse(block.isCollapsed()); for (let i = 0, input; (input = block.inputList[i]); i++) { - chai.assert.isTrue(input.isVisible()); + assert.isTrue(input.isVisible()); for (let j = 0, field; (field = input.fieldRow[j]); j++) { - chai.assert.isTrue(field.isVisible()); + assert.isTrue(field.isVisible()); } } const input = block.getInput(Blockly.Block.COLLAPSED_INPUT_NAME); - chai.assert.isNull(input); + assert.isNull(input); const field = block.getField(Blockly.Block.COLLAPSED_FIELD_NAME); - chai.assert.isNull(field); + assert.isNull(field); } function isBlockHidden(block) { let node = block.getSvgRoot(); @@ -1967,10 +1965,10 @@ suite('Blocks', function () { blockA.setCollapsed(true); assertCollapsed(blockA); blockA.getInput('INPUT').connection.connect(blockB.outputConnection); - chai.assert.isTrue(isBlockHidden(blockB)); + assert.isTrue(isBlockHidden(blockB)); blockA.setCollapsed(false); assertNotCollapsed(blockA); - chai.assert.isFalse(isBlockHidden(blockB)); + assert.isFalse(isBlockHidden(blockB)); }); test('Connect Block to Statement Input', function () { const blockA = createRenderedBlock(this.workspace, 'statement_block'); @@ -1981,10 +1979,10 @@ suite('Blocks', function () { blockA .getInput('STATEMENT') .connection.connect(blockB.previousConnection); - chai.assert.isTrue(isBlockHidden(blockB)); + assert.isTrue(isBlockHidden(blockB)); blockA.setCollapsed(false); assertNotCollapsed(blockA); - chai.assert.isFalse(isBlockHidden(blockB)); + assert.isFalse(isBlockHidden(blockB)); }); test('Connect Block to Child of Collapsed - Input', function () { const blockA = createRenderedBlock(this.workspace, 'row_block'); @@ -1994,14 +1992,14 @@ suite('Blocks', function () { blockA.getInput('INPUT').connection.connect(blockB.outputConnection); blockA.setCollapsed(true); assertCollapsed(blockA); - chai.assert.isTrue(isBlockHidden(blockB)); + assert.isTrue(isBlockHidden(blockB)); blockB.getInput('INPUT').connection.connect(blockC.outputConnection); - chai.assert.isTrue(isBlockHidden(blockC)); + assert.isTrue(isBlockHidden(blockC)); blockA.setCollapsed(false); assertNotCollapsed(blockA); - chai.assert.isFalse(isBlockHidden(blockB)); - chai.assert.isFalse(isBlockHidden(blockC)); + assert.isFalse(isBlockHidden(blockB)); + assert.isFalse(isBlockHidden(blockC)); }); test('Connect Block to Child of Collapsed - Next', function () { const blockA = createRenderedBlock(this.workspace, 'statement_block'); @@ -2013,14 +2011,14 @@ suite('Blocks', function () { .connection.connect(blockB.previousConnection); blockA.setCollapsed(true); assertCollapsed(blockA); - chai.assert.isTrue(isBlockHidden(blockB)); + assert.isTrue(isBlockHidden(blockB)); blockB.nextConnection.connect(blockC.previousConnection); - chai.assert.isTrue(isBlockHidden(blockC)); + assert.isTrue(isBlockHidden(blockC)); blockA.setCollapsed(false); assertNotCollapsed(blockA); - chai.assert.isFalse(isBlockHidden(blockB)); - chai.assert.isFalse(isBlockHidden(blockC)); + assert.isFalse(isBlockHidden(blockB)); + assert.isFalse(isBlockHidden(blockC)); }); test('Connect Block to Value Input Already Taken', function () { const blockA = createRenderedBlock(this.workspace, 'row_block'); @@ -2030,16 +2028,16 @@ suite('Blocks', function () { blockA.getInput('INPUT').connection.connect(blockB.outputConnection); blockA.setCollapsed(true); assertCollapsed(blockA); - chai.assert.isTrue(isBlockHidden(blockB)); + assert.isTrue(isBlockHidden(blockB)); blockA.getInput('INPUT').connection.connect(blockC.outputConnection); - chai.assert.isTrue(isBlockHidden(blockC)); + assert.isTrue(isBlockHidden(blockC)); // Still hidden after C is inserted between. - chai.assert.isTrue(isBlockHidden(blockB)); + assert.isTrue(isBlockHidden(blockB)); blockA.setCollapsed(false); assertNotCollapsed(blockA); - chai.assert.isFalse(isBlockHidden(blockB)); - chai.assert.isFalse(isBlockHidden(blockC)); + assert.isFalse(isBlockHidden(blockB)); + assert.isFalse(isBlockHidden(blockC)); }); test('Connect Block to Statement Input Already Taken', function () { const blockA = createRenderedBlock(this.workspace, 'statement_block'); @@ -2051,18 +2049,18 @@ suite('Blocks', function () { .connection.connect(blockB.previousConnection); blockA.setCollapsed(true); assertCollapsed(blockA); - chai.assert.isTrue(isBlockHidden(blockB)); + assert.isTrue(isBlockHidden(blockB)); blockA .getInput('STATEMENT') .connection.connect(blockC.previousConnection); - chai.assert.isTrue(isBlockHidden(blockC)); + assert.isTrue(isBlockHidden(blockC)); // Still hidden after C is inserted between. - chai.assert.isTrue(isBlockHidden(blockB)); + assert.isTrue(isBlockHidden(blockB)); blockA.setCollapsed(false); assertNotCollapsed(blockA); - chai.assert.isFalse(isBlockHidden(blockB)); - chai.assert.isFalse(isBlockHidden(blockC)); + assert.isFalse(isBlockHidden(blockB)); + assert.isFalse(isBlockHidden(blockC)); }); test('Connect Block with Child - Input', function () { const blockA = createRenderedBlock(this.workspace, 'row_block'); @@ -2073,13 +2071,13 @@ suite('Blocks', function () { blockA.setCollapsed(true); assertCollapsed(blockA); blockA.getInput('INPUT').connection.connect(blockB.outputConnection); - chai.assert.isTrue(isBlockHidden(blockC)); - chai.assert.isTrue(isBlockHidden(blockB)); + assert.isTrue(isBlockHidden(blockC)); + assert.isTrue(isBlockHidden(blockB)); blockA.setCollapsed(false); assertNotCollapsed(blockA); - chai.assert.isFalse(isBlockHidden(blockB)); - chai.assert.isFalse(isBlockHidden(blockC)); + assert.isFalse(isBlockHidden(blockB)); + assert.isFalse(isBlockHidden(blockC)); }); test('Connect Block with Child - Statement', function () { const blockA = createRenderedBlock(this.workspace, 'statement_block'); @@ -2092,13 +2090,13 @@ suite('Blocks', function () { blockA .getInput('STATEMENT') .connection.connect(blockB.previousConnection); - chai.assert.isTrue(isBlockHidden(blockC)); - chai.assert.isTrue(isBlockHidden(blockB)); + assert.isTrue(isBlockHidden(blockC)); + assert.isTrue(isBlockHidden(blockB)); blockA.setCollapsed(false); assertNotCollapsed(blockA); - chai.assert.isFalse(isBlockHidden(blockB)); - chai.assert.isFalse(isBlockHidden(blockC)); + assert.isFalse(isBlockHidden(blockB)); + assert.isFalse(isBlockHidden(blockC)); }); test('Disconnect Block from Value Input', function () { const blockA = createRenderedBlock(this.workspace, 'row_block'); @@ -2107,9 +2105,9 @@ suite('Blocks', function () { blockA.getInput('INPUT').connection.connect(blockB.outputConnection); blockA.setCollapsed(true); assertCollapsed(blockA); - chai.assert.isTrue(isBlockHidden(blockB)); + assert.isTrue(isBlockHidden(blockB)); blockB.outputConnection.disconnect(); - chai.assert.isFalse(isBlockHidden(blockB)); + assert.isFalse(isBlockHidden(blockB)); }); test('Disconnect Block from Statement Input', function () { const blockA = createRenderedBlock(this.workspace, 'statement_block'); @@ -2120,9 +2118,9 @@ suite('Blocks', function () { .connection.connect(blockB.previousConnection); blockA.setCollapsed(true); assertCollapsed(blockA); - chai.assert.isTrue(isBlockHidden(blockB)); + assert.isTrue(isBlockHidden(blockB)); blockB.previousConnection.disconnect(); - chai.assert.isFalse(isBlockHidden(blockB)); + assert.isFalse(isBlockHidden(blockB)); }); test('Disconnect Block from Child of Collapsed - Input', function () { const blockA = createRenderedBlock(this.workspace, 'row_block'); @@ -2133,11 +2131,11 @@ suite('Blocks', function () { blockB.getInput('INPUT').connection.connect(blockC.outputConnection); blockA.setCollapsed(true); assertCollapsed(blockA); - chai.assert.isTrue(isBlockHidden(blockB)); - chai.assert.isTrue(isBlockHidden(blockC)); + assert.isTrue(isBlockHidden(blockB)); + assert.isTrue(isBlockHidden(blockC)); blockC.outputConnection.disconnect(); - chai.assert.isFalse(isBlockHidden(blockC)); + assert.isFalse(isBlockHidden(blockC)); }); test('Disconnect Block from Child of Collapsed - Next', function () { const blockA = createRenderedBlock(this.workspace, 'statement_block'); @@ -2150,11 +2148,11 @@ suite('Blocks', function () { blockB.nextConnection.connect(blockC.previousConnection); blockA.setCollapsed(true); assertCollapsed(blockA); - chai.assert.isTrue(isBlockHidden(blockB)); - chai.assert.isTrue(isBlockHidden(blockC)); + assert.isTrue(isBlockHidden(blockB)); + assert.isTrue(isBlockHidden(blockC)); blockC.previousConnection.disconnect(); - chai.assert.isFalse(isBlockHidden(blockC)); + assert.isFalse(isBlockHidden(blockC)); }); test('Disconnect Block with Child - Input', function () { const blockA = createRenderedBlock(this.workspace, 'row_block'); @@ -2165,12 +2163,12 @@ suite('Blocks', function () { blockA.getInput('INPUT').connection.connect(blockB.outputConnection); blockA.setCollapsed(true); assertCollapsed(blockA); - chai.assert.isTrue(isBlockHidden(blockB)); - chai.assert.isTrue(isBlockHidden(blockC)); + assert.isTrue(isBlockHidden(blockB)); + assert.isTrue(isBlockHidden(blockC)); blockB.outputConnection.disconnect(); - chai.assert.isFalse(isBlockHidden(blockB)); - chai.assert.isFalse(isBlockHidden(blockC)); + assert.isFalse(isBlockHidden(blockB)); + assert.isFalse(isBlockHidden(blockC)); }); test('Disconnect Block with Child - Statement', function () { const blockA = createRenderedBlock(this.workspace, 'statement_block'); @@ -2183,12 +2181,12 @@ suite('Blocks', function () { .connection.connect(blockB.previousConnection); blockA.setCollapsed(true); assertCollapsed(blockA); - chai.assert.isTrue(isBlockHidden(blockC)); - chai.assert.isTrue(isBlockHidden(blockB)); + assert.isTrue(isBlockHidden(blockC)); + assert.isTrue(isBlockHidden(blockB)); blockB.previousConnection.disconnect(); - chai.assert.isFalse(isBlockHidden(blockB)); - chai.assert.isFalse(isBlockHidden(blockC)); + assert.isFalse(isBlockHidden(blockB)); + assert.isFalse(isBlockHidden(blockC)); }); }); suite('Adding and Removing Block Parts', function () { @@ -2198,7 +2196,7 @@ suite('Blocks', function () { assertCollapsed(blockA); blockA.setPreviousStatement(true); assertCollapsed(blockA); - chai.assert.isNotNull(blockA.previousConnection); + assert.isNotNull(blockA.previousConnection); }); test('Add Next Connection', function () { const blockA = createRenderedBlock(this.workspace, 'empty_block'); @@ -2206,7 +2204,7 @@ suite('Blocks', function () { assertCollapsed(blockA); blockA.setNextStatement(true); assertCollapsed(blockA); - chai.assert.isNotNull(blockA.nextConnection); + assert.isNotNull(blockA.nextConnection); }); test('Add Input', function () { const blockA = createRenderedBlock(this.workspace, 'empty_block'); @@ -2216,7 +2214,7 @@ suite('Blocks', function () { this.clock.runAll(); assertCollapsed(blockA); - chai.assert.isNotNull(blockA.getInput('NAME')); + assert.isNotNull(blockA.getInput('NAME')); }); test('Add Field', function () { const blockA = createRenderedBlock(this.workspace, 'empty_block'); @@ -2226,8 +2224,8 @@ suite('Blocks', function () { input.appendField(new Blockly.FieldLabel('test'), 'FIELD'); assertCollapsed(blockA); const field = blockA.getField('FIELD'); - chai.assert.isNotNull(field); - chai.assert.equal(field.getText(), 'test'); + assert.isNotNull(field); + assert.equal(field.getText(), 'test'); }); test('Add Icon', function () { const blockA = createRenderedBlock(this.workspace, 'empty_block'); @@ -2243,7 +2241,7 @@ suite('Blocks', function () { assertCollapsed(blockA); blockA.setPreviousStatement(false); assertCollapsed(blockA); - chai.assert.isNull(blockA.previousConnection); + assert.isNull(blockA.previousConnection); }); test('Remove Next Connection', function () { const blockA = createRenderedBlock(this.workspace, 'empty_block'); @@ -2252,7 +2250,7 @@ suite('Blocks', function () { assertCollapsed(blockA); blockA.setNextStatement(false); assertCollapsed(blockA); - chai.assert.isNull(blockA.nextConnection); + assert.isNull(blockA.nextConnection); }); test('Remove Input', function () { const blockA = createRenderedBlock(this.workspace, 'empty_block'); @@ -2261,7 +2259,7 @@ suite('Blocks', function () { assertCollapsed(blockA); blockA.removeInput('NAME'); assertCollapsed(blockA); - chai.assert.isNull(blockA.getInput('NAME')); + assert.isNull(blockA.getInput('NAME')); }); test('Remove Field', function () { const blockA = createRenderedBlock(this.workspace, 'empty_block'); @@ -2272,7 +2270,7 @@ suite('Blocks', function () { input.removeField('FIELD'); assertCollapsed(blockA); const field = blockA.getField('FIELD'); - chai.assert.isNull(field); + assert.isNull(field); }); test('Remove Icon', function () { const blockA = createRenderedBlock(this.workspace, 'empty_block'); @@ -2321,8 +2319,8 @@ suite('Blocks', function () { blockA.setCollapsed(false); // The child blocks should be enabled. - chai.assert.isTrue(blockB.isEnabled()); - chai.assert.isFalse( + assert.isTrue(blockB.isEnabled()); + assert.isFalse( blockB.getSvgRoot().classList.contains('blocklyDisabled'), ); }); @@ -2345,7 +2343,7 @@ suite('Blocks', function () { blockA.setCollapsed(true); // Child blocks should stay disabled if they have been set. - chai.assert.isFalse(blockB.isEnabled()); + assert.isFalse(blockB.isEnabled()); }); test('Disabled blocks from JSON should have proper disabled status', function () { // Nested c-shaped blocks, inner block is disabled @@ -2364,11 +2362,11 @@ suite('Blocks', function () { const innerBlock = this.workspace .getTopBlocks(false)[0] .getChildren()[0]; - chai.assert.isTrue( + assert.isTrue( innerBlock.visuallyDisabled, 'block should have visuallyDisabled set because it is disabled', ); - chai.assert.isFalse( + assert.isFalse( innerBlock.isEnabled(), 'block should be marked disabled because enabled json property was set to false', ); @@ -2389,11 +2387,11 @@ suite('Blocks', function () { const innerBlock = this.workspace .getTopBlocks(false)[0] .getChildren()[0]; - chai.assert.isTrue( + assert.isTrue( innerBlock.visuallyDisabled, 'block should have visuallyDisabled set because it is disabled', ); - chai.assert.isFalse( + assert.isFalse( innerBlock.isEnabled(), 'block should be marked disabled because enabled xml property was set to false', ); @@ -2443,7 +2441,7 @@ suite('Blocks', function () { this.parent.setDisabledReason(true, 'test reason'); await Blockly.renderManagement.finishQueuedRenders(); for (const child of this.parent.getDescendants(false)) { - chai.assert.isTrue( + assert.isTrue( child.visuallyDisabled, `block ${child.id} should be visually disabled`, ); @@ -2456,38 +2454,26 @@ suite('Blocks', function () { await Blockly.renderManagement.finishQueuedRenders(); // child2 is disabled, rest should be enabled - chai.assert.isTrue( - this.child1.isEnabled(), - 'child1 should be enabled', - ); - chai.assert.isFalse( + assert.isTrue(this.child1.isEnabled(), 'child1 should be enabled'); + assert.isFalse( this.child1.visuallyDisabled, 'child1 should not be visually disabled', ); - chai.assert.isFalse( - this.child2.isEnabled(), - 'child2 should be disabled', - ); - chai.assert.isTrue( + assert.isFalse(this.child2.isEnabled(), 'child2 should be disabled'); + assert.isTrue( this.child2.visuallyDisabled, 'child2 should be visually disabled', ); - chai.assert.isTrue( - this.child3.isEnabled(), - 'child3 should be enabled', - ); - chai.assert.isFalse( + assert.isTrue(this.child3.isEnabled(), 'child3 should be enabled'); + assert.isFalse( this.child3.visuallyDisabled, 'child3 should not be visually disabled', ); - chai.assert.isTrue( - this.child4.isEnabled(), - 'child34 should be enabled', - ); - chai.assert.isFalse( + assert.isTrue(this.child4.isEnabled(), 'child34 should be enabled'); + assert.isFalse( this.child4.visuallyDisabled, 'child4 should not be visually disabled', ); @@ -2506,16 +2492,16 @@ suite('Blocks', function () { }); test('Set colour', function () { this.block.setColour('20'); - chai.assert.equal(this.block.getColour(), '#a5745b'); - chai.assert.equal(this.block.colour_, this.block.getColour()); - chai.assert.equal(this.block.hue_, '20'); + assert.equal(this.block.getColour(), '#a5745b'); + assert.equal(this.block.colour_, this.block.getColour()); + assert.equal(this.block.hue_, '20'); }); test('Set style', function () { this.block.setStyle('styleOne'); - chai.assert.equal(this.block.getStyleName(), 'styleOne'); - chai.assert.isNull(this.block.hue_); + assert.equal(this.block.getStyleName(), 'styleOne'); + assert.isNull(this.block.hue_); // Calling setStyle does not update the colour on a headless block. - chai.assert.equal(this.block.getColour(), '#000000'); + assert.equal(this.block.getColour(), '#000000'); }); }); suite('Rendered', function () { @@ -2544,23 +2530,23 @@ suite('Blocks', function () { }); test('Set colour hue', function () { this.block.setColour('20'); - chai.assert.equal(this.block.getStyleName(), 'auto_#a5745b'); - chai.assert.equal(this.block.getColour(), '#a5745b'); - chai.assert.equal(this.block.colour_, this.block.getColour()); - chai.assert.equal(this.block.hue_, '20'); + assert.equal(this.block.getStyleName(), 'auto_#a5745b'); + assert.equal(this.block.getColour(), '#a5745b'); + assert.equal(this.block.colour_, this.block.getColour()); + assert.equal(this.block.hue_, '20'); }); test('Set colour hex', function () { this.block.setColour('#000000'); - chai.assert.equal(this.block.getStyleName(), 'auto_#000000'); - chai.assert.equal(this.block.getColour(), '#000000'); - chai.assert.equal(this.block.colour_, this.block.getColour()); - chai.assert.isNull(this.block.hue_); + assert.equal(this.block.getStyleName(), 'auto_#000000'); + assert.equal(this.block.getColour(), '#000000'); + assert.equal(this.block.colour_, this.block.getColour()); + assert.isNull(this.block.hue_); }); test('Set style', function () { this.block.setStyle('styleOne'); - chai.assert.equal(this.block.getStyleName(), 'styleOne'); - chai.assert.equal(this.block.getColour(), '#000000'); - chai.assert.equal(this.block.colour_, this.block.getColour()); + assert.equal(this.block.getStyleName(), 'styleOne'); + assert.equal(this.block.getColour(), '#000000'); + assert.equal(this.block.colour_, this.block.getColour()); }); }); }); @@ -2689,7 +2675,7 @@ suite('Blocks', function () { Blockly.utils.xml.textToDom(t.xml), this.workspace, ); - chai.assert.equal(block.toString(), t.toString); + assert.equal(block.toString(), t.toString); }); }); }); @@ -2713,20 +2699,20 @@ suite('Blocks', function () { recordUndoDuringInit = eventUtils.getRecordUndo(); throw new Error(); }; - chai.assert.throws( + assert.throws( function () { this.workspace.newBlock('init_test_block'); }.bind(this), ); - chai.assert.isFalse( + assert.isFalse( recordUndoDuringInit, 'recordUndo should be false during block init function', ); - chai.assert.isTrue( + assert.isTrue( eventUtils.getRecordUndo(), 'recordUndo should be reset to true after init', ); - chai.assert.isTrue(initCalled, 'expected init function to be called'); + assert.isTrue(initCalled, 'expected init function to be called'); }); }); @@ -2742,12 +2728,12 @@ suite('Blocks', function () { }); test('Newline is converted to an end-row input', function () { const block = this.workspace.newBlock('end_row_test_block'); - chai.assert.equal(block.inputList[0].fieldRow[0].getValue(), 'Row1'); - chai.assert.isTrue( + assert.equal(block.inputList[0].fieldRow[0].getValue(), 'Row1'); + assert.isTrue( block.inputList[0] instanceof EndRowInput, 'newline should be converted to an end-row input', ); - chai.assert.equal(block.inputList[1].fieldRow[0].getValue(), 'Row2'); + assert.equal(block.inputList[1].fieldRow[0].getValue(), 'Row2'); }); }); }); diff --git a/tests/mocha/blocks/lists_test.js b/tests/mocha/blocks/lists_test.js index 07510513b07..cecf3c808cc 100644 --- a/tests/mocha/blocks/lists_test.js +++ b/tests/mocha/blocks/lists_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../../node_modules/chai/chai.js'; import {runSerializationTestSuite} from '../test_helpers/serialization.js'; import { sharedTestSetup, @@ -37,8 +38,8 @@ suite('Lists', function () { fields: {MODE: 'GET', WHERE: 'FIRST'}, }, assertBlockStructure: (block) => { - chai.assert.equal(block.type, 'lists_getIndex'); - chai.assert.exists(block.outputConnection); + assert.equal(block.type, 'lists_getIndex'); + assert.exists(block.outputConnection); }, }, { @@ -50,9 +51,9 @@ suite('Lists', function () { fields: {MODE: 'REMOVE', WHERE: 'FROM_START'}, }, assertBlockStructure: (block) => { - chai.assert.equal(block.type, 'lists_getIndex'); - chai.assert.isNotTrue(block.outputConnection); - chai.assert.isTrue( + assert.equal(block.type, 'lists_getIndex'); + assert.isNotTrue(block.outputConnection); + assert.isTrue( block.getInput('AT').type === ConnectionType.INPUT_VALUE, ); }, @@ -122,7 +123,7 @@ suite('Lists', function () { title: 'JSON not requiring mutations', json: serializedJson, assertBlockStructure: (block) => { - chai.assert.equal(block.type, serializedJson.type); + assert.equal(block.type, serializedJson.type); }, }, { diff --git a/tests/mocha/blocks/logic_ternary_test.js b/tests/mocha/blocks/logic_ternary_test.js index 2afa51f7aaf..6661bd5d4fc 100644 --- a/tests/mocha/blocks/logic_ternary_test.js +++ b/tests/mocha/blocks/logic_ternary_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../../node_modules/chai/chai.js'; import * as eventUtils from '../../../build/src/core/events/utils.js'; import {runSerializationTestSuite} from '../test_helpers/serialization.js'; import { @@ -28,21 +29,21 @@ suite('Logic ternary', function () { * inline. */ function assertBlockStructure(block, inputsInline = false) { - chai.assert.equal(block.type, 'logic_ternary'); + assert.equal(block.type, 'logic_ternary'); const inputs = block.inputList; - chai.assert.exists(inputs, 'Has inputList'); - chai.assert.lengthOf(inputs, 3); + assert.exists(inputs, 'Has inputList'); + assert.lengthOf(inputs, 3); const ifInput = block.getInput('IF'); - chai.assert.exists(ifInput, 'Has "IF" input'); + assert.exists(ifInput, 'Has "IF" input'); const checkList = ifInput.connection.getCheck(); - chai.assert.equal(checkList.length, 1); - chai.assert.equal(checkList[0], 'Boolean'); - chai.assert.exists(block.onchangeWrapper_, 'Has onchange handler'); + assert.equal(checkList.length, 1); + assert.equal(checkList[0], 'Boolean'); + assert.exists(block.onchangeWrapper_, 'Has onchange handler'); if (inputsInline) { - chai.assert.isTrue(block.inputsInline); + assert.isTrue(block.inputsInline); } else { // inputsInline can be undefined - chai.assert.isNotTrue(block.inputsInline); + assert.isNotTrue(block.inputsInline); } } @@ -90,20 +91,20 @@ suite('Logic ternary', function () { .getInput(parentInputName) .connection.connect(block.outputConnection); eventUtils.TEST_ONLY.fireNow(); // Force synchronous onchange() call. - chai.assert.equal( + assert.equal( block.getParent(), parent, 'Successful connection to parent', ); if (opt_thenInput) { - chai.assert.equal( + assert.equal( opt_thenInput.getParent(), block, 'Input THEN still connected after connecting parent', ); } if (opt_elseInput) { - chai.assert.equal( + assert.equal( opt_elseInput.getParent(), block, 'Input ELSE still connected after connecting parent', @@ -118,16 +119,16 @@ suite('Logic ternary', function () { ) { block.getInput('THEN').connection.connect(thenInput.outputConnection); eventUtils.TEST_ONLY.fireNow(); // Force synchronous onchange() call. - chai.assert.equal(thenInput.getParent(), block, 'THEN is connected'); + assert.equal(thenInput.getParent(), block, 'THEN is connected'); if (opt_parent) { - chai.assert.equal( + assert.equal( block.getParent(), opt_parent, 'Still connected to parent after connecting THEN', ); } if (opt_elseInput) { - chai.assert.equal( + assert.equal( opt_elseInput.getParent(), block, 'Input ELSE still connected after connecting THEN', @@ -142,16 +143,16 @@ suite('Logic ternary', function () { ) { block.getInput('ELSE').connection.connect(elseInput.outputConnection); eventUtils.TEST_ONLY.fireNow(); // Force synchronous onchange() call. - chai.assert.equal(elseInput.getParent(), block, 'ELSE is connected'); + assert.equal(elseInput.getParent(), block, 'ELSE is connected'); if (opt_parent) { - chai.assert.equal( + assert.equal( block.getParent(), opt_parent, 'Still connected to parent after connecting ELSE', ); } if (opt_thenInput) { - chai.assert.equal( + assert.equal( opt_thenInput.getParent(), block, 'Input THEN still connected after connecting ELSE', @@ -232,7 +233,7 @@ suite('Logic ternary', function () { // Adding mismatching number. connectThenInputAndCheckConnections(this.block, number, string); - chai.assert.equal( + assert.equal( this.block.getRootBlock(), this.block, 'Disconnected from parent', @@ -250,7 +251,7 @@ suite('Logic ternary', function () { // Adding mismatching number. connectElseInputAndCheckConnections(this.block, number, string); - chai.assert.equal( + assert.equal( this.block.getRootBlock(), this.block, 'Disconnected from parent', @@ -302,11 +303,7 @@ suite('Logic ternary', function () { null, string, ); - chai.assert.equal( - number.getRootBlock(), - number, - 'Input THEN disconnected', - ); + assert.equal(number.getRootBlock(), number, 'Input THEN disconnected'); }); test('Mismatch with else causes break with else', function () { const string = this.workspace.newBlock('text'); @@ -316,11 +313,7 @@ suite('Logic ternary', function () { const parent = this.workspace.newBlock('text_trim'); connectParentAndCheckConnections(this.block, parent, 'TEXT', string); - chai.assert.equal( - number.getRootBlock(), - number, - 'Input ELSE disconnected', - ); + assert.equal(number.getRootBlock(), number, 'Input ELSE disconnected'); }); }); }); diff --git a/tests/mocha/blocks/loops_test.js b/tests/mocha/blocks/loops_test.js index 3bbfdac1084..8f4897e0088 100644 --- a/tests/mocha/blocks/loops_test.js +++ b/tests/mocha/blocks/loops_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../../node_modules/chai/chai.js'; import * as Blockly from '../../../build/src/core/blockly.js'; import { sharedTestSetup, @@ -27,7 +28,7 @@ suite('Loops', function () { this.workspace, ); this.clock.runAll(); - chai.assert.isFalse( + assert.isFalse( breakBlock.isEnabled(), 'Expected the break block to be disabled', ); @@ -46,7 +47,7 @@ suite('Loops', function () { .getInput('DO') .connection.connect(breakBlock.previousConnection); this.clock.runAll(); - chai.assert.isTrue( + assert.isTrue( breakBlock.isEnabled(), 'Expected the break block to be enabled', ); diff --git a/tests/mocha/blocks/procedures_test.js b/tests/mocha/blocks/procedures_test.js index 109d3b2d4eb..6842370062f 100644 --- a/tests/mocha/blocks/procedures_test.js +++ b/tests/mocha/blocks/procedures_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../../node_modules/chai/chai.js'; import * as Blockly from '../../../build/src/core/blockly.js'; import { assertCallBlockStructure, @@ -45,7 +46,7 @@ suite('Procedures', function () { defBlock.setFieldValue('new name', 'NAME'); - chai.assert.equal( + assert.equal( callBlock.getFieldValue('NAME'), 'new name', 'Expected the procedure block to be renamed', @@ -71,12 +72,12 @@ suite('Procedures', function () { defBlockB.setFieldValue('procA', 'NAME'); - chai.assert.notEqual( + assert.notEqual( defBlockB.getFieldValue('NAME'), 'procA', 'Expected the procedure def block to have a legal name', ); - chai.assert.notEqual( + assert.notEqual( callBlockB.getFieldValue('NAME'), 'procA', 'Expected the procedure call block to have a legal name', @@ -112,7 +113,7 @@ suite('Procedures', function () { .getWorkspace() .getTopBlocks(true)[0] .getFieldValue('NAME'); - chai.assert.notEqual( + assert.notEqual( newFlyoutParamName, origFlyoutParamName, 'Expected the flyout param to have updated to not conflict', @@ -133,11 +134,11 @@ suite('Procedures', function () { .connection.connect(paramBlock.previousConnection); this.clock.runAll(); - chai.assert.isNotNull( + assert.isNotNull( defBlock.getField('PARAMS'), 'Expected the params field to exist', ); - chai.assert.isTrue( + assert.isTrue( defBlock.getFieldValue('PARAMS').includes('param1'), 'Expected the params field to contain the name of the new param', ); @@ -158,11 +159,11 @@ suite('Procedures', function () { .connection.connect(paramBlock.previousConnection); this.clock.runAll(); - chai.assert.isNotNull( + assert.isNotNull( callBlock.getInput('ARG0'), 'Expected the param input to exist', ); - chai.assert.equal( + assert.equal( callBlock.getFieldValue('ARGNAME0'), 'param1', 'Expected the params field to match the name of the new param', @@ -185,7 +186,7 @@ suite('Procedures', function () { this.workspace.undo(); - chai.assert.isFalse( + assert.isFalse( defBlock.getFieldValue('PARAMS').includes('param1'), 'Expected the params field to not contain the name of the new param', ); @@ -211,11 +212,11 @@ suite('Procedures', function () { this.workspace.undo(); this.workspace.undo(/* redo= */ true); - chai.assert.isNotNull( + assert.isNotNull( defBlock.getField('PARAMS'), 'Expected the params field to exist', ); - chai.assert.isTrue( + assert.isTrue( defBlock.getFieldValue('PARAMS').includes('param1'), 'Expected the params field to contain the name of the new param', ); @@ -241,7 +242,7 @@ suite('Procedures', function () { paramBlock.checkAndDelete(); this.clock.runAll(); - chai.assert.isFalse( + assert.isFalse( defBlock.getFieldValue('PARAMS').includes('param1'), 'Expected the params field to not contain the name of the new param', ); @@ -265,7 +266,7 @@ suite('Procedures', function () { paramBlock.checkAndDelete(); this.clock.runAll(); - chai.assert.isNull( + assert.isNull( callBlock.getInput('ARG0'), 'Expected the param input to not exist', ); @@ -289,7 +290,7 @@ suite('Procedures', function () { this.workspace.undo(); - chai.assert.isTrue( + assert.isTrue( defBlock.getFieldValue('PARAMS').includes('param1'), 'Expected the params field to contain the name of the new param', ); @@ -317,7 +318,7 @@ suite('Procedures', function () { this.workspace.undo(); this.workspace.undo(/* redo= */ true); - chai.assert.isFalse( + assert.isFalse( defBlock.getFieldValue('PARAMS').includes('param1'), 'Expected the params field to not contain the name of the new param', ); @@ -343,11 +344,11 @@ suite('Procedures', function () { paramBlock.setFieldValue('new name', 'NAME'); this.clock.runAll(); - chai.assert.isNotNull( + assert.isNotNull( defBlock.getField('PARAMS'), 'Expected the params field to exist', ); - chai.assert.isTrue( + assert.isTrue( defBlock.getFieldValue('PARAMS').includes('new name'), 'Expected the params field to contain the new name of the param', ); @@ -373,11 +374,11 @@ suite('Procedures', function () { paramBlock1.setFieldValue('new name', 'NAME'); this.clock.runAll(); - chai.assert.isNotNull( + assert.isNotNull( defBlock.getField('PARAMS'), 'Expected the params field to exist', ); - chai.assert.isTrue( + assert.isTrue( defBlock.getFieldValue('PARAMS').includes('new name'), 'Expected the params field to contain the new name of the param', ); @@ -401,11 +402,11 @@ suite('Procedures', function () { paramBlock.setFieldValue('new name', 'NAME'); this.clock.runAll(); - chai.assert.isNotNull( + assert.isNotNull( callBlock.getInput('ARG0'), 'Expected the param input to exist', ); - chai.assert.equal( + assert.equal( callBlock.getFieldValue('ARGNAME0'), 'new name', 'Expected the params field to match the name of the new param', @@ -430,7 +431,7 @@ suite('Procedures', function () { paramBlock.setFieldValue('param2', 'NAME'); this.clock.runAll(); - chai.assert.isNotNull( + assert.isNotNull( this.workspace.getVariable('param1', ''), 'Expected the old variable to continue to exist', ); @@ -454,11 +455,11 @@ suite('Procedures', function () { const variable = this.workspace.getVariable('param1', ''); this.workspace.renameVariableById(variable.getId(), 'new name'); - chai.assert.isNotNull( + assert.isNotNull( defBlock.getField('PARAMS'), 'Expected the params field to exist', ); - chai.assert.isTrue( + assert.isTrue( defBlock.getFieldValue('PARAMS').includes('new name'), 'Expected the params field to contain the new name of the param', ); @@ -481,7 +482,7 @@ suite('Procedures', function () { const variable = this.workspace.getVariable('param1', ''); this.workspace.renameVariableById(variable.getId(), 'new name'); - chai.assert.equal( + assert.equal( paramBlock.getFieldValue('NAME'), 'new name', 'Expected the params field to contain the new name of the param', @@ -507,11 +508,11 @@ suite('Procedures', function () { const variable = this.workspace.getVariable('param1', ''); this.workspace.renameVariableById(variable.getId(), 'new name'); - chai.assert.isNotNull( + assert.isNotNull( callBlock.getInput('ARG0'), 'Expected the param input to exist', ); - chai.assert.equal( + assert.equal( callBlock.getFieldValue('ARGNAME0'), 'new name', 'Expected the params field to match the name of the new param', @@ -536,11 +537,11 @@ suite('Procedures', function () { const variable = this.workspace.getVariable('param1', ''); this.workspace.renameVariableById(variable.getId(), 'preCreatedVar'); - chai.assert.isNotNull( + assert.isNotNull( defBlock.getField('PARAMS'), 'Expected the params field to exist', ); - chai.assert.isTrue( + assert.isTrue( defBlock.getFieldValue('PARAMS').includes('preCreatedVar'), 'Expected the params field to contain the new name of the param', ); @@ -563,7 +564,7 @@ suite('Procedures', function () { const variable = this.workspace.getVariable('param1', ''); this.workspace.renameVariableById(variable.getId(), 'preCreatedVar'); - chai.assert.equal( + assert.equal( paramBlock.getFieldValue('NAME'), 'preCreatedVar', 'Expected the params field to contain the new name of the param', @@ -589,11 +590,11 @@ suite('Procedures', function () { const variable = this.workspace.getVariable('param1', ''); this.workspace.renameVariableById(variable.getId(), 'preCreatedVar'); - chai.assert.isNotNull( + assert.isNotNull( callBlock.getInput('ARG0'), 'Expected the param input to exist', ); - chai.assert.equal( + assert.equal( callBlock.getFieldValue('ARGNAME0'), 'preCreatedVar', 'Expected the params field to match the name of the new param', @@ -631,7 +632,7 @@ suite('Procedures', function () { this.workspace.undo(); this.clock.runAll(); - chai.assert.isTrue( + assert.isTrue( defBlock.getFieldValue('PARAMS').includes('param1'), 'Expected the params field to contain the old name of the param', ); @@ -662,7 +663,7 @@ suite('Procedures', function () { this.workspace.undo(); this.workspace.undo(/* redo= */ true); - chai.assert.isTrue( + assert.isTrue( defBlock.getFieldValue('PARAMS').includes('new'), 'Expected the params field to contain the new name of the param', ); @@ -696,11 +697,11 @@ suite('Procedures', function () { paramBlock2.nextConnection.connect(paramBlock1.previousConnection); this.clock.runAll(); - chai.assert.isNotNull( + assert.isNotNull( defBlock.getField('PARAMS'), 'Expected the params field to exist', ); - chai.assert.isTrue( + assert.isTrue( defBlock.getFieldValue('PARAMS').includes('param2, param1'), 'Expected the params field order to match the parameter order', ); @@ -733,20 +734,20 @@ suite('Procedures', function () { paramBlock2.nextConnection.connect(paramBlock1.previousConnection); this.clock.runAll(); - chai.assert.isNotNull( + assert.isNotNull( callBlock.getInput('ARG0'), 'Expected the param input to exist', ); - chai.assert.equal( + assert.equal( callBlock.getFieldValue('ARGNAME0'), 'param2', 'Expected the params field to match the name of the second param', ); - chai.assert.isNotNull( + assert.isNotNull( callBlock.getInput('ARG1'), 'Expected the param input to exist', ); - chai.assert.equal( + assert.equal( callBlock.getFieldValue('ARGNAME1'), 'param1', 'Expected the params field to match the name of the first param', @@ -789,12 +790,12 @@ suite('Procedures', function () { paramBlock2.nextConnection.connect(paramBlock1.previousConnection); this.clock.runAll(); - chai.assert.equal( + assert.equal( callBlock.getInputTargetBlock('ARG0'), block2, 'Expected the second block to be in the first slot', ); - chai.assert.equal( + assert.equal( callBlock.getInputTargetBlock('ARG1'), block1, 'Expected the first block to be in the second slot', @@ -814,7 +815,7 @@ suite('Procedures', function () { defBlock.setDisabledReason(true, 'MANUALLY_DISABLED'); this.clock.runAll(); - chai.assert.isFalse( + assert.isFalse( callBlock.isEnabled(), 'Expected the caller block to be disabled', ); @@ -831,7 +832,7 @@ suite('Procedures', function () { defBlock.setDisabledReason(true, 'test reason'); this.clock.runAll(); - chai.assert.isFalse( + assert.isFalse( callBlock.isEnabled(), 'Expected the caller block to be invalid', ); @@ -850,7 +851,7 @@ suite('Procedures', function () { defBlock.setDisabledReason(false, 'MANUALLY_DISABLED'); this.clock.runAll(); - chai.assert.isTrue( + assert.isTrue( callBlock.isEnabled(), 'Expected the caller block to be enabled', ); @@ -872,7 +873,7 @@ suite('Procedures', function () { defBlock.setDisabledReason(false, 'MANUALLY_DISABLED'); this.clock.runAll(); - chai.assert.isFalse( + assert.isFalse( callBlock.isEnabled(), 'Expected the caller block to continue to be disabled', ); @@ -887,7 +888,7 @@ suite('Procedures', function () { this.workspace, ); this.clock.runAll(); - chai.assert.isFalse( + assert.isFalse( ifreturnBlock.isEnabled(), 'Expected the ifreturn block to be invalid', ); @@ -903,7 +904,7 @@ suite('Procedures', function () { .getInput('STACK') .connection.connect(ifreturnBlock.previousConnection); this.clock.runAll(); - chai.assert.isTrue( + assert.isTrue( ifreturnBlock.isEnabled(), 'Expected the ifreturn block to be valid', ); @@ -923,11 +924,11 @@ suite('Procedures', function () { defBlock.dispose(); this.clock.runAll(); - chai.assert.isTrue( + assert.isTrue( callBlock1.disposed, 'Expected the first caller to be disposed', ); - chai.assert.isTrue( + assert.isTrue( callBlock2.disposed, 'Expected the second caller to be disposed', ); @@ -1233,7 +1234,7 @@ suite('Procedures', function () { const options = []; def.customContextMenu(options); - chai.assert.isTrue( + assert.isTrue( options[0].text.includes('test name'), 'Expected the context menu to have an option to create the caller', ); @@ -1267,11 +1268,11 @@ suite('Procedures', function () { const options = []; def.customContextMenu(options); - chai.assert.isTrue( + assert.isTrue( options[1].text.includes('testParam1'), 'Expected the context menu to have an option to create the first param', ); - chai.assert.isTrue( + assert.isTrue( options[2].text.includes('testParam2'), 'Expected the context menu to have an option to create the second param', ); @@ -1286,13 +1287,13 @@ suite('Procedures', function () { returnBlock.setFieldValue('return', 'NAME'); const allProcedures = Blockly.Procedures.allProcedures(this.workspace); - chai.assert.lengthOf(allProcedures, 2); + assert.lengthOf(allProcedures, 2); - chai.assert.lengthOf(allProcedures[0], 1); - chai.assert.equal(allProcedures[0][0][0], 'no return'); + assert.lengthOf(allProcedures[0], 1); + assert.equal(allProcedures[0][0][0], 'no return'); - chai.assert.lengthOf(allProcedures[1], 1); - chai.assert.equal(allProcedures[1][0][0], 'return'); + assert.lengthOf(allProcedures[1], 1); + assert.equal(allProcedures[1][0][0], 'return'); }); test('Multiple Blocks', function () { @@ -1305,26 +1306,26 @@ suite('Procedures', function () { const _ = this.workspace.newBlock('controls_if'); const allProcedures = Blockly.Procedures.allProcedures(this.workspace); - chai.assert.lengthOf(allProcedures, 2); + assert.lengthOf(allProcedures, 2); - chai.assert.lengthOf(allProcedures[0], 1); - chai.assert.equal(allProcedures[0][0][0], 'no return'); + assert.lengthOf(allProcedures[0], 1); + assert.equal(allProcedures[0][0][0], 'no return'); - chai.assert.lengthOf(allProcedures[1], 2); - chai.assert.equal(allProcedures[1][0][0], 'return'); - chai.assert.equal(allProcedures[1][1][0], 'return2'); + assert.lengthOf(allProcedures[1], 2); + assert.equal(allProcedures[1][0][0], 'return'); + assert.equal(allProcedures[1][1][0], 'return2'); }); test('No Procedures', function () { const _ = this.workspace.newBlock('controls_if'); const allProcedures = Blockly.Procedures.allProcedures(this.workspace); - chai.assert.lengthOf(allProcedures, 2); - chai.assert.lengthOf( + assert.lengthOf(allProcedures, 2); + assert.lengthOf( allProcedures[0], 0, 'No procedures_defnoreturn blocks expected', ); - chai.assert.lengthOf( + assert.lengthOf( allProcedures[1], 0, 'No procedures_defreturn blocks expected', @@ -1334,21 +1335,19 @@ suite('Procedures', function () { suite('isNameUsed', function () { test('returns false if no blocks or models exists', function () { - chai.assert.isFalse( + assert.isFalse( 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), - ); + assert.isTrue(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( + assert.isFalse( Blockly.Procedures.isNameUsed('other proc name', this.workspace), ); }); @@ -1357,16 +1356,14 @@ suite('Procedures', function () { this.workspace .getProcedureMap() .add(new MockProcedureModel().setName('proc name')); - chai.assert.isTrue( - Blockly.Procedures.isNameUsed('proc name', this.workspace), - ); + assert.isTrue(Blockly.Procedures.isNameUsed('proc name', this.workspace)); }); test('returns false if an associated procedure model exists', function () { this.workspace .getProcedureMap() .add(new MockProcedureModel().setName('proc name')); - chai.assert.isFalse( + assert.isFalse( Blockly.Procedures.isNameUsed('other proc name', this.workspace), ); }); @@ -1381,20 +1378,20 @@ suite('Procedures', function () { ) { const allProcedures = Blockly.Procedures.allProcedures(workspace); const defNoReturnBlocks = allProcedures[0]; - chai.assert.lengthOf( + assert.lengthOf( defNoReturnBlocks, 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]; - chai.assert.equal(defNoReturnBlocks[i][0], expectedName); + assert.equal(defNoReturnBlocks[i][0], expectedName); if (hasCallers) { const callers = Blockly.Procedures.getCallers( expectedName, workspace, ); - chai.assert.lengthOf( + assert.lengthOf( callers, 1, `Expected there to be one caller of the ${expectedName} block`, @@ -1402,20 +1399,20 @@ suite('Procedures', function () { } } const defReturnBlocks = allProcedures[1]; - chai.assert.lengthOf( + assert.lengthOf( defReturnBlocks, returnNames.length, `Expected the number of return blocks to be ${returnNames.length}`, ); for (let i = 0; i < returnNames.length; i++) { const expectedName = returnNames[i]; - chai.assert.equal(defReturnBlocks[i][0], expectedName); + assert.equal(defReturnBlocks[i][0], expectedName); if (hasCallers) { const callers = Blockly.Procedures.getCallers( expectedName, workspace, ); - chai.assert.lengthOf( + assert.lengthOf( callers, 1, `Expected there to be one caller of the ${expectedName} block`, @@ -1429,7 +1426,7 @@ suite('Procedures', function () { expectedCount *= 2; } const blocks = workspace.getAllBlocks(false); - chai.assert.lengthOf(blocks, expectedCount); + assert.lengthOf(blocks, expectedCount); } suite('no name renamed to unnamed', function () { @@ -1532,7 +1529,7 @@ suite('Procedures', function () { // Do not require procedures to be the built-in procedures. const defBlock = this.workspace.newBlock('new_proc'); const def = Blockly.Procedures.getDefinition('test', this.workspace); - chai.assert.equal(def, defBlock); + assert.equal(def, defBlock); }); test('Stacked procedures', function () { @@ -1542,7 +1539,7 @@ suite('Procedures', function () { blockB.name = 'b'; blockA.nextConnection.connect(blockB.previousConnection); const def = Blockly.Procedures.getDefinition('b', this.workspace); - chai.assert.equal(def, blockB); + assert.equal(def, blockB); }); }); @@ -1612,8 +1609,8 @@ suite('Procedures', function () { this.defBlock.getFieldValue('NAME') + '2', 'NAME', ); - chai.assert.equal(this.defBlock.getFieldValue('NAME'), 'proc name2'); - chai.assert.equal(this.callBlock.getFieldValue('NAME'), 'proc name2'); + assert.equal(this.defBlock.getFieldValue('NAME'), 'proc name2'); + assert.equal(this.callBlock.getFieldValue('NAME'), 'proc name2'); }); test('Simple, Input', function () { const defInput = this.defBlock.getField('NAME'); @@ -1625,8 +1622,8 @@ suite('Procedures', function () { defInput.htmlInput_.value = 'proc name2'; defInput.onHtmlInputChange_(null); - chai.assert.equal(this.defBlock.getFieldValue('NAME'), 'proc name2'); - chai.assert.equal(this.callBlock.getFieldValue('NAME'), 'proc name2'); + assert.equal(this.defBlock.getFieldValue('NAME'), 'proc name2'); + assert.equal(this.callBlock.getFieldValue('NAME'), 'proc name2'); }); test('lower -> CAPS', function () { const defInput = this.defBlock.getField('NAME'); @@ -1638,8 +1635,8 @@ suite('Procedures', function () { defInput.htmlInput_.value = 'PROC NAME'; defInput.onHtmlInputChange_(null); - chai.assert.equal(this.defBlock.getFieldValue('NAME'), 'PROC NAME'); - chai.assert.equal(this.callBlock.getFieldValue('NAME'), 'PROC NAME'); + assert.equal(this.defBlock.getFieldValue('NAME'), 'PROC NAME'); + assert.equal(this.callBlock.getFieldValue('NAME'), 'PROC NAME'); }); test('CAPS -> lower', function () { this.defBlock.setFieldValue('PROC NAME', 'NAME'); @@ -1653,8 +1650,8 @@ suite('Procedures', function () { defInput.htmlInput_.value = 'proc name'; defInput.onHtmlInputChange_(null); - chai.assert.equal(this.defBlock.getFieldValue('NAME'), 'proc name'); - chai.assert.equal(this.callBlock.getFieldValue('NAME'), 'proc name'); + assert.equal(this.defBlock.getFieldValue('NAME'), 'proc name'); + assert.equal(this.callBlock.getFieldValue('NAME'), 'proc name'); }); test('Whitespace', function () { const defInput = this.defBlock.getField('NAME'); @@ -1666,8 +1663,8 @@ suite('Procedures', function () { defInput.htmlInput_.value = 'proc name '; defInput.onHtmlInputChange_(null); - chai.assert.equal(this.defBlock.getFieldValue('NAME'), 'proc name'); - chai.assert.equal(this.callBlock.getFieldValue('NAME'), 'proc name'); + assert.equal(this.defBlock.getFieldValue('NAME'), 'proc name'); + assert.equal(this.callBlock.getFieldValue('NAME'), 'proc name'); }); test('Whitespace then Text', function () { const defInput = this.defBlock.getField('NAME'); @@ -1681,11 +1678,8 @@ suite('Procedures', function () { defInput.onHtmlInputChange_(null); defInput.htmlInput_.value = 'proc name 2'; defInput.onHtmlInputChange_(null); - chai.assert.equal(this.defBlock.getFieldValue('NAME'), 'proc name 2'); - chai.assert.equal( - this.callBlock.getFieldValue('NAME'), - 'proc name 2', - ); + assert.equal(this.defBlock.getFieldValue('NAME'), 'proc name 2'); + assert.equal(this.callBlock.getFieldValue('NAME'), 'proc name 2'); }); test('Set Empty', function () { const defInput = this.defBlock.getField('NAME'); @@ -1697,11 +1691,11 @@ suite('Procedures', function () { defInput.htmlInput_.value = ''; defInput.onHtmlInputChange_(null); - chai.assert.equal( + assert.equal( this.defBlock.getFieldValue('NAME'), Blockly.Msg['UNNAMED_KEY'], ); - chai.assert.equal( + assert.equal( this.callBlock.getFieldValue('NAME'), Blockly.Msg['UNNAMED_KEY'], ); @@ -1718,11 +1712,11 @@ suite('Procedures', function () { defInput.onHtmlInputChange_(null); const newDefBlock = this.workspace.newBlock(testSuite.defType); newDefBlock.setFieldValue('new name', 'NAME'); - chai.assert.equal( + assert.equal( this.defBlock.getFieldValue('NAME'), Blockly.Msg['UNNAMED_KEY'], ); - chai.assert.equal( + assert.equal( this.callBlock.getFieldValue('NAME'), Blockly.Msg['UNNAMED_KEY'], ); @@ -1754,8 +1748,8 @@ suite('Procedures', function () { 'proc name', this.workspace, ); - chai.assert.equal(callers.length, 1); - chai.assert.equal(callers[0], this.callBlock); + assert.equal(callers.length, 1); + assert.equal(callers[0], this.callBlock); }); test('Multiple Callers', function () { const caller2 = this.workspace.newBlock(testSuite.callType); @@ -1767,10 +1761,10 @@ suite('Procedures', function () { 'proc name', this.workspace, ); - chai.assert.equal(callers.length, 3); - chai.assert.equal(callers[0], this.callBlock); - chai.assert.equal(callers[1], caller2); - chai.assert.equal(callers[2], caller3); + assert.equal(callers.length, 3); + assert.equal(callers[0], this.callBlock); + assert.equal(callers[1], caller2); + assert.equal(callers[2], caller3); }); test('Multiple Procedures', function () { const def2 = this.workspace.newBlock(testSuite.defType); @@ -1782,8 +1776,8 @@ suite('Procedures', function () { 'proc name', this.workspace, ); - chai.assert.equal(callers.length, 1); - chai.assert.equal(callers[0], this.callBlock); + assert.equal(callers.length, 1); + assert.equal(callers[0], this.callBlock); }); // This can occur if you: // 1) Create an uppercase definition and call block. @@ -1799,8 +1793,8 @@ suite('Procedures', function () { 'proc name', this.workspace, ); - chai.assert.equal(callers.length, 1); - chai.assert.equal(callers[0], this.callBlock); + assert.equal(callers.length, 1); + assert.equal(callers[0], this.callBlock); }); test('Multiple Workspaces', function () { const workspace = new Blockly.Workspace(); @@ -1814,12 +1808,12 @@ suite('Procedures', function () { 'proc name', this.workspace, ); - chai.assert.equal(callers.length, 1); - chai.assert.equal(callers[0], this.callBlock); + assert.equal(callers.length, 1); + assert.equal(callers[0], this.callBlock); callers = Blockly.Procedures.getCallers('proc name', workspace); - chai.assert.equal(callers.length, 1); - chai.assert.equal(callers[0], caller2); + assert.equal(callers.length, 1); + assert.equal(callers[0], caller2); } finally { workspaceTeardown.call(this, workspace); } @@ -1851,7 +1845,7 @@ suite('Procedures', function () { 'proc name', this.workspace, ); - chai.assert.equal(def, this.defBlock); + assert.equal(def, this.defBlock); }); test('Multiple Procedures', function () { const def2 = this.workspace.newBlock(testSuite.defType); @@ -1863,7 +1857,7 @@ suite('Procedures', function () { 'proc name', this.workspace, ); - chai.assert.equal(def, this.defBlock); + assert.equal(def, this.defBlock); }); test('Multiple Workspaces', function () { const workspace = new Blockly.Workspace(); @@ -1877,10 +1871,10 @@ suite('Procedures', function () { 'proc name', this.workspace, ); - chai.assert.equal(def, this.defBlock); + assert.equal(def, this.defBlock); def = Blockly.Procedures.getDefinition('proc name', workspace); - chai.assert.equal(def, def2); + assert.equal(def, def2); } finally { workspaceTeardown.call(this, workspace); } @@ -1925,11 +1919,11 @@ suite('Procedures', function () { if (testSuite.defType === 'procedures_defreturn') { test('Has Statements', function () { setStatementValue(this.workspace, this.defBlock, true); - chai.assert.isTrue(this.defBlock.hasStatements_); + assert.isTrue(this.defBlock.hasStatements_); }); test('Has No Statements', function () { setStatementValue(this.workspace, this.defBlock, false); - chai.assert.isFalse(this.defBlock.hasStatements_); + assert.isFalse(this.defBlock.hasStatements_); }); test('Saving Statements', function () { const blockXml = Blockly.utils.xml.textToDom( @@ -1944,14 +1938,14 @@ suite('Procedures', function () { this.workspace, ); setStatementValue(this.workspace, defBlock, false); - chai.assert.isNull(defBlock.getInput('STACK')); + assert.isNull(defBlock.getInput('STACK')); setStatementValue(this.workspace, defBlock, true); - chai.assert.isNotNull(defBlock.getInput('STACK')); + assert.isNotNull(defBlock.getInput('STACK')); const statementBlocks = defBlock.getChildren(); - chai.assert.equal(statementBlocks.length, 1); + assert.equal(statementBlocks.length, 1); const block = statementBlocks[0]; - chai.assert.equal(block.type, 'procedures_ifreturn'); - chai.assert.equal(block.id, 'test'); + assert.equal(block.type, 'procedures_ifreturn'); + assert.equal(block.id, 'test'); }); } }); @@ -1976,21 +1970,21 @@ suite('Procedures', function () { this.clock.runAll(); } function assertArgs(argArray) { - chai.assert.equal( + assert.equal( this.defBlock.getVars().length, argArray.length, '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]); + assert.equal(this.defBlock.getVars()[i], argArray[i]); } - chai.assert.equal( + assert.equal( this.callBlock.getVars().length, argArray.length, '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]); + assert.equal(this.callBlock.getVars()[i], argArray[i]); } } test('Simple Add Arg', async function () { @@ -2062,7 +2056,7 @@ suite('Procedures', function () { const statementInput = mutatorWorkspace .getTopBlocks()[0] .getInput('STATEMENT_INPUT'); - chai.assert.isNotNull(statementInput); + assert.isNotNull(statementInput); }); test('Has Statements', function () { this.defBlock.hasStatements_ = true; @@ -2076,7 +2070,7 @@ suite('Procedures', function () { .getTopBlocks()[0] .getField('STATEMENTS') .getValueBoolean(); - chai.assert.isTrue(statementValue); + assert.isTrue(statementValue); }); test('No Has Statements', function () { this.defBlock.hasStatements_ = false; @@ -2090,7 +2084,7 @@ suite('Procedures', function () { .getTopBlocks()[0] .getField('STATEMENTS') .getValueBoolean(); - chai.assert.isFalse(statementValue); + assert.isFalse(statementValue); }); } else { test('Has no Statement Input', function () { @@ -2103,7 +2097,7 @@ suite('Procedures', function () { const statementInput = mutatorWorkspace .getTopBlocks()[0] .getInput('STATEMENT_INPUT'); - chai.assert.isNull(statementInput); + assert.isNull(statementInput); }); } }); diff --git a/tests/mocha/blocks/variables_test.js b/tests/mocha/blocks/variables_test.js index caee68aeca7..ea45d59c355 100644 --- a/tests/mocha/blocks/variables_test.js +++ b/tests/mocha/blocks/variables_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -64,7 +65,7 @@ suite('Variables', function () { createTestVarBlock(this.workspace, '3'); const result = Blockly.Variables.allUsedVarModels(this.workspace); - chai.assert.equal( + assert.equal( result.length, 3, 'Expected three variables in the list of used variables', @@ -75,12 +76,12 @@ suite('Variables', function () { createTestVarBlock(this.workspace, '2'); const result = Blockly.Variables.allUsedVarModels(this.workspace); - chai.assert.equal( + assert.equal( result.length, 1, 'Expected one variable in the list of used variables', ); - chai.assert.equal( + assert.equal( result[0].getId(), '2', 'Expected variable with ID 2 in the list of used variables', @@ -94,12 +95,12 @@ suite('Variables', function () { const result = Blockly.Variables.allUsedVarModels(this.workspace); // Using the same variable multiple times should not change the number of // elements in the list. - chai.assert.equal( + assert.equal( result.length, 1, 'Expected one variable in the list of used variables', ); - chai.assert.equal( + assert.equal( result[0].getId(), '2', 'Expected variable with ID 2 in the list of used variables', @@ -108,7 +109,7 @@ suite('Variables', function () { test('All unused', function () { const result = Blockly.Variables.allUsedVarModels(this.workspace); - chai.assert.equal( + assert.equal( result.length, 0, 'Expected no variables in the list of used variables', @@ -125,9 +126,9 @@ suite('Variables', function () { const result2 = Blockly.Variables.getVariable(this.workspace, 'id2'); const result3 = Blockly.Variables.getVariable(this.workspace, 'id3'); - chai.assert.equal(var1, result1); - chai.assert.equal(var2, result2); - chai.assert.equal(var3, result3); + assert.equal(var1, result1); + assert.equal(var2, result2); + assert.equal(var3, result3); }); test('By name and type', function () { @@ -154,9 +155,9 @@ suite('Variables', function () { ); // Searching by name + type is correct. - chai.assert.equal(var1, result1); - chai.assert.equal(var2, result2); - chai.assert.equal(var3, result3); + assert.equal(var1, result1); + assert.equal(var2, result2); + assert.equal(var3, result3); }); test('Bad ID with name and type fallback', function () { @@ -183,9 +184,9 @@ suite('Variables', function () { ); // Searching by ID failed, but falling back onto name + type is correct. - chai.assert.equal(var1, result1); - chai.assert.equal(var2, result2); - chai.assert.equal(var3, result3); + assert.equal(var1, result1); + assert.equal(var2, result2); + assert.equal(var3, result3); }); }); @@ -214,7 +215,7 @@ suite('Variables', function () { this.workspace, ); - chai.assert.equal( + assert.equal( 'test name', nameUsedWithConflictingParam('x', 'y', this.workspace), 'Expected the name of the procedure with the conflicting ' + @@ -248,7 +249,7 @@ suite('Variables', function () { this.workspace, ); - chai.assert.isNull( + assert.isNull( nameUsedWithConflictingParam('x', 'y', this.workspace), 'Expected there to be no conflict', ); @@ -270,7 +271,7 @@ suite('Variables', function () { ), ); - chai.assert.equal( + assert.equal( 'test name', nameUsedWithConflictingParam('x', 'y', this.workspace), 'Expected the name of the procedure with the conflicting ' + @@ -299,7 +300,7 @@ suite('Variables', function () { ), ); - chai.assert.isNull( + assert.isNull( nameUsedWithConflictingParam('x', 'y', this.workspace), 'Expected there to be no conflict', ); diff --git a/tests/mocha/clipboard_test.js b/tests/mocha/clipboard_test.js index fb0c4188275..37145de07f9 100644 --- a/tests/mocha/clipboard_test.js +++ b/tests/mocha/clipboard_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -30,7 +31,7 @@ suite('Clipboard', function () { Blockly.clipboard.registry.register('test-paster', paster); Blockly.clipboard.paste({paster: 'test-paster'}, this.workspace); - chai.assert.isTrue(paster.paste.calledOnce); + assert.isTrue(paster.paste.calledOnce); Blockly.clipboard.registry.unregister('test-paster'); }); @@ -73,7 +74,7 @@ suite('Clipboard', function () { const data = block.toCopyData(); const newBlock = Blockly.clipboard.paste(data, this.workspace); - chai.assert.deepEqual( + assert.deepEqual( newBlock.getRelativeToSurfaceXY(), new Blockly.utils.Coordinate(66, 69), ); @@ -105,7 +106,7 @@ suite('Clipboard', function () { const data = this.workspace.getBlockById('sourceBlockId').toCopyData(); const newBlock = Blockly.clipboard.paste(data, this.workspace); - chai.assert.deepEqual( + assert.deepEqual( newBlock.getRelativeToSurfaceXY(), new Blockly.utils.Coordinate(94, 125), ); @@ -126,7 +127,7 @@ suite('Clipboard', function () { const data = comment.toCopyData(); const newComment = Blockly.clipboard.paste(data, this.workspace); - chai.assert.deepEqual( + assert.deepEqual( newComment.getRelativeToSurfaceXY(), new Blockly.utils.Coordinate(60, 60), ); diff --git a/tests/mocha/comment_deserialization_test.js b/tests/mocha/comment_deserialization_test.js index 843453278e4..2517ed77982 100644 --- a/tests/mocha/comment_deserialization_test.js +++ b/tests/mocha/comment_deserialization_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -60,23 +61,23 @@ suite('Comment Deserialization', function () { icon.setBubbleVisible(true); // Check comment bubble size. const bubbleSize = icon.getBubbleSize(); - chai.assert.isNotNaN(bubbleSize.width); - chai.assert.isNotNaN(bubbleSize.height); - chai.assert.equal(icon.getText(), text); + assert.isNotNaN(bubbleSize.width); + assert.isNotNaN(bubbleSize.height); + assert.equal(icon.getText(), text); } test('Trashcan', function () { // Create block. this.block = createBlock(this.workspace); // Delete block. this.block.checkAndDelete(); - chai.assert.equal(this.workspace.getAllBlocks().length, 0); + assert.equal(this.workspace.getAllBlocks().length, 0); // Open trashcan. simulateClick(this.workspace.trashcan.svgGroup); // Place from trashcan. simulateClick( this.workspace.trashcan.flyout.svgGroup_.querySelector('.blocklyPath'), ); - chai.assert.equal(this.workspace.getAllBlocks().length, 1); + assert.equal(this.workspace.getAllBlocks().length, 1); // Check comment. assertComment(this.workspace, 'test text'); }); @@ -85,10 +86,10 @@ suite('Comment Deserialization', function () { this.block = createBlock(this.workspace); // Delete block. this.block.checkAndDelete(); - chai.assert.equal(this.workspace.getAllBlocks().length, 0); + assert.equal(this.workspace.getAllBlocks().length, 0); // Undo. this.workspace.undo(false); - chai.assert.equal(this.workspace.getAllBlocks().length, 1); + assert.equal(this.workspace.getAllBlocks().length, 1); // Check comment. assertComment(this.workspace, 'test text'); }); @@ -98,11 +99,11 @@ suite('Comment Deserialization', function () { // Undo & undo. this.workspace.undo(false); this.workspace.undo(false); - chai.assert.equal(this.workspace.getAllBlocks().length, 0); + assert.equal(this.workspace.getAllBlocks().length, 0); // Redo & redo. this.workspace.undo(true); this.workspace.undo(true); - chai.assert.equal(this.workspace.getAllBlocks().length, 1); + assert.equal(this.workspace.getAllBlocks().length, 1); // Check comment. assertComment(this.workspace, 'test text'); }); @@ -113,7 +114,7 @@ suite('Comment Deserialization', function () { simulateClick( toolbox.getFlyout().svgGroup_.querySelector('.blocklyPath'), ); - chai.assert.equal(this.workspace.getAllBlocks().length, 1); + assert.equal(this.workspace.getAllBlocks().length, 1); // Check comment. assertComment(this.workspace, 'test toolbox text'); }); diff --git a/tests/mocha/comment_test.js b/tests/mocha/comment_test.js index 452f07493cf..d4091b9c2d3 100644 --- a/tests/mocha/comment_test.js +++ b/tests/mocha/comment_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import {assertEventFired} from './test_helpers/events.js'; import * as eventUtils from '../../build/src/core/events/utils.js'; import { @@ -40,16 +41,16 @@ suite('Comments', function () { }); function assertEditable(comment) { - chai.assert.isNotOk(comment.textBubble); - chai.assert.isOk(comment.textInputBubble); + assert.isNotOk(comment.textBubble); + assert.isOk(comment.textInputBubble); } function assertNotEditable(comment) { - chai.assert.isNotOk(comment.textInputBubble); - chai.assert.isOk(comment.textBubble); + assert.isNotOk(comment.textInputBubble); + assert.isOk(comment.textBubble); } test('Editable', async function () { await this.comment.setBubbleVisible(true); - chai.assert.isTrue(this.comment.bubbleIsVisible()); + assert.isTrue(this.comment.bubbleIsVisible()); assertEditable(this.comment); assertEventFired( this.eventsFireStub, @@ -64,7 +65,7 @@ suite('Comments', function () { await this.comment.setBubbleVisible(true); - chai.assert.isTrue(this.comment.bubbleIsVisible()); + assert.isTrue(this.comment.bubbleIsVisible()); assertNotEditable(this.comment); assertEventFired( this.eventsFireStub, @@ -80,7 +81,7 @@ suite('Comments', function () { await this.comment.updateEditable(); - chai.assert.isTrue(this.comment.bubbleIsVisible()); + assert.isTrue(this.comment.bubbleIsVisible()); assertNotEditable(this.comment); assertEventFired( this.eventsFireStub, @@ -98,7 +99,7 @@ suite('Comments', function () { editableStub.returns(true); await this.comment.updateEditable(); - chai.assert.isTrue(this.comment.bubbleIsVisible()); + assert.isTrue(this.comment.bubbleIsVisible()); assertEditable(this.comment); assertEventFired( this.eventsFireStub, @@ -115,8 +116,8 @@ suite('Comments', function () { }); function assertBubbleSize(comment, height, width) { const size = comment.getBubbleSize(); - chai.assert.equal(size.height, height); - chai.assert.equal(size.width, width); + assert.equal(size.height, height); + assert.equal(size.width, width); } function assertBubbleSizeDefault(comment) { assertBubbleSize(comment, 80, 160); diff --git a/tests/mocha/comment_view_test.js b/tests/mocha/comment_view_test.js index 6650848e51f..57a24742457 100644 --- a/tests/mocha/comment_view_test.js +++ b/tests/mocha/comment_view_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -28,11 +29,8 @@ suite('Workspace comment', function () { this.commentView.setText('test'); - chai.assert.isTrue( - spy.calledOnce, - 'Expected the spy to be called once', - ); - chai.assert.isTrue( + assert.isTrue(spy.calledOnce, 'Expected the spy to be called once'); + assert.isTrue( spy.calledWith('', 'test'), 'Expected the spy to be called with the given args', ); @@ -50,15 +48,15 @@ suite('Workspace comment', function () { this.commentView.setText('test'); - chai.assert.isTrue( + assert.isTrue( fake1.calledOnce, 'Expected the first listener to be called', ); - chai.assert.isTrue( + assert.isTrue( fake2.calledOnce, 'Expected the second listener to be called', ); - chai.assert.isTrue( + assert.isTrue( fake3.calledOnce, 'Expected the third listener to be called', ); @@ -74,11 +72,8 @@ suite('Workspace comment', function () { this.commentView.setSize(newSize); - chai.assert.isTrue( - spy.calledOnce, - 'Expected the spy to be called once', - ); - chai.assert.isTrue( + assert.isTrue(spy.calledOnce, 'Expected the spy to be called once'); + assert.isTrue( spy.calledWith(originalSize, newSize), 'Expected the spy to be called with the given args', ); @@ -97,15 +92,15 @@ suite('Workspace comment', function () { this.commentView.setSize(newSize); - chai.assert.isTrue( + assert.isTrue( fake1.calledOnce, 'Expected the first listener to be called', ); - chai.assert.isTrue( + assert.isTrue( fake2.calledOnce, 'Expected the second listener to be called', ); - chai.assert.isTrue( + assert.isTrue( fake3.calledOnce, 'Expected the third listener to be called', ); @@ -119,11 +114,8 @@ suite('Workspace comment', function () { this.commentView.setCollapsed(true); - chai.assert.isTrue( - spy.calledOnce, - 'Expected the spy to be called once', - ); - chai.assert.isTrue( + assert.isTrue(spy.calledOnce, 'Expected the spy to be called once'); + assert.isTrue( spy.calledWith(true), 'Expected the spy to be called with the given args', ); @@ -141,15 +133,15 @@ suite('Workspace comment', function () { this.commentView.setCollapsed(true); - chai.assert.isTrue( + assert.isTrue( fake1.calledOnce, 'Expected the first listener to be called', ); - chai.assert.isTrue( + assert.isTrue( fake2.calledOnce, 'Expected the second listener to be called', ); - chai.assert.isTrue( + assert.isTrue( fake3.calledOnce, 'Expected the third listener to be called', ); @@ -163,10 +155,7 @@ suite('Workspace comment', function () { this.commentView.dispose(); - chai.assert.isTrue( - spy.calledOnce, - 'Expected the spy to be called once', - ); + assert.isTrue(spy.calledOnce, 'Expected the spy to be called once'); }); test('dispose listeners can remove themselves without skipping others', function () { @@ -181,15 +170,15 @@ suite('Workspace comment', function () { this.commentView.dispose(); - chai.assert.isTrue( + assert.isTrue( fake1.calledOnce, 'Expected the first listener to be called', ); - chai.assert.isTrue( + assert.isTrue( fake2.calledOnce, 'Expected the second listener to be called', ); - chai.assert.isTrue( + assert.isTrue( fake3.calledOnce, 'Expected the third listener to be called', ); diff --git a/tests/mocha/connection_checker_test.js b/tests/mocha/connection_checker_test.js index 09797d6a772..20f85623a43 100644 --- a/tests/mocha/connection_checker_test.js +++ b/tests/mocha/connection_checker_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import {ConnectionType} from '../../build/src/core/connection_type.js'; import { sharedTestSetup, @@ -22,9 +23,9 @@ suite('Connection checker', function () { }); suite('Safety checks', function () { function assertReasonHelper(checker, one, two, reason) { - chai.assert.equal(checker.canConnectWithReason(one, two), reason); + assert.equal(checker.canConnectWithReason(one, two), reason); // Order should not matter. - chai.assert.equal(checker.canConnectWithReason(two, one), reason); + assert.equal(checker.canConnectWithReason(two, one), reason); } test('Target Null', function () { @@ -452,9 +453,9 @@ suite('Connection checker', function () { this.con2 = new Blockly.Connection({}, ConnectionType.NEXT_STATEMENT); }); function assertCheckTypes(checker, one, two) { - chai.assert.isTrue(checker.doTypeChecks(one, two)); + assert.isTrue(checker.doTypeChecks(one, two)); // Order should not matter. - chai.assert.isTrue(checker.doTypeChecks(one, two)); + assert.isTrue(checker.doTypeChecks(one, two)); } test('No Types', function () { assertCheckTypes(this.checker, this.con1, this.con2); @@ -481,7 +482,7 @@ suite('Connection checker', function () { test('No Compatible Types', function () { this.con1.setCheck('type1'); this.con2.setCheck('type2'); - chai.assert.isFalse(this.checker.doTypeChecks(this.con1, this.con2)); + assert.isFalse(this.checker.doTypeChecks(this.con1, this.con2)); }); }); suite('Dragging Checks', function () { @@ -509,7 +510,7 @@ suite('Connection checker', function () { test('Connect a stack', function () { // block C is not connected to block A; both are movable. - chai.assert.isTrue( + assert.isTrue( this.checker.doDragChecks( this.blockC.nextConnection, this.blockA.previousConnection, @@ -543,7 +544,7 @@ suite('Connection checker', function () { // Try to connect blockC into the input connection of blockA, replacing blockB. // This is allowed because shadow blocks can always be replaced, even though // they are unmovable. - chai.assert.isTrue( + assert.isTrue( this.checker.doDragChecks( this.blockC.previousConnection, this.blockA.nextConnection, @@ -556,7 +557,7 @@ suite('Connection checker', function () { test('Do not splice into unmovable stack', function () { // Try to connect blockC above blockB. It shouldn't work because B is not movable // and is already connected to A's nextConnection. - chai.assert.isFalse( + assert.isFalse( this.checker.doDragChecks( this.blockC.previousConnection, this.blockA.nextConnection, @@ -569,7 +570,7 @@ suite('Connection checker', function () { test('Connect to bottom of unmovable stack', function () { // Try to connect blockC below blockB. // This is allowed even though B is not movable because it is on B's nextConnection. - chai.assert.isTrue( + assert.isTrue( this.checker.doDragChecks( this.blockC.previousConnection, this.blockB.nextConnection, @@ -585,7 +586,7 @@ suite('Connection checker', function () { // Try to connect blockC above blockB. // This is allowed because we're not splicing into a stack. - chai.assert.isTrue( + assert.isTrue( this.checker.doDragChecks( this.blockC.nextConnection, this.blockB.previousConnection, @@ -620,7 +621,7 @@ suite('Connection checker', function () { // Try to connect C's output to A's input. Should fail because // A is already connected to B, which is unmovable. const inputConnection = this.blockA.inputList[0].connection; - chai.assert.isFalse( + assert.isFalse( this.checker.doDragChecks( this.blockC.outputConnection, inputConnection, @@ -635,7 +636,7 @@ suite('Connection checker', function () { this.blockC.setMovable(false); // Try to connect A's output to C's input. This is allowed. const inputConnection = this.blockC.inputList[0].connection; - chai.assert.isTrue( + assert.isTrue( this.checker.doDragChecks( this.blockA.outputConnection, inputConnection, @@ -651,7 +652,7 @@ suite('Connection checker', function () { // Try to connect C's input to B's output. Allowed because B is now unconnected. const inputConnection = this.blockC.inputList[0].connection; - chai.assert.isTrue( + assert.isTrue( this.checker.doDragChecks( inputConnection, this.blockB.outputConnection, diff --git a/tests/mocha/connection_db_test.js b/tests/mocha/connection_db_test.js index 9cf579f1b1d..11eeecf31db 100644 --- a/tests/mocha/connection_db_test.js +++ b/tests/mocha/connection_db_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import {ConnectionType} from '../../build/src/core/connection_type.js'; import { sharedTestSetup, @@ -18,7 +19,7 @@ suite('Connection Database', function () { this.assertOrder = function () { const length = this.database.connections.length; for (let i = 1; i < length; i++) { - chai.assert.isAtMost( + assert.isAtMost( this.database.connections[i - 1].y, this.database.connections[i].y, ); @@ -59,24 +60,19 @@ suite('Connection Database', function () { const y3b = {y: 3}; this.database.addConnection(y2, 2); - chai.assert.sameOrderedMembers(this.database.connections, [y2]); + assert.sameOrderedMembers(this.database.connections, [y2]); this.database.addConnection(y4, 4); - chai.assert.sameOrderedMembers(this.database.connections, [y2, y4]); + assert.sameOrderedMembers(this.database.connections, [y2, y4]); this.database.addConnection(y1, 1); - chai.assert.sameOrderedMembers(this.database.connections, [y1, y2, y4]); + assert.sameOrderedMembers(this.database.connections, [y1, y2, y4]); this.database.addConnection(y3a, 3); - chai.assert.sameOrderedMembers(this.database.connections, [ - y1, - y2, - y3a, - y4, - ]); + assert.sameOrderedMembers(this.database.connections, [y1, y2, y3a, y4]); this.database.addConnection(y3b, 3); - chai.assert.sameOrderedMembers(this.database.connections, [ + assert.sameOrderedMembers(this.database.connections, [ y1, y2, y3b, @@ -99,7 +95,7 @@ suite('Connection Database', function () { this.database.addConnection(y3b, 3); this.database.addConnection(y3a, 3); - chai.assert.sameOrderedMembers(this.database.connections, [ + assert.sameOrderedMembers(this.database.connections, [ y1, y2, y3a, @@ -109,7 +105,7 @@ suite('Connection Database', function () { ]); this.database.removeConnection(y2, 2); - chai.assert.sameOrderedMembers(this.database.connections, [ + assert.sameOrderedMembers(this.database.connections, [ y1, y3a, y3b, @@ -118,24 +114,19 @@ suite('Connection Database', function () { ]); this.database.removeConnection(y4, 4); - chai.assert.sameOrderedMembers(this.database.connections, [ - y1, - y3a, - y3b, - y3c, - ]); + assert.sameOrderedMembers(this.database.connections, [y1, y3a, y3b, y3c]); this.database.removeConnection(y1, 1); - chai.assert.sameOrderedMembers(this.database.connections, [y3a, y3b, y3c]); + assert.sameOrderedMembers(this.database.connections, [y3a, y3b, y3c]); this.database.removeConnection(y3a, 3); - chai.assert.sameOrderedMembers(this.database.connections, [y3b, y3c]); + assert.sameOrderedMembers(this.database.connections, [y3b, y3c]); this.database.removeConnection(y3c, 3); - chai.assert.sameOrderedMembers(this.database.connections, [y3b]); + assert.sameOrderedMembers(this.database.connections, [y3b]); this.database.removeConnection(y3b, 3); - chai.assert.isEmpty(this.database.connections); + assert.isEmpty(this.database.connections); }); suite('Get Neighbors', function () { test('Empty Database', function () { @@ -145,7 +136,7 @@ suite('Connection Database', function () { ConnectionType.NEXT_STATEMENT, new Blockly.ConnectionDB(), ); - chai.assert.isEmpty(this.database.getNeighbours(connection), 100); + assert.isEmpty(this.database.getNeighbours(connection), 100); }); test('Block At Top', function () { this.createSimpleTestConnections(); @@ -157,7 +148,7 @@ suite('Connection Database', function () { new Blockly.ConnectionDB(), ); const neighbors = this.database.getNeighbours(checkConnection, 4); - chai.assert.sameMembers(neighbors, this.database.connections.slice(0, 5)); + assert.sameMembers(neighbors, this.database.connections.slice(0, 5)); }); test('Block In Middle', function () { this.createSimpleTestConnections(); @@ -169,7 +160,7 @@ suite('Connection Database', function () { new Blockly.ConnectionDB(), ); const neighbors = this.database.getNeighbours(checkConnection, 2); - chai.assert.sameMembers(neighbors, this.database.connections.slice(2, 7)); + assert.sameMembers(neighbors, this.database.connections.slice(2, 7)); }); test('Block At End', function () { this.createSimpleTestConnections(); @@ -181,10 +172,7 @@ suite('Connection Database', function () { new Blockly.ConnectionDB(), ); const neighbors = this.database.getNeighbours(checkConnection, 4); - chai.assert.sameMembers( - neighbors, - this.database.connections.slice(5, 10), - ); + assert.sameMembers(neighbors, this.database.connections.slice(5, 10)); }); test('Out of Range X', function () { this.createSimpleTestConnections(); @@ -196,7 +184,7 @@ suite('Connection Database', function () { new Blockly.ConnectionDB(), ); const neighbors = this.database.getNeighbours(checkConnection, 4); - chai.assert.isEmpty(neighbors); + assert.isEmpty(neighbors); }); test('Out of Range Y', function () { this.createSimpleTestConnections(); @@ -208,7 +196,7 @@ suite('Connection Database', function () { new Blockly.ConnectionDB(), ); const neighbors = this.database.getNeighbours(checkConnection, 4); - chai.assert.isEmpty(neighbors); + assert.isEmpty(neighbors); }); test('Out of Range Diagonal', function () { this.createSimpleTestConnections(); @@ -220,7 +208,7 @@ suite('Connection Database', function () { new Blockly.ConnectionDB(), ); const neighbors = this.database.getNeighbours(checkConnection, 2); - chai.assert.isEmpty(neighbors); + assert.isEmpty(neighbors); }); }); suite('Ordering', function () { @@ -300,7 +288,7 @@ suite('Connection Database', function () { ConnectionType.NEXT_STATEMENT, new Blockly.ConnectionDB(), ); - chai.assert.isNull( + assert.isNull( this.database.searchForClosest(checkConnection, 100, {x: 0, y: 0}) .connection, ); @@ -319,7 +307,7 @@ suite('Connection Database', function () { ConnectionType.NEXT_STATEMENT, new Blockly.ConnectionDB(), ); - chai.assert.isNull( + assert.isNull( this.database.searchForClosest(checkConnection, 50, {x: 0, y: 0}) .connection, ); @@ -334,7 +322,7 @@ suite('Connection Database', function () { x: 0, y: 0, }).connection; - chai.assert.equal(last, closest); + assert.equal(last, closest); }); test('Many in Range', function () { this.createSimpleTestConnections(); @@ -346,7 +334,7 @@ suite('Connection Database', function () { x: 0, y: 0, }).connection; - chai.assert.equal(last, closest); + assert.equal(last, closest); }); test('No Y-Coord Priority', function () { const connection1 = this.createConnection( @@ -368,7 +356,7 @@ suite('Connection Database', function () { x: 0, y: 0, }).connection; - chai.assert.equal(connection2, closest); + assert.equal(connection2, closest); }); }); }); diff --git a/tests/mocha/connection_test.js b/tests/mocha/connection_test.js index afba4948cff..040f59f401b 100644 --- a/tests/mocha/connection_test.js +++ b/tests/mocha/connection_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { createGenUidStubWithReturns, sharedTestSetup, @@ -39,19 +40,19 @@ suite('Connection', function () { suite('Set Shadow', function () { function assertBlockMatches(block, isShadow, opt_id) { - chai.assert.equal( + assert.equal( block.isShadow(), isShadow, `expected block ${block.id} to ${isShadow ? '' : 'not'} be a shadow`, ); if (opt_id) { - chai.assert.equal(block.id, opt_id); + assert.equal(block.id, opt_id); } } function assertInputHasBlock(parent, inputName, isShadow, opt_name) { const block = parent.getInputTargetBlock(inputName); - chai.assert.exists( + assert.exists( block, `expected block ${opt_name || ''} to be attached to ${inputName}`, ); @@ -60,7 +61,7 @@ suite('Connection', function () { function assertNextHasBlock(parent, isShadow, opt_name) { const block = parent.getNextBlock(); - chai.assert.exists( + assert.exists( block, `expected block ${opt_name || ''} to be attached to next connection`, ); @@ -69,7 +70,7 @@ suite('Connection', function () { function assertInputNotHasBlock(parent, inputName) { const block = parent.getInputTargetBlock(inputName); - chai.assert.notExists( + assert.notExists( block, `expected block ${ block && block.id @@ -79,7 +80,7 @@ suite('Connection', function () { function assertNextNotHasBlock(parent) { const block = parent.getNextBlock(); - chai.assert.notExists( + assert.notExists( block, `expected block ${ block && block.id @@ -92,8 +93,8 @@ suite('Connection', function () { addNextBlocks: true, }); const actualXml = Blockly.Xml.domToText(Blockly.Xml.blockToDom(block)); - chai.assert.deepEqual(actualJso, jso); - chai.assert.equal(actualXml, xmlText); + assert.deepEqual(actualJso, jso); + assert.equal(actualXml, xmlText); } const testSuites = [ @@ -1382,7 +1383,7 @@ suite('Connection', function () { suite('Invalid', function () { test('Attach to output', function () { const block = this.workspace.newBlock('row_block'); - chai.assert.throws(() => + assert.throws(() => block.outputConnection.setShadowDom( Blockly.utils.xml.textToDom(''), ), @@ -1391,7 +1392,7 @@ suite('Connection', function () { test('Attach to previous', function () { const block = this.workspace.newBlock('stack_block'); - chai.assert.throws(() => + assert.throws(() => block.previousConnection.setShadowDom( Blockly.utils.xml.textToDom(''), ), @@ -1400,7 +1401,7 @@ suite('Connection', function () { test('Missing output', function () { const block = this.workspace.newBlock('row_block'); - chai.assert.throws(() => + assert.throws(() => block.outputConnection.setShadowDom( Blockly.utils.xml.textToDom(''), ), @@ -1409,7 +1410,7 @@ suite('Connection', function () { test('Missing previous', function () { const block = this.workspace.newBlock('stack_block'); - chai.assert.throws(() => + assert.throws(() => block.previousConnection.setShadowDom( Blockly.utils.xml.textToDom(''), ), @@ -1418,7 +1419,7 @@ suite('Connection', function () { test('Invalid connection checks, output', function () { const block = this.workspace.newBlock('logic_operation'); - chai.assert.throws(() => + assert.throws(() => block .getInput('A') .connection.setShadowDom( @@ -1437,7 +1438,7 @@ suite('Connection', function () { }, ]); const block = this.workspace.newBlock('stack_checks_block'); - chai.assert.throws(() => + assert.throws(() => block.nextConnection.setShadowDom( Blockly.utils.xml.textToDom( '', @@ -2751,14 +2752,14 @@ suite('Connection', function () { suite('Invalid', function () { test('Attach to output', function () { const block = this.workspace.newBlock('row_block'); - chai.assert.throws(() => + assert.throws(() => block.outputConnection.setShadowState({'type': 'row_block'}), ); }); test('Attach to previous', function () { const block = this.workspace.newBlock('stack_block'); - chai.assert.throws(() => + assert.throws(() => block.previousConnection.setShadowState({ 'type': 'stack_block', }), @@ -2767,21 +2768,21 @@ suite('Connection', function () { test('Missing output', function () { const block = this.workspace.newBlock('row_block'); - chai.assert.throws(() => + assert.throws(() => block.outputConnection.setShadowState({'type': 'stack_block'}), ); }); test('Missing previous', function () { const block = this.workspace.newBlock('stack_block'); - chai.assert.throws(() => + assert.throws(() => block.previousConnection.setShadowState({'type': 'row_block'}), ); }); test('Invalid connection checks, output', function () { const block = this.workspace.newBlock('logic_operation'); - chai.assert.throws(() => + assert.throws(() => block .getInput('A') .connection.setShadowState({'type': 'math_number'}), @@ -2798,7 +2799,7 @@ suite('Connection', function () { }, ]); const block = this.workspace.newBlock('stack_checks_block'); - chai.assert.throws(() => + assert.throws(() => block.nextConnection.setShadowState({ 'type': 'stack_checks_block', }), @@ -2984,7 +2985,7 @@ suite('Connection', function () { // Used to make sure we don't get stray shadow blocks or anything. this.assertBlockCount = function (count) { - chai.assert.equal(this.workspace.getAllBlocks().length, count); + assert.equal(this.workspace.getAllBlocks().length, count); }; }); @@ -2997,9 +2998,7 @@ suite('Connection', function () { oldParent.getInput('INPUT').connection.connect(child.outputConnection); newParent.getInput('INPUT').connection.connect(child.outputConnection); - chai.assert.isFalse( - oldParent.getInput('INPUT').connection.isConnected(), - ); + assert.isFalse(oldParent.getInput('INPUT').connection.isConnected()); this.assertBlockCount(3); }); @@ -3011,9 +3010,7 @@ suite('Connection', function () { oldParent.getInput('NAME').connection.connect(child.previousConnection); newParent.getInput('NAME').connection.connect(child.previousConnection); - chai.assert.isFalse( - oldParent.getInput('NAME').connection.isConnected(), - ); + assert.isFalse(oldParent.getInput('NAME').connection.isConnected()); this.assertBlockCount(3); }); @@ -3025,7 +3022,7 @@ suite('Connection', function () { oldParent.nextConnection.connect(child.previousConnection); newParent.nextConnection.connect(child.previousConnection); - chai.assert.isFalse(oldParent.nextConnection.isConnected()); + assert.isFalse(oldParent.nextConnection.isConnected()); this.assertBlockCount(3); }); }); @@ -3036,11 +3033,11 @@ suite('Connection', function () { const child = this.workspace.newBlock('row_block'); const xml = Blockly.utils.xml.textToDom(''); newParent.getInput('INPUT').connection.setShadowDom(xml); - chai.assert.isTrue(newParent.getInputTargetBlock('INPUT').isShadow()); + assert.isTrue(newParent.getInputTargetBlock('INPUT').isShadow()); newParent.getInput('INPUT').connection.connect(child.outputConnection); - chai.assert.isFalse(newParent.getInputTargetBlock('INPUT').isShadow()); + assert.isFalse(newParent.getInputTargetBlock('INPUT').isShadow()); this.assertBlockCount(2); }); @@ -3049,11 +3046,11 @@ suite('Connection', function () { const child = this.workspace.newBlock('stack_block'); const xml = Blockly.utils.xml.textToDom(''); newParent.getInput('NAME').connection.setShadowDom(xml); - chai.assert.isTrue(newParent.getInputTargetBlock('NAME').isShadow()); + assert.isTrue(newParent.getInputTargetBlock('NAME').isShadow()); newParent.getInput('NAME').connection.connect(child.previousConnection); - chai.assert.isFalse(newParent.getInputTargetBlock('NAME').isShadow()); + assert.isFalse(newParent.getInputTargetBlock('NAME').isShadow()); this.assertBlockCount(2); }); @@ -3062,11 +3059,11 @@ suite('Connection', function () { const child = this.workspace.newBlock('stack_block'); const xml = Blockly.utils.xml.textToDom(''); newParent.nextConnection.setShadowDom(xml); - chai.assert.isTrue(newParent.getNextBlock().isShadow()); + assert.isTrue(newParent.getNextBlock().isShadow()); newParent.nextConnection.connect(child.previousConnection); - chai.assert.isFalse(newParent.getNextBlock().isShadow()); + assert.isFalse(newParent.getNextBlock().isShadow()); this.assertBlockCount(2); }); }); @@ -3083,8 +3080,8 @@ suite('Connection', function () { newParent.getInput('INPUT').connection.disconnect(); const target = newParent.getInputTargetBlock('INPUT'); - chai.assert.isTrue(target.isShadow()); - chai.assert.equal(target.getFieldValue('FIELD'), 'new'); + assert.isTrue(target.isShadow()); + assert.equal(target.getFieldValue('FIELD'), 'new'); this.assertBlockCount(3); }); @@ -3099,8 +3096,8 @@ suite('Connection', function () { newParent.getInput('NAME').connection.disconnect(); const target = newParent.getInputTargetBlock('NAME'); - chai.assert.isTrue(target.isShadow()); - chai.assert.equal(target.getFieldValue('FIELD'), 'new'); + assert.isTrue(target.isShadow()); + assert.equal(target.getFieldValue('FIELD'), 'new'); this.assertBlockCount(3); }); @@ -3115,8 +3112,8 @@ suite('Connection', function () { newParent.nextConnection.disconnect(); const target = newParent.getNextBlock(); - chai.assert.isTrue(target.isShadow()); - chai.assert.equal(target.getFieldValue('FIELD'), 'new'); + assert.isTrue(target.isShadow()); + assert.equal(target.getFieldValue('FIELD'), 'new'); this.assertBlockCount(3); }); }); @@ -3136,11 +3133,9 @@ suite('Connection', function () { .getInput('INPUT') .connection.connect(newChild.outputConnection); - chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); - chai.assert.isFalse(oldChild.outputConnection.isConnected()); + assert.isTrue(parent.getInput('INPUT').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('INPUT'), newChild); + assert.isFalse(oldChild.outputConnection.isConnected()); }); test('All statements', function () { @@ -3155,11 +3150,9 @@ suite('Connection', function () { .getInput('INPUT') .connection.connect(newChild.outputConnection); - chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); - chai.assert.isFalse(oldChild.outputConnection.isConnected()); + assert.isTrue(parent.getInput('INPUT').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('INPUT'), newChild); + assert.isFalse(oldChild.outputConnection.isConnected()); }); test('Bad checks', function () { @@ -3174,11 +3167,9 @@ suite('Connection', function () { .getInput('INPUT') .connection.connect(newChild.outputConnection); - chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); - chai.assert.isFalse(oldChild.outputConnection.isConnected()); + assert.isTrue(parent.getInput('INPUT').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('INPUT'), newChild); + assert.isFalse(oldChild.outputConnection.isConnected()); }); test('Through different types', function () { @@ -3198,11 +3189,9 @@ suite('Connection', function () { .getInput('INPUT') .connection.connect(newChild.outputConnection); - chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); - chai.assert.isFalse(oldChild.outputConnection.isConnected()); + assert.isTrue(parent.getInput('INPUT').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('INPUT'), newChild); + assert.isFalse(oldChild.outputConnection.isConnected()); }); }); @@ -3223,11 +3212,9 @@ suite('Connection', function () { .getInput('INPUT') .connection.connect(newChild.outputConnection); - chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); - chai.assert.isFalse(oldChild.outputConnection.isConnected()); + assert.isTrue(parent.getInput('INPUT').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('INPUT'), newChild); + assert.isFalse(oldChild.outputConnection.isConnected()); }); test('Child blocks', function () { @@ -3253,11 +3240,9 @@ suite('Connection', function () { .getInput('INPUT') .connection.connect(newChild.outputConnection); - chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); - chai.assert.isFalse(oldChild.outputConnection.isConnected()); + assert.isTrue(parent.getInput('INPUT').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('INPUT'), newChild); + assert.isFalse(oldChild.outputConnection.isConnected()); }); test('Spots filled', function () { @@ -3279,11 +3264,9 @@ suite('Connection', function () { .getInput('INPUT') .connection.connect(newChild.outputConnection); - chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); - chai.assert.isFalse(oldChild.outputConnection.isConnected()); + assert.isTrue(parent.getInput('INPUT').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('INPUT'), newChild); + assert.isFalse(oldChild.outputConnection.isConnected()); }); }); @@ -3317,11 +3300,9 @@ suite('Connection', function () { .getInput('INPUT') .connection.connect(newChild.outputConnection); - chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); - chai.assert.isFalse(oldChild.outputConnection.isConnected()); + assert.isTrue(parent.getInput('INPUT').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('INPUT'), newChild); + assert.isFalse(oldChild.outputConnection.isConnected()); }); test('Child blocks', function () { @@ -3361,11 +3342,9 @@ suite('Connection', function () { .getInput('INPUT') .connection.connect(newChild.outputConnection); - chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); - chai.assert.isFalse(oldChild.outputConnection.isConnected()); + assert.isTrue(parent.getInput('INPUT').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('INPUT'), newChild); + assert.isFalse(oldChild.outputConnection.isConnected()); }); test('Spots filled', function () { @@ -3394,11 +3373,9 @@ suite('Connection', function () { .getInput('INPUT') .connection.connect(newChild.outputConnection); - chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); - chai.assert.isFalse(oldChild.outputConnection.isConnected()); + assert.isTrue(parent.getInput('INPUT').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('INPUT'), newChild); + assert.isFalse(oldChild.outputConnection.isConnected()); }); }); }); @@ -3417,14 +3394,10 @@ suite('Connection', function () { .getInput('INPUT') .connection.connect(newChild.outputConnection); - chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); - chai.assert.isTrue( - newChild.getInput('INPUT').connection.isConnected(), - ); - chai.assert.equal(newChild.getInputTargetBlock('INPUT'), oldChild); + assert.isTrue(parent.getInput('INPUT').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('INPUT'), newChild); + assert.isTrue(newChild.getInput('INPUT').connection.isConnected()); + assert.equal(newChild.getInputTargetBlock('INPUT'), oldChild); }); test('Shadows', function () { @@ -3447,14 +3420,10 @@ suite('Connection', function () { .getInput('INPUT') .connection.connect(newChild.outputConnection); - chai.assert.isTrue( - parent.getInput('INPUT').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('INPUT'), newChild); - chai.assert.isTrue( - newChild.getInput('INPUT').connection.isConnected(), - ); - chai.assert.equal(newChild.getInputTargetBlock('INPUT'), oldChild); + assert.isTrue(parent.getInput('INPUT').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('INPUT'), newChild); + assert.isTrue(newChild.getInput('INPUT').connection.isConnected()); + assert.equal(newChild.getInputTargetBlock('INPUT'), oldChild); }); }); }); @@ -3473,12 +3442,10 @@ suite('Connection', function () { .getInput('NAME') .connection.connect(newChild.previousConnection); - chai.assert.isTrue( - parent.getInput('NAME').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('NAME'), newChild); - chai.assert.isTrue(newChild.nextConnection.isConnected()); - chai.assert.equal(newChild.getNextBlock(), oldChild); + assert.isTrue(parent.getInput('NAME').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('NAME'), newChild); + assert.isTrue(newChild.nextConnection.isConnected()); + assert.equal(newChild.getNextBlock(), oldChild); this.assertBlockCount(3); }); @@ -3496,12 +3463,10 @@ suite('Connection', function () { .getInput('NAME') .connection.connect(newChild1.previousConnection); - chai.assert.isTrue( - parent.getInput('NAME').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('NAME'), newChild1); - chai.assert.isTrue(newChild2.nextConnection.isConnected()); - chai.assert.equal(newChild2.getNextBlock(), oldChild); + assert.isTrue(parent.getInput('NAME').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('NAME'), newChild1); + assert.isTrue(newChild2.nextConnection.isConnected()); + assert.equal(newChild2.getNextBlock(), oldChild); this.assertBlockCount(4); }); @@ -3521,12 +3486,10 @@ suite('Connection', function () { .getInput('NAME') .connection.connect(newChild.previousConnection); - chai.assert.isTrue( - parent.getInput('NAME').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('NAME'), newChild); - chai.assert.isFalse(newChild.nextConnection.isConnected()); - chai.assert.isTrue(spy.calledOnce); + assert.isTrue(parent.getInput('NAME').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('NAME'), newChild); + assert.isFalse(newChild.nextConnection.isConnected()); + assert.isTrue(spy.calledOnce); this.assertBlockCount(3); }); @@ -3546,11 +3509,9 @@ suite('Connection', function () { .getInput('NAME') .connection.connect(newChild.previousConnection); - chai.assert.isTrue( - parent.getInput('NAME').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('NAME'), newChild); - chai.assert.isTrue(spy.calledOnce); + assert.isTrue(parent.getInput('NAME').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('NAME'), newChild); + assert.isTrue(spy.calledOnce); this.assertBlockCount(3); }); }); @@ -3572,12 +3533,10 @@ suite('Connection', function () { .getInput('NAME') .connection.connect(newChild.previousConnection); - chai.assert.isTrue( - parent.getInput('NAME').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('NAME'), newChild); - chai.assert.isTrue(newChild.nextConnection.isConnected()); - chai.assert.equal(newChild.getNextBlock(), oldChild); + assert.isTrue(parent.getInput('NAME').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('NAME'), newChild); + assert.isTrue(newChild.nextConnection.isConnected()); + assert.equal(newChild.getNextBlock(), oldChild); this.assertBlockCount(3); }); @@ -3599,12 +3558,10 @@ suite('Connection', function () { .getInput('NAME') .connection.connect(newChild1.previousConnection); - chai.assert.isTrue( - parent.getInput('NAME').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('NAME'), newChild1); - chai.assert.isTrue(newChild2.nextConnection.isConnected()); - chai.assert.equal(newChild2.getNextBlock(), oldChild); + assert.isTrue(parent.getInput('NAME').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('NAME'), newChild1); + assert.isTrue(newChild2.nextConnection.isConnected()); + assert.equal(newChild2.getNextBlock(), oldChild); this.assertBlockCount(4); }); @@ -3628,13 +3585,11 @@ suite('Connection', function () { .getInput('NAME') .connection.connect(newChild.previousConnection); - chai.assert.isTrue( - parent.getInput('NAME').connection.isConnected(), - ); - chai.assert.equal(parent.getInputTargetBlock('NAME'), newChild); - chai.assert.isTrue(newChild.nextConnection.isConnected()); - chai.assert.isTrue(newChild.getNextBlock().isShadow()); - chai.assert.isTrue(spy.calledOnce); + assert.isTrue(parent.getInput('NAME').connection.isConnected()); + assert.equal(parent.getInputTargetBlock('NAME'), newChild); + assert.isTrue(newChild.nextConnection.isConnected()); + assert.isTrue(newChild.getNextBlock().isShadow()); + assert.isTrue(spy.calledOnce); this.assertBlockCount(4); }); }); @@ -3650,10 +3605,10 @@ suite('Connection', function () { parent.nextConnection.connect(newChild.previousConnection); - chai.assert.isTrue(parent.nextConnection.isConnected()); - chai.assert.equal(parent.getNextBlock(), newChild); - chai.assert.isTrue(newChild.nextConnection.isConnected()); - chai.assert.equal(newChild.getNextBlock(), oldChild); + assert.isTrue(parent.nextConnection.isConnected()); + assert.equal(parent.getNextBlock(), newChild); + assert.isTrue(newChild.nextConnection.isConnected()); + assert.equal(newChild.getNextBlock(), oldChild); this.assertBlockCount(3); }); @@ -3667,10 +3622,10 @@ suite('Connection', function () { parent.nextConnection.connect(newChild1.previousConnection); - chai.assert.isTrue(parent.nextConnection.isConnected()); - chai.assert.equal(parent.getNextBlock(), newChild1); - chai.assert.isTrue(newChild2.nextConnection.isConnected()); - chai.assert.equal(newChild2.getNextBlock(), oldChild); + assert.isTrue(parent.nextConnection.isConnected()); + assert.equal(parent.getNextBlock(), newChild1); + assert.isTrue(newChild2.nextConnection.isConnected()); + assert.equal(newChild2.getNextBlock(), oldChild); this.assertBlockCount(4); }); @@ -3686,10 +3641,10 @@ suite('Connection', function () { parent.nextConnection.connect(newChild.previousConnection); - chai.assert.isTrue(parent.nextConnection.isConnected()); - chai.assert.equal(parent.getNextBlock(), newChild); - chai.assert.isFalse(newChild.nextConnection.isConnected()); - chai.assert.isTrue(spy.calledOnce); + assert.isTrue(parent.nextConnection.isConnected()); + assert.equal(parent.getNextBlock(), newChild); + assert.isFalse(newChild.nextConnection.isConnected()); + assert.isTrue(spy.calledOnce); this.assertBlockCount(3); }); @@ -3705,9 +3660,9 @@ suite('Connection', function () { parent.nextConnection.connect(newChild.previousConnection); - chai.assert.isTrue(parent.nextConnection.isConnected()); - chai.assert.equal(parent.getNextBlock(), newChild); - chai.assert.isTrue(spy.calledOnce); + assert.isTrue(parent.nextConnection.isConnected()); + assert.equal(parent.getNextBlock(), newChild); + assert.isTrue(spy.calledOnce); this.assertBlockCount(3); }); }); @@ -3725,10 +3680,10 @@ suite('Connection', function () { parent.nextConnection.connect(newChild.previousConnection); - chai.assert.isTrue(parent.nextConnection.isConnected()); - chai.assert.equal(parent.getNextBlock(), newChild); - chai.assert.isTrue(newChild.nextConnection.isConnected()); - chai.assert.equal(newChild.getNextBlock(), oldChild); + assert.isTrue(parent.nextConnection.isConnected()); + assert.equal(parent.getNextBlock(), newChild); + assert.isTrue(newChild.nextConnection.isConnected()); + assert.equal(newChild.getNextBlock(), oldChild); this.assertBlockCount(3); }); @@ -3746,10 +3701,10 @@ suite('Connection', function () { parent.nextConnection.connect(newChild1.previousConnection); - chai.assert.isTrue(parent.nextConnection.isConnected()); - chai.assert.equal(parent.getNextBlock(), newChild1); - chai.assert.isTrue(newChild2.nextConnection.isConnected()); - chai.assert.equal(newChild2.getNextBlock(), oldChild); + assert.isTrue(parent.nextConnection.isConnected()); + assert.equal(parent.getNextBlock(), newChild1); + assert.isTrue(newChild2.nextConnection.isConnected()); + assert.equal(newChild2.getNextBlock(), oldChild); this.assertBlockCount(4); }); @@ -3769,11 +3724,11 @@ suite('Connection', function () { parent.nextConnection.connect(newChild.previousConnection); - chai.assert.isTrue(parent.nextConnection.isConnected()); - chai.assert.equal(parent.getNextBlock(), newChild); - chai.assert.isTrue(newChild.nextConnection.isConnected()); - chai.assert.isTrue(newChild.getNextBlock().isShadow()); - chai.assert.isTrue(spy.calledOnce); + assert.isTrue(parent.nextConnection.isConnected()); + assert.equal(parent.getNextBlock(), newChild); + assert.isTrue(newChild.nextConnection.isConnected()); + assert.isTrue(newChild.getNextBlock().isShadow()); + assert.isTrue(spy.calledOnce); this.assertBlockCount(4); }); }); diff --git a/tests/mocha/contextmenu_items_test.js b/tests/mocha/contextmenu_items_test.js index 4596513c68c..b5d480c37b0 100644 --- a/tests/mocha/contextmenu_items_test.js +++ b/tests/mocha/contextmenu_items_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -39,7 +40,7 @@ suite('Context Menu Items', function () { test('Disabled when nothing to undo', function () { const precondition = this.undoOption.preconditionFn(this.scope); - chai.assert.equal( + assert.equal( precondition, 'disabled', 'Should be disabled when there is nothing to undo', @@ -50,7 +51,7 @@ suite('Context Menu Items', function () { // Create a new block, which should be undoable. this.workspace.newBlock('text'); const precondition = this.undoOption.preconditionFn(this.scope); - chai.assert.equal( + assert.equal( precondition, 'enabled', 'Should be enabled when there are actions to undo', @@ -59,9 +60,9 @@ suite('Context Menu Items', function () { test('Undoes adding a new block', function () { this.workspace.newBlock('text'); - chai.assert.equal(this.workspace.getTopBlocks(false).length, 1); + assert.equal(this.workspace.getTopBlocks(false).length, 1); this.undoOption.callback(this.scope); - chai.assert.equal( + assert.equal( this.workspace.getTopBlocks(false).length, 0, 'Should be no blocks after undo', @@ -69,7 +70,7 @@ suite('Context Menu Items', function () { }); test('Has correct label', function () { - chai.assert.equal(this.undoOption.displayText(), 'Undo'); + assert.equal(this.undoOption.displayText(), 'Undo'); }); }); @@ -82,7 +83,7 @@ suite('Context Menu Items', function () { // Create a new block. There should be something to undo, but not redo. this.workspace.newBlock('text'); const precondition = this.redoOption.preconditionFn(this.scope); - chai.assert.equal( + assert.equal( precondition, 'disabled', 'Should be disabled when there is nothing to redo', @@ -94,7 +95,7 @@ suite('Context Menu Items', function () { this.workspace.newBlock('text'); this.workspace.undo(false); const precondition = this.redoOption.preconditionFn(this.scope); - chai.assert.equal( + assert.equal( precondition, 'enabled', 'Should be enabled when there are actions to redo', @@ -105,9 +106,9 @@ suite('Context Menu Items', function () { // Add a new block, then undo it, then redo it. this.workspace.newBlock('text'); this.workspace.undo(false); - chai.assert.equal(this.workspace.getTopBlocks(false).length, 0); + assert.equal(this.workspace.getTopBlocks(false).length, 0); this.redoOption.callback(this.scope); - chai.assert.equal( + assert.equal( this.workspace.getTopBlocks(false).length, 1, 'Should be 1 block after redo', @@ -115,7 +116,7 @@ suite('Context Menu Items', function () { }); test('Has correct label', function () { - chai.assert.equal(this.redoOption.displayText(), 'Redo'); + assert.equal(this.redoOption.displayText(), 'Redo'); }); }); @@ -128,7 +129,7 @@ suite('Context Menu Items', function () { test('Enabled when multiple blocks', function () { this.workspace.newBlock('text'); this.workspace.newBlock('text'); - chai.assert.equal( + assert.equal( this.cleanupOption.preconditionFn(this.scope), 'enabled', 'Should be enabled if there are multiple blocks', @@ -136,7 +137,7 @@ suite('Context Menu Items', function () { }); test('Disabled when no blocks', function () { - chai.assert.equal( + assert.equal( this.cleanupOption.preconditionFn(this.scope), 'disabled', 'Should be disabled if there are no blocks', @@ -145,7 +146,7 @@ suite('Context Menu Items', function () { test('Hidden when not movable', function () { sinon.stub(this.workspace, 'isMovable').returns(false); - chai.assert.equal( + assert.equal( this.cleanupOption.preconditionFn(this.scope), 'hidden', 'Should be hidden if the workspace is not movable', @@ -158,7 +159,7 @@ suite('Context Menu Items', function () { }); test('Has correct label', function () { - chai.assert.equal(this.cleanupOption.displayText(), 'Clean up Blocks'); + assert.equal(this.cleanupOption.displayText(), 'Clean up Blocks'); }); }); @@ -171,7 +172,7 @@ suite('Context Menu Items', function () { this.workspace.newBlock('text'); const block2 = this.workspace.newBlock('text'); block2.setCollapsed(true); - chai.assert.equal( + assert.equal( this.collapseOption.preconditionFn(this.scope), 'enabled', 'Should be enabled when any blocks are expanded', @@ -180,7 +181,7 @@ suite('Context Menu Items', function () { test('Disabled when all blocks collapsed', function () { this.workspace.newBlock('text').setCollapsed(true); - chai.assert.equal( + assert.equal( this.collapseOption.preconditionFn(this.scope), 'disabled', 'Should be disabled when no blocks are expanded', @@ -194,7 +195,7 @@ suite('Context Menu Items', function () { this.scope.workspace = workspaceWithOptions; try { - chai.assert.equal( + assert.equal( this.collapseOption.preconditionFn(this.scope), 'hidden', 'Should be hidden if collapse is disabled in options', @@ -216,18 +217,18 @@ suite('Context Menu Items', function () { this.collapseOption.callback(this.scope); this.clock.runAll(); - chai.assert.isTrue( + assert.isTrue( block1.isCollapsed(), 'Previously collapsed block should still be collapsed', ); - chai.assert.isTrue( + assert.isTrue( block2.isCollapsed(), 'Previously expanded block should now be collapsed', ); }); test('Has correct label', function () { - chai.assert.equal(this.collapseOption.displayText(), 'Collapse Blocks'); + assert.equal(this.collapseOption.displayText(), 'Collapse Blocks'); }); }); @@ -241,7 +242,7 @@ suite('Context Menu Items', function () { const block2 = this.workspace.newBlock('text'); block2.setCollapsed(true); - chai.assert.equal( + assert.equal( this.expandOption.preconditionFn(this.scope), 'enabled', 'Should be enabled when any blocks are collapsed', @@ -250,7 +251,7 @@ suite('Context Menu Items', function () { test('Disabled when no collapsed blocks', function () { this.workspace.newBlock('text'); - chai.assert.equal( + assert.equal( this.expandOption.preconditionFn(this.scope), 'disabled', 'Should be disabled when no blocks are collapsed', @@ -264,7 +265,7 @@ suite('Context Menu Items', function () { this.scope.workspace = workspaceWithOptions; try { - chai.assert.equal( + assert.equal( this.expandOption.preconditionFn(this.scope), 'hidden', 'Should be hidden if collapse is disabled in options', @@ -286,18 +287,18 @@ suite('Context Menu Items', function () { this.expandOption.callback(this.scope); this.clock.runAll(); - chai.assert.isFalse( + assert.isFalse( block1.isCollapsed(), 'Previously expanded block should still be expanded', ); - chai.assert.isFalse( + assert.isFalse( block2.isCollapsed(), 'Previously collapsed block should now be expanded', ); }); test('Has correct label', function () { - chai.assert.equal(this.expandOption.displayText(), 'Expand Blocks'); + assert.equal(this.expandOption.displayText(), 'Expand Blocks'); }); }); @@ -308,17 +309,11 @@ suite('Context Menu Items', function () { test('Enabled when blocks to delete', function () { this.workspace.newBlock('text'); - chai.assert.equal( - this.deleteOption.preconditionFn(this.scope), - 'enabled', - ); + assert.equal(this.deleteOption.preconditionFn(this.scope), 'enabled'); }); test('Disabled when no blocks to delete', function () { - chai.assert.equal( - this.deleteOption.preconditionFn(this.scope), - 'disabled', - ); + assert.equal(this.deleteOption.preconditionFn(this.scope), 'disabled'); }); test('Deletes all blocks after confirming', function () { @@ -332,7 +327,7 @@ suite('Context Menu Items', function () { this.deleteOption.callback(this.scope); this.clock.runAll(); sinon.assert.calledOnce(confirmStub); - chai.assert.equal(this.workspace.getTopBlocks(false).length, 0); + assert.equal(this.workspace.getTopBlocks(false).length, 0); }); test('Does not delete blocks if not confirmed', function () { @@ -346,7 +341,7 @@ suite('Context Menu Items', function () { this.deleteOption.callback(this.scope); this.clock.runAll(); sinon.assert.calledOnce(confirmStub); - chai.assert.equal(this.workspace.getTopBlocks(false).length, 2); + assert.equal(this.workspace.getTopBlocks(false).length, 2); }); test('No dialog for single block', function () { @@ -359,14 +354,14 @@ suite('Context Menu Items', function () { this.clock.runAll(); sinon.assert.notCalled(confirmStub); - chai.assert.equal(this.workspace.getTopBlocks(false).length, 0); + assert.equal(this.workspace.getTopBlocks(false).length, 0); }); test('Has correct label for multiple blocks', function () { this.workspace.newBlock('text'); this.workspace.newBlock('text'); - chai.assert.equal( + assert.equal( this.deleteOption.displayText(this.scope), 'Delete 2 Blocks', ); @@ -374,10 +369,7 @@ suite('Context Menu Items', function () { test('Has correct label for single block', function () { this.workspace.newBlock('text'); - chai.assert.equal( - this.deleteOption.displayText(this.scope), - 'Delete Block', - ); + assert.equal(this.deleteOption.displayText(this.scope), 'Delete Block'); }); }); }); @@ -395,7 +387,7 @@ suite('Context Menu Items', function () { test('Enabled when block is duplicatable', function () { // Block is duplicatable by default - chai.assert.equal( + assert.equal( this.duplicateOption.preconditionFn(this.scope), 'enabled', ); @@ -403,7 +395,7 @@ suite('Context Menu Items', function () { test('Disabled when block is not dupicatable', function () { sinon.stub(this.block, 'isDuplicatable').returns(false); - chai.assert.equal( + assert.equal( this.duplicateOption.preconditionFn(this.scope), 'disabled', ); @@ -411,15 +403,12 @@ suite('Context Menu Items', function () { test('Hidden when in flyout', function () { this.block.isInFlyout = true; - chai.assert.equal( - this.duplicateOption.preconditionFn(this.scope), - 'hidden', - ); + assert.equal(this.duplicateOption.preconditionFn(this.scope), 'hidden'); }); test('the block is duplicated', function () { this.duplicateOption.callback(this.scope); - chai.assert.equal( + assert.equal( this.workspace.getTopBlocks(false).length, 2, 'Expected a second block', @@ -427,7 +416,7 @@ suite('Context Menu Items', function () { }); test('Has correct label', function () { - chai.assert.equal(this.duplicateOption.displayText(), 'Duplicate'); + assert.equal(this.duplicateOption.displayText(), 'Duplicate'); }); }); @@ -437,10 +426,7 @@ suite('Context Menu Items', function () { }); test('Enabled for normal block', function () { - chai.assert.equal( - this.commentOption.preconditionFn(this.scope), - 'enabled', - ); + assert.equal(this.commentOption.preconditionFn(this.scope), 'enabled'); }); test('Hidden for collapsed block', function () { @@ -449,20 +435,17 @@ suite('Context Menu Items', function () { this.block.render(); this.block.setCollapsed(true); - chai.assert.equal( - this.commentOption.preconditionFn(this.scope), - 'hidden', - ); + assert.equal(this.commentOption.preconditionFn(this.scope), 'hidden'); }); test('Creates comment if one did not exist', function () { - chai.assert.isUndefined( + 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(Blockly.icons.CommentIcon.TYPE)); - chai.assert.isEmpty( + assert.exists(this.block.getIcon(Blockly.icons.CommentIcon.TYPE)); + assert.isEmpty( this.block.getCommentText(), 'Block should have empty comment text', ); @@ -471,22 +454,19 @@ suite('Context Menu Items', function () { test('Removes comment if block had one', function () { this.block.setCommentText('Test comment'); this.commentOption.callback(this.scope); - chai.assert.isNull( + assert.isNull( this.block.getCommentText(), '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', - ); + assert.equal(this.commentOption.displayText(this.scope), 'Add Comment'); }); test('Has correct label for remove comment', function () { this.block.setCommentText('Test comment'); - chai.assert.equal( + assert.equal( this.commentOption.displayText(this.scope), 'Remove Comment', ); @@ -501,10 +481,7 @@ suite('Context Menu Items', function () { test('Enabled when inputs to inline', function () { this.block.appendValueInput('test1'); this.block.appendValueInput('test2'); - chai.assert.equal( - this.inlineOption.preconditionFn(this.scope), - 'enabled', - ); + assert.equal(this.inlineOption.preconditionFn(this.scope), 'enabled'); }); }); }); diff --git a/tests/mocha/contextmenu_test.js b/tests/mocha/contextmenu_test.js index 7af9c79186d..b730b250db1 100644 --- a/tests/mocha/contextmenu_test.js +++ b/tests/mocha/contextmenu_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -42,9 +43,9 @@ suite('Context Menu', function () { const callback = callbackFactory(this.forLoopBlock, xmlBlock); const getVarBlock = callback(); - chai.assert.equal(getVarBlock.type, 'variables_get'); - chai.assert.equal(getVarBlock.workspace, this.forLoopBlock.workspace); - chai.assert.equal( + assert.equal(getVarBlock.type, 'variables_get'); + assert.equal(getVarBlock.workspace, this.forLoopBlock.workspace); + assert.equal( getVarBlock.getField('VAR').getVariable().getId(), this.forLoopBlock.getField('VAR').getVariable().getId(), ); @@ -59,9 +60,9 @@ suite('Context Menu', function () { const callback = callbackFactory(this.forLoopBlock, jsonState); const getVarBlock = callback(); - chai.assert.equal(getVarBlock.type, 'variables_get'); - chai.assert.equal(getVarBlock.workspace, this.forLoopBlock.workspace); - chai.assert.equal( + assert.equal(getVarBlock.type, 'variables_get'); + assert.equal(getVarBlock.workspace, this.forLoopBlock.workspace); + assert.equal( getVarBlock.getField('VAR').getVariable().getId(), this.forLoopBlock.getField('VAR').getVariable().getId(), ); diff --git a/tests/mocha/cursor_test.js b/tests/mocha/cursor_test.js index c7b3a76afcc..fcb763304bd 100644 --- a/tests/mocha/cursor_test.js +++ b/tests/mocha/cursor_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -90,7 +91,7 @@ suite('Cursor', function () { this.cursor.setCurNode(prevNode); this.cursor.next(); const curNode = this.cursor.getCurNode(); - chai.assert.equal(curNode.getLocation(), this.blocks.B.previousConnection); + assert.equal(curNode.getLocation(), this.blocks.B.previousConnection); }); test('Next - From last block in a stack go to next connection', function () { const prevNode = ASTNode.createConnectionNode( @@ -99,7 +100,7 @@ suite('Cursor', function () { this.cursor.setCurNode(prevNode); this.cursor.next(); const curNode = this.cursor.getCurNode(); - chai.assert.equal(curNode.getLocation(), this.blocks.B.nextConnection); + assert.equal(curNode.getLocation(), this.blocks.B.nextConnection); }); test('In - From output connection', function () { @@ -110,10 +111,7 @@ suite('Cursor', function () { this.cursor.setCurNode(outputNode); this.cursor.in(); const curNode = this.cursor.getCurNode(); - chai.assert.equal( - curNode.getLocation(), - fieldBlock.inputList[0].fieldRow[0], - ); + assert.equal(curNode.getLocation(), fieldBlock.inputList[0].fieldRow[0]); }); test('Prev - From previous connection skip over next connection', function () { @@ -122,7 +120,7 @@ suite('Cursor', function () { this.cursor.setCurNode(prevConnectionNode); this.cursor.prev(); const curNode = this.cursor.getCurNode(); - chai.assert.equal(curNode.getLocation(), this.blocks.A.previousConnection); + assert.equal(curNode.getLocation(), this.blocks.A.previousConnection); }); test('Out - From field skip over block node', function () { @@ -131,6 +129,6 @@ suite('Cursor', function () { this.cursor.setCurNode(fieldNode); this.cursor.out(); const curNode = this.cursor.getCurNode(); - chai.assert.equal(curNode.getLocation(), this.blocks.E.outputConnection); + assert.equal(curNode.getLocation(), this.blocks.E.outputConnection); }); }); diff --git a/tests/mocha/dropdowndiv_test.js b/tests/mocha/dropdowndiv_test.js index 22066dda4e0..32109bfcadd 100644 --- a/tests/mocha/dropdowndiv_test.js +++ b/tests/mocha/dropdowndiv_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -51,10 +52,10 @@ suite('DropDownDiv', function () { -10, ); // "Above" in value actually means below in render. - chai.assert.isAtLeast(metrics.initialY, 0); - chai.assert.isAbove(metrics.finalY, 0); - chai.assert.isTrue(metrics.arrowVisible); - chai.assert.isTrue(metrics.arrowAtTop); + assert.isAtLeast(metrics.initialY, 0); + assert.isAbove(metrics.finalY, 0); + assert.isTrue(metrics.arrowVisible); + assert.isTrue(metrics.arrowAtTop); }); test('Above, in Bounds', function () { const metrics = Blockly.DropDownDiv.TEST_ONLY.getPositionMetrics( @@ -64,10 +65,10 @@ suite('DropDownDiv', function () { 90, ); // "Below" in value actually means above in render. - chai.assert.isAtMost(metrics.initialY, 100); - chai.assert.isBelow(metrics.finalY, 100); - chai.assert.isTrue(metrics.arrowVisible); - chai.assert.isFalse(metrics.arrowAtTop); + assert.isAtMost(metrics.initialY, 100); + assert.isBelow(metrics.finalY, 100); + assert.isTrue(metrics.arrowVisible); + assert.isFalse(metrics.arrowAtTop); }); test('Below, out of Bounds', function () { const metrics = Blockly.DropDownDiv.TEST_ONLY.getPositionMetrics( @@ -77,10 +78,10 @@ suite('DropDownDiv', function () { 50, ); // "Above" in value actually means below in render. - chai.assert.isAtLeast(metrics.initialY, 60); - chai.assert.isAbove(metrics.finalY, 60); - chai.assert.isTrue(metrics.arrowVisible); - chai.assert.isTrue(metrics.arrowAtTop); + assert.isAtLeast(metrics.initialY, 60); + assert.isAbove(metrics.finalY, 60); + assert.isTrue(metrics.arrowVisible); + assert.isTrue(metrics.arrowAtTop); }); test('Above, in Bounds', function () { const metrics = Blockly.DropDownDiv.TEST_ONLY.getPositionMetrics( @@ -90,10 +91,10 @@ suite('DropDownDiv', function () { 90, ); // "Below" in value actually means above in render. - chai.assert.isAtMost(metrics.initialY, 100); - chai.assert.isBelow(metrics.finalY, 100); - chai.assert.isTrue(metrics.arrowVisible); - chai.assert.isFalse(metrics.arrowAtTop); + assert.isAtMost(metrics.initialY, 100); + assert.isBelow(metrics.finalY, 100); + assert.isTrue(metrics.arrowVisible); + assert.isFalse(metrics.arrowAtTop); }); test('No Solution, Render At Top', function () { this.clientHeightStub.get(function () { @@ -106,10 +107,10 @@ suite('DropDownDiv', function () { 50, ); // "Above" in value actually means below in render. - chai.assert.equal(metrics.initialY, 0); - chai.assert.equal(metrics.finalY, 0); - chai.assert.isFalse(metrics.arrowVisible); - chai.assert.isNotOk(metrics.arrowAtTop); + assert.equal(metrics.initialY, 0); + assert.equal(metrics.finalY, 0); + assert.isFalse(metrics.arrowVisible); + assert.isNotOk(metrics.arrowAtTop); }); }); }); diff --git a/tests/mocha/event_block_change_test.js b/tests/mocha/event_block_change_test.js index 4f4728cc32c..a4de1eddbe6 100644 --- a/tests/mocha/event_block_change_test.js +++ b/tests/mocha/event_block_change_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -45,7 +46,7 @@ suite('Block Change Event', function () { '', ); blockChange.run(false); - chai.assert.isFalse(block.hasInput); + assert.isFalse(block.hasInput); }); test('Redo', function () { @@ -58,7 +59,7 @@ suite('Block Change Event', function () { '', ); blockChange.run(true); - chai.assert.isTrue(block.hasInput); + assert.isTrue(block.hasInput); }); }); @@ -74,7 +75,7 @@ suite('Block Change Event', function () { '{"hasInput":true}', ); blockChange.run(false); - chai.assert.isFalse(block.hasInput); + assert.isFalse(block.hasInput); }); test('Redo', function () { @@ -87,7 +88,7 @@ suite('Block Change Event', function () { '{"hasInput":true}', ); blockChange.run(true); - chai.assert.isTrue(block.hasInput); + assert.isTrue(block.hasInput); }); }); }); @@ -119,7 +120,7 @@ suite('Block Change Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_block_create_test.js b/tests/mocha/event_block_create_test.js index f3aed672f49..4ca6fb22a5a 100644 --- a/tests/mocha/event_block_create_test.js +++ b/tests/mocha/event_block_create_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import {assertEventFired} from './test_helpers/events.js'; import * as eventUtils from '../../build/src/core/events/utils.js'; import { @@ -53,7 +54,7 @@ suite('Block Create Event', function () { ); const calls = this.eventsFireStub.getCalls(); const event = calls[calls.length - 1].args[0]; - chai.assert.equal(event.xml.tagName, 'shadow'); + assert.equal(event.xml.tagName, 'shadow'); }); test('Does not create extra shadow blocks', function () { @@ -85,7 +86,7 @@ suite('Block Create Event', function () { event.run(true); const blocksAfter = this.workspace.getAllBlocks(); - chai.assert.deepEqual( + assert.deepEqual( blocksAfter, blocksBefore, 'No new blocks should be created from an event that only creates shadow blocks', @@ -102,7 +103,7 @@ suite('Block Create Event', function () { delete origEvent.xml; // xml fails deep equals for some reason. delete newEvent.xml; // xml fails deep equals for some reason. - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_block_delete_test.js b/tests/mocha/event_block_delete_test.js index 1aa70c4d1ab..d74b6aa062b 100644 --- a/tests/mocha/event_block_delete_test.js +++ b/tests/mocha/event_block_delete_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import {defineRowBlock} from './test_helpers/block_definitions.js'; import { sharedTestSetup, @@ -34,7 +35,7 @@ suite('Block Delete Event', function () { testBlock.dispose(); this.clock.runAll(); - chai.assert.isFalse(spy.called); + assert.isFalse(spy.called); }); }); @@ -48,7 +49,7 @@ suite('Block Delete Event', function () { delete origEvent.oldXml; // xml fails deep equals for some reason. delete newEvent.oldXml; // xml fails deep equals for some reason. - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_block_drag_test.js b/tests/mocha/event_block_drag_test.js index 8a5399c8bde..9b0f2031ad0 100644 --- a/tests/mocha/event_block_drag_test.js +++ b/tests/mocha/event_block_drag_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import {defineRowBlock} from './test_helpers/block_definitions.js'; import { sharedTestSetup, @@ -29,7 +30,7 @@ suite('Block Drag Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_block_field_intermediate_change_test.js b/tests/mocha/event_block_field_intermediate_change_test.js index 4d441e5d6a4..0ff4e1bbf3c 100644 --- a/tests/mocha/event_block_field_intermediate_change_test.js +++ b/tests/mocha/event_block_field_intermediate_change_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -32,7 +33,7 @@ suite('Field Intermediate Change Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); @@ -47,10 +48,7 @@ suite('Field Intermediate Change Event', function () { ); origEvent.run(true); - chai.assert.deepEqual( - block.getField(origEvent.name).getValue(), - 'new value', - ); + assert.deepEqual(block.getField(origEvent.name).getValue(), 'new value'); }); test("running backward changes the block's value to old value", function () { @@ -63,10 +61,7 @@ suite('Field Intermediate Change Event', function () { ); origEvent.run(false); - chai.assert.deepEqual( - block.getField(origEvent.name).getValue(), - 'old value', - ); + assert.deepEqual(block.getField(origEvent.name).getValue(), 'old value'); }); }); }); diff --git a/tests/mocha/event_block_move_test.js b/tests/mocha/event_block_move_test.js index 2b4102de6a0..b93457e14c1 100644 --- a/tests/mocha/event_block_move_test.js +++ b/tests/mocha/event_block_move_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import {defineRowBlock} from './test_helpers/block_definitions.js'; import { sharedTestSetup, @@ -32,7 +33,7 @@ suite('Block Move Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_bubble_open_test.js b/tests/mocha/event_bubble_open_test.js index 54e48aa9cff..099a625f6e2 100644 --- a/tests/mocha/event_bubble_open_test.js +++ b/tests/mocha/event_bubble_open_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import {defineMutatorBlocks} from './test_helpers/block_definitions.js'; import { sharedTestSetup, @@ -35,7 +36,7 @@ suite('Bubble Open Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_click_test.js b/tests/mocha/event_click_test.js index ec998b62de4..6e18769485b 100644 --- a/tests/mocha/event_click_test.js +++ b/tests/mocha/event_click_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import {defineRowBlock} from './test_helpers/block_definitions.js'; import { sharedTestSetup, @@ -33,7 +34,7 @@ suite('Click Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_comment_change_test.js b/tests/mocha/event_comment_change_test.js index c2355f87462..ed5f4d9f6ae 100644 --- a/tests/mocha/event_comment_change_test.js +++ b/tests/mocha/event_comment_change_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -32,7 +33,7 @@ suite('Comment Change Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_comment_collapse_test.js b/tests/mocha/event_comment_collapse_test.js index 86b36b07588..e2d27530708 100644 --- a/tests/mocha/event_comment_collapse_test.js +++ b/tests/mocha/event_comment_collapse_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -27,7 +28,7 @@ suite('Comment Collapse Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_comment_create_test.js b/tests/mocha/event_comment_create_test.js index 57c246f1f1e..df919541d95 100644 --- a/tests/mocha/event_comment_create_test.js +++ b/tests/mocha/event_comment_create_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -31,7 +32,7 @@ suite('Comment Create Event', function () { delete origEvent.xml; // xml fails deep equals for some reason. delete newEvent.xml; // xml fails deep equals for some reason. - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_comment_delete_test.js b/tests/mocha/event_comment_delete_test.js index e0a8a98db33..2e2bb45c491 100644 --- a/tests/mocha/event_comment_delete_test.js +++ b/tests/mocha/event_comment_delete_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -31,7 +32,7 @@ suite('Comment Delete Event', function () { delete origEvent.xml; // xml fails deep equals for some reason. delete newEvent.xml; // xml fails deep equals for some reason. - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_comment_move_test.js b/tests/mocha/event_comment_move_test.js index 420bdbb52de..aae3fdfe632 100644 --- a/tests/mocha/event_comment_move_test.js +++ b/tests/mocha/event_comment_move_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -33,7 +34,7 @@ suite('Comment Move Event', function () { delete origEvent.comment_; // Ignore private properties. delete newEvent.comment_; // Ignore private properties. - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_marker_move_test.js b/tests/mocha/event_marker_move_test.js index 26238dc43db..cd5609c33d7 100644 --- a/tests/mocha/event_marker_move_test.js +++ b/tests/mocha/event_marker_move_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import {defineRowBlock} from './test_helpers/block_definitions.js'; import { sharedTestSetup, @@ -37,7 +38,7 @@ suite('Marker Move Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_selected_test.js b/tests/mocha/event_selected_test.js index 3c69889f2b1..1ce8306db48 100644 --- a/tests/mocha/event_selected_test.js +++ b/tests/mocha/event_selected_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import {defineRowBlock} from './test_helpers/block_definitions.js'; import { sharedTestSetup, @@ -34,7 +35,7 @@ suite('Selected Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_test.js b/tests/mocha/event_test.js index 75688c6547e..4709297d845 100644 --- a/tests/mocha/event_test.js +++ b/tests/mocha/event_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import * as Blockly from '../../build/src/core/blockly.js'; import {ASTNode} from '../../build/src/core/keyboard_nav/ast_node.js'; import { @@ -916,10 +917,7 @@ suite('Events', function () { const json = event.toJson(); const event2 = Blockly.Events.fromJson(json, this.workspace); - chai.assert.equal( - safeStringify(event2.toJson()), - safeStringify(json), - ); + assert.equal(safeStringify(event2.toJson()), safeStringify(json)); }); }); }); @@ -931,10 +929,7 @@ suite('Events', function () { const json = event.toJson(); const expectedJson = testCase.getExpectedJson(this); - chai.assert.equal( - safeStringify(json), - safeStringify(expectedJson), - ); + assert.equal(safeStringify(json), safeStringify(expectedJson)); }); } }); @@ -958,10 +953,10 @@ suite('Events', function () { */ function checkVariableValues(container, name, type, id) { const variable = container.getVariableById(id); - chai.assert.isDefined(variable); - chai.assert.equal(name, variable.name); - chai.assert.equal(type, variable.type); - chai.assert.equal(id, variable.getId()); + assert.isDefined(variable); + assert.equal(name, variable.name); + assert.equal(type, variable.type); + assert.equal(id, variable.getId()); } suite('Constructors', function () { @@ -1036,29 +1031,29 @@ suite('Events', function () { }; const event = eventUtils.fromJson(json, this.workspace); const x = this.workspace.getVariableById('id2'); - chai.assert.isNull(x); + assert.isNull(x); event.run(true); assertVariableValues(this.workspace, 'name2', 'type2', 'id2'); }); test('Var delete', function () { const event = new Blockly.Events.VarDelete(this.variable); - chai.assert.isNotNull(this.workspace.getVariableById('id1')); + assert.isNotNull(this.workspace.getVariableById('id1')); event.run(true); - chai.assert.isNull(this.workspace.getVariableById('id1')); + assert.isNull(this.workspace.getVariableById('id1')); }); test('Var rename', function () { const event = new Blockly.Events.VarRename(this.variable, 'name2'); event.run(true); - chai.assert.isNull(this.workspace.getVariable('name1')); + assert.isNull(this.workspace.getVariable('name1')); checkVariableValues(this.workspace, 'name2', 'type1', 'id1'); }); }); suite('Run Backward', function () { test('Var create', function () { const event = new Blockly.Events.VarCreate(this.variable); - chai.assert.isNotNull(this.workspace.getVariableById('id1')); + assert.isNotNull(this.workspace.getVariableById('id1')); event.run(false); }); @@ -1070,7 +1065,7 @@ suite('Events', function () { varName: 'name2', }; const event = eventUtils.fromJson(json, this.workspace); - chai.assert.isNull(this.workspace.getVariableById('id2')); + assert.isNull(this.workspace.getVariableById('id2')); event.run(false); assertVariableValues(this.workspace, 'name2', 'type2', 'id2'); }); @@ -1078,7 +1073,7 @@ suite('Events', function () { test('Var rename', function () { const event = new Blockly.Events.VarRename(this.variable, 'name2'); event.run(false); - chai.assert.isNull(this.workspace.getVariable('name2')); + assert.isNull(this.workspace.getVariable('name2')); checkVariableValues(this.workspace, 'name1', 'type1', 'id1'); }); }); @@ -1106,16 +1101,12 @@ suite('Events', function () { new Blockly.Events.Click(block), ]; const filteredEvents = eventUtils.filter(events, true); - chai.assert.equal(filteredEvents.length, 4); // no event should have been removed. + 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, - ); - chai.assert.isTrue(filteredEvents[1] instanceof Blockly.Events.BlockMove); - chai.assert.isTrue( - filteredEvents[2] instanceof Blockly.Events.BlockChange, - ); - chai.assert.isTrue(filteredEvents[3] instanceof Blockly.Events.Click); + assert.isTrue(filteredEvents[0] instanceof Blockly.Events.BlockCreate); + assert.isTrue(filteredEvents[1] instanceof Blockly.Events.BlockMove); + assert.isTrue(filteredEvents[2] instanceof Blockly.Events.BlockChange); + assert.isTrue(filteredEvents[3] instanceof Blockly.Events.Click); }); test('Different blocks no removed', function () { @@ -1128,7 +1119,7 @@ suite('Events', function () { new Blockly.Events.BlockMove(block2), ]; const filteredEvents = eventUtils.filter(events, true); - chai.assert.equal(filteredEvents.length, 4); // no event should have been removed. + assert.equal(filteredEvents.length, 4); // no event should have been removed. }); test('Forward', function () { @@ -1138,14 +1129,12 @@ suite('Events', function () { addMoveEvent(events, block, 2, 2); addMoveEvent(events, block, 3, 3); const filteredEvents = eventUtils.filter(events, true); - chai.assert.equal(filteredEvents.length, 2); // duplicate moves should have been removed. + 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, - ); - chai.assert.isTrue(filteredEvents[1] instanceof Blockly.Events.BlockMove); - chai.assert.equal(filteredEvents[1].newCoordinate.x, 3); - chai.assert.equal(filteredEvents[1].newCoordinate.y, 3); + assert.isTrue(filteredEvents[0] instanceof Blockly.Events.BlockCreate); + assert.isTrue(filteredEvents[1] instanceof Blockly.Events.BlockMove); + assert.equal(filteredEvents[1].newCoordinate.x, 3); + assert.equal(filteredEvents[1].newCoordinate.y, 3); }); test('Backward', function () { @@ -1155,14 +1144,12 @@ suite('Events', function () { addMoveEvent(events, block, 2, 2); addMoveEvent(events, block, 3, 3); const filteredEvents = eventUtils.filter(events, false); - chai.assert.equal(filteredEvents.length, 2); // duplicate event should have been removed. + 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, - ); - chai.assert.isTrue(filteredEvents[1] instanceof Blockly.Events.BlockMove); - chai.assert.equal(filteredEvents[1].newCoordinate.x, 1); - chai.assert.equal(filteredEvents[1].newCoordinate.y, 1); + assert.isTrue(filteredEvents[0] instanceof Blockly.Events.BlockCreate); + assert.isTrue(filteredEvents[1] instanceof Blockly.Events.BlockMove); + assert.equal(filteredEvents[1].newCoordinate.x, 1); + assert.equal(filteredEvents[1].newCoordinate.y, 1); }); test('Merge block move events', function () { @@ -1171,9 +1158,9 @@ suite('Events', function () { addMoveEvent(events, block, 0, 0); addMoveEvent(events, block, 1, 1); const filteredEvents = eventUtils.filter(events, true); - chai.assert.equal(filteredEvents.length, 1); // second move event merged into first - chai.assert.equal(filteredEvents[0].newCoordinate.x, 1); - chai.assert.equal(filteredEvents[0].newCoordinate.y, 1); + assert.equal(filteredEvents.length, 1); // second move event merged into first + assert.equal(filteredEvents[0].newCoordinate.x, 1); + assert.equal(filteredEvents[0].newCoordinate.y, 1); }); test('Merge block change events', function () { @@ -1189,9 +1176,9 @@ suite('Events', function () { ), ]; const filteredEvents = eventUtils.filter(events, true); - chai.assert.equal(filteredEvents.length, 1); // second change event merged into first - chai.assert.equal(filteredEvents[0].oldValue, 'item'); - chai.assert.equal(filteredEvents[0].newValue, 'item2'); + assert.equal(filteredEvents.length, 1); // second change event merged into first + assert.equal(filteredEvents[0].oldValue, 'item'); + assert.equal(filteredEvents[0].newValue, 'item2'); }); test('Merge viewport change events', function () { @@ -1200,11 +1187,11 @@ suite('Events', function () { new Blockly.Events.ViewportChange(5, 6, 7, this.workspace, 8), ]; const filteredEvents = eventUtils.filter(events, true); - chai.assert.equal(filteredEvents.length, 1); // second change event merged into first - chai.assert.equal(filteredEvents[0].viewTop, 5); - chai.assert.equal(filteredEvents[0].viewLeft, 6); - chai.assert.equal(filteredEvents[0].scale, 7); - chai.assert.equal(filteredEvents[0].oldScale, 8); + assert.equal(filteredEvents.length, 1); // second change event merged into first + assert.equal(filteredEvents[0].viewTop, 5); + assert.equal(filteredEvents[0].viewLeft, 6); + assert.equal(filteredEvents[0].scale, 7); + assert.equal(filteredEvents[0].oldScale, 8); }); test('Merge ui events', function () { @@ -1221,19 +1208,13 @@ suite('Events', function () { ]; const filteredEvents = eventUtils.filter(events, true); // click event merged into corresponding *Open event - chai.assert.equal(filteredEvents.length, 3); - chai.assert.isTrue( - filteredEvents[0] instanceof Blockly.Events.BubbleOpen, - ); - chai.assert.isTrue( - filteredEvents[1] instanceof Blockly.Events.BubbleOpen, - ); - chai.assert.isTrue( - filteredEvents[2] instanceof Blockly.Events.BubbleOpen, - ); - chai.assert.equal(filteredEvents[0].bubbleType, 'comment'); - chai.assert.equal(filteredEvents[1].bubbleType, 'mutator'); - chai.assert.equal(filteredEvents[2].bubbleType, 'warning'); + assert.equal(filteredEvents.length, 3); + assert.isTrue(filteredEvents[0] instanceof Blockly.Events.BubbleOpen); + assert.isTrue(filteredEvents[1] instanceof Blockly.Events.BubbleOpen); + assert.isTrue(filteredEvents[2] instanceof Blockly.Events.BubbleOpen); + assert.equal(filteredEvents[0].bubbleType, 'comment'); + assert.equal(filteredEvents[1].bubbleType, 'mutator'); + assert.equal(filteredEvents[2].bubbleType, 'warning'); }); test('Colliding events not dropped', function () { @@ -1246,9 +1227,9 @@ suite('Events', function () { ]; const filteredEvents = eventUtils.filter(events, true); // click and stackclick should both exist - chai.assert.equal(filteredEvents.length, 2); - chai.assert.isTrue(filteredEvents[0] instanceof Blockly.Events.Click); - chai.assert.equal(filteredEvents[1].isStart, true); + assert.equal(filteredEvents.length, 2); + assert.isTrue(filteredEvents[0] instanceof Blockly.Events.Click); + assert.equal(filteredEvents[1].isStart, true); }); test('Merging null operations dropped', function () { @@ -1267,7 +1248,7 @@ suite('Events', function () { const filteredEvents = eventUtils.filter(events, true); // The two events should be merged, but because nothing has changed // they will be filtered out. - chai.assert.equal(filteredEvents.length, 0); + assert.equal(filteredEvents.length, 0); }); test('Move events different blocks not merged', function () { @@ -1287,14 +1268,12 @@ suite('Events', function () { const filteredEvents = eventUtils.filter(events, true); // Nothing should have merged. - chai.assert.equal(filteredEvents.length, 4); + assert.equal(filteredEvents.length, 4); // test that the order hasn't changed - 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, - ); - chai.assert.isTrue(filteredEvents[3] instanceof Blockly.Events.BlockMove); + assert.isTrue(filteredEvents[0] instanceof Blockly.Events.BlockMove); + assert.isTrue(filteredEvents[1] instanceof Blockly.Events.BlockMove); + assert.isTrue(filteredEvents[2] instanceof Blockly.Events.BlockDelete); + assert.isTrue(filteredEvents[3] instanceof Blockly.Events.BlockMove); }); }); @@ -1344,7 +1323,7 @@ suite('Events', function () { ); // Expect the workspace to not have a variable with ID 'test_block_id'. - chai.assert.isNull(this.workspace.getVariableById(TEST_BLOCK_ID)); + assert.isNull(this.workspace.getVariableById(TEST_BLOCK_ID)); } finally { workspaceTeardown.call(this, workspaceSvg); } @@ -1374,11 +1353,7 @@ suite('Events', function () { // Expect both events to trigger change listener. sinon.assert.calledTwice(this.changeListenerSpy); // Both events should be on undo stack - chai.assert.equal( - this.workspace.undoStack_.length, - 2, - 'Undo stack length', - ); + assert.equal(this.workspace.undoStack_.length, 2, 'Undo stack length'); assertNthCallEventArgEquals( this.changeListenerSpy, @@ -1398,7 +1373,7 @@ suite('Events', function () { ); // Expect the workspace to have a variable with ID 'test_var_id'. - chai.assert.isNotNull(this.workspace.getVariableById(TEST_VAR_ID)); + assert.isNotNull(this.workspace.getVariableById(TEST_VAR_ID)); }); test('New block new var xml', function () { @@ -1432,11 +1407,7 @@ suite('Events', function () { // The first varCreate and move event should have been ignored. sinon.assert.callCount(this.changeListenerSpy, 3); // Expect two events on undo stack: varCreate and block create. - chai.assert.equal( - this.workspace.undoStack_.length, - 2, - 'Undo stack length', - ); + assert.equal(this.workspace.undoStack_.length, 2, 'Undo stack length'); assertNthCallEventArgEquals( this.changeListenerSpy, @@ -1466,7 +1437,7 @@ suite('Events', function () { ); // Expect the workspace to have a variable with ID 'test_var_id'. - chai.assert.isNotNull(this.workspace.getVariableById(TEST_VAR_ID)); + assert.isNotNull(this.workspace.getVariableById(TEST_VAR_ID)); }); }); suite('Disable orphans', function () { @@ -1487,7 +1458,7 @@ suite('Events', function () { // Fire all events this.clock.runAll(); - chai.assert.isFalse( + assert.isFalse( block.isEnabled(), 'Expected orphan block to be disabled after creation', ); @@ -1503,7 +1474,7 @@ suite('Events', function () { // Fire all events this.clock.runAll(); - chai.assert.isTrue( + assert.isTrue( functionBlock.isEnabled(), 'Expected top-level procedure block to be enabled', ); @@ -1527,7 +1498,7 @@ suite('Events', function () { // Fire all events this.clock.runAll(); - chai.assert.isFalse( + assert.isFalse( block.isEnabled(), 'Expected disconnected block to be disabled', ); @@ -1548,7 +1519,7 @@ suite('Events', function () { // Fire all events this.clock.runAll(); - chai.assert.isTrue( + assert.isTrue( block.isEnabled(), 'Expected block to be enabled after connecting to parent', ); @@ -1575,7 +1546,7 @@ suite('Events', function () { const disabledEvents = this.workspace.getUndoStack().filter(function (e) { return e.element === 'disabled'; }); - chai.assert.isEmpty( + assert.isEmpty( disabledEvents, '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 155e373a3f9..f20f745b6a0 100644 --- a/tests/mocha/event_theme_change_test.js +++ b/tests/mocha/event_theme_change_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -29,7 +30,7 @@ suite('Theme Change Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_toolbox_item_select_test.js b/tests/mocha/event_toolbox_item_select_test.js index 82f8e4863b2..bf6a9a46212 100644 --- a/tests/mocha/event_toolbox_item_select_test.js +++ b/tests/mocha/event_toolbox_item_select_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -57,7 +58,7 @@ suite('Toolbox Item Select Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_trashcan_open_test.js b/tests/mocha/event_trashcan_open_test.js index 84c2abd9c56..2c809f2dfad 100644 --- a/tests/mocha/event_trashcan_open_test.js +++ b/tests/mocha/event_trashcan_open_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -29,7 +30,7 @@ suite('Trashcan Open Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_var_create_test.js b/tests/mocha/event_var_create_test.js index 003cd11b5a2..e374c496541 100644 --- a/tests/mocha/event_var_create_test.js +++ b/tests/mocha/event_var_create_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -32,7 +33,7 @@ suite('Var Create Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); test('typed variable events round-trip through JSON', function () { @@ -47,7 +48,7 @@ suite('Var Create Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_var_delete_test.js b/tests/mocha/event_var_delete_test.js index 7bad8eb7b73..b06943d9a19 100644 --- a/tests/mocha/event_var_delete_test.js +++ b/tests/mocha/event_var_delete_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -32,7 +33,7 @@ suite('Var Delete Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); test('typed variable events round-trip through JSON', function () { @@ -47,7 +48,7 @@ suite('Var Delete Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_var_rename_test.js b/tests/mocha/event_var_rename_test.js index 0c8fb80cdad..7fbd185ab7b 100644 --- a/tests/mocha/event_var_rename_test.js +++ b/tests/mocha/event_var_rename_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -32,7 +33,7 @@ suite('Var Rename Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/event_viewport_test.js b/tests/mocha/event_viewport_test.js index 7913e7bf507..edacc0da6cb 100644 --- a/tests/mocha/event_viewport_test.js +++ b/tests/mocha/event_viewport_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -32,7 +33,7 @@ suite('Viewport Change Event', function () { const json = origEvent.toJson(); const newEvent = new Blockly.Events.fromJson(json, this.workspace); - chai.assert.deepEqual(newEvent, origEvent); + assert.deepEqual(newEvent, origEvent); }); }); }); diff --git a/tests/mocha/extensions_test.js b/tests/mocha/extensions_test.js index 8eb37e75df7..66772cbea4b 100644 --- a/tests/mocha/extensions_test.js +++ b/tests/mocha/extensions_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -27,7 +28,7 @@ suite('Extensions', function () { this.extensionsCleanup_.push('extensions_test_before'); this.extensionsCleanup_.push('extensions_test_after'); - chai.assert.isUndefined( + assert.isUndefined( Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test_before'], ); const beforeCallback = sinon.spy(); @@ -42,18 +43,18 @@ suite('Extensions', function () { }, ]); - chai.assert.isUndefined( + assert.isUndefined( Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test_after'], ); const afterCallback = sinon.spy(); // Extension defined after the block type (but before instantiation). Blockly.Extensions.register('extensions_test_after', afterCallback); - chai.assert.typeOf( + assert.typeOf( Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test_before'], 'function', ); - chai.assert.typeOf( + assert.typeOf( Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test_after'], 'function', ); @@ -98,27 +99,27 @@ suite('Extensions', function () { ); // Tooltip is dynamic after extension initialization. - chai.assert.typeOf(block.tooltip, 'function'); - chai.assert.equal(block.tooltip(), defaultTooltip); + assert.typeOf(block.tooltip, 'function'); + assert.equal(block.tooltip(), defaultTooltip); // Tooltip is normal before connected to parent. const parent = new Blockly.Block(this.workspace, 'test_parent'); - chai.assert.equal(parent.tooltip, parentTooltip); - chai.assert.notExists(parent.inputsInline); + assert.equal(parent.tooltip, parentTooltip); + assert.notExists(parent.inputsInline); // Tooltip is normal when parent is not inline. parent.getInput('INPUT').connection.connect(block.outputConnection); - chai.assert.equal(block.getParent(), parent); - chai.assert.equal(block.tooltip(), defaultTooltip); + assert.equal(block.getParent(), parent); + assert.equal(block.tooltip(), defaultTooltip); // Tooltip is parent's when parent is inline. parent.setInputsInline(true); - chai.assert.equal(block.tooltip(), parentTooltip); + assert.equal(block.tooltip(), parentTooltip); // Tooltip revert when disconnected. parent.getInput('INPUT').connection.disconnect(); - chai.assert.notExists(block.getParent()); - chai.assert.equal(block.tooltip(), defaultTooltip); + assert.notExists(block.getParent()); + assert.equal(block.tooltip(), defaultTooltip); }); suite('Mixin', function () { @@ -132,13 +133,13 @@ suite('Extensions', function () { }, }; - chai.assert.isUndefined( + assert.isUndefined( Blockly.Extensions.TEST_ONLY.allExtensions['mixin_test'], ); // Extension defined before the block type is defined. Blockly.Extensions.registerMixin('mixin_test', testMixin); - chai.assert.typeOf( + assert.typeOf( Blockly.Extensions.TEST_ONLY.allExtensions['mixin_test'], 'function', ); @@ -153,8 +154,8 @@ suite('Extensions', function () { const block = new Blockly.Block(this.workspace, 'test_block_mixin'); - chai.assert.equal(testMixin.field, block.field); - chai.assert.equal(testMixin.method, block.method); + assert.equal(testMixin.field, block.field); + assert.equal(testMixin.method, block.method); }); suite('Mutator', function () { @@ -190,10 +191,10 @@ suite('Extensions', function () { const block = new Blockly.Block(this.workspace, 'mutator_test_block'); // Make sure all of the functions were installed correctly. - chai.assert.equal(block.domToMutation(), 'domToMutationFn'); - chai.assert.equal(block.mutationToDom(), 'mutationToDomFn'); - chai.assert.equal(block.compose(), 'composeFn'); - chai.assert.equal(block.decompose(), 'decomposeFn'); + assert.equal(block.domToMutation(), 'domToMutationFn'); + assert.equal(block.mutationToDom(), 'mutationToDomFn'); + assert.equal(block.compose(), 'composeFn'); + assert.equal(block.decompose(), 'decomposeFn'); }); test('With helper function', function () { @@ -210,7 +211,7 @@ suite('Extensions', function () { // Events code calls mutationToDom and expects it to give back a // meaningful value. Blockly.Events.disable(); - chai.assert.isUndefined( + assert.isUndefined( Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test'], ); const helperFunctionSpy = sinon.spy(); @@ -246,7 +247,7 @@ suite('Extensions', function () { // Events code calls mutationToDom and expects it to give back a // meaningful value. Blockly.Events.disable(); - chai.assert.isUndefined( + assert.isUndefined( Blockly.Extensions.TEST_ONLY.allExtensions['mutator_test'], ); Blockly.Extensions.registerMutator('mutator_test', { @@ -261,10 +262,10 @@ suite('Extensions', function () { const block = new Blockly.Block(this.workspace, 'mutator_test_block'); // Make sure all of the functions were installed correctly. - chai.assert.equal(block.domToMutation(), 'domToMutationFn'); - chai.assert.equal(block.mutationToDom(), 'mutationToDomFn'); - chai.assert.isUndefined(block['compose']); - chai.assert.isUndefined(block['decompose']); + assert.equal(block.domToMutation(), 'domToMutationFn'); + assert.equal(block.mutationToDom(), 'mutationToDomFn'); + assert.isUndefined(block['compose']); + assert.isUndefined(block['decompose']); }); }); }); @@ -279,11 +280,11 @@ suite('Extensions', function () { }, ]); - chai.assert.isUndefined( + assert.isUndefined( Blockly.Extensions.TEST_ONLY.allExtensions['missing_extension'], ); const workspace = this.workspace; - chai.assert.throws(function () { + assert.throws(function () { const _ = new Blockly.Block(workspace, 'missing_extension_block'); }); }); @@ -295,7 +296,7 @@ suite('Extensions', function () { inputList: 'bad inputList', // Defined in constructor }; - chai.assert.isUndefined( + assert.isUndefined( Blockly.Extensions.TEST_ONLY.allExtensions['mixin_bad_inputList'], ); // Extension defined before the block type is defined. @@ -303,7 +304,7 @@ suite('Extensions', function () { 'mixin_bad_inputList', TEST_MIXIN_BAD_INPUTLIST, ); - chai.assert.typeOf( + assert.typeOf( Blockly.Extensions.TEST_ONLY.allExtensions['mixin_bad_inputList'], 'function', ); @@ -317,7 +318,7 @@ suite('Extensions', function () { ]); const workspace = this.workspace; - chai.assert.throws(function () { + assert.throws(function () { const _ = new Blockly.Block(workspace, 'test_block_bad_inputList'); }, /inputList/); }); @@ -329,7 +330,7 @@ suite('Extensions', function () { colour_: 'bad colour_', // Defined on prototype }; - chai.assert.isUndefined( + assert.isUndefined( Blockly.Extensions.TEST_ONLY.allExtensions['mixin_bad_colour_'], ); // Extension defined before the block type is defined. @@ -337,7 +338,7 @@ suite('Extensions', function () { 'mixin_bad_colour_', TEST_MIXIN_BAD_COLOUR, ); - chai.assert.typeOf( + assert.typeOf( Blockly.Extensions.TEST_ONLY.allExtensions['mixin_bad_colour_'], 'function', ); @@ -351,7 +352,7 @@ suite('Extensions', function () { ]); const workspace = this.workspace; - chai.assert.throws(function () { + assert.throws(function () { const _ = new Blockly.Block(workspace, 'test_block_bad_colour'); }, /colour_/); }); @@ -370,7 +371,7 @@ suite('Extensions', function () { // Events code calls mutationToDom and expects it to give back a // meaningful value. Blockly.Events.disable(); - chai.assert.isUndefined( + assert.isUndefined( Blockly.Extensions.TEST_ONLY.allExtensions['mutator_test'], ); Blockly.Extensions.registerMutator('mutator_test', { @@ -383,11 +384,11 @@ suite('Extensions', function () { }); const workspace = this.workspace; - chai.assert.throws(function () { + assert.throws(function () { const _ = new Blockly.Block(workspace, 'mutator_test_block'); }); // Should have failed on apply, not on register. - chai.assert.isNotNull( + assert.isNotNull( Blockly.Extensions.TEST_ONLY.allExtensions['mutator_test'], ); }); @@ -406,7 +407,7 @@ suite('Extensions', function () { // Events code calls mutationToDom and expects it to give back a // meaningful value. Blockly.Events.disable(); - chai.assert.isUndefined( + assert.isUndefined( Blockly.Extensions.TEST_ONLY.allExtensions['mutator_test'], ); Blockly.Extensions.registerMixin('mutator_test', { @@ -419,11 +420,11 @@ suite('Extensions', function () { }); const workspace = this.workspace; - chai.assert.throws(function () { + assert.throws(function () { const _ = new Blockly.Block(workspace, 'mutator_test_block'); }); // Should have failed on apply, not on register. - chai.assert.isNotNull( + assert.isNotNull( Blockly.Extensions.TEST_ONLY.allExtensions['mutator_test'], ); }); @@ -442,7 +443,7 @@ suite('Extensions', function () { // Events code calls mutationToDom and expects it to give back a // meaningful value. Blockly.Events.disable(); - chai.assert.isUndefined( + assert.isUndefined( Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test'], ); Blockly.Extensions.register('extensions_test', function () { @@ -450,11 +451,11 @@ suite('Extensions', function () { }); const workspace = this.workspace; - chai.assert.throws(function () { + assert.throws(function () { const _ = new Blockly.Block(workspace, 'mutator_test_block'); }); // Should have failed on apply, not on register. - chai.assert.isNotNull( + assert.isNotNull( Blockly.Extensions.TEST_ONLY.allExtensions['extensions_test'], ); }); @@ -462,30 +463,30 @@ suite('Extensions', function () { suite('register', function () { test('Just a string', function () { this.extensionsCleanup_.push('extension_just_a_string'); - chai.assert.isUndefined( + assert.isUndefined( Blockly.Extensions.TEST_ONLY.allExtensions['extension_just_a_string'], ); - chai.assert.throws(function () { + assert.throws(function () { Blockly.Extensions.register('extension_just_a_string', null); }); }); test('Null', function () { this.extensionsCleanup_.push('extension_is_null'); - chai.assert.isUndefined( + assert.isUndefined( Blockly.Extensions.TEST_ONLY.allExtensions['extension_is_null'], ); - chai.assert.throws(function () { + assert.throws(function () { Blockly.Extensions.register('extension_is_null', null); }); }); test('Undefined', function () { this.extensionsCleanup_.push('extension_is_undefined'); - chai.assert.isUndefined( + assert.isUndefined( Blockly.Extensions.TEST_ONLY.allExtensions['extension_is_undefined'], ); - chai.assert.throws(function () { + assert.throws(function () { Blockly.Extensions.register('extension_is_undefined', null); }); }); @@ -494,7 +495,7 @@ suite('Extensions', function () { suite('registerMutator', function () { test('No domToMutation', function () { this.extensionsCleanup_.push('mutator_test'); - chai.assert.throws(function () { + assert.throws(function () { Blockly.Extensions.registerMutator('mutator_test', { mutationToDom: function () { return 'mutationToDomFn'; @@ -511,7 +512,7 @@ suite('Extensions', function () { test('No mutationToDom', function () { this.extensionsCleanup_.push('mutator_test'); - chai.assert.throws(function () { + assert.throws(function () { Blockly.Extensions.registerMutator('mutator_test', { domToMutation: function () { return 'domToMutationFn'; @@ -528,7 +529,7 @@ suite('Extensions', function () { test('No saveExtraState', function () { this.extensionsCleanup_.push('mutator_test'); - chai.assert.throws(function () { + assert.throws(function () { Blockly.Extensions.registerMutator('mutator_test', { loadExtraState: function () { return 'loadExtraState'; @@ -545,7 +546,7 @@ suite('Extensions', function () { test('No loadExtraState', function () { this.extensionsCleanup_.push('mutator_test'); - chai.assert.throws(function () { + assert.throws(function () { Blockly.Extensions.registerMutator('mutator_test', { saveExtraState: function () { return 'saveExtraState'; @@ -562,7 +563,7 @@ suite('Extensions', function () { test('No serialization hooks', function () { this.extensionsCleanup_.push('mutator_test'); - chai.assert.throws(function () { + assert.throws(function () { Blockly.Extensions.registerMutator('mutator_test', { compose: function () { return 'composeFn'; @@ -576,7 +577,7 @@ suite('Extensions', function () { test('Has decompose but no compose', function () { this.extensionsCleanup_.push('mutator_test'); - chai.assert.throws(function () { + assert.throws(function () { Blockly.Extensions.registerMutator('mutator_test', { domToMutation: function () { return 'domToMutationFn'; @@ -593,7 +594,7 @@ suite('Extensions', function () { test('Has compose but no decompose', function () { this.extensionsCleanup_.push('mutator_test'); - chai.assert.throws(function () { + assert.throws(function () { Blockly.Extensions.registerMutator('mutator_test', { domToMutation: function () { return 'domToMutationFn'; diff --git a/tests/mocha/field_checkbox_test.js b/tests/mocha/field_checkbox_test.js index 4f9503d9c5b..1db3c9a4b1b 100644 --- a/tests/mocha/field_checkbox_test.js +++ b/tests/mocha/field_checkbox_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, @@ -223,7 +224,7 @@ suite('Checkbox Fields', function () { }; field.initView(); field.render_(); - chai.assert(field.textContent_.nodeValue, char); + assert(field.textContent_.nodeValue, char); } test('Constant', function () { const checkChar = Blockly.FieldCheckbox.CHECK_CHAR; @@ -251,7 +252,7 @@ suite('Checkbox Fields', function () { assertCharacter(field, Blockly.FieldCheckbox.CHECK_CHAR); field.setCheckCharacter('\u2661'); // Don't call assertCharacter b/c we don't want to re-initialize. - chai.assert.equal(field.textContent_.nodeValue, '\u2661'); + assert.equal(field.textContent_.nodeValue, '\u2661'); }); test('setCheckCharacter Before Init', function () { const field = new Blockly.FieldCheckbox(); @@ -264,10 +265,7 @@ suite('Checkbox Fields', function () { }); assertCharacter(field, '\u2661'); field.setCheckCharacter(null); - chai.assert( - field.textContent_.nodeValue, - Blockly.FieldCheckbox.CHECK_CHAR, - ); + assert(field.textContent_.nodeValue, Blockly.FieldCheckbox.CHECK_CHAR); }); }); }); @@ -282,7 +280,7 @@ suite('Checkbox Fields', function () { const field = new Blockly.FieldCheckbox(value); block.getInput('INPUT').appendField(field, 'CHECK'); const jso = Blockly.serialization.blocks.save(block); - chai.assert.deepEqual(jso['fields'], {'CHECK': value}); + assert.deepEqual(jso['fields'], {'CHECK': value}); }; }); diff --git a/tests/mocha/field_colour_test.js b/tests/mocha/field_colour_test.js index fcc5041bdae..ed30be5527a 100644 --- a/tests/mocha/field_colour_test.js +++ b/tests/mocha/field_colour_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, @@ -253,8 +254,8 @@ suite('Colour Fields', function () { let index = 0; let node = field.picker.firstChild.firstChild; while (node) { - chai.assert.equal(node.getAttribute('title'), titles[index]); - chai.assert.equal( + assert.equal(node.getAttribute('title'), titles[index]); + assert.equal( Blockly.utils.colour.parse(node.style.backgroundColor), colours[index], ); @@ -331,7 +332,7 @@ suite('Colour Fields', function () { suite('Columns', function () { function assertColumns(field, columns) { field.dropdownCreate(); - chai.assert.equal(field.picker.firstChild.children.length, columns); + assert.equal(field.picker.firstChild.children.length, columns); } test('Constants', function () { const columns = Blockly.FieldColour.COLUMNS; @@ -375,7 +376,7 @@ suite('Colour Fields', function () { const field = new Blockly.FieldColour(value); block.getInput('INPUT').appendField(field, 'COLOUR'); const jso = Blockly.serialization.blocks.save(block); - chai.assert.deepEqual(jso['fields'], {'COLOUR': value}); + assert.deepEqual(jso['fields'], {'COLOUR': value}); }; }); diff --git a/tests/mocha/field_dropdown_test.js b/tests/mocha/field_dropdown_test.js index 6162112876c..c0261bc65e0 100644 --- a/tests/mocha/field_dropdown_test.js +++ b/tests/mocha/field_dropdown_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, @@ -252,7 +253,7 @@ suite('Dropdown Fields', function () { field.setValue(value); block.getInput('INPUT').appendField(field, 'DROPDOWN'); const jso = Blockly.serialization.blocks.save(block); - chai.assert.deepEqual(jso['fields'], {'DROPDOWN': value}); + assert.deepEqual(jso['fields'], {'DROPDOWN': value}); }; }); diff --git a/tests/mocha/field_image_test.js b/tests/mocha/field_image_test.js index ec8ad222712..ed1ec5596b5 100644 --- a/tests/mocha/field_image_test.js +++ b/tests/mocha/field_image_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, @@ -134,23 +135,23 @@ suite('Image Fields', function () { }); test('JS Constructor', function () { const field = new Blockly.FieldImage('src', 10, 10, null, this.onClick); - chai.assert.equal(field.clickHandler, this.onClick); + assert.equal(field.clickHandler, this.onClick); }); test('setOnClickHandler', function () { const field = new Blockly.FieldImage('src', 10, 10); field.setOnClickHandler(this.onClick); - chai.assert.equal(field.clickHandler, this.onClick); + assert.equal(field.clickHandler, this.onClick); }); test('Remove Click Handler', function () { const field = new Blockly.FieldImage('src', 10, 10, null, this.onClick); field.setOnClickHandler(null); - chai.assert.isNull(field.clickHandler); + assert.isNull(field.clickHandler); }); }); suite('Alt', function () { test('JS Constructor', function () { const field = new Blockly.FieldImage('src', 10, 10, 'alt'); - chai.assert.equal(field.getText(), 'alt'); + assert.equal(field.getText(), 'alt'); }); test('JSON Definition', function () { const field = Blockly.FieldImage.fromJson({ @@ -159,7 +160,7 @@ suite('Image Fields', function () { height: 10, alt: 'alt', }); - chai.assert.equal(field.getText(), 'alt'); + assert.equal(field.getText(), 'alt'); }); suite('SetAlt', function () { setup(function () { @@ -182,31 +183,31 @@ suite('Image Fields', function () { const field = new Blockly.FieldImage('src', 10, 10, null, null, null, { alt: 'alt', }); - chai.assert.equal(field.getText(), 'alt'); + assert.equal(field.getText(), 'alt'); }); test('JS Configuration - Ignore', function () { const field = new Blockly.FieldImage('src', 10, 10, 'alt', null, null, { alt: 'configAlt', }); - chai.assert.equal(field.getText(), 'configAlt'); + assert.equal(field.getText(), 'configAlt'); }); test("JS Configuration - Ignore - ''", function () { const field = new Blockly.FieldImage('src', 10, 10, '', null, null, { alt: 'configAlt', }); - chai.assert.equal(field.getText(), 'configAlt'); + assert.equal(field.getText(), 'configAlt'); }); test("JS Configuration - Ignore - Config ''", function () { const field = new Blockly.FieldImage('src', 10, 10, 'alt', null, null, { alt: '', }); - chai.assert.equal(field.getText(), ''); + assert.equal(field.getText(), ''); }); }); suite('Flip RTL', function () { test('JS Constructor', function () { const field = new Blockly.FieldImage('src', 10, 10, null, null, true); - chai.assert.isTrue(field.getFlipRtl()); + assert.isTrue(field.getFlipRtl()); }); test('JSON Definition', function () { const field = Blockly.FieldImage.fromJson({ @@ -215,25 +216,25 @@ suite('Image Fields', function () { height: 10, flipRtl: true, }); - chai.assert.isTrue(field.getFlipRtl()); + assert.isTrue(field.getFlipRtl()); }); test('JS Configuration - Simple', function () { const field = new Blockly.FieldImage('src', 10, 10, null, null, null, { flipRtl: true, }); - chai.assert.isTrue(field.getFlipRtl()); + assert.isTrue(field.getFlipRtl()); }); test('JS Configuration - Ignore - True', function () { const field = new Blockly.FieldImage('src', 10, 10, null, null, true, { flipRtl: false, }); - chai.assert.isFalse(field.getFlipRtl()); + assert.isFalse(field.getFlipRtl()); }); test('JS Configuration - Ignore - False', function () { const field = new Blockly.FieldImage('src', 10, 10, null, null, false, { flipRtl: true, }); - chai.assert.isTrue(field.getFlipRtl()); + assert.isTrue(field.getFlipRtl()); }); }); }); diff --git a/tests/mocha/field_label_serializable_test.js b/tests/mocha/field_label_serializable_test.js index 37052f046cf..f6502db08ac 100644 --- a/tests/mocha/field_label_serializable_test.js +++ b/tests/mocha/field_label_serializable_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, @@ -137,7 +138,7 @@ suite('Label Serializable Fields', function () { FIELD_TEXT_BASELINE_Y: 13, }; labelField.initView(); - chai.assert.isTrue( + assert.isTrue( Blockly.utils.dom.hasClass(labelField.textElement_, cssClass), ); } @@ -151,7 +152,7 @@ suite('Label Serializable Fields', function () { FIELD_TEXT_BASELINE_Y: 13, }; labelField.initView(); - chai.assert.isFalse( + assert.isFalse( Blockly.utils.dom.hasClass(labelField.textElement_, cssClass), ); } @@ -204,7 +205,7 @@ suite('Label Serializable Fields', function () { field.initView(); field.setClass('testClass'); // Don't call assertHasClass b/c we don't want to re-initialize. - chai.assert.isTrue( + assert.isTrue( Blockly.utils.dom.hasClass(field.textElement_, 'testClass'), ); }); @@ -219,7 +220,7 @@ suite('Label Serializable Fields', function () { }); assertHasClass(field, 'testClass'); field.setClass(null); - chai.assert.isFalse( + assert.isFalse( Blockly.utils.dom.hasClass(field.textElement_, 'testClass'), ); }); @@ -236,7 +237,7 @@ suite('Label Serializable Fields', function () { const field = new Blockly.FieldLabelSerializable(value); block.getInput('INPUT').appendField(field, 'LABEL'); const jso = Blockly.serialization.blocks.save(block); - chai.assert.deepEqual(jso['fields'], {'LABEL': value}); + assert.deepEqual(jso['fields'], {'LABEL': value}); }; }); diff --git a/tests/mocha/field_label_test.js b/tests/mocha/field_label_test.js index 368e7fd3cf7..43883ebf8e8 100644 --- a/tests/mocha/field_label_test.js +++ b/tests/mocha/field_label_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, @@ -133,7 +134,7 @@ suite('Label Fields', function () { FIELD_TEXT_BASELINE_Y: 13, }; labelField.initView(); - chai.assert.isTrue( + assert.isTrue( Blockly.utils.dom.hasClass(labelField.textElement_, cssClass), ); } @@ -147,7 +148,7 @@ suite('Label Fields', function () { FIELD_TEXT_BASELINE_Y: 13, }; labelField.initView(); - chai.assert.isFalse( + assert.isFalse( Blockly.utils.dom.hasClass(labelField.textElement_, cssClass), ); } @@ -201,7 +202,7 @@ suite('Label Fields', function () { field.initView(); field.setClass('testClass'); // Don't call assertHasClass b/c we don't want to re-initialize. - chai.assert.isTrue( + assert.isTrue( Blockly.utils.dom.hasClass(field.textElement_, 'testClass'), ); }); @@ -216,7 +217,7 @@ suite('Label Fields', function () { }); assertHasClass(field, 'testClass'); field.setClass(null); - chai.assert.isFalse( + assert.isFalse( Blockly.utils.dom.hasClass(field.textElement_, 'testClass'), ); }); diff --git a/tests/mocha/field_number_test.js b/tests/mocha/field_number_test.js index c6737668d05..fb671204627 100644 --- a/tests/mocha/field_number_test.js +++ b/tests/mocha/field_number_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, @@ -87,9 +88,9 @@ suite('Number Fields', function () { expectedValue, ) { assertFieldValue(field, expectedValue); - chai.assert.equal(field.getMin(), expectedMin, 'Min'); - chai.assert.equal(field.getMax(), expectedMax, 'Max'); - chai.assert.equal(field.getPrecision(), expectedPrecision, 'Precision'); + assert.equal(field.getMin(), expectedMin, 'Min'); + assert.equal(field.getMax(), expectedMax, 'Max'); + assert.equal(field.getPrecision(), expectedPrecision, 'Precision'); } /** * Asserts that the field property values are set to default. @@ -190,7 +191,7 @@ suite('Number Fields', function () { }); test('Null', function () { const field = Blockly.FieldNumber.fromJson({precision: null}); - chai.assert.equal(field.getPrecision(), 0); + assert.equal(field.getPrecision(), 0); }); }); const setValueBoundsTestFn = function (testCase) { @@ -226,7 +227,7 @@ suite('Number Fields', function () { runTestCases(testCases, setValueBoundsTestFn); test('Null', function () { const field = Blockly.FieldNumber.fromJson({min: null}); - chai.assert.equal(field.getMin(), -Infinity); + assert.equal(field.getMin(), -Infinity); }); }); suite('Max', function () { @@ -253,7 +254,7 @@ suite('Number Fields', function () { runTestCases(testCases, setValueBoundsTestFn); test('Null', function () { const field = Blockly.FieldNumber.fromJson({max: null}); - chai.assert.equal(field.getMax(), Infinity); + assert.equal(field.getMax(), Infinity); }); }); }); @@ -473,7 +474,7 @@ suite('Number Fields', function () { const field = new Blockly.FieldNumber(value); block.getInput('INPUT').appendField(field, 'NUMBER'); const jso = Blockly.serialization.blocks.save(block); - chai.assert.deepEqual(jso['fields'], {'NUMBER': value}); + assert.deepEqual(jso['fields'], {'NUMBER': value}); }; }); diff --git a/tests/mocha/field_registry_test.js b/tests/mocha/field_registry_test.js index aca5487469b..c6ec26967e2 100644 --- a/tests/mocha/field_registry_test.js +++ b/tests/mocha/field_registry_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import * as Blockly from '../../build/src/core/blockly.js'; import {createDeprecationWarningStub} from './test_helpers/warnings.js'; import { @@ -37,20 +38,20 @@ suite('Field Registry', function () { Blockly.fieldRegistry.register('field_custom_test', CustomFieldType); }); test('fromJson as Key', function () { - chai.assert.throws(function () { + assert.throws(function () { Blockly.fieldRegistry.register(CustomFieldType.fromJson, ''); }, 'Invalid name'); }); test('No fromJson', function () { class IncorrectField {} - chai.assert.throws(function () { + assert.throws(function () { Blockly.fieldRegistry.register('field_custom_test', IncorrectField); }, 'must have a fromJson function'); }); test('fromJson not a function', function () { const fromJson = CustomFieldType.fromJson; CustomFieldType.fromJson = true; - chai.assert.throws(function () { + assert.throws(function () { Blockly.fieldRegistry.register('field_custom_test', CustomFieldType); }, 'must have a fromJson function'); CustomFieldType.fromJson = fromJson; @@ -67,8 +68,8 @@ suite('Field Registry', function () { const field = Blockly.fieldRegistry.fromJson(json); - chai.assert.isNotNull(field); - chai.assert.equal(field.getValue(), 'ok'); + assert.isNotNull(field); + assert.equal(field.getValue(), 'ok'); }); test('Not Registered', function () { const json = { @@ -78,8 +79,8 @@ suite('Field Registry', function () { const spy = sinon.stub(console, 'warn'); const field = Blockly.fieldRegistry.fromJson(json); - chai.assert.isNull(field); - chai.assert.isTrue(spy.called); + assert.isNull(field); + assert.isTrue(spy.called); spy.restore(); }); test('Case Different', function () { @@ -92,8 +93,8 @@ suite('Field Registry', function () { const field = Blockly.fieldRegistry.fromJson(json); - chai.assert.isNotNull(field); - chai.assert.equal(field.getValue(), 'ok'); + assert.isNotNull(field); + assert.equal(field.getValue(), 'ok'); }); test('Did not override fromJson', function () { // This class will have a fromJson method, so it can be registered @@ -107,7 +108,7 @@ suite('Field Registry', function () { value: 'ok', }; - chai.assert.throws(function () { + assert.throws(function () { Blockly.fieldRegistry.fromJson(json); }, 'Attempted to instantiate a field from the registry'); }); diff --git a/tests/mocha/field_test.js b/tests/mocha/field_test.js index 7265a1bb4cd..dfc79803383 100644 --- a/tests/mocha/field_test.js +++ b/tests/mocha/field_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import * as Blockly from '../../build/src/core/blockly.js'; import { addBlockTypeToCleanup, @@ -65,26 +66,26 @@ suite('Abstract Fields', function () { // An old default field should be serialized. const field = new FieldDefault(); const stub = sinon.stub(console, 'warn'); - chai.assert.isTrue(field.isSerializable()); + assert.isTrue(field.isSerializable()); sinon.assert.calledOnce(stub); stub.restore(); }); test('Editable False, Serializable Default(false)', function () { // An old non-editable field should not be serialized. const field = new FieldFalseDefault(); - chai.assert.isFalse(field.isSerializable()); + assert.isFalse(field.isSerializable()); }); /* Test Other Cases */ test('Editable Default(true), Serializable True', function () { // A field that is both editable and serializable should be serialized. const field = new FieldDefaultTrue(); - chai.assert.isTrue(field.isSerializable()); + assert.isTrue(field.isSerializable()); }); test('Editable False, Serializable True', function () { // A field that is not editable, but overrides serializable to true // should be serialized (e.g. field_label_serializable) const field = new FieldFalseTrue(); - chai.assert.isTrue(field.isSerializable()); + assert.isTrue(field.isSerializable()); }); }); @@ -193,19 +194,19 @@ suite('Abstract Fields', function () { test('No implementations', function () { const field = new DefaultSerializationField('test value'); const value = field.saveState(); - chai.assert.equal(value, 'test value'); + assert.equal(value, 'test value'); }); test('Xml implementations', function () { const field = new CustomXmlField('test value'); const value = field.saveState(); - chai.assert.equal(value, 'custom value'); + assert.equal(value, 'custom value'); }); test('Xml super implementation', function () { const field = new CustomXmlCallSuperField('test value'); const value = field.saveState(); - chai.assert.equal( + assert.equal( value, 'test value', ); @@ -214,13 +215,13 @@ suite('Abstract Fields', function () { test('JSO implementations', function () { const field = new CustomJsoField('test value'); const value = field.saveState(); - chai.assert.equal(value, 'custom value'); + assert.equal(value, 'custom value'); }); test('JSO super implementations', function () { const field = new CustomJsoCallSuperField('test value'); const value = field.saveState(); - chai.assert.deepEqual(value, { + assert.deepEqual(value, { default: 'test value', val: 'custom value', }); @@ -229,7 +230,7 @@ suite('Abstract Fields', function () { test('Xml and JSO implementations', function () { const field = new CustomXmlAndJsoField('test value'); const value = field.saveState(); - chai.assert.equal(value, 'custom value'); + assert.equal(value, 'custom value'); }); }); @@ -238,7 +239,7 @@ suite('Abstract Fields', function () { const field = new DefaultSerializationField('test value'); const element = document.createElement('field'); const value = Blockly.Xml.domToText(field.toXml(element)); - chai.assert.equal( + assert.equal( value, 'test value', ); @@ -248,7 +249,7 @@ suite('Abstract Fields', function () { const field = new CustomXmlField('test value'); const element = document.createElement('field'); const value = Blockly.Xml.domToText(field.toXml(element)); - chai.assert.equal( + assert.equal( value, 'custom value', ); @@ -258,7 +259,7 @@ suite('Abstract Fields', function () { const field = new CustomXmlCallSuperField('test value'); const element = document.createElement('field'); const value = Blockly.Xml.domToText(field.toXml(element)); - chai.assert.equal( + assert.equal( value, 'test value', @@ -269,7 +270,7 @@ suite('Abstract Fields', function () { const field = new CustomXmlAndJsoField('test value'); const element = document.createElement('field'); const value = Blockly.Xml.domToText(field.toXml(element)); - chai.assert.equal( + assert.equal( value, 'custom value', ); @@ -282,13 +283,13 @@ suite('Abstract Fields', function () { test('No implementations', function () { const field = new DefaultSerializationField(''); field.loadState('test value'); - chai.assert.equal(field.getValue(), 'test value'); + assert.equal(field.getValue(), 'test value'); }); test('Xml implementations', function () { const field = new CustomXmlField(''); field.loadState('custom value'); - chai.assert.equal(field.someProperty, 'custom value'); + assert.equal(field.someProperty, 'custom value'); }); test('Xml super implementation', function () { @@ -296,27 +297,27 @@ suite('Abstract Fields', function () { field.loadState( 'test value', ); - chai.assert.equal(field.getValue(), 'test value'); - chai.assert.equal(field.someProperty, 'custom value'); + assert.equal(field.getValue(), 'test value'); + assert.equal(field.someProperty, 'custom value'); }); test('JSO implementations', function () { const field = new CustomJsoField(''); field.loadState('custom value'); - chai.assert.equal(field.someProperty, 'custom value'); + assert.equal(field.someProperty, 'custom value'); }); test('JSO super implementations', function () { const field = new CustomJsoCallSuperField(''); field.loadState({default: 'test value', val: 'custom value'}); - chai.assert.equal(field.getValue(), 'test value'); - chai.assert.equal(field.someProperty, 'custom value'); + assert.equal(field.getValue(), 'test value'); + assert.equal(field.someProperty, 'custom value'); }); test('Xml and JSO implementations', function () { const field = new CustomXmlAndJsoField(''); field.loadState('custom value'); - chai.assert.equal(field.someProperty, 'custom value'); + assert.equal(field.someProperty, 'custom value'); }); }); @@ -326,7 +327,7 @@ suite('Abstract Fields', function () { field.fromXml( Blockly.utils.xml.textToDom('test value'), ); - chai.assert.equal(field.getValue(), 'test value'); + assert.equal(field.getValue(), 'test value'); }); test('Xml implementations', function () { @@ -334,7 +335,7 @@ suite('Abstract Fields', function () { field.fromXml( Blockly.utils.xml.textToDom('custom value'), ); - chai.assert.equal(field.someProperty, 'custom value'); + assert.equal(field.someProperty, 'custom value'); }); test('Xml super implementation', function () { @@ -344,8 +345,8 @@ suite('Abstract Fields', function () { 'test value', ), ); - chai.assert.equal(field.getValue(), 'test value'); - chai.assert.equal(field.someProperty, 'custom value'); + assert.equal(field.getValue(), 'test value'); + assert.equal(field.someProperty, 'custom value'); }); test('XML andd JSO implementations', function () { @@ -353,7 +354,7 @@ suite('Abstract Fields', function () { field.fromXml( Blockly.utils.xml.textToDom('custom value'), ); - chai.assert.equal(field.someProperty, 'custom value'); + assert.equal(field.someProperty, 'custom value'); }); }); }); @@ -572,7 +573,7 @@ suite('Abstract Fields', function () { stubClassValidatorWithReturn(this.field, undefined); addSpies(this.field); this.field.setValue('value'); - chai.assert.equal(this.field.getValue(), 'value'); + assert.equal(this.field.getValue(), 'value'); sinon.assert.notCalled(this.field.doValueInvalid_); sinon.assert.calledOnce(this.field.doValueUpdate_); }); @@ -603,7 +604,7 @@ suite('Abstract Fields', function () { setLocalValidatorWithReturn(this.field, undefined); addSpies(this.field); this.field.setValue('value'); - chai.assert.equal(this.field.getValue(), 'value'); + assert.equal(this.field.getValue(), 'value'); sinon.assert.notCalled(this.field.doValueInvalid_); sinon.assert.calledOnce(this.field.doValueUpdate_); }); @@ -626,7 +627,7 @@ suite('Abstract Fields', function () { const field = new Blockly.Field('value', null, { tooltip: 'test tooltip', }); - chai.assert.equal(field.tooltip_, 'test tooltip'); + assert.equal(field.tooltip_, 'test tooltip'); }); test('JS Constructor - Dynamic', function () { const returnTooltip = function () { @@ -635,13 +636,13 @@ suite('Abstract Fields', function () { const field = new Blockly.Field('value', null, { tooltip: returnTooltip, }); - chai.assert.equal(field.tooltip_, returnTooltip); + assert.equal(field.tooltip_, returnTooltip); }); test('JSON Definition', function () { const field = CustomField.fromJson({ tooltip: 'test tooltip', }); - chai.assert.equal(field.tooltip_, 'test tooltip'); + assert.equal(field.tooltip_, 'test tooltip'); }); suite('W/ Msg References', function () { setup(function () { @@ -652,13 +653,13 @@ suite('Abstract Fields', function () { const field = new Blockly.Field('value', null, { tooltip: '%{BKY_TOOLTIP}', }); - chai.assert.equal(field.tooltip_, 'test tooltip'); + assert.equal(field.tooltip_, 'test tooltip'); }); test('JSON Definition', function () { const field = CustomField.fromJson({ tooltip: '%{BKY_TOOLTIP}', }); - chai.assert.equal(field.tooltip_, 'test tooltip'); + assert.equal(field.tooltip_, 'test tooltip'); }); }); suite('setTooltip', function () { @@ -687,7 +688,7 @@ suite('Abstract Fields', function () { this.workspace, ); const field = block.getField('TOOLTIP'); - chai.assert.equal(field.getClickTarget_().tooltip, 'tooltip'); + assert.equal(field.getClickTarget_().tooltip, 'tooltip'); }); test('After Append', function () { addBlockTypeToCleanup(this.sharedCleanup, 'tooltip'); @@ -707,7 +708,7 @@ suite('Abstract Fields', function () { this.workspace, ); const field = block.getField('TOOLTIP'); - chai.assert.equal(field.getClickTarget_().tooltip, 'tooltip'); + assert.equal(field.getClickTarget_().tooltip, 'tooltip'); }); test('After Block Creation', function () { addBlockTypeToCleanup(this.sharedCleanup, 'tooltip'); @@ -727,7 +728,7 @@ suite('Abstract Fields', function () { ); const field = block.getField('TOOLTIP'); field.setTooltip('tooltip'); - chai.assert.equal(field.getClickTarget_().tooltip, 'tooltip'); + assert.equal(field.getClickTarget_().tooltip, 'tooltip'); }); test('Dynamic Function', function () { addBlockTypeToCleanup(this.sharedCleanup, 'tooltip'); @@ -751,7 +752,7 @@ suite('Abstract Fields', function () { this.workspace, ); const field = block.getField('TOOLTIP'); - chai.assert.equal(field.getClickTarget_().tooltip, block.tooltipFunc); + assert.equal(field.getClickTarget_().tooltip, block.tooltipFunc); }); test('Element', function () { addBlockTypeToCleanup(this.sharedCleanup, 'tooltip'); @@ -774,7 +775,7 @@ suite('Abstract Fields', function () { this.workspace, ); const field = block.getField('TOOLTIP'); - chai.assert.equal(field.getClickTarget_().tooltip, block.element); + assert.equal(field.getClickTarget_().tooltip, block.element); }); test('Null', function () { addBlockTypeToCleanup(this.sharedCleanup, 'tooltip'); @@ -794,7 +795,7 @@ suite('Abstract Fields', function () { this.workspace, ); const field = block.getField('TOOLTIP'); - chai.assert.equal(field.getClickTarget_().tooltip, block); + assert.equal(field.getClickTarget_().tooltip, block); }); test('Undefined', function () { addBlockTypeToCleanup(this.sharedCleanup, 'tooltip'); @@ -813,7 +814,7 @@ suite('Abstract Fields', function () { this.workspace, ); const field = block.getField('TOOLTIP'); - chai.assert.equal(field.getClickTarget_().tooltip, block); + assert.equal(field.getClickTarget_().tooltip, block); }); }); }); diff --git a/tests/mocha/field_textinput_test.js b/tests/mocha/field_textinput_test.js index f68006e8768..7b0da1b4cca 100644 --- a/tests/mocha/field_textinput_test.js +++ b/tests/mocha/field_textinput_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, @@ -228,7 +229,7 @@ suite('Text Input Fields', function () { this.assertSpellcheck = function (field, value) { this.prepField(field); field.showEditor_(); - chai.assert.equal( + assert.equal( field.htmlInput_.getAttribute('spellcheck'), value.toString(), ); @@ -266,7 +267,7 @@ suite('Text Input Fields', function () { this.prepField(field); field.showEditor_(); field.setSpellcheck(false); - chai.assert.equal(field.htmlInput_.getAttribute('spellcheck'), 'false'); + assert.equal(field.htmlInput_.getAttribute('spellcheck'), 'false'); }); }); }); @@ -281,7 +282,7 @@ suite('Text Input Fields', function () { const field = new Blockly.FieldTextInput(value); block.getInput('INPUT').appendField(field, 'TEXT'); const jso = Blockly.serialization.blocks.save(block); - chai.assert.deepEqual(jso['fields'], {'TEXT': value}); + assert.deepEqual(jso['fields'], {'TEXT': value}); }; }); diff --git a/tests/mocha/field_variable_test.js b/tests/mocha/field_variable_test.js index 0815303c655..63dd644c393 100644 --- a/tests/mocha/field_variable_test.js +++ b/tests/mocha/field_variable_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import * as Blockly from '../../build/src/core/blockly.js'; import { assertFieldValue, @@ -135,8 +136,8 @@ suite('Variable Fields', function () { suite('initModel', function () { test('No Value Before InitModel', function () { const fieldVariable = new Blockly.FieldVariable('name1'); - chai.assert.equal(fieldVariable.getText(), ''); - chai.assert.isNull(fieldVariable.getValue()); + assert.equal(fieldVariable.getText(), ''); + assert.isNull(fieldVariable.getValue()); }); }); @@ -199,19 +200,13 @@ suite('Variable Fields', function () { const dropdownOptions = Blockly.FieldVariable.dropdownCreate.call(fieldVariable); // Expect variable options, a rename option, and a delete option. - chai.assert.lengthOf(dropdownOptions, expectedVarOptions.length + 2); + assert.lengthOf(dropdownOptions, expectedVarOptions.length + 2); for (let i = 0, option; (option = expectedVarOptions[i]); i++) { - chai.assert.deepEqual(dropdownOptions[i], option); + assert.deepEqual(dropdownOptions[i], option); } - chai.assert.include( - dropdownOptions[dropdownOptions.length - 2][0], - 'Rename', - ); + assert.include(dropdownOptions[dropdownOptions.length - 2][0], 'Rename'); - chai.assert.include( - dropdownOptions[dropdownOptions.length - 1][0], - 'Delete', - ); + assert.include(dropdownOptions[dropdownOptions.length - 1][0], 'Delete'); }; test('Contains variables created before field', function () { this.workspace.createVariable('name1', '', 'id1'); @@ -311,8 +306,8 @@ suite('Variable Fields', function () { ['Type1'], 'Type1', ); - chai.assert.deepEqual(field.variableTypes, ['Type1']); - chai.assert.equal(field.defaultType, 'Type1'); + assert.deepEqual(field.variableTypes, ['Type1']); + assert.equal(field.defaultType, 'Type1'); }); test('JSON Definition', function () { const field = Blockly.FieldVariable.fromJson({ @@ -320,8 +315,8 @@ suite('Variable Fields', function () { variableTypes: ['Type1'], defaultType: 'Type1', }); - chai.assert.deepEqual(field.variableTypes, ['Type1']); - chai.assert.equal(field.defaultType, 'Type1'); + assert.deepEqual(field.variableTypes, ['Type1']); + assert.equal(field.defaultType, 'Type1'); }); test('JS Configuration - Simple', function () { const field = new Blockly.FieldVariable( @@ -334,8 +329,8 @@ suite('Variable Fields', function () { defaultType: 'Type1', }, ); - chai.assert.deepEqual(field.variableTypes, ['Type1']); - chai.assert.equal(field.defaultType, 'Type1'); + assert.deepEqual(field.variableTypes, ['Type1']); + assert.equal(field.defaultType, 'Type1'); }); test('JS Configuration - Ignore', function () { const field = new Blockly.FieldVariable( @@ -348,8 +343,8 @@ suite('Variable Fields', function () { defaultType: 'Type1', }, ); - chai.assert.deepEqual(field.variableTypes, ['Type1']); - chai.assert.equal(field.defaultType, 'Type1'); + assert.deepEqual(field.variableTypes, ['Type1']); + assert.equal(field.defaultType, 'Type1'); }); }); }); @@ -363,7 +358,7 @@ suite('Variable Fields', function () { // will be returned (regardless of what types are available on the workspace). const fieldVariable = new Blockly.FieldVariable('name1'); const resultTypes = fieldVariable.getVariableTypes(); - chai.assert.deepEqual(resultTypes, ['']); + assert.deepEqual(resultTypes, ['']); }); test('variableTypes is explicit', function () { // Expect that since variableTypes is defined, it will be the return @@ -375,8 +370,8 @@ suite('Variable Fields', function () { 'type1', ); const resultTypes = fieldVariable.getVariableTypes(); - chai.assert.deepEqual(resultTypes, ['type1', 'type2']); - chai.assert.equal( + assert.deepEqual(resultTypes, ['type1', 'type2']); + assert.equal( fieldVariable.defaultType, 'type1', 'Default type was wrong', @@ -394,7 +389,7 @@ suite('Variable Fields', function () { const resultTypes = fieldVariable.getVariableTypes(); // The empty string is always one of the options. - chai.assert.deepEqual(resultTypes, ['type1', 'type2', '']); + assert.deepEqual(resultTypes, ['type1', 'type2', '']); }); test('variableTypes is the empty list', function () { const fieldVariable = new Blockly.FieldVariable('name1'); @@ -403,7 +398,7 @@ suite('Variable Fields', function () { fieldVariable.setSourceBlock(mockBlock); fieldVariable.variableTypes = []; - chai.assert.throws(function () { + assert.throws(function () { fieldVariable.getVariableTypes(); }); }); @@ -411,7 +406,7 @@ suite('Variable Fields', function () { suite('Default types', function () { test('Default type exists', function () { const fieldVariable = new Blockly.FieldVariable(null, null, ['b'], 'b'); - chai.assert.equal( + assert.equal( fieldVariable.defaultType, 'b', 'The variable field\'s default type should be "b"', @@ -419,25 +414,25 @@ suite('Variable Fields', function () { }); test('No default type', function () { const fieldVariable = new Blockly.FieldVariable(null); - chai.assert.equal( + assert.equal( fieldVariable.defaultType, '', "The variable field's default type should be the empty string", ); - chai.assert.isNull( + assert.isNull( fieldVariable.variableTypes, "The variable field's allowed types should be null", ); }); test('Default type mismatch', function () { // Invalid default type when creating a variable field. - chai.assert.throws(function () { + assert.throws(function () { new Blockly.FieldVariable(null, null, ['a'], 'b'); }); }); test('Default type mismatch with empty array', function () { // Invalid default type when creating a variable field. - chai.assert.throws(function () { + assert.throws(function () { new Blockly.FieldVariable(null, null, ['a']); }); }); @@ -466,14 +461,14 @@ suite('Variable Fields', function () { }); test('Rename & Keep Old ID', function () { this.workspace.renameVariableById('id1', 'name2'); - chai.assert.equal(this.variableField.getText(), 'name2'); - chai.assert.equal(this.variableField.getValue(), 'id1'); + assert.equal(this.variableField.getText(), 'name2'); + assert.equal(this.variableField.getValue(), 'id1'); }); test('Rename & Get New ID', function () { this.workspace.createVariable('name2', null, 'id2'); this.workspace.renameVariableById('id1', 'name2'); - chai.assert.equal(this.variableField.getText(), 'name2'); - chai.assert.equal(this.variableField.getValue(), 'id2'); + assert.equal(this.variableField.getText(), 'name2'); + assert.equal(this.variableField.getValue(), 'id2'); }); }); @@ -494,7 +489,7 @@ suite('Variable Fields', function () { const field = new Blockly.FieldVariable('x'); block.getInput('INPUT').appendField(field, 'VAR'); const jso = Blockly.serialization.blocks.save(block); - chai.assert.deepEqual(jso['fields'], { + assert.deepEqual(jso['fields'], { 'VAR': {'id': 'id2', 'name': 'x', 'type': ''}, }); }); @@ -509,7 +504,7 @@ suite('Variable Fields', function () { ); block.getInput('INPUT').appendField(field, 'VAR'); const jso = Blockly.serialization.blocks.save(block); - chai.assert.deepEqual(jso['fields'], { + assert.deepEqual(jso['fields'], { 'VAR': {'id': 'id2', 'name': 'x', 'type': 'String'}, }); }); @@ -523,9 +518,9 @@ suite('Variable Fields', function () { const jso = Blockly.serialization.blocks.save(block, { doFullSerialization: false, }); - chai.assert.deepEqual(jso['fields'], {'VAR': {'id': 'id2'}}); - chai.assert.isUndefined(jso['fields']['VAR']['name']); - chai.assert.isUndefined(jso['fields']['VAR']['type']); + assert.deepEqual(jso['fields'], {'VAR': {'id': 'id2'}}); + assert.isUndefined(jso['fields']['VAR']['name']); + assert.isUndefined(jso['fields']['VAR']['type']); }); test('Typed', function () { @@ -540,9 +535,9 @@ suite('Variable Fields', function () { const jso = Blockly.serialization.blocks.save(block, { doFullSerialization: false, }); - chai.assert.deepEqual(jso['fields'], {'VAR': {'id': 'id2'}}); - chai.assert.isUndefined(jso['fields']['VAR']['name']); - chai.assert.isUndefined(jso['fields']['VAR']['type']); + assert.deepEqual(jso['fields'], {'VAR': {'id': 'id2'}}); + assert.isUndefined(jso['fields']['VAR']['name']); + assert.isUndefined(jso['fields']['VAR']['type']); }); }); }); @@ -572,9 +567,9 @@ suite('Variable Fields', function () { this.workspace, ); const variable = block.getField('VAR').getVariable(); - chai.assert.equal(variable.name, 'test'); - chai.assert.equal(variable.type, ''); - chai.assert.equal(variable.getId(), 'id1'); + assert.equal(variable.name, 'test'); + assert.equal(variable.type, ''); + assert.equal(variable.getId(), 'id1'); }); test('Name, untyped', function () { @@ -590,9 +585,9 @@ suite('Variable Fields', function () { this.workspace, ); const variable = block.getField('VAR').getVariable(); - chai.assert.equal(variable.name, 'test'); - chai.assert.equal(variable.type, ''); - chai.assert.equal(variable.getId(), 'id2'); + assert.equal(variable.name, 'test'); + assert.equal(variable.type, ''); + assert.equal(variable.getId(), 'id2'); }); test('Name, typed', function () { @@ -609,9 +604,9 @@ suite('Variable Fields', function () { this.workspace, ); const variable = block.getField('VAR').getVariable(); - chai.assert.equal(variable.name, 'test'); - chai.assert.equal(variable.type, 'string'); - chai.assert.equal(variable.getId(), 'id2'); + assert.equal(variable.name, 'test'); + assert.equal(variable.type, 'string'); + assert.equal(variable.getId(), 'id2'); }); }); }); diff --git a/tests/mocha/flyout_test.js b/tests/mocha/flyout_test.js index f2fe79e3851..522efbdc6e4 100644 --- a/tests/mocha/flyout_test.js +++ b/tests/mocha/flyout_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -59,7 +60,7 @@ suite('Flyout', function () { this.flyout.targetWorkspace.getMetricsManager(); }); test('y is always 0', function () { - chai.assert.equal( + assert.equal( this.flyout.getY(), 0, 'y coordinate in vertical flyout should be 0', @@ -72,7 +73,7 @@ suite('Flyout', function () { this.flyout.targetWorkspace.toolboxPosition = Blockly.utils.toolbox.Position.RIGHT; this.flyout.toolboxPosition_ = Blockly.utils.toolbox.Position.RIGHT; - chai.assert.equal( + assert.equal( this.flyout.getX(), 100, 'x should be right of workspace', @@ -82,7 +83,7 @@ suite('Flyout', function () { this.flyout.targetWorkspace.toolboxPosition = Blockly.utils.toolbox.Position.LEFT; this.flyout.toolboxPosition_ = Blockly.utils.toolbox.Position.LEFT; - chai.assert.equal( + assert.equal( this.flyout.getX(), 0, 'x should be 0 if the flyout is on the left', @@ -110,7 +111,7 @@ suite('Flyout', function () { this.flyout.targetWorkspace.toolboxPosition = Blockly.utils.toolbox.Position.LEFT; this.flyout.toolboxPosition_ = Blockly.utils.toolbox.Position.LEFT; - chai.assert.equal( + assert.equal( this.flyout.getX(), 20, 'x should be aligned with toolbox', @@ -128,7 +129,7 @@ suite('Flyout', function () { this.flyout.targetWorkspace.toolboxPosition = Blockly.utils.toolbox.Position.RIGHT; this.flyout.toolboxPosition_ = Blockly.utils.toolbox.Position.RIGHT; - chai.assert.equal( + assert.equal( this.flyout.getX(), 90, 'x + width should be aligned with toolbox', @@ -150,7 +151,7 @@ suite('Flyout', function () { this.flyout.targetWorkspace.toolboxPosition = Blockly.utils.toolbox.Position.RIGHT; this.flyout.toolboxPosition_ = Blockly.utils.toolbox.Position.LEFT; - chai.assert.equal( + assert.equal( this.flyout.getX(), 0, 'x should be aligned with left edge', @@ -169,7 +170,7 @@ suite('Flyout', function () { this.flyout.targetWorkspace.toolboxPosition = Blockly.utils.toolbox.Position.LEFT; this.flyout.toolboxPosition_ = Blockly.utils.toolbox.Position.RIGHT; - chai.assert.equal( + assert.equal( this.flyout.getX(), 90, 'x + width should be aligned with right edge', @@ -195,7 +196,7 @@ suite('Flyout', function () { this.flyout.targetWorkspace.getMetricsManager(); }); test('x is always 0', function () { - chai.assert.equal( + assert.equal( this.flyout.getX(), 0, 'x coordinate in horizontal flyout should be 0', @@ -205,7 +206,7 @@ suite('Flyout', function () { this.flyout.targetWorkspace.toolboxPosition = Blockly.utils.toolbox.Position.TOP; this.flyout.toolboxPosition_ = Blockly.utils.toolbox.Position.TOP; - chai.assert.equal( + assert.equal( this.flyout.getY(), 0, 'y should be 0 if flyout is at the top', @@ -218,7 +219,7 @@ suite('Flyout', function () { sinon.stub(this.targetMetricsManager, 'getViewMetrics').returns({ height: 50, }); - chai.assert.equal( + assert.equal( this.flyout.getY(), 50, 'y should be below the workspace', @@ -247,7 +248,7 @@ suite('Flyout', function () { this.flyout.targetWorkspace.toolboxPosition = Blockly.utils.toolbox.Position.TOP; this.flyout.toolboxPosition_ = Blockly.utils.toolbox.Position.TOP; - chai.assert.equal( + assert.equal( this.flyout.getY(), 20, 'y should be aligned with toolbox', @@ -265,7 +266,7 @@ suite('Flyout', function () { this.flyout.targetWorkspace.toolboxPosition = Blockly.utils.toolbox.Position.BOTTOM; this.flyout.toolboxPosition_ = Blockly.utils.toolbox.Position.BOTTOM; - chai.assert.equal( + assert.equal( this.flyout.getY(), 70, 'y + height should be aligned with toolbox', @@ -284,11 +285,7 @@ suite('Flyout', function () { this.flyout.targetWorkspace.toolboxPosition = Blockly.utils.toolbox.Position.BOTTOM; this.flyout.toolboxPosition_ = Blockly.utils.toolbox.Position.TOP; - chai.assert.equal( - this.flyout.getY(), - 0, - 'y should be aligned with top', - ); + assert.equal(this.flyout.getY(), 0, 'y should be aligned with top'); }); test('trashcan on bottom covers bottom of workspace', function () { this.flyout.targetWorkspace.toolboxPosition = @@ -302,7 +299,7 @@ suite('Flyout', function () { }); this.flyout.setVisible(true); this.flyout.height_ = 20; - chai.assert.equal( + assert.equal( this.flyout.getY(), 40, 'y + height should be aligned with bottom', @@ -324,26 +321,26 @@ suite('Flyout', function () { const gaps = flyoutInfo.gaps; const expectedGaps = [20, 24, 24]; - chai.assert.deepEqual(gaps, expectedGaps); + assert.deepEqual(gaps, expectedGaps); - chai.assert.equal(contents.length, 3, 'Contents'); + assert.equal(contents.length, 3, 'Contents'); - chai.assert.equal(contents[0].type, 'block', 'Contents'); + assert.equal(contents[0].type, 'block', 'Contents'); const block = contents[0]['block']; - chai.assert.instanceOf(block, Blockly.BlockSvg); - chai.assert.equal(block.getFieldValue('OP'), 'NEQ'); + assert.instanceOf(block, Blockly.BlockSvg); + assert.equal(block.getFieldValue('OP'), 'NEQ'); const childA = block.getInputTargetBlock('A'); const childB = block.getInputTargetBlock('B'); - chai.assert.isTrue(childA.isShadow()); - chai.assert.isFalse(childB.isShadow()); - chai.assert.equal(childA.getFieldValue('NUM'), 1); - chai.assert.equal(childB.getFieldValue('NUM'), 2); + assert.isTrue(childA.isShadow()); + assert.isFalse(childB.isShadow()); + assert.equal(childA.getFieldValue('NUM'), 1); + assert.equal(childB.getFieldValue('NUM'), 2); - chai.assert.equal(contents[1].type, 'button', 'Contents'); - chai.assert.instanceOf(contents[1]['button'], Blockly.FlyoutButton); + assert.equal(contents[1].type, 'button', 'Contents'); + assert.instanceOf(contents[1]['button'], Blockly.FlyoutButton); - chai.assert.equal(contents[2].type, 'button', 'Contents'); - chai.assert.instanceOf(contents[2]['button'], Blockly.FlyoutButton); + assert.equal(contents[2].type, 'button', 'Contents'); + assert.instanceOf(contents[2]['button'], Blockly.FlyoutButton); } suite('Direct show', function () { @@ -391,7 +388,7 @@ suite('Flyout', function () { }); test('No category available', function () { - chai.assert.throws( + assert.throws( function () { this.flyout.show('someString'); }.bind(this), @@ -431,7 +428,7 @@ suite('Flyout', function () { this.assertDisabled = function (disabled) { const block = this.flyout.getWorkspace().getTopBlocks(false)[0]; - chai.assert.equal(!block.isEnabled(), disabled); + assert.equal(!block.isEnabled(), disabled); }; }); @@ -630,7 +627,7 @@ suite('Flyout', function () { ], }); const block = this.flyout.workspace_.getAllBlocks()[0]; - chai.assert.equal(block.getFieldValue('NUM'), 321); + assert.equal(block.getFieldValue('NUM'), 321); }); test('Recycling enabled', function () { @@ -660,7 +657,7 @@ suite('Flyout', function () { ], }); const block = this.flyout.workspace_.getAllBlocks()[0]; - chai.assert.equal(block.getFieldValue('NUM'), 123); + assert.equal(block.getFieldValue('NUM'), 123); }); }); }); diff --git a/tests/mocha/generator_test.js b/tests/mocha/generator_test.js index 3a2679dca81..efaa924de66 100644 --- a/tests/mocha/generator_test.js +++ b/tests/mocha/generator_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import * as Blockly from '../../build/src/core/blockly.js'; import {DartGenerator} from '../../build/src/generators/dart/dart_generator.js'; import {JavascriptGenerator} from '../../build/src/generators/javascript/javascript_generator.js'; @@ -31,22 +32,19 @@ suite('Generator', function () { }); test('Nothing', function () { - chai.assert.equal(this.generator.prefixLines('', ''), ''); + assert.equal(this.generator.prefixLines('', ''), ''); }); test('One word', function () { - chai.assert.equal(this.generator.prefixLines('Hello', '@'), '@Hello'); + assert.equal(this.generator.prefixLines('Hello', '@'), '@Hello'); }); test('One line', function () { - chai.assert.equal( - this.generator.prefixLines('Hello\n', '12'), - '12Hello\n', - ); + assert.equal(this.generator.prefixLines('Hello\n', '12'), '12Hello\n'); }); test('Two lines', function () { - chai.assert.equal( + assert.equal( this.generator.prefixLines('Hello\nWorld\n', '***'), '***Hello\n***World\n', ); @@ -97,7 +95,7 @@ suite('Generator', function () { const code = generator.blockToCode(rowBlock, opt_thisOnly); delete generator.forBlock['stack_block']; delete generator.forBlock['row_block']; - chai.assert.equal(code, expectedCode, opt_message); + assert.equal(code, expectedCode, opt_message); }; }); @@ -187,7 +185,7 @@ suite('Generator', function () { blockA.nextConnection.connect(blockC.previousConnection); const code = generator.blockToCode(blockA, opt_thisOnly); - chai.assert.equal(code, expectedCode, opt_message); + assert.equal(code, expectedCode, opt_message); }; }); @@ -214,7 +212,7 @@ suite('Generator', function () { this.generator = new TestGenerator(); }); test('No nameDB_ initialized', function () { - chai.assert.throws(() => { + assert.throws(() => { this.generator.getVariableName('foo'); }); }); @@ -222,13 +220,13 @@ suite('Generator', function () { test('Get variable name', function () { this.generator.init(); - chai.assert.equal(this.generator.getVariableName('foo'), 'foo'); + assert.equal(this.generator.getVariableName('foo'), 'foo'); }); test('Get procedure name', function () { this.generator.init(); - chai.assert.equal(this.generator.getProcedureName('foo'), 'foo'); + assert.equal(this.generator.getProcedureName('foo'), 'foo'); }); }); }); diff --git a/tests/mocha/gesture_test.js b/tests/mocha/gesture_test.js index 0572fed5b94..122e96b8b4c 100644 --- a/tests/mocha/gesture_test.js +++ b/tests/mocha/gesture_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import {assertEventFired, assertEventNotFired} from './test_helpers/events.js'; import {defineBasicBlockWithField} from './test_helpers/block_definitions.js'; import {dispatchPointerEvent} from './test_helpers/user_input.js'; @@ -17,10 +18,7 @@ suite('Gesture', function () { function testGestureIsFieldClick(block, isFieldClick, eventsFireStub) { const field = block.getField('NAME'); const eventTarget = field.getClickTarget_(); - chai.assert.exists( - eventTarget, - 'Precondition: missing click target for field', - ); + assert.exists(eventTarget, 'Precondition: missing click target for field'); eventsFireStub.resetHistory(); dispatchPointerEvent(eventTarget, 'pointerdown'); @@ -29,14 +27,14 @@ suite('Gesture', function () { // Gestures triggered on flyouts are stored on targetWorkspace. const gestureWorkspace = fieldWorkspace.targetWorkspace || fieldWorkspace; const gesture = gestureWorkspace.currentGesture_; - chai.assert.exists(gesture, 'Gesture exists after pointerdown.'); + assert.exists(gesture, 'Gesture exists after pointerdown.'); const isFieldClickSpy = sinon.spy(gesture, 'isFieldClick'); dispatchPointerEvent(eventTarget, 'pointerup'); dispatchPointerEvent(eventTarget, 'click'); sinon.assert.called(isFieldClickSpy); - chai.assert.isTrue(isFieldClickSpy.alwaysReturned(isFieldClick)); + assert.isTrue(isFieldClickSpy.alwaysReturned(isFieldClick)); assertEventFired( eventsFireStub, @@ -67,8 +65,8 @@ suite('Gesture', function () { test('Constructor', function () { const e = {id: 'dummy_test_event'}; const gesture = new Blockly.Gesture(e, this.workspace); - chai.assert.equal(gesture.mostRecentEvent, e); - chai.assert.equal(gesture.creatorWorkspace, this.workspace); + assert.equal(gesture.mostRecentEvent, e); + assert.equal(gesture.creatorWorkspace, this.workspace); }); test('Field click - Click in workspace', function () { @@ -81,7 +79,7 @@ suite('Gesture', function () { test('Field click - Auto close flyout', function () { const flyout = this.workspace.getFlyout(true); - chai.assert.exists(flyout, 'Precondition: missing flyout'); + assert.exists(flyout, 'Precondition: missing flyout'); flyout.autoClose = true; const block = getTopFlyoutBlock(flyout); @@ -90,7 +88,7 @@ suite('Gesture', function () { test('Field click - Always open flyout', function () { const flyout = this.workspace.getFlyout(true); - chai.assert.exists(flyout, 'Precondition: missing flyout'); + assert.exists(flyout, 'Precondition: missing flyout'); flyout.autoClose = false; const block = getTopFlyoutBlock(flyout); diff --git a/tests/mocha/icon_test.js b/tests/mocha/icon_test.js index 3463d8ad83b..dd5668b24c8 100644 --- a/tests/mocha/icon_test.js +++ b/tests/mocha/icon_test.js @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {assert} from '../../node_modules/chai/chai.js'; import { sharedTestSetup, sharedTestTeardown, @@ -62,7 +63,7 @@ suite('Icon', function () { block.addIcon(icon); - chai.assert.isFalse( + assert.isFalse( initViewSpy.called, 'Expected initView to not be called', ); @@ -79,7 +80,7 @@ suite('Icon', function () { const initViewSpy = sinon.spy(icon, 'initView'); block.addIcon(icon); - chai.assert.isTrue( + assert.isTrue( initViewSpy.calledOnce, 'Expected initView to be called', ); @@ -96,7 +97,7 @@ suite('Icon', function () { block.addIcon(icon); - chai.assert.isFalse( + assert.isFalse( applyColourSpy.called, 'Expected applyColour to not be called', ); @@ -112,7 +113,7 @@ suite('Icon', function () { const applyColourSpy = sinon.spy(icon, 'applyColour'); block.addIcon(icon); - chai.assert.isTrue( + assert.isTrue( applyColourSpy.calledOnce, 'Expected applyColour to be called', ); @@ -128,7 +129,7 @@ suite('Icon', function () { block.addIcon(icon); applyColourSpy.resetHistory(); block.setColour('#cccccc'); - chai.assert.isTrue( + assert.isTrue( applyColourSpy.calledOnce, 'Expected applyColour to be called', ); @@ -143,7 +144,7 @@ suite('Icon', function () { block.addIcon(icon); applyColourSpy.resetHistory(); block.setStyle('logic_block'); - chai.assert.isTrue( + assert.isTrue( applyColourSpy.calledOnce, 'Expected applyColour to be called', ); @@ -158,7 +159,7 @@ suite('Icon', function () { block.addIcon(icon); applyColourSpy.resetHistory(); block.setDisabledReason(true, 'test reason'); - chai.assert.isTrue( + assert.isTrue( applyColourSpy.calledOnce, 'Expected applyColour to be called', ); @@ -173,7 +174,7 @@ suite('Icon', function () { block.addIcon(icon); applyColourSpy.resetHistory(); block.setShadow(true); - chai.assert.isTrue( + assert.isTrue( applyColourSpy.calledOnce, 'Expected applyColour to be called', ); @@ -189,7 +190,7 @@ suite('Icon', function () { block.addIcon(icon); - chai.assert.isFalse( + assert.isFalse( updateEditableSpy.called, 'Expected updateEditable to not be called', ); @@ -205,7 +206,7 @@ suite('Icon', function () { const updateEditableSpy = sinon.spy(icon, 'updateEditable'); block.addIcon(icon); - chai.assert.isTrue( + assert.isTrue( updateEditableSpy.calledOnce, 'Expected updateEditable to be called', ); @@ -221,7 +222,7 @@ suite('Icon', function () { block.addIcon(icon); updateEditableSpy.resetHistory(); block.setEditable(false); - chai.assert.isTrue( + assert.isTrue( updateEditableSpy.calledOnce, 'Expected updateEditable to be called', ); @@ -237,7 +238,7 @@ suite('Icon', function () { block.setEditable(false); updateEditableSpy.resetHistory(); block.setEditable(true); - chai.assert.isTrue( + assert.isTrue( updateEditableSpy.calledOnce, 'Expected updateEditable to be called', ); @@ -255,7 +256,7 @@ suite('Icon', function () { block.setCollapsed(true); block.setCollapsed(false); - chai.assert.isFalse( + assert.isFalse( updateCollapsedSpy.called, 'Expected updateCollapsed to not be called', ); @@ -272,7 +273,7 @@ suite('Icon', function () { block.setCollapsed(true); this.clock.runAll(); - chai.assert.isTrue( + assert.isTrue( updateCollapsedSpy.called, 'Expected updateCollapsed to be called', ); @@ -289,7 +290,7 @@ suite('Icon', function () { block.setCollapsed(false); this.clock.runAll(); - chai.assert.isTrue( + assert.isTrue( updateCollapsedSpy.called, 'Expected updateCollapsed to be called', ); @@ -302,7 +303,7 @@ suite('Icon', function () { const block = createHeadlessBlock(createHeadlessWorkspace()); block.addIcon(new MockSerializableIcon()); const json = Blockly.serialization.blocks.save(block); - chai.assert.deepNestedInclude( + assert.deepNestedInclude( json, {'icons': {'serializable icon': 'some state'}}, 'Expected the JSON to include the saved state of the ' + @@ -314,7 +315,7 @@ suite('Icon', function () { const block = createHeadlessBlock(createHeadlessWorkspace()); block.addIcon(new MockNonSerializableIcon()); const json = Blockly.serialization.blocks.save(block); - chai.assert.notProperty( + assert.notProperty( json, 'icons', 'Expected the JSON to not include any saved state for icons', @@ -337,7 +338,7 @@ suite('Icon', function () { }, }; const block = Blockly.serialization.blocks.append(json, workspace); - chai.assert.equal( + assert.equal( block.getIcon('serializable icon').state, 'some state', 'Expected the icon to have been properly instantiated and ' + @@ -355,7 +356,7 @@ suite('Icon', function () { 'serializable icon': 'some state', }, }; - chai.assert.throws( + assert.throws( () => { Blockly.serialization.blocks.append(json, workspace); }, diff --git a/tests/mocha/index.html b/tests/mocha/index.html index 9c7b10cabe2..e095f402a09 100644 --- a/tests/mocha/index.html +++ b/tests/mocha/index.html @@ -21,7 +21,6 @@ -