mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
chore: convert mocha tests and test helpers to esmodules (#6333)
* chore: change goog.module to goog.declareModuleId * chore: change test helper exports to esmod exports * chore: change test helpers to use esmodule imports * chore: convert imports of test helpers to esmodule imports * chore: convert other imports in tests to esm imports * fix: make imports use built files * chore: add blockly imports to a bunch of tests * fix: reference Blockly.Blocks instead of Blocks' * fix: properly import generators * chore: fix lint * chore: cleanup from rebase * chore: cleanup from rebase * chore: fix blocks tests
This commit is contained in:
@@ -11,7 +11,11 @@
|
||||
"no-unused-vars": ["off"],
|
||||
// Allow uncommented helper functions in tests.
|
||||
"require-jsdoc": ["off"],
|
||||
"prefer-rest-params": ["off"]
|
||||
"prefer-rest-params": ["off"],
|
||||
"no-invalid-this": ["off"]
|
||||
},
|
||||
"extends": "../../.eslintrc.json"
|
||||
"extends": "../../.eslintrc.json",
|
||||
"parserOptions": {
|
||||
"sourceType": "module"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.astNode');
|
||||
goog.declareModuleId('Blockly.test.astNode');
|
||||
|
||||
const {ASTNode} = goog.require('Blockly.ASTNode');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {ASTNode} from '../../build/src/core/keyboard_nav/ast_node.js';
|
||||
import {sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('ASTNode', function() {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.blockChangeEvent');
|
||||
goog.declareModuleId('Blockly.test.blockChangeEvent');
|
||||
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {defineMutatorBlocks} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {defineMutatorBlocks} from './test_helpers/block_definitions.js';
|
||||
|
||||
|
||||
suite('Block Change Event', function() {
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.blockCreateEvent');
|
||||
goog.declareModuleId('Blockly.test.blockCreateEvent');
|
||||
|
||||
const {assertEventFired} = goog.require('Blockly.test.helpers.events');
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {assertEventFired} from './test_helpers/events.js';
|
||||
import * as eventUtils from '../../build/src/core/events/utils.js';
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Block Create Event', function() {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.blockJson');
|
||||
goog.declareModuleId('Blockly.test.blockJson');
|
||||
|
||||
const {Align} = goog.require('Blockly.Input');
|
||||
import {Align} from '../../build/src/core/input.js';
|
||||
|
||||
|
||||
suite('Block JSON initialization', function() {
|
||||
|
||||
@@ -4,14 +4,13 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.blocks');
|
||||
goog.declareModuleId('Blockly.test.blocks');
|
||||
|
||||
const {Blocks} = goog.require('Blockly.blocks');
|
||||
const {ConnectionType} = goog.require('Blockly.ConnectionType');
|
||||
const {createDeprecationWarningStub} = goog.require('Blockly.test.helpers.warnings');
|
||||
const {createRenderedBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {ConnectionType} from '../../build/src/core/connection_type.js';
|
||||
import {createDeprecationWarningStub} from './test_helpers/warnings.js';
|
||||
import {createRenderedBlock} from './test_helpers/block_definitions.js';
|
||||
import * as eventUtils from '../../build/src/core/events/utils.js';
|
||||
import {sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Blocks', function() {
|
||||
@@ -1990,7 +1989,7 @@ suite('Blocks', function() {
|
||||
// so we assert init was called to be safe.
|
||||
let initCalled = false;
|
||||
let recordUndoDuringInit;
|
||||
Blocks['init_test_block'].init = function() {
|
||||
Blockly.Blocks['init_test_block'].init = function() {
|
||||
initCalled = true;
|
||||
recordUndoDuringInit = eventUtils.getRecordUndo();
|
||||
throw new Error();
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.lists');
|
||||
goog.declareModuleId('Blockly.test.lists');
|
||||
|
||||
const {runSerializationTestSuite} = goog.require('Blockly.test.helpers.serialization');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {ConnectionType} = goog.require('Blockly.ConnectionType');
|
||||
const {defineStatementBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
import {runSerializationTestSuite} from '../test_helpers/serialization.js';
|
||||
import {sharedTestSetup, sharedTestTeardown} from '../test_helpers/setup_teardown.js';
|
||||
import {ConnectionType} from '../../build/src/core/connection_type.js';
|
||||
import {defineStatementBlock} from '../test_helpers/block_definitions.js';
|
||||
|
||||
|
||||
suite('Lists', function() {
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.logicTernary');
|
||||
goog.declareModuleId('Blockly.test.logicTernary');
|
||||
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
const {runSerializationTestSuite} = goog.require('Blockly.test.helpers.serialization');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import * as eventUtils from '../../build/src/core/events/utils.js';
|
||||
import {runSerializationTestSuite} from '../test_helpers/serialization.js';
|
||||
import {sharedTestSetup, sharedTestTeardown} from '../test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Logic ternary', function() {
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.procedures');
|
||||
goog.declareModuleId('Blockly.test.procedures');
|
||||
|
||||
goog.require('Blockly');
|
||||
goog.require('Blockly.Msg');
|
||||
const {assertCallBlockStructure, assertDefBlockStructure, createProcDefBlock, createProcCallBlock} = goog.require('Blockly.test.helpers.procedures');
|
||||
const {runSerializationTestSuite} = goog.require('Blockly.test.helpers.serialization');
|
||||
const {createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
import {assertCallBlockStructure, assertDefBlockStructure, createProcDefBlock, createProcCallBlock} from '../test_helpers/procedures.js';
|
||||
import {runSerializationTestSuite} from '../test_helpers/serialization.js';
|
||||
import {createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} from '../test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Procedures', function() {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.variables');
|
||||
goog.declareModuleId('Blockly.test.variables');
|
||||
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {sharedTestSetup, sharedTestTeardown} from '../test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Variables', function() {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.commentDeserialization');
|
||||
goog.declareModuleId('Blockly.test.commentDeserialization');
|
||||
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {simulateClick} = goog.require('Blockly.test.helpers.userInput');
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {simulateClick} from './test_helpers/user_input.js';
|
||||
|
||||
|
||||
suite('Comment Deserialization', function() {
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.comments');
|
||||
goog.declareModuleId('Blockly.test.comments');
|
||||
|
||||
const {assertEventFired} = goog.require('Blockly.test.helpers.events');
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {assertEventFired} from './test_helpers/events.js';
|
||||
import * as eventUtils from '../../build/src/core/events/utils.js';
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Comments', function() {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.connectionChecker');
|
||||
goog.declareModuleId('Blockly.test.connectionChecker');
|
||||
|
||||
const {ConnectionType} = goog.require('Blockly.ConnectionType');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {ConnectionType} from '../../build/src/core/connection_type.js';
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Connection checker', function() {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.connectionDb');
|
||||
goog.declareModuleId('Blockly.test.connectionDb');
|
||||
|
||||
const {ConnectionType} = goog.require('Blockly.ConnectionType');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {ConnectionType} from '../../build/src/core/connection_type.js';
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Connection Database', function() {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.connection');
|
||||
goog.declareModuleId('Blockly.test.connection');
|
||||
|
||||
const {createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {defineRowBlock, defineStatementBlock, defineStackBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
import {createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {defineRowBlock, defineStatementBlock, defineStackBlock} from './test_helpers/block_definitions.js';
|
||||
|
||||
|
||||
suite('Connection', function() {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.contextMenuItem');
|
||||
goog.declareModuleId('Blockly.test.contextMenuItem');
|
||||
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Context Menu Items', function() {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.cursor');
|
||||
goog.declareModuleId('Blockly.test.cursor');
|
||||
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {ASTNode} = goog.require('Blockly.ASTNode');
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {ASTNode} from '../../build/src/core/keyboard_nav/ast_node.js';
|
||||
|
||||
|
||||
suite('Cursor', function() {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.dropdown');
|
||||
goog.declareModuleId('Blockly.test.dropdown');
|
||||
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('DropDownDiv', function() {
|
||||
|
||||
@@ -4,14 +4,15 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.event');
|
||||
goog.declareModuleId('Blockly.test.event');
|
||||
|
||||
const {ASTNode} = goog.require('Blockly.ASTNode');
|
||||
const {assertEventEquals, assertNthCallEventArgEquals, createFireChangeListenerSpy} = goog.require('Blockly.test.helpers.events');
|
||||
const {assertVariableValues} = goog.require('Blockly.test.helpers.variables');
|
||||
const {createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
goog.require('Blockly.WorkspaceComment');
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
import {ASTNode} from '../../build/src/core/keyboard_nav/ast_node.js';
|
||||
import {assertEventEquals, assertNthCallEventArgEquals, createFireChangeListenerSpy} from './test_helpers/events.js';
|
||||
import {assertVariableValues} from './test_helpers/variables.js';
|
||||
import {createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
import * as eventUtils from '../../build/src/core/events/utils.js';
|
||||
import {WorkspaceComment} from '../../build/src/core/workspace_comment.js';
|
||||
|
||||
|
||||
suite('Events', function() {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.extensions');
|
||||
goog.declareModuleId('Blockly.test.extensions');
|
||||
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Extensions', function() {
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.fieldAngle');
|
||||
goog.declareModuleId('Blockly.test.fieldAngle');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {createTestBlock, defineRowBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
import {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} from './test_helpers/fields.js';
|
||||
import {createTestBlock, defineRowBlock} from './test_helpers/block_definitions.js';
|
||||
import {sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Angle Fields', function() {
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.fieldCheckbox');
|
||||
goog.declareModuleId('Blockly.test.fieldCheckbox');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {defineRowBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
import {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} from './test_helpers/fields.js';
|
||||
import {sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {defineRowBlock} from './test_helpers/block_definitions.js';
|
||||
|
||||
|
||||
suite('Checkbox Fields', function() {
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.fieldColour');
|
||||
goog.declareModuleId('Blockly.test.fieldColour');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {createTestBlock, defineRowBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
import {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} from './test_helpers/fields.js';
|
||||
import {createTestBlock, defineRowBlock} from './test_helpers/block_definitions.js';
|
||||
import {sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Colour Fields', function() {
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.fieldDropdown');
|
||||
goog.declareModuleId('Blockly.test.fieldDropdown');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {createTestBlock, defineRowBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
import {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} from './test_helpers/fields.js';
|
||||
import {createTestBlock, defineRowBlock} from './test_helpers/block_definitions.js';
|
||||
import {sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Dropdown Fields', function() {
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.fieldImage');
|
||||
goog.declareModuleId('Blockly.test.fieldImage');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
import {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} from './test_helpers/fields.js';
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Image Fields', function() {
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.fieldLabelSerialization');
|
||||
goog.declareModuleId('Blockly.test.fieldLabelSerialization');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {createTestBlock, defineRowBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
import {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} from './test_helpers/fields.js';
|
||||
import {sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {createTestBlock, defineRowBlock} from './test_helpers/block_definitions.js';
|
||||
|
||||
|
||||
suite('Label Serializable Fields', function() {
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.fieldLabel');
|
||||
goog.declareModuleId('Blockly.test.fieldLabel');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {createTestBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
import {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} from './test_helpers/fields.js';
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {createTestBlock} from './test_helpers/block_definitions.js';
|
||||
|
||||
|
||||
suite('Label Fields', function() {
|
||||
|
||||
@@ -4,12 +4,18 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.fieldMultiline');
|
||||
goog.declareModuleId('Blockly.test.fieldMultiline');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {createTestBlock, defineRowBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {runCodeGenerationTestSuites} = goog.require('Blockly.test.helpers.codeGeneration');
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
import {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} from './test_helpers/fields.js';
|
||||
import {createTestBlock, defineRowBlock} from './test_helpers/block_definitions.js';
|
||||
import {sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {runCodeGenerationTestSuites} from './test_helpers/code_generation.js';
|
||||
const {dartGenerator} = goog.require('Blockly.Dart');
|
||||
const {javascriptGenerator} = goog.require('Blockly.JavaScript');
|
||||
const {luaGenerator} = goog.require('Blockly.Lua');
|
||||
const {phpGenerator} = goog.require('Blockly.PHP');
|
||||
const {pythonGenerator} = goog.require('Blockly.Python');
|
||||
|
||||
|
||||
suite('Multiline Input Fields', function() {
|
||||
|
||||
@@ -4,12 +4,13 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.fieldNumber');
|
||||
goog.declareModuleId('Blockly.test.fieldNumber');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {defineRowBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {runTestCases} = goog.require('Blockly.test.helpers.common');
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
import {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} from './test_helpers/fields.js';
|
||||
import {defineRowBlock} from './test_helpers/block_definitions.js';
|
||||
import {sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {runTestCases} from './test_helpers/common.js';
|
||||
|
||||
|
||||
suite('Number Fields', function() {
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.fieldRegistry');
|
||||
goog.declareModuleId('Blockly.test.fieldRegistry');
|
||||
|
||||
const {createDeprecationWarningStub} = goog.require('Blockly.test.helpers.warnings');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
import {createDeprecationWarningStub} from './test_helpers/warnings.js';
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Field Registry', function() {
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.fieldTest');
|
||||
goog.declareModuleId('Blockly.test.fieldTest');
|
||||
|
||||
const {addBlockTypeToCleanup, addMessageToCleanup, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {createDeprecationWarningStub} = goog.require('Blockly.test.helpers.warnings');
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
import {addBlockTypeToCleanup, addMessageToCleanup, sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {createDeprecationWarningStub} from './test_helpers/warnings.js';
|
||||
|
||||
|
||||
suite('Abstract Fields', function() {
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.fieldTextInput');
|
||||
goog.declareModuleId('Blockly.test.fieldTextInput');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {createTestBlock, defineRowBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
import {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} from './test_helpers/fields.js';
|
||||
import {createTestBlock, defineRowBlock} from './test_helpers/block_definitions.js';
|
||||
import {sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Text Input Fields', function() {
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.fieldVariable');
|
||||
goog.declareModuleId('Blockly.test.fieldVariable');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {createTestBlock, defineRowBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
import {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} from './test_helpers/fields.js';
|
||||
import {createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {createTestBlock, defineRowBlock} from './test_helpers/block_definitions.js';
|
||||
|
||||
|
||||
suite('Variable Fields', function() {
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.flyout');
|
||||
goog.declareModuleId('Blockly.test.flyout');
|
||||
|
||||
const {defineStackBlock, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {getBasicToolbox, getChildItem, getCollapsibleItem, getDeeplyNestedJSON, getInjectedToolbox, getNonCollapsibleItem, getProperSimpleJson, getSeparator, getSimpleJson, getXmlArray} = goog.require('Blockly.test.helpers.toolboxDefinitions');
|
||||
import {sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {defineStackBlock} from './test_helpers/block_definitions.js';
|
||||
import {getBasicToolbox, getChildItem, getCollapsibleItem, getDeeplyNestedJSON, getInjectedToolbox, getNonCollapsibleItem, getProperSimpleJson, getSeparator, getSimpleJson, getXmlArray} from './test_helpers/toolbox_definitions.js';
|
||||
|
||||
|
||||
suite('Flyout', function() {
|
||||
|
||||
@@ -4,14 +4,15 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.generator');
|
||||
goog.declareModuleId('Blockly.test.generator');
|
||||
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
const {dartGenerator} = goog.require('Blockly.Dart');
|
||||
const {javaScriptGenerator} = goog.require('Blockly.JavaScript');
|
||||
const {javascriptGenerator} = goog.require('Blockly.JavaScript');
|
||||
const {luaGenerator} = goog.require('Blockly.Lua');
|
||||
const {phpGenerator} = goog.require('Blockly.PHP');
|
||||
const {pythonGenerator} = goog.require('Blockly.Python');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Generator', function() {
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.gesture');
|
||||
goog.declareModuleId('Blockly.test.gesture');
|
||||
|
||||
const {assertEventFired, assertEventNotFired} = goog.require('Blockly.test.helpers.events');
|
||||
const {defineBasicBlockWithField} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const {dispatchPointerEvent} = goog.require('Blockly.test.helpers.userInput');
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {assertEventFired, assertEventNotFired} from './test_helpers/events.js';
|
||||
import {defineBasicBlockWithField} from './test_helpers/block_definitions.js';
|
||||
import {dispatchPointerEvent} from './test_helpers/user_input.js';
|
||||
import * as eventUtils from '../../build/src/core/events/utils.js';
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Gesture', function() {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.input');
|
||||
goog.declareModuleId('Blockly.test.input');
|
||||
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Inputs', function() {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.insertionMarker');
|
||||
goog.declareModuleId('Blockly.test.insertionMarker');
|
||||
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('InsertionMarkers', function() {
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.jsoDeserialization');
|
||||
goog.declareModuleId('Blockly.test.jsoDeserialization');
|
||||
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {assertEventFired} = goog.require('Blockly.test.helpers.events');
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
import {sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {assertEventFired} from './test_helpers/events.js';
|
||||
import * as eventUtils from '../../build/src/core/events/utils.js';
|
||||
|
||||
|
||||
suite('JSO Deserialization', function() {
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.jsoSerialization');
|
||||
goog.declareModuleId('Blockly.test.jsoSerialization');
|
||||
|
||||
const {createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {defineRowBlock, defineStackBlock, defineStatementBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
import {createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {defineRowBlock, defineStackBlock, defineStatementBlock} from './test_helpers/block_definitions.js';
|
||||
|
||||
|
||||
suite('JSO Serialization', function() {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.json');
|
||||
goog.declareModuleId('Blockly.test.json');
|
||||
|
||||
const {addMessageToCleanup, sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {assertNoWarnings, assertWarnings} = goog.require('Blockly.test.helpers.warnings');
|
||||
import {addMessageToCleanup, sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {assertNoWarnings, assertWarnings} from './test_helpers/warnings.js';
|
||||
|
||||
|
||||
suite('JSON Block Definitions', function() {
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.keydown');
|
||||
goog.declareModuleId('Blockly.test.keydown');
|
||||
|
||||
const {createKeyDownEvent} = goog.require('Blockly.test.helpers.userInput');
|
||||
const {defineStackBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
import {createKeyDownEvent} from './test_helpers/user_input.js';
|
||||
import {defineStackBlock} from './test_helpers/block_definitions.js';
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Key Down', function() {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.metrics');
|
||||
goog.declareModuleId('Blockly.test.metrics');
|
||||
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Metrics', function() {
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.mutator');
|
||||
goog.declareModuleId('Blockly.test.mutator');
|
||||
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {createRenderedBlock, defineMutatorBlocks} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {createRenderedBlock, defineMutatorBlocks} from './test_helpers/block_definitions.js';
|
||||
|
||||
|
||||
suite('Mutator', function() {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.names');
|
||||
goog.declareModuleId('Blockly.test.names');
|
||||
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Names', function() {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.registry');
|
||||
goog.declareModuleId('Blockly.test.registry');
|
||||
|
||||
const {assertWarnings} = goog.require('Blockly.test.helpers.warnings');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {assertWarnings} from './test_helpers/warnings.js';
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Registry', function() {
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.serialization');
|
||||
goog.declareModuleId('Blockly.test.serialization');
|
||||
|
||||
const {TestCase, TestSuite, runTestCases, runTestSuites} = goog.require('Blockly.test.helpers.common');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import * as Blockly from '../../build/src/core/blockly.js';
|
||||
import {TestCase, TestSuite, runTestCases, runTestSuites} from './test_helpers/common.js';
|
||||
import {sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
// TODO: Move this into samples as part of the dev-tools package.
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.shortcutRegistry');
|
||||
goog.declareModuleId('Blockly.test.shortcutRegistry');
|
||||
|
||||
const {createKeyDownEvent} = goog.require('Blockly.test.helpers.userInput');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {createKeyDownEvent} from './test_helpers/user_input.js';
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Keyboard Shortcut Registry Test', function() {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.helpers.blockDefinitions');
|
||||
goog.declareModuleId('Blockly.test.helpers.blockDefinitions');
|
||||
|
||||
|
||||
function defineStackBlock(name = 'stack_block') {
|
||||
export function defineStackBlock(name = 'stack_block') {
|
||||
Blockly.defineBlocksWithJsonArray([{
|
||||
"type": name,
|
||||
"message0": "",
|
||||
@@ -15,9 +15,8 @@ function defineStackBlock(name = 'stack_block') {
|
||||
"nextStatement": null,
|
||||
}]);
|
||||
}
|
||||
exports.defineStackBlock = defineStackBlock;
|
||||
|
||||
function defineRowBlock(name = 'row_block') {
|
||||
export function defineRowBlock(name = 'row_block') {
|
||||
Blockly.defineBlocksWithJsonArray([{
|
||||
"type": name,
|
||||
"message0": "%1",
|
||||
@@ -30,9 +29,8 @@ function defineRowBlock(name = 'row_block') {
|
||||
"output": null,
|
||||
}]);
|
||||
}
|
||||
exports.defineRowBlock = defineRowBlock;
|
||||
|
||||
function defineStatementBlock(name = 'statement_block') {
|
||||
export function defineStatementBlock(name = 'statement_block') {
|
||||
Blockly.defineBlocksWithJsonArray([{
|
||||
"type": name,
|
||||
"message0": "%1",
|
||||
@@ -49,9 +47,8 @@ function defineStatementBlock(name = 'statement_block') {
|
||||
"helpUrl": "",
|
||||
}]);
|
||||
}
|
||||
exports.defineStatementBlock = defineStatementBlock;
|
||||
|
||||
function defineBasicBlockWithField(name = 'test_field_block') {
|
||||
export function defineBasicBlockWithField(name = 'test_field_block') {
|
||||
Blockly.defineBlocksWithJsonArray([{
|
||||
"type": name,
|
||||
"message0": "%1",
|
||||
@@ -64,9 +61,8 @@ function defineBasicBlockWithField(name = 'test_field_block') {
|
||||
"output": null,
|
||||
}]);
|
||||
}
|
||||
exports.defineBasicBlockWithField = defineBasicBlockWithField;
|
||||
|
||||
function defineMutatorBlocks() {
|
||||
export function defineMutatorBlocks() {
|
||||
Blockly.defineBlocksWithJsonArray([
|
||||
{
|
||||
'type': 'xml_block',
|
||||
@@ -158,9 +154,8 @@ function defineMutatorBlocks() {
|
||||
};
|
||||
Blockly.Extensions.registerMutator('jso_mutator', jsoMutator);
|
||||
}
|
||||
exports.defineMutatorBlocks = defineMutatorBlocks;
|
||||
|
||||
function createTestBlock() {
|
||||
export function createTestBlock() {
|
||||
return {
|
||||
'id': 'test',
|
||||
'rendered': false,
|
||||
@@ -174,12 +169,10 @@ function createTestBlock() {
|
||||
'updateVarName': Blockly.Block.prototype.updateVarName,
|
||||
};
|
||||
}
|
||||
exports.createTestBlock = createTestBlock;
|
||||
|
||||
function createRenderedBlock(workspaceSvg, type) {
|
||||
export function createRenderedBlock(workspaceSvg, type) {
|
||||
const block = workspaceSvg.newBlock(type);
|
||||
block.initSvg();
|
||||
block.render();
|
||||
return block;
|
||||
}
|
||||
exports.createRenderedBlock = createRenderedBlock;
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.helpers.codeGeneration');
|
||||
goog.declareModuleId('Blockly.test.helpers.codeGeneration');
|
||||
|
||||
const {runTestSuites} = goog.require('Blockly.test.helpers.common');
|
||||
import {runTestSuites} from './common.js';
|
||||
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@ const {runTestSuites} = goog.require('Blockly.test.helpers.common');
|
||||
* @implements {TestCase}
|
||||
* @record
|
||||
*/
|
||||
class CodeGenerationTestCase {
|
||||
export class CodeGenerationTestCase {
|
||||
/**
|
||||
* Class for a code generation test case.
|
||||
*/
|
||||
@@ -43,14 +43,13 @@ class CodeGenerationTestCase {
|
||||
*/
|
||||
createBlock(workspace) {}
|
||||
}
|
||||
exports.CodeGenerationTestCase = CodeGenerationTestCase;
|
||||
|
||||
/**
|
||||
* Code generation test suite.
|
||||
* @extends {TestSuite<CodeGenerationTestCase, CodeGenerationTestSuite>}
|
||||
* @record
|
||||
*/
|
||||
class CodeGenerationTestSuite {
|
||||
export class CodeGenerationTestSuite {
|
||||
/**
|
||||
* Class for a code generation test suite.
|
||||
*/
|
||||
@@ -61,7 +60,6 @@ class CodeGenerationTestSuite {
|
||||
this.generator;
|
||||
}
|
||||
}
|
||||
exports.CodeGenerationTestSuite = CodeGenerationTestSuite;
|
||||
|
||||
/**
|
||||
* Returns mocha test callback for code generation based on provided
|
||||
@@ -102,7 +100,7 @@ const createCodeGenerationTestFn_ = (generator) => {
|
||||
* Runs blockToCode test suites.
|
||||
* @param {!Array<!CodeGenerationTestSuite>} testSuites The test suites to run.
|
||||
*/
|
||||
const runCodeGenerationTestSuites = (testSuites) => {
|
||||
export const runCodeGenerationTestSuites = (testSuites) => {
|
||||
/**
|
||||
* Creates function used to generate mocha test callback.
|
||||
* @param {!CodeGenerationTestSuite} suiteInfo The test suite information.
|
||||
@@ -115,4 +113,3 @@ const runCodeGenerationTestSuites = (testSuites) => {
|
||||
|
||||
runTestSuites(testSuites, createTestFn);
|
||||
};
|
||||
exports.runCodeGenerationTestSuites = runCodeGenerationTestSuites;
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.helpers.common');
|
||||
goog.declareModuleId('Blockly.test.helpers.common');
|
||||
|
||||
/**
|
||||
* Test case configuration.
|
||||
* @record
|
||||
*/
|
||||
class TestCase {
|
||||
export class TestCase {
|
||||
/**
|
||||
* Class for a test case configuration.
|
||||
*/
|
||||
@@ -31,7 +31,6 @@ class TestCase {
|
||||
this.only;
|
||||
}
|
||||
}
|
||||
exports.TestCase = TestCase;
|
||||
|
||||
/**
|
||||
* Test suite configuration.
|
||||
@@ -39,7 +38,7 @@ exports.TestCase = TestCase;
|
||||
* @template {TestCase} T
|
||||
* @template {TestSuite} U
|
||||
*/
|
||||
class TestSuite {
|
||||
export class TestSuite {
|
||||
/**
|
||||
* Class for a test suite configuration.
|
||||
*/
|
||||
@@ -68,7 +67,6 @@ class TestSuite {
|
||||
this.only;
|
||||
}
|
||||
}
|
||||
exports.TestSuite = TestSuite;
|
||||
|
||||
/**
|
||||
* Runs provided test cases.
|
||||
@@ -77,14 +75,13 @@ exports.TestSuite = TestSuite;
|
||||
* @param {function(T):Function} createTestCallback Creates test
|
||||
* callback using given test case.
|
||||
*/
|
||||
function runTestCases(testCases, createTestCallback) {
|
||||
export function runTestCases(testCases, createTestCallback) {
|
||||
testCases.forEach((testCase) => {
|
||||
let testCall = (testCase.skip ? test.skip : test);
|
||||
testCall = (testCase.only ? test.only : testCall);
|
||||
testCall(testCase.title, createTestCallback(testCase));
|
||||
});
|
||||
}
|
||||
exports.runTestCases = runTestCases;
|
||||
|
||||
/**
|
||||
* Runs provided test suite.
|
||||
@@ -95,7 +92,7 @@ exports.runTestCases = runTestCases;
|
||||
* } createTestCaseCallback Creates test case callback using given test
|
||||
* suite.
|
||||
*/
|
||||
function runTestSuites(testSuites, createTestCaseCallback) {
|
||||
export function runTestSuites(testSuites, createTestCaseCallback) {
|
||||
testSuites.forEach((testSuite) => {
|
||||
let suiteCall = (testSuite.skip ? suite.skip : suite);
|
||||
suiteCall = (testSuite.only ? suite.only : suiteCall);
|
||||
@@ -109,4 +106,3 @@ function runTestSuites(testSuites, createTestCaseCallback) {
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.runTestSuites = runTestSuites;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.helpers.events');
|
||||
goog.declareModuleId('Blockly.test.helpers.events');
|
||||
|
||||
|
||||
/**
|
||||
@@ -13,10 +13,9 @@ goog.module('Blockly.test.helpers.events');
|
||||
* calls on.
|
||||
* @return {!SinonSpy} The created spy.
|
||||
*/
|
||||
function createFireChangeListenerSpy(workspace) {
|
||||
export function createFireChangeListenerSpy(workspace) {
|
||||
return sinon.spy(workspace, 'fireChangeListener');
|
||||
}
|
||||
exports.createFireChangeListenerSpy = createFireChangeListenerSpy;
|
||||
|
||||
/**
|
||||
* Asserts whether the given xml property has the expected property.
|
||||
@@ -75,7 +74,7 @@ function isXmlProperty_(key) {
|
||||
* @param {boolean=} [isUiEvent=false] Whether the event is a UI event.
|
||||
* @param {string=} message Optional message to prepend assert messages.
|
||||
*/
|
||||
function assertEventEquals(event, expectedType,
|
||||
export function assertEventEquals(event, expectedType,
|
||||
expectedWorkspaceId, expectedBlockId, expectedProperties, isUiEvent = false, message) {
|
||||
let prependMessage = message ? message + ' ' : '';
|
||||
prependMessage += 'Event fired ';
|
||||
@@ -107,7 +106,6 @@ function assertEventEquals(event, expectedType,
|
||||
chai.assert.isFalse(event.isUiEvent);
|
||||
}
|
||||
}
|
||||
exports.assertEventEquals = assertEventEquals;
|
||||
|
||||
/**
|
||||
* Asserts that an event with the given values was fired.
|
||||
@@ -119,7 +117,7 @@ exports.assertEventEquals = assertEventEquals;
|
||||
* @param {string} expectedWorkspaceId Expected workspace id of event fired.
|
||||
* @param {?string=} expectedBlockId Expected block id of event fired.
|
||||
*/
|
||||
function assertEventFired(spy, instanceType, expectedProperties,
|
||||
export function assertEventFired(spy, instanceType, expectedProperties,
|
||||
expectedWorkspaceId, expectedBlockId) {
|
||||
expectedProperties = Object.assign({
|
||||
workspaceId: expectedWorkspaceId,
|
||||
@@ -129,7 +127,6 @@ function assertEventFired(spy, instanceType, expectedProperties,
|
||||
sinon.match.instanceOf(instanceType).and(sinon.match(expectedProperties));
|
||||
sinon.assert.calledWith(spy, expectedEvent);
|
||||
}
|
||||
exports.assertEventFired = assertEventFired;
|
||||
|
||||
/**
|
||||
* Asserts that an event with the given values was not fired.
|
||||
@@ -141,7 +138,7 @@ exports.assertEventFired = assertEventFired;
|
||||
* @param {string=} expectedWorkspaceId Expected workspace id of event fired.
|
||||
* @param {?string=} expectedBlockId Expected block id of event fired.
|
||||
*/
|
||||
function assertEventNotFired(spy, instanceType, expectedProperties,
|
||||
export function assertEventNotFired(spy, instanceType, expectedProperties,
|
||||
expectedWorkspaceId, expectedBlockId) {
|
||||
expectedProperties.type = instanceType.prototype.type;
|
||||
if (expectedWorkspaceId !== undefined) {
|
||||
@@ -154,7 +151,6 @@ function assertEventNotFired(spy, instanceType, expectedProperties,
|
||||
sinon.match.instanceOf(instanceType).and(sinon.match(expectedProperties));
|
||||
sinon.assert.neverCalledWith(spy, expectedEvent);
|
||||
}
|
||||
exports.assertEventNotFired = assertEventNotFired;
|
||||
|
||||
/**
|
||||
* Filters out xml properties from given object based on key.
|
||||
@@ -189,7 +185,7 @@ function splitByXmlProperties_(properties) {
|
||||
* @param {string} expectedWorkspaceId Expected workspace id of event fired.
|
||||
* @param {?string=} expectedBlockId Expected block id of event fired.
|
||||
*/
|
||||
function assertNthCallEventArgEquals(spy, n, instanceType, expectedProperties,
|
||||
export function assertNthCallEventArgEquals(spy, n, instanceType, expectedProperties,
|
||||
expectedWorkspaceId, expectedBlockId) {
|
||||
const nthCall = spy.getCall(n);
|
||||
const splitProperties = splitByXmlProperties_(expectedProperties);
|
||||
@@ -201,4 +197,3 @@ function assertNthCallEventArgEquals(spy, n, instanceType, expectedProperties,
|
||||
const eventArg = nthCall.firstArg;
|
||||
assertXmlProperties_(eventArg, xmlProperties);
|
||||
}
|
||||
exports.assertNthCallEventArgEquals = assertNthCallEventArgEquals;
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.helpers.fields');
|
||||
goog.declareModuleId('Blockly.test.helpers.fields');
|
||||
|
||||
const {runTestCases, TestCase} = goog.require('Blockly.test.helpers.common');
|
||||
import {runTestCases, TestCase} from './common.js';
|
||||
|
||||
|
||||
/**
|
||||
@@ -14,7 +14,7 @@ const {runTestCases, TestCase} = goog.require('Blockly.test.helpers.common');
|
||||
* @implements {TestCase}
|
||||
* @record
|
||||
*/
|
||||
class FieldValueTestCase {
|
||||
export class FieldValueTestCase {
|
||||
/**
|
||||
* Class for a a field value test case.
|
||||
*/
|
||||
@@ -39,14 +39,13 @@ class FieldValueTestCase {
|
||||
this.errMsgMatcher;
|
||||
}
|
||||
}
|
||||
exports.FieldValueTestCase = FieldValueTestCase;
|
||||
|
||||
/**
|
||||
* Field creation test case.
|
||||
* @extends {FieldValueTestCase}
|
||||
* @record
|
||||
*/
|
||||
class FieldCreationTestCase {
|
||||
export class FieldCreationTestCase {
|
||||
/**
|
||||
* Class for a field creation test case.
|
||||
*/
|
||||
@@ -61,7 +60,6 @@ class FieldCreationTestCase {
|
||||
this.json;
|
||||
}
|
||||
}
|
||||
exports.FieldCreationTestCase = FieldCreationTestCase;
|
||||
|
||||
/**
|
||||
* Assert a field's value is the same as the expected value.
|
||||
@@ -69,7 +67,7 @@ exports.FieldCreationTestCase = FieldCreationTestCase;
|
||||
* @param {*} expectedValue The expected value.
|
||||
* @param {string=} expectedText The expected text.
|
||||
*/
|
||||
function assertFieldValue(field, expectedValue, expectedText = undefined) {
|
||||
export function assertFieldValue(field, expectedValue, expectedText = undefined) {
|
||||
const actualValue = field.getValue();
|
||||
const actualText = field.getText();
|
||||
if (expectedText === undefined) {
|
||||
@@ -78,7 +76,6 @@ function assertFieldValue(field, expectedValue, expectedText = undefined) {
|
||||
chai.assert.equal(actualValue, expectedValue, 'Value');
|
||||
chai.assert.equal(actualText, expectedText, 'Text');
|
||||
}
|
||||
exports.assertFieldValue = assertFieldValue;
|
||||
|
||||
/**
|
||||
* Runs provided creation test cases.
|
||||
@@ -145,7 +142,7 @@ function runCreationTestsAssertThrows_(testCases, creation) {
|
||||
* @param {function(!FieldCreationTestCase=)=} customCreateWithJs Custom
|
||||
* creation function to use in tests.
|
||||
*/
|
||||
function runConstructorSuiteTests(TestedField, validValueTestCases,
|
||||
export function runConstructorSuiteTests(TestedField, validValueTestCases,
|
||||
invalidValueTestCases, validRunAssertField, assertFieldDefault,
|
||||
customCreateWithJs) {
|
||||
suite('Constructor', function() {
|
||||
@@ -182,7 +179,6 @@ function runConstructorSuiteTests(TestedField, validValueTestCases,
|
||||
runCreationTests_(validValueTestCases, validRunAssertField, createWithJs);
|
||||
});
|
||||
}
|
||||
exports.runConstructorSuiteTests = runConstructorSuiteTests;
|
||||
|
||||
/**
|
||||
* Runs suite of tests for fromJson creation of specified field.
|
||||
@@ -200,7 +196,7 @@ exports.runConstructorSuiteTests = runConstructorSuiteTests;
|
||||
* @param {function(!FieldCreationTestCase=)=} customCreateWithJson Custom
|
||||
* creation function to use in tests.
|
||||
*/
|
||||
function runFromJsonSuiteTests(TestedField, validValueTestCases,
|
||||
export function runFromJsonSuiteTests(TestedField, validValueTestCases,
|
||||
invalidValueTestCases, validRunAssertField, assertFieldDefault,
|
||||
customCreateWithJson) {
|
||||
suite('fromJson', function() {
|
||||
@@ -237,7 +233,6 @@ function runFromJsonSuiteTests(TestedField, validValueTestCases,
|
||||
runCreationTests_(validValueTestCases, validRunAssertField, createWithJson);
|
||||
});
|
||||
}
|
||||
exports.runFromJsonSuiteTests = runFromJsonSuiteTests;
|
||||
|
||||
/**
|
||||
* Runs tests for setValue calls.
|
||||
@@ -250,7 +245,7 @@ exports.runFromJsonSuiteTests = runFromJsonSuiteTests;
|
||||
* @param {string=} invalidRunExpectedText Expected text for field after invalid
|
||||
* call to setValue.
|
||||
*/
|
||||
function runSetValueTests(validValueTestCases, invalidValueTestCases,
|
||||
export function runSetValueTests(validValueTestCases, invalidValueTestCases,
|
||||
invalidRunExpectedValue, invalidRunExpectedText) {
|
||||
/**
|
||||
* Creates test callback for invalid setValue test.
|
||||
@@ -279,4 +274,3 @@ function runSetValueTests(validValueTestCases, invalidValueTestCases,
|
||||
runTestCases(invalidValueTestCases, createInvalidSetValueTestCallback);
|
||||
runTestCases(validValueTestCases, createValidSetValueTestCallback);
|
||||
}
|
||||
exports.runSetValueTests = runSetValueTests;
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* Copyright 2020 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
goog.module('Blockly.test.helpers.procedures');
|
||||
goog.declareModuleId('Blockly.test.helpers.procedures');
|
||||
|
||||
const {ConnectionType} = goog.require('Blockly.ConnectionType');
|
||||
import {ConnectionType} from '../../../build/src/core/connection_type.js';
|
||||
|
||||
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ function assertCallBlockArgsStructure(callBlock, args) {
|
||||
* @param {boolean=} hasStatements If we expect the procedure def to have a
|
||||
* statement input or not.
|
||||
*/
|
||||
function assertDefBlockStructure(defBlock, hasReturn = false,
|
||||
export function assertDefBlockStructure(defBlock, hasReturn = false,
|
||||
args = [], varIds = [], hasStatements = true) {
|
||||
if (hasStatements) {
|
||||
chai.assert.isNotNull(defBlock.getInput('STACK'),
|
||||
@@ -82,7 +82,6 @@ function assertDefBlockStructure(defBlock, hasReturn = false,
|
||||
chai.assert.sameOrderedMembers(defBlock.getVars(), args);
|
||||
assertBlockVarModels(defBlock, varIds);
|
||||
}
|
||||
exports.assertDefBlockStructure = assertDefBlockStructure;
|
||||
|
||||
/**
|
||||
* Asserts that the procedure call block has the expected inputs and
|
||||
@@ -92,7 +91,7 @@ exports.assertDefBlockStructure = assertDefBlockStructure;
|
||||
* @param {Array<string>=} varIds An array of variable ids.
|
||||
* @param {string=} name The name we expect the caller to have.
|
||||
*/
|
||||
function assertCallBlockStructure(
|
||||
export function assertCallBlockStructure(
|
||||
callBlock, args = [], varIds = [], name = undefined) {
|
||||
if (args.length) {
|
||||
chai.assert.include(callBlock.toString(), 'with');
|
||||
@@ -106,7 +105,6 @@ function assertCallBlockStructure(
|
||||
chai.assert(callBlock.getFieldValue('NAME'), name);
|
||||
}
|
||||
}
|
||||
exports.assertCallBlockStructure = assertCallBlockStructure;
|
||||
|
||||
/**
|
||||
* Creates procedure definition block using domToBlock call.
|
||||
@@ -116,7 +114,7 @@ exports.assertCallBlockStructure = assertCallBlockStructure;
|
||||
* @param {Array<string>=} args An array of argument names.
|
||||
* @return {Blockly.Block} The created block.
|
||||
*/
|
||||
function createProcDefBlock(
|
||||
export function createProcDefBlock(
|
||||
workspace, hasReturn = false, args = []) {
|
||||
const type = hasReturn ?
|
||||
'procedures_defreturn' : 'procedures_defnoreturn';
|
||||
@@ -130,7 +128,6 @@ function createProcDefBlock(
|
||||
'</block>';
|
||||
return Blockly.Xml.domToBlock(Blockly.Xml.textToDom(xml), workspace);
|
||||
}
|
||||
exports.createProcDefBlock = createProcDefBlock;
|
||||
|
||||
/**
|
||||
* Creates procedure call block using domToBlock call.
|
||||
@@ -139,7 +136,7 @@ exports.createProcDefBlock = createProcDefBlock;
|
||||
* has return.
|
||||
* @return {Blockly.Block} The created block.
|
||||
*/
|
||||
function createProcCallBlock(
|
||||
export function createProcCallBlock(
|
||||
workspace, hasReturn = false) {
|
||||
const type = hasReturn ?
|
||||
'procedures_callreturn' : 'procedures_callnoreturn';
|
||||
@@ -149,4 +146,3 @@ function createProcCallBlock(
|
||||
'</block>'
|
||||
), workspace);
|
||||
}
|
||||
exports.createProcCallBlock = createProcCallBlock;
|
||||
|
||||
@@ -4,16 +4,16 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.helpers.serialization');
|
||||
goog.declareModuleId('Blockly.test.helpers.serialization');
|
||||
|
||||
const {runTestCases} = goog.require('Blockly.test.helpers.common');
|
||||
import {runTestCases} from './common.js';
|
||||
|
||||
/**
|
||||
* Serialization test case.
|
||||
* @implements {TestCase}
|
||||
* @record
|
||||
*/
|
||||
class SerializationTestCase {
|
||||
export class SerializationTestCase {
|
||||
/**
|
||||
* Class for a block serialization test case.
|
||||
*/
|
||||
@@ -45,13 +45,12 @@ class SerializationTestCase {
|
||||
*/
|
||||
assertBlockStructure(block) {}
|
||||
}
|
||||
exports.SerializationTestCase = SerializationTestCase;
|
||||
|
||||
/**
|
||||
* Runs serialization test suite.
|
||||
* @param {!Array<!SerializationTestCase>} testCases The test cases to run.
|
||||
*/
|
||||
const runSerializationTestSuite = (testCases) => {
|
||||
export const runSerializationTestSuite = (testCases) => {
|
||||
/**
|
||||
* Creates test callback for xmlToBlock test.
|
||||
* @param {!SerializationTestCase} testCase The test case information.
|
||||
@@ -129,4 +128,3 @@ const runSerializationTestSuite = (testCases) => {
|
||||
});
|
||||
});
|
||||
};
|
||||
exports.runSerializationTestSuite = runSerializationTestSuite;
|
||||
|
||||
@@ -4,11 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.helpers.setupTeardown');
|
||||
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
const {Blocks} = goog.require('Blockly.blocks');
|
||||
goog.declareModuleId('Blockly.test.helpers.setupTeardown');
|
||||
|
||||
import * as eventUtils from '../../../build/src/core/events/utils.js';
|
||||
|
||||
/**
|
||||
* Safely disposes of Blockly workspace, logging any errors.
|
||||
@@ -16,7 +14,7 @@ const {Blocks} = goog.require('Blockly.blocks');
|
||||
* using workspaceTeardown.call(this).
|
||||
* @param {!Blockly.Workspace} workspace The workspace to dispose.
|
||||
*/
|
||||
function workspaceTeardown(workspace) {
|
||||
export function workspaceTeardown(workspace) {
|
||||
try {
|
||||
this.clock.runAll(); // Run all queued setTimeout calls.
|
||||
workspace.dispose();
|
||||
@@ -26,7 +24,6 @@ function workspaceTeardown(workspace) {
|
||||
console.error(testRef.fullTitle() + '\n', e);
|
||||
}
|
||||
}
|
||||
exports.workspaceTeardown = workspaceTeardown;
|
||||
|
||||
/**
|
||||
* Creates stub for Blockly.Events.fire that advances the clock forward after
|
||||
@@ -53,10 +50,9 @@ function createEventsFireStubFireImmediately_(clock) {
|
||||
* sharedTestSetup.
|
||||
* @param {string} message The message to add to shared cleanup object.
|
||||
*/
|
||||
function addMessageToCleanup(sharedCleanupObj, message) {
|
||||
export function addMessageToCleanup(sharedCleanupObj, message) {
|
||||
sharedCleanupObj.messagesCleanup_.push(message);
|
||||
}
|
||||
exports.addMessageToCleanup = addMessageToCleanup;
|
||||
|
||||
/**
|
||||
* Adds block type to shared cleanup object so that it is cleaned from
|
||||
@@ -65,10 +61,9 @@ exports.addMessageToCleanup = addMessageToCleanup;
|
||||
* sharedTestSetup.
|
||||
* @param {string} blockType The block type to add to shared cleanup object.
|
||||
*/
|
||||
function addBlockTypeToCleanup(sharedCleanupObj, blockType) {
|
||||
export function addBlockTypeToCleanup(sharedCleanupObj, blockType) {
|
||||
sharedCleanupObj.blockTypesCleanup_.push(blockType);
|
||||
}
|
||||
exports.addBlockTypeToCleanup = addBlockTypeToCleanup;
|
||||
|
||||
/**
|
||||
* Wraps Blockly.defineBlocksWithJsonArray using stub in order to keep track of
|
||||
@@ -111,7 +106,7 @@ function wrapDefineBlocksWithJsonArrayWithCleanup_(sharedCleanupObj) {
|
||||
* @param {Object<string, boolean>} options Options to enable/disable setup
|
||||
* of certain stubs.
|
||||
*/
|
||||
function sharedTestSetup(options = {}) {
|
||||
export function sharedTestSetup(options = {}) {
|
||||
this.sharedSetupCalled_ = true;
|
||||
// Sandbox created for greater control when certain stubs are cleared.
|
||||
this.sharedSetupSandbox_ = sinon.createSandbox();
|
||||
@@ -128,14 +123,13 @@ function sharedTestSetup(options = {}) {
|
||||
this.messagesCleanup_ = this.sharedCleanup.messagesCleanup_;
|
||||
wrapDefineBlocksWithJsonArrayWithCleanup_(this.sharedCleanup);
|
||||
}
|
||||
exports.sharedTestSetup = sharedTestSetup;
|
||||
|
||||
/**
|
||||
* Shared cleanup method that clears up pending setTimeout calls, disposes of
|
||||
* workspace, and resets global variables. Should be called in setup of
|
||||
* outermost suite using sharedTestTeardown.call(this).
|
||||
*/
|
||||
function sharedTestTeardown() {
|
||||
export function sharedTestTeardown() {
|
||||
const testRef = this.currentTest || this.test;
|
||||
if (!this.sharedSetupCalled_) {
|
||||
console.error('"' + testRef.fullTitle() + '" did not call sharedTestSetup');
|
||||
@@ -173,7 +167,7 @@ function sharedTestTeardown() {
|
||||
|
||||
const blockTypes = this.sharedCleanup.blockTypesCleanup_;
|
||||
for (let i = 0; i < blockTypes.length; i++) {
|
||||
delete Blocks[blockTypes[i]];
|
||||
delete Blockly.Blocks[blockTypes[i]];
|
||||
}
|
||||
const messages = this.sharedCleanup.messagesCleanup_;
|
||||
for (let i = 0; i < messages.length; i++) {
|
||||
@@ -183,7 +177,6 @@ function sharedTestTeardown() {
|
||||
Blockly.WidgetDiv.testOnly_setDiv(null);
|
||||
}
|
||||
}
|
||||
exports.sharedTestTeardown = sharedTestTeardown;
|
||||
|
||||
/**
|
||||
* Creates stub for Blockly.utils.genUid that returns the provided id or ids.
|
||||
@@ -194,7 +187,7 @@ exports.sharedTestTeardown = sharedTestTeardown;
|
||||
* that value.
|
||||
* @return {!SinonStub} The created stub.
|
||||
*/
|
||||
function createGenUidStubWithReturns(returnIds) {
|
||||
export function createGenUidStubWithReturns(returnIds) {
|
||||
const stub = sinon.stub(Blockly.utils.idGenerator.TEST_ONLY, "genUid");
|
||||
if (Array.isArray(returnIds)) {
|
||||
for (let i = 0; i < returnIds.length; i++) {
|
||||
@@ -205,4 +198,3 @@ function createGenUidStubWithReturns(returnIds) {
|
||||
}
|
||||
return stub;
|
||||
}
|
||||
exports.createGenUidStubWithReturns = createGenUidStubWithReturns;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.helpers.toolboxDefinitions');
|
||||
goog.declareModuleId('Blockly.test.helpers.toolboxDefinitions');
|
||||
|
||||
|
||||
/**
|
||||
@@ -12,7 +12,7 @@ goog.module('Blockly.test.helpers.toolboxDefinitions');
|
||||
* @return {Blockly.utils.toolbox.ToolboxJson} The array holding information
|
||||
* for a toolbox.
|
||||
*/
|
||||
function getCategoryJSON() {
|
||||
export function getCategoryJSON() {
|
||||
return {"contents": [
|
||||
{
|
||||
"kind": "CATEGORY",
|
||||
@@ -42,14 +42,13 @@ function getCategoryJSON() {
|
||||
"name": "Second",
|
||||
}]};
|
||||
}
|
||||
exports.getCategoryJSON = getCategoryJSON;
|
||||
|
||||
/**
|
||||
* Get JSON for a simple toolbox.
|
||||
* @return {Blockly.utils.toolbox.ToolboxJson} The array holding information
|
||||
* for a simple toolbox.
|
||||
*/
|
||||
function getSimpleJson() {
|
||||
export function getSimpleJson() {
|
||||
return {"contents": [
|
||||
{
|
||||
"kind": "BLOCK",
|
||||
@@ -83,9 +82,8 @@ function getSimpleJson() {
|
||||
},
|
||||
]};
|
||||
}
|
||||
exports.getSimpleJson = getSimpleJson;
|
||||
|
||||
function getProperSimpleJson() {
|
||||
export function getProperSimpleJson() {
|
||||
return {
|
||||
"contents": [
|
||||
{
|
||||
@@ -128,14 +126,13 @@ function getProperSimpleJson() {
|
||||
},
|
||||
]};
|
||||
}
|
||||
exports.getProperSimpleJson = getProperSimpleJson;
|
||||
|
||||
/**
|
||||
* Get JSON for a toolbox that contains categories that contain categories.
|
||||
* @return {Blockly.utils.toolbox.ToolboxJson} The array holding information
|
||||
* for a toolbox.
|
||||
*/
|
||||
function getDeeplyNestedJSON() {
|
||||
export function getDeeplyNestedJSON() {
|
||||
return {"contents": [
|
||||
{
|
||||
"kind": "CATEGORY",
|
||||
@@ -173,13 +170,12 @@ function getDeeplyNestedJSON() {
|
||||
"name": "Second",
|
||||
}]};
|
||||
}
|
||||
exports.getDeeplyNestedJSON = getDeeplyNestedJSON;
|
||||
|
||||
/**
|
||||
* Get an array filled with xml elements.
|
||||
* @return {Array<Node>} Array holding xml elements for a toolbox.
|
||||
*/
|
||||
function getXmlArray() {
|
||||
export function getXmlArray() {
|
||||
const block = Blockly.Xml.textToDom(
|
||||
`<block type="logic_compare">
|
||||
<field name="OP">NEQ</field>
|
||||
@@ -199,9 +195,8 @@ function getXmlArray() {
|
||||
const label = Blockly.Xml.textToDom('<label text="tooltips"></label>');
|
||||
return [block, separator, button, label];
|
||||
}
|
||||
exports.getXmlArray = getXmlArray;
|
||||
|
||||
function getInjectedToolbox() {
|
||||
export function getInjectedToolbox() {
|
||||
/**
|
||||
* Category: First
|
||||
* sep
|
||||
@@ -221,18 +216,16 @@ function getInjectedToolbox() {
|
||||
});
|
||||
return workspace.getToolbox();
|
||||
}
|
||||
exports.getInjectedToolbox = getInjectedToolbox;
|
||||
|
||||
function getBasicToolbox() {
|
||||
export function getBasicToolbox() {
|
||||
const workspace = new Blockly.WorkspaceSvg(new Blockly.Options({}));
|
||||
const toolbox = new Blockly.Toolbox(workspace);
|
||||
toolbox.HtmlDiv = document.createElement('div');
|
||||
toolbox.flyout_ = sinon.createStubInstance(Blockly.VerticalFlyout);
|
||||
return toolbox;
|
||||
}
|
||||
exports.getBasicToolbox = getBasicToolbox;
|
||||
|
||||
function getCollapsibleItem(toolbox) {
|
||||
export function getCollapsibleItem(toolbox) {
|
||||
const contents = toolbox.contents_;
|
||||
for (let i = 0; i < contents.length; i++) {
|
||||
const item = contents[i];
|
||||
@@ -241,9 +234,8 @@ function getCollapsibleItem(toolbox) {
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.getCollapsibleItem = getCollapsibleItem;
|
||||
|
||||
function getNonCollapsibleItem(toolbox) {
|
||||
export function getNonCollapsibleItem(toolbox) {
|
||||
const contents = toolbox.contents_;
|
||||
for (let i = 0; i < contents.length; i++) {
|
||||
const item = contents[i];
|
||||
@@ -252,14 +244,11 @@ function getNonCollapsibleItem(toolbox) {
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.getNonCollapsibleItem = getNonCollapsibleItem;
|
||||
|
||||
function getChildItem(toolbox) {
|
||||
export function getChildItem(toolbox) {
|
||||
return toolbox.getToolboxItemById('nestedCategory');
|
||||
}
|
||||
exports.getChildItem = getChildItem;
|
||||
|
||||
function getSeparator(toolbox) {
|
||||
export function getSeparator(toolbox) {
|
||||
return toolbox.getToolboxItemById('separator');
|
||||
}
|
||||
exports.getSeparator = getSeparator;
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.helpers.userInput');
|
||||
goog.declareModuleId('Blockly.test.helpers.userInput');
|
||||
|
||||
const {KeyCodes} = goog.require('Blockly.utils.KeyCodes');
|
||||
import {KeyCodes} from '../../../build/src/core/utils/keycodes.js';
|
||||
|
||||
|
||||
/**
|
||||
@@ -17,7 +17,7 @@ const {KeyCodes} = goog.require('Blockly.utils.KeyCodes');
|
||||
* @param {Object<string, string>=} properties Properties to pass into event
|
||||
* constructor.
|
||||
*/
|
||||
function dispatchPointerEvent(target, type, properties) {
|
||||
export function dispatchPointerEvent(target, type, properties) {
|
||||
const eventInitDict = {
|
||||
cancelable: true,
|
||||
bubbles: true,
|
||||
@@ -32,7 +32,6 @@ function dispatchPointerEvent(target, type, properties) {
|
||||
const event = new PointerEvent(type, eventInitDict);
|
||||
target.dispatchEvent(event);
|
||||
}
|
||||
exports.dispatchPointerEvent = dispatchPointerEvent;
|
||||
|
||||
/**
|
||||
* Creates a key down event used for testing.
|
||||
@@ -40,7 +39,7 @@ exports.dispatchPointerEvent = dispatchPointerEvent;
|
||||
* @param {!Array<number>=} modifiers A list of modifiers. Use Blockly.utils.KeyCodes enum.
|
||||
* @return {!KeyboardEvent} The mocked keydown event.
|
||||
*/
|
||||
function createKeyDownEvent(keyCode, modifiers) {
|
||||
export function createKeyDownEvent(keyCode, modifiers) {
|
||||
const event = {
|
||||
keyCode: keyCode,
|
||||
};
|
||||
@@ -52,7 +51,6 @@ function createKeyDownEvent(keyCode, modifiers) {
|
||||
}
|
||||
return new KeyboardEvent('keydown', event);
|
||||
}
|
||||
exports.createKeyDownEvent = createKeyDownEvent;
|
||||
|
||||
/**
|
||||
* Simulates mouse click by triggering relevant mouse events.
|
||||
@@ -60,9 +58,8 @@ exports.createKeyDownEvent = createKeyDownEvent;
|
||||
* @param {Object<string, string>=} properties Properties to pass into event
|
||||
* constructor.
|
||||
*/
|
||||
function simulateClick(target, properties) {
|
||||
export function simulateClick(target, properties) {
|
||||
dispatchPointerEvent(target, 'pointerdown', properties);
|
||||
dispatchPointerEvent(target, 'pointerup', properties);
|
||||
dispatchPointerEvent(target, 'click', properties);
|
||||
}
|
||||
exports.simulateClick = simulateClick;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.helpers.variables');
|
||||
goog.declareModuleId('Blockly.test.helpers.variables');
|
||||
|
||||
|
||||
/**
|
||||
@@ -15,11 +15,10 @@ goog.module('Blockly.test.helpers.variables');
|
||||
* @param {!string} type The expected type of the variable.
|
||||
* @param {!string} id The expected id of the variable.
|
||||
*/
|
||||
function assertVariableValues(container, name, type, id) {
|
||||
export function assertVariableValues(container, name, type, id) {
|
||||
const variable = container.getVariableById(id);
|
||||
chai.assert.isDefined(variable);
|
||||
chai.assert.equal(variable.name, name);
|
||||
chai.assert.equal(variable.type, type);
|
||||
chai.assert.equal(variable.getId(), id);
|
||||
}
|
||||
exports.assertVariableValues = assertVariableValues;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.helpers.warnings');
|
||||
goog.declareModuleId('Blockly.test.helpers.warnings');
|
||||
|
||||
|
||||
/**
|
||||
@@ -13,7 +13,7 @@ goog.module('Blockly.test.helpers.warnings');
|
||||
* @param {Function} innerFunc The function where warnings may called.
|
||||
* @return {Array<string>} The warning messages (only the first arguments).
|
||||
*/
|
||||
function captureWarnings(innerFunc) {
|
||||
export function captureWarnings(innerFunc) {
|
||||
const msgs = [];
|
||||
const nativeConsoleWarn = console.warn;
|
||||
try {
|
||||
@@ -26,7 +26,6 @@ function captureWarnings(innerFunc) {
|
||||
}
|
||||
return msgs;
|
||||
}
|
||||
exports.captureWarnings = captureWarnings;
|
||||
|
||||
/**
|
||||
* Asserts that the given function logs the provided warning messages.
|
||||
@@ -34,7 +33,7 @@ exports.captureWarnings = captureWarnings;
|
||||
* @param {Array<!RegExp>|!RegExp} messages A list of regex for the expected
|
||||
* messages (in the expected order).
|
||||
*/
|
||||
function assertWarnings(innerFunc, messages) {
|
||||
export function assertWarnings(innerFunc, messages) {
|
||||
if (!Array.isArray(messages)) {
|
||||
messages = [messages];
|
||||
}
|
||||
@@ -44,25 +43,22 @@ function assertWarnings(innerFunc, messages) {
|
||||
chai.assert.match(warnings[i], message);
|
||||
});
|
||||
}
|
||||
exports.assertWarnings = assertWarnings;
|
||||
|
||||
/**
|
||||
* Asserts that the given function logs no warning messages.
|
||||
* @param {function()} innerFunc The function to call.
|
||||
*/
|
||||
function assertNoWarnings(innerFunc) {
|
||||
export function assertNoWarnings(innerFunc) {
|
||||
assertWarnings(innerFunc, []);
|
||||
}
|
||||
exports.assertNoWarnings = assertNoWarnings;
|
||||
|
||||
/**
|
||||
* Stubs Blockly.utils.deprecation.warn call.
|
||||
* @return {!SinonStub} The created stub.
|
||||
*/
|
||||
function createDeprecationWarningStub() {
|
||||
export function createDeprecationWarningStub() {
|
||||
return sinon.stub(Blockly.utils.deprecation, 'warn');
|
||||
}
|
||||
exports.createDeprecationWarningStub = createDeprecationWarningStub;
|
||||
|
||||
/**
|
||||
* Asserts whether the given deprecation warning stub or call was called with
|
||||
@@ -71,10 +67,9 @@ exports.createDeprecationWarningStub = createDeprecationWarningStub;
|
||||
* @param {string} functionName The function name to check that the given spy or
|
||||
* spy call was called with.
|
||||
*/
|
||||
function assertDeprecationWarningCall(spyOrSpyCall, functionName) {
|
||||
export function assertDeprecationWarningCall(spyOrSpyCall, functionName) {
|
||||
sinon.assert.calledWith(spyOrSpyCall, functionName);
|
||||
}
|
||||
exports.assertDeprecationWarningCall = assertDeprecationWarningCall;
|
||||
|
||||
/**
|
||||
* Asserts that there was a single deprecation warning call with the given
|
||||
@@ -83,8 +78,7 @@ exports.assertDeprecationWarningCall = assertDeprecationWarningCall;
|
||||
* @param {string} functionName The function name to check that the given spy
|
||||
* was called with.
|
||||
*/
|
||||
function assertSingleDeprecationWarningCall(spy, functionName) {
|
||||
export function assertSingleDeprecationWarningCall(spy, functionName) {
|
||||
sinon.assert.calledOnce(spy);
|
||||
assertDeprecationWarningCall(spy.getCall(0), functionName);
|
||||
}
|
||||
exports.assertSingleDeprecationWarningCall = assertSingleDeprecationWarningCall;
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.helpers.workspace');
|
||||
goog.declareModuleId('Blockly.test.helpers.workspace');
|
||||
|
||||
const {assertVariableValues} = goog.require('Blockly.test.helpers.variables');
|
||||
const {assertWarnings} = goog.require('Blockly.test.helpers.warnings');
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
const {workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {assertVariableValues} from './variables.js';
|
||||
import {assertWarnings} from './warnings.js';
|
||||
import * as eventUtils from '../../../build/src/core/events/utils.js';
|
||||
import {workspaceTeardown} from './setup_teardown.js';
|
||||
|
||||
|
||||
function testAWorkspace() {
|
||||
export function testAWorkspace() {
|
||||
setup(function() {
|
||||
Blockly.defineBlocksWithJsonArray([{
|
||||
"type": "get_var_block",
|
||||
@@ -1528,4 +1528,3 @@ function testAWorkspace() {
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.testAWorkspace = testAWorkspace;
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.theme');
|
||||
goog.declareModuleId('Blockly.test.theme');
|
||||
|
||||
const {assertEventFired} = goog.require('Blockly.test.helpers.events');
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {assertEventFired} from './test_helpers/events.js';
|
||||
import * as eventUtils from '../../build/src/core/events/utils.js';
|
||||
import {sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Theme', function() {
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.toolbox');
|
||||
goog.declareModuleId('Blockly.test.toolbox');
|
||||
|
||||
const {defineStackBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {getBasicToolbox, getCategoryJSON, getChildItem, getCollapsibleItem, getDeeplyNestedJSON, getInjectedToolbox, getNonCollapsibleItem, getSeparator, getSimpleJson, getXmlArray} = goog.require('Blockly.test.helpers.toolboxDefinitions');
|
||||
import {defineStackBlock} from './test_helpers/block_definitions.js';
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {getBasicToolbox, getCategoryJSON, getChildItem, getCollapsibleItem, getDeeplyNestedJSON, getInjectedToolbox, getNonCollapsibleItem, getSeparator, getSimpleJson, getXmlArray} from './test_helpers/toolbox_definitions.js';
|
||||
|
||||
|
||||
suite('Toolbox', function() {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.tooltip');
|
||||
goog.declareModuleId('Blockly.test.tooltip');
|
||||
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Tooltip', function() {
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.trashcan');
|
||||
goog.declareModuleId('Blockly.test.trashcan');
|
||||
|
||||
const {assertEventFired, assertEventNotFired} = goog.require('Blockly.test.helpers.events');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {defineBasicBlockWithField, defineMutatorBlocks, defineRowBlock, defineStackBlock, defineStatementBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
const {simulateClick} = goog.require('Blockly.test.helpers.userInput');
|
||||
import {assertEventFired, assertEventNotFired} from './test_helpers/events.js';
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {defineBasicBlockWithField, defineMutatorBlocks, defineRowBlock, defineStackBlock, defineStatementBlock} from './test_helpers/block_definitions.js';
|
||||
import * as eventUtils from '../../build/src/core/events/utils.js';
|
||||
import {simulateClick} from './test_helpers/user_input.js';
|
||||
|
||||
|
||||
suite("Trashcan", function() {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.utils');
|
||||
goog.declareModuleId('Blockly.test.utils');
|
||||
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Utils', function() {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.variableMap');
|
||||
goog.declareModuleId('Blockly.test.variableMap');
|
||||
|
||||
const {assertVariableValues} = goog.require('Blockly.test.helpers.variables');
|
||||
const {createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {assertVariableValues} from './test_helpers/variables.js';
|
||||
import {createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Variable Map', function() {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.variableModel');
|
||||
goog.declareModuleId('Blockly.test.variableModel');
|
||||
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Variable Model', function() {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.widgetDiv');
|
||||
goog.declareModuleId('Blockly.test.widgetDiv');
|
||||
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('WidgetDiv', function() {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.workspaceComment');
|
||||
goog.declareModuleId('Blockly.test.workspaceComment');
|
||||
|
||||
goog.require('Blockly.WorkspaceComment');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
import {WorkspaceComment} from '../../build/src/core/workspace_comment.js';
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
|
||||
|
||||
suite('Workspace comment', function() {
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.workspaceSvg');
|
||||
goog.declareModuleId('Blockly.test.workspaceSvg');
|
||||
|
||||
const {assertEventFired, assertEventNotFired, createFireChangeListenerSpy} = goog.require('Blockly.test.helpers.events');
|
||||
const {assertVariableValues} = goog.require('Blockly.test.helpers.variables');
|
||||
const {defineStackBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {testAWorkspace} = goog.require('Blockly.test.helpers.workspace');
|
||||
import {assertEventFired, assertEventNotFired, createFireChangeListenerSpy} from './test_helpers/events.js';
|
||||
import {assertVariableValues} from './test_helpers/variables.js';
|
||||
import {defineStackBlock} from './test_helpers/block_definitions.js';
|
||||
import * as eventUtils from '../../build/src/core/events/utils.js';
|
||||
import {sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {testAWorkspace} from './test_helpers/workspace.js';
|
||||
|
||||
|
||||
suite('WorkspaceSvg', function() {
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.workspace');
|
||||
goog.declareModuleId('Blockly.test.workspace');
|
||||
|
||||
const {assertVariableValues} = goog.require('Blockly.test.helpers.variables');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {testAWorkspace} = goog.require('Blockly.test.helpers.workspace');
|
||||
import {assertVariableValues} from './test_helpers/variables.js';
|
||||
import {sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {testAWorkspace} from './test_helpers/workspace.js';
|
||||
|
||||
|
||||
suite('Workspace', function() {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.xml');
|
||||
goog.declareModuleId('Blockly.test.xml');
|
||||
|
||||
const {addBlockTypeToCleanup, createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {assertVariableValues} = goog.require('Blockly.test.helpers.variables');
|
||||
import {addBlockTypeToCleanup, createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {assertVariableValues} from './test_helpers/variables.js';
|
||||
|
||||
|
||||
suite('XML', function() {
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.zoomControls');
|
||||
goog.declareModuleId('Blockly.test.zoomControls');
|
||||
|
||||
const {assertEventFired, assertEventNotFired} = goog.require('Blockly.test.helpers.events');
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers.setupTeardown');
|
||||
const {simulateClick} = goog.require('Blockly.test.helpers.userInput');
|
||||
import {assertEventFired, assertEventNotFired} from './test_helpers/events.js';
|
||||
import * as eventUtils from '../../build/src/core/events/utils.js';
|
||||
import {sharedTestSetup, sharedTestTeardown} from './test_helpers/setup_teardown.js';
|
||||
import {simulateClick} from './test_helpers/user_input.js';
|
||||
|
||||
|
||||
suite("Zoom Controls", function() {
|
||||
|
||||
Reference in New Issue
Block a user