mirror of
https://github.com/google/blockly.git
synced 2026-01-28 19:20:10 +01:00
fix: split block defs into new helper file
This commit is contained in:
@@ -1,49 +1,50 @@
|
||||
goog.addDependency('../../tests/mocha/.mocharc.js', [], []);
|
||||
goog.addDependency('../../tests/mocha/astnode_test.js', ['Blockly.test.astNode'], ['Blockly.ASTNode', 'Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/block_change_event_test.js', ['Blockly.test.blockChangeEvent'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/block_change_event_test.js', ['Blockly.test.blockChangeEvent'], ['Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/block_create_event_test.js', ['Blockly.test.blockCreateEvent'], ['Blockly.Events.utils', 'Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/block_json_test.js', ['Blockly.test.blockJson'], ['Blockly.Input'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/block_test.js', ['Blockly.test.blocks'], ['Blockly.ConnectionType', 'Blockly.Events.utils', 'Blockly.blocks', 'Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/block_test.js', ['Blockly.test.blocks'], ['Blockly.ConnectionType', 'Blockly.Events.utils', 'Blockly.blocks', 'Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/comment_test.js', ['Blockly.test.comments'], ['Blockly.Events.utils', 'Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/connection_checker_test.js', ['Blockly.test.connectionChecker'], ['Blockly.ConnectionType', 'Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/connection_db_test.js', ['Blockly.test.connectionDb'], ['Blockly.ConnectionType', 'Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/connection_test.js', ['Blockly.test.connection'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/connection_test.js', ['Blockly.test.connection'], ['Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/contextmenu_items_test.js', ['Blockly.test.contextMenuItem'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/cursor_test.js', ['Blockly.test.cursor'], ['Blockly.ASTNode', 'Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/dropdowndiv_test.js', ['Blockly.test.dropdown'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/event_test.js', ['Blockly.test.event'], ['Blockly.ASTNode', 'Blockly.Events.utils', 'Blockly.WorkspaceComment', 'Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/extensions_test.js', ['Blockly.test.extensions'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_angle_test.js', ['Blockly.test.fieldAngle'], ['Blockly.test.helpers', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_checkbox_test.js', ['Blockly.test.fieldCheckbox'], ['Blockly.test.helpers', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_colour_test.js', ['Blockly.test.fieldColour'], ['Blockly.test.helpers', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_dropdown_test.js', ['Blockly.test.fieldDropdown'], ['Blockly.test.helpers', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_angle_test.js', ['Blockly.test.fieldAngle'], ['Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_checkbox_test.js', ['Blockly.test.fieldCheckbox'], ['Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_colour_test.js', ['Blockly.test.fieldColour'], ['Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_dropdown_test.js', ['Blockly.test.fieldDropdown'], ['Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_image_test.js', ['Blockly.test.fieldImage'], ['Blockly.test.helpers', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_label_serializable_test.js', ['Blockly.test.fieldLabelSerialization'], ['Blockly.test.helpers', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_label_test.js', ['Blockly.test.fieldLabel'], ['Blockly.test.helpers', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_multilineinput_test.js', ['Blockly.test.fieldMultiline'], ['Blockly.test.helpers', 'Blockly.test.helpers.codeGeneration', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_number_test.js', ['Blockly.test.fieldNumber'], ['Blockly.test.helpers', 'Blockly.test.helpers.common', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_label_serializable_test.js', ['Blockly.test.fieldLabelSerialization'], ['Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_label_test.js', ['Blockly.test.fieldLabel'], ['Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_multilineinput_test.js', ['Blockly.test.fieldMultiline'], ['Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions', 'Blockly.test.helpers.codeGeneration', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_number_test.js', ['Blockly.test.fieldNumber'], ['Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions', 'Blockly.test.helpers.common', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_registry_test.js', ['Blockly.test.fieldRegistry'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_test.js', ['Blockly.test.fieldTest'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_textinput_test.js', ['Blockly.test.fieldTextInput'], ['Blockly.test.helpers', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_variable_test.js', ['Blockly.test.fieldVariable'], ['Blockly.test.helpers', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_textinput_test.js', ['Blockly.test.fieldTextInput'], ['Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/field_variable_test.js', ['Blockly.test.fieldVariable'], ['Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions', 'Blockly.test.helpers.fields'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/flyout_test.js', ['Blockly.test.flyout'], ['Blockly.test.helpers', 'Blockly.test.helpers.toolbox_definitions'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/generator_test.js', ['Blockly.test.generator'], ['Blockly.Dart', 'Blockly.JavaScript', 'Blockly.Lua', 'Blockly.PHP', 'Blockly.Python', 'Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/gesture_test.js', ['Blockly.test.gesture'], ['Blockly.Events.utils', 'Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/gesture_test.js', ['Blockly.test.gesture'], ['Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/input_test.js', ['Blockly.test.input'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/insertion_marker_test.js', ['Blockly.test.insertionMarker'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/jso_deserialization_test.js', ['Blockly.test.jsoDeserialization'], ['Blockly.Events.utils', 'Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/jso_serialization_test.js', ['Blockly.test.jsoSerialization'], ['Blockly.test.helpers'], {'lang': 'es8', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/jso_serialization_test.js', ['Blockly.test.jsoSerialization'], ['Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions'], {'lang': 'es8', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/json_test.js', ['Blockly.test.json'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/keydown_test.js', ['Blockly.test.keydown'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/keydown_test.js', ['Blockly.test.keydown'], ['Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/logic_ternary_test.js', ['Blockly.test.logicTernary'], ['Blockly.Events.utils', 'Blockly.test.helpers', 'Blockly.test.helpers.serialization'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/metrics_test.js', ['Blockly.test.metrics'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/mutator_test.js', ['Blockly.test.mutator'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/mutator_test.js', ['Blockly.test.mutator'], ['Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/names_test.js', ['Blockly.test.names'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/procedures_test.js', ['Blockly.test.procedures'], ['Blockly', 'Blockly.Msg', 'Blockly.test.helpers', 'Blockly.test.helpers.procedures', 'Blockly.test.helpers.serialization'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/registry_test.js', ['Blockly.test.registry'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/run_mocha_tests_in_browser.js', [], [], {'lang': 'es8'});
|
||||
goog.addDependency('../../tests/mocha/serializer_test.js', ['Blockly.test.serialization'], ['Blockly.test.helpers', 'Blockly.test.helpers.common'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/shortcut_registry_test.js', ['Blockly.test.shortcutRegistry'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/test_helpers/block_definitions.js', ['Blockly.test.helpers.blockDefinitions'], [], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/test_helpers/code_generation.js', ['Blockly.test.helpers.codeGeneration'], ['Blockly.test.helpers.common'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/test_helpers/common.js', ['Blockly.test.helpers.common'], [], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/test_helpers/fields.js', ['Blockly.test.helpers.fields'], ['Blockly.test.helpers.common'], {'lang': 'es6', 'module': 'goog'});
|
||||
@@ -53,16 +54,16 @@ goog.addDependency('../../tests/mocha/test_helpers/test_helpers.js', ['Blockly.t
|
||||
goog.addDependency('../../tests/mocha/test_helpers/toolbox_definitions.js', ['Blockly.test.helpers.toolbox_definitions'], [], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/test_helpers/workspace.js', ['Blockly.test.helpers.workspace'], ['Blockly.Events.utils', 'Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/theme_test.js', ['Blockly.test.theme'], ['Blockly.Events.utils', 'Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/toolbox_test.js', ['Blockly.test.toolbox'], ['Blockly.test.helpers', 'Blockly.test.helpers.toolbox_definitions'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/toolbox_test.js', ['Blockly.test.toolbox'], ['Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions', 'Blockly.test.helpers.toolbox_definitions'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/tooltip_test.js', ['Blockly.test.tooltip'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/trashcan_test.js', ['Blockly.test.trashcan'], ['Blockly.Events.utils', 'Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/trashcan_test.js', ['Blockly.test.trashcan'], ['Blockly.Events.utils', 'Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/utils_test.js', ['Blockly.test.utils'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/variable_map_test.js', ['Blockly.test.variableMap'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/variable_model_test.js', ['Blockly.test.variableModel'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/variables_test.js', ['Blockly.test.variables'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/widget_div_test.js', ['Blockly.test.widgetDiv'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/workspace_comment_test.js', ['Blockly.test.workspaceComment'], ['Blockly.WorkspaceComment', 'Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/workspace_svg_test.js', ['Blockly.test.workspaceSvg'], ['Blockly.Events.utils', 'Blockly.test.helpers', 'Blockly.test.helpers.workspace'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/workspace_svg_test.js', ['Blockly.test.workspaceSvg'], ['Blockly.test.helpers', 'Blockly.test.helpers.blockDefinitions', 'Blockly.test.helpers.workspace'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/workspace_test.js', ['Blockly.test.workspace'], ['Blockly.test.helpers', 'Blockly.test.helpers.workspace'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/xml_test.js', ['Blockly.test.xml'], ['Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
goog.addDependency('../../tests/mocha/zoom_controls_test.js', ['Blockly.test.zoomControls'], ['Blockly.Events.utils', 'Blockly.test.helpers'], {'lang': 'es6', 'module': 'goog'});
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
goog.module('Blockly.test.blockChangeEvent');
|
||||
|
||||
const {defineMutatorBlocks, sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {defineMutatorBlocks} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
|
||||
|
||||
suite('Block Change Event', function() {
|
||||
|
||||
@@ -9,7 +9,8 @@ goog.module('Blockly.test.blocks');
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
const {Blocks} = goog.require('Blockly.blocks');
|
||||
const {ConnectionType} = goog.require('Blockly.ConnectionType');
|
||||
const {createDeprecationWarningStub, createRenderedBlock, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {createDeprecationWarningStub, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {createRenderedBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
|
||||
|
||||
suite('Blocks', function() {
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
goog.module('Blockly.test.connection');
|
||||
|
||||
const {assertSingleDeprecationWarningCall, createDeprecationWarningStub, createGenUidStubWithReturns, defineRowBlock, defineStatementBlock, defineStackBlock, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {assertSingleDeprecationWarningCall, createDeprecationWarningStub, createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {defineRowBlock, defineStatementBlock, defineStackBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
|
||||
|
||||
suite('Connection', function() {
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
goog.module('Blockly.test.fieldAngle');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {createTestBlock, defineRowBlock, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {createTestBlock, defineRowBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
|
||||
|
||||
suite('Angle Fields', function() {
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
goog.module('Blockly.test.fieldCheckbox');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {defineRowBlock, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {defineRowBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
|
||||
|
||||
suite('Checkbox Fields', function() {
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
goog.module('Blockly.test.fieldColour');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {createTestBlock, defineRowBlock, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {createTestBlock, defineRowBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
|
||||
|
||||
suite('Colour Fields', function() {
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
goog.module('Blockly.test.fieldDropdown');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {createTestBlock, defineRowBlock, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {createTestBlock, defineRowBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
|
||||
|
||||
suite('Dropdown Fields', function() {
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
goog.module('Blockly.test.fieldLabelSerialization');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {createTestBlock, defineRowBlock, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {createTestBlock, defineRowBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
|
||||
|
||||
suite('Label Serializable Fields', function() {
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
goog.module('Blockly.test.fieldLabel');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {createTestBlock, sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {createTestBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
|
||||
|
||||
suite('Label Fields', function() {
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
goog.module('Blockly.test.fieldMultiline');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {createTestBlock, defineRowBlock, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {createTestBlock, defineRowBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {runCodeGenerationTestSuites} = goog.require('Blockly.test.helpers.codeGeneration');
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
goog.module('Blockly.test.fieldNumber');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {defineRowBlock, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {defineRowBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {runTestCases} = goog.require('Blockly.test.helpers.common');
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
goog.module('Blockly.test.fieldTextInput');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {createTestBlock, defineRowBlock, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {createTestBlock, defineRowBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const {sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
|
||||
|
||||
suite('Text Input Fields', function() {
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
goog.module('Blockly.test.fieldVariable');
|
||||
|
||||
const {assertFieldValue, runConstructorSuiteTests, runFromJsonSuiteTests, runSetValueTests} = goog.require('Blockly.test.helpers.fields');
|
||||
const {createGenUidStubWithReturns, createTestBlock, defineRowBlock, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {createTestBlock, defineRowBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
|
||||
|
||||
suite('Variable Fields', function() {
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
goog.module('Blockly.test.gesture');
|
||||
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
const {assertEventFired, assertEventNotFired, defineBasicBlockWithField, dispatchPointerEvent, sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {assertEventFired, assertEventNotFired, dispatchPointerEvent, sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {defineBasicBlockWithField} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
|
||||
|
||||
suite('Gesture', function() {
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
goog.module('Blockly.test.jsoSerialization');
|
||||
|
||||
const {defineStackBlock, defineRowBlock, defineStatementBlock, createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {createGenUidStubWithReturns, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {defineRowBlock, defineStackBlock, defineStatementBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
|
||||
|
||||
suite('JSO Serialization', function() {
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
goog.module('Blockly.test.keydown');
|
||||
|
||||
const {createKeyDownEvent, defineStackBlock, sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {createKeyDownEvent, sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {defineStackBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
|
||||
|
||||
suite('Key Down', function() {
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
|
||||
goog.module('Blockly.test.mutator');
|
||||
|
||||
const {createRenderedBlock, defineMutatorBlocks, sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {createRenderedBlock, defineMutatorBlocks} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
|
||||
|
||||
suite('Mutator', function() {
|
||||
|
||||
185
tests/mocha/test_helpers/block_definitions.js
Normal file
185
tests/mocha/test_helpers/block_definitions.js
Normal file
@@ -0,0 +1,185 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
goog.module('Blockly.test.helpers.blockDefinitions');
|
||||
|
||||
|
||||
function defineStackBlock(name = 'stack_block') {
|
||||
Blockly.defineBlocksWithJsonArray([{
|
||||
"type": name,
|
||||
"message0": "",
|
||||
"previousStatement": null,
|
||||
"nextStatement": null,
|
||||
}]);
|
||||
}
|
||||
exports.defineStackBlock = defineStackBlock;
|
||||
|
||||
function defineRowBlock(name = 'row_block') {
|
||||
Blockly.defineBlocksWithJsonArray([{
|
||||
"type": name,
|
||||
"message0": "%1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "INPUT",
|
||||
},
|
||||
],
|
||||
"output": null,
|
||||
}]);
|
||||
}
|
||||
exports.defineRowBlock = defineRowBlock;
|
||||
|
||||
function defineStatementBlock(name = 'statement_block') {
|
||||
Blockly.defineBlocksWithJsonArray([{
|
||||
"type": name,
|
||||
"message0": "%1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_statement",
|
||||
"name": "NAME",
|
||||
},
|
||||
],
|
||||
"previousStatement": null,
|
||||
"nextStatement": null,
|
||||
"colour": 230,
|
||||
"tooltip": "",
|
||||
"helpUrl": "",
|
||||
}]);
|
||||
}
|
||||
exports.defineStatementBlock = defineStatementBlock;
|
||||
|
||||
function defineBasicBlockWithField(name = 'test_field_block') {
|
||||
Blockly.defineBlocksWithJsonArray([{
|
||||
"type": name,
|
||||
"message0": "%1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "field_input",
|
||||
"name": "NAME",
|
||||
},
|
||||
],
|
||||
"output": null,
|
||||
}]);
|
||||
}
|
||||
exports.defineBasicBlockWithField = defineBasicBlockWithField;
|
||||
|
||||
function defineMutatorBlocks() {
|
||||
Blockly.defineBlocksWithJsonArray([
|
||||
{
|
||||
'type': 'xml_block',
|
||||
'mutator': 'xml_mutator',
|
||||
},
|
||||
{
|
||||
'type': 'jso_block',
|
||||
'mutator': 'jso_mutator',
|
||||
},
|
||||
{
|
||||
'type': 'checkbox_block',
|
||||
'message0': '%1',
|
||||
'args0': [
|
||||
{
|
||||
'type': 'field_checkbox',
|
||||
'name': 'CHECK',
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
const xmlMutator = {
|
||||
hasInput: false,
|
||||
|
||||
mutationToDom: function() {
|
||||
const mutation = Blockly.utils.xml.createElement('mutation');
|
||||
mutation.setAttribute('hasInput', this.hasInput);
|
||||
return mutation;
|
||||
},
|
||||
|
||||
domToMutation: function(mutation) {
|
||||
this.hasInput = mutation.getAttribute('hasInput') == 'true';
|
||||
this.updateShape();
|
||||
},
|
||||
|
||||
decompose: function(workspace) {
|
||||
const topBlock = workspace.newBlock('checkbox_block', 'check_block');
|
||||
topBlock.initSvg();
|
||||
topBlock.render();
|
||||
return topBlock;
|
||||
},
|
||||
|
||||
compose: function(topBlock) {
|
||||
this.hasInput = topBlock.getFieldValue('CHECK') == 'TRUE';
|
||||
this.updateShape();
|
||||
},
|
||||
|
||||
updateShape: function() {
|
||||
if (this.hasInput && !this.getInput('INPUT')) {
|
||||
this.appendValueInput('INPUT');
|
||||
} else if (!this.hasInput && this.getInput('INPUT')) {
|
||||
this.removeInput('INPUT');
|
||||
}
|
||||
},
|
||||
};
|
||||
Blockly.Extensions.registerMutator('xml_mutator', xmlMutator);
|
||||
|
||||
const jsoMutator = {
|
||||
hasInput: false,
|
||||
|
||||
saveExtraState: function() {
|
||||
return {hasInput: this.hasInput};
|
||||
},
|
||||
|
||||
loadExtraState: function(state) {
|
||||
this.hasInput = state.hasInput || false;
|
||||
this.updateShape();
|
||||
},
|
||||
|
||||
decompose: function(workspace) {
|
||||
const topBlock = workspace.newBlock('checkbox_block', 'check_block');
|
||||
topBlock.initSvg();
|
||||
topBlock.render();
|
||||
return topBlock;
|
||||
},
|
||||
|
||||
compose: function(topBlock) {
|
||||
this.hasInput = topBlock.getFieldValue('CHECK') == 'TRUE';
|
||||
this.updateShape();
|
||||
},
|
||||
|
||||
updateShape: function() {
|
||||
if (this.hasInput && !this.getInput('INPUT')) {
|
||||
this.appendValueInput('INPUT');
|
||||
} else if (!this.hasInput && this.getInput('INPUT')) {
|
||||
this.removeInput('INPUT');
|
||||
}
|
||||
},
|
||||
};
|
||||
Blockly.Extensions.registerMutator('jso_mutator', jsoMutator);
|
||||
}
|
||||
exports.defineMutatorBlocks = defineMutatorBlocks;
|
||||
|
||||
function createTestBlock() {
|
||||
return {
|
||||
'id': 'test',
|
||||
'rendered': false,
|
||||
'workspace': {
|
||||
'rendered': false,
|
||||
},
|
||||
'isShadow': function() {
|
||||
return false;
|
||||
},
|
||||
'renameVarById': Blockly.Block.prototype.renameVarById,
|
||||
'updateVarName': Blockly.Block.prototype.updateVarName,
|
||||
};
|
||||
}
|
||||
exports.createTestBlock = createTestBlock;
|
||||
|
||||
function createRenderedBlock(workspaceSvg, type) {
|
||||
const block = workspaceSvg.newBlock(type);
|
||||
block.initSvg();
|
||||
block.render();
|
||||
return block;
|
||||
}
|
||||
exports.createRenderedBlock = createRenderedBlock;
|
||||
@@ -482,183 +482,6 @@ function assertNthCallEventArgEquals(spy, n, instanceType, expectedProperties,
|
||||
}
|
||||
exports.assertNthCallEventArgEquals = assertNthCallEventArgEquals;
|
||||
|
||||
function defineStackBlock(name = 'stack_block') {
|
||||
Blockly.defineBlocksWithJsonArray([{
|
||||
"type": name,
|
||||
"message0": "",
|
||||
"previousStatement": null,
|
||||
"nextStatement": null,
|
||||
}]);
|
||||
}
|
||||
exports.defineStackBlock = defineStackBlock;
|
||||
|
||||
function defineRowBlock(name = 'row_block') {
|
||||
Blockly.defineBlocksWithJsonArray([{
|
||||
"type": name,
|
||||
"message0": "%1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "INPUT",
|
||||
},
|
||||
],
|
||||
"output": null,
|
||||
}]);
|
||||
}
|
||||
exports.defineRowBlock = defineRowBlock;
|
||||
|
||||
function defineStatementBlock(name = 'statement_block') {
|
||||
Blockly.defineBlocksWithJsonArray([{
|
||||
"type": name,
|
||||
"message0": "%1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_statement",
|
||||
"name": "NAME",
|
||||
},
|
||||
],
|
||||
"previousStatement": null,
|
||||
"nextStatement": null,
|
||||
"colour": 230,
|
||||
"tooltip": "",
|
||||
"helpUrl": "",
|
||||
}]);
|
||||
}
|
||||
exports.defineStatementBlock = defineStatementBlock;
|
||||
|
||||
function defineBasicBlockWithField(name = 'test_field_block') {
|
||||
Blockly.defineBlocksWithJsonArray([{
|
||||
"type": name,
|
||||
"message0": "%1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "field_input",
|
||||
"name": "NAME",
|
||||
},
|
||||
],
|
||||
"output": null,
|
||||
}]);
|
||||
}
|
||||
exports.defineBasicBlockWithField = defineBasicBlockWithField;
|
||||
|
||||
function defineMutatorBlocks() {
|
||||
Blockly.defineBlocksWithJsonArray([
|
||||
{
|
||||
'type': 'xml_block',
|
||||
'mutator': 'xml_mutator',
|
||||
},
|
||||
{
|
||||
'type': 'jso_block',
|
||||
'mutator': 'jso_mutator',
|
||||
},
|
||||
{
|
||||
'type': 'checkbox_block',
|
||||
'message0': '%1',
|
||||
'args0': [
|
||||
{
|
||||
'type': 'field_checkbox',
|
||||
'name': 'CHECK',
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
const xmlMutator = {
|
||||
hasInput: false,
|
||||
|
||||
mutationToDom: function() {
|
||||
const mutation = Blockly.utils.xml.createElement('mutation');
|
||||
mutation.setAttribute('hasInput', this.hasInput);
|
||||
return mutation;
|
||||
},
|
||||
|
||||
domToMutation: function(mutation) {
|
||||
this.hasInput = mutation.getAttribute('hasInput') == 'true';
|
||||
this.updateShape();
|
||||
},
|
||||
|
||||
decompose: function(workspace) {
|
||||
const topBlock = workspace.newBlock('checkbox_block', 'check_block');
|
||||
topBlock.initSvg();
|
||||
topBlock.render();
|
||||
return topBlock;
|
||||
},
|
||||
|
||||
compose: function(topBlock) {
|
||||
this.hasInput = topBlock.getFieldValue('CHECK') == 'TRUE';
|
||||
this.updateShape();
|
||||
},
|
||||
|
||||
updateShape: function() {
|
||||
if (this.hasInput && !this.getInput('INPUT')) {
|
||||
this.appendValueInput('INPUT');
|
||||
} else if (!this.hasInput && this.getInput('INPUT')) {
|
||||
this.removeInput('INPUT');
|
||||
}
|
||||
},
|
||||
};
|
||||
Blockly.Extensions.registerMutator('xml_mutator', xmlMutator);
|
||||
|
||||
const jsoMutator = {
|
||||
hasInput: false,
|
||||
|
||||
saveExtraState: function() {
|
||||
return {hasInput: this.hasInput};
|
||||
},
|
||||
|
||||
loadExtraState: function(state) {
|
||||
this.hasInput = state.hasInput || false;
|
||||
this.updateShape();
|
||||
},
|
||||
|
||||
decompose: function(workspace) {
|
||||
const topBlock = workspace.newBlock('checkbox_block', 'check_block');
|
||||
topBlock.initSvg();
|
||||
topBlock.render();
|
||||
return topBlock;
|
||||
},
|
||||
|
||||
compose: function(topBlock) {
|
||||
this.hasInput = topBlock.getFieldValue('CHECK') == 'TRUE';
|
||||
this.updateShape();
|
||||
},
|
||||
|
||||
updateShape: function() {
|
||||
if (this.hasInput && !this.getInput('INPUT')) {
|
||||
this.appendValueInput('INPUT');
|
||||
} else if (!this.hasInput && this.getInput('INPUT')) {
|
||||
this.removeInput('INPUT');
|
||||
}
|
||||
},
|
||||
};
|
||||
Blockly.Extensions.registerMutator('jso_mutator', jsoMutator);
|
||||
}
|
||||
exports.defineMutatorBlocks = defineMutatorBlocks;
|
||||
|
||||
function createTestBlock() {
|
||||
return {
|
||||
'id': 'test',
|
||||
'rendered': false,
|
||||
'workspace': {
|
||||
'rendered': false,
|
||||
},
|
||||
'isShadow': function() {
|
||||
return false;
|
||||
},
|
||||
'renameVarById': Blockly.Block.prototype.renameVarById,
|
||||
'updateVarName': Blockly.Block.prototype.updateVarName,
|
||||
};
|
||||
}
|
||||
exports.createTestBlock = createTestBlock;
|
||||
|
||||
function createRenderedBlock(workspaceSvg, type) {
|
||||
const block = workspaceSvg.newBlock(type);
|
||||
block.initSvg();
|
||||
block.render();
|
||||
return block;
|
||||
}
|
||||
exports.createRenderedBlock = createRenderedBlock;
|
||||
|
||||
/**
|
||||
* Triggers pointer event on target.
|
||||
* @param {!EventTarget} target The object receiving the event.
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
goog.module('Blockly.test.toolbox');
|
||||
|
||||
const {defineStackBlock, sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {defineStackBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const {sharedTestSetup, sharedTestTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {getBasicToolbox, getCategoryJSON, getChildItem, getCollapsibleItem, getDeeplyNestedJSON, getInjectedToolbox, getNonCollapsibleItem, getSeparator, getSimpleJson, getXmlArray} = goog.require('Blockly.test.helpers.toolbox_definitions');
|
||||
|
||||
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
|
||||
goog.module('Blockly.test.trashcan');
|
||||
|
||||
const {assertEventFired, assertEventNotFired, sharedTestSetup, sharedTestTeardown, simulateClick} = goog.require('Blockly.test.helpers');
|
||||
const {defineBasicBlockWithField, defineMutatorBlocks, defineRowBlock, defineStackBlock, defineStatementBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
const {assertEventFired, assertEventNotFired, defineBasicBlockWithField, defineRowBlock, defineStatementBlock, defineStackBlock, defineMutatorBlocks, sharedTestSetup, sharedTestTeardown, simulateClick} = goog.require('Blockly.test.helpers');
|
||||
|
||||
|
||||
suite("Trashcan", function() {
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
goog.module('Blockly.test.workspaceSvg');
|
||||
|
||||
const {assertEventFired, assertEventNotFired, assertVariableValues, createFireChangeListenerSpy, defineStackBlock, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const eventUtils = goog.require('Blockly.Events.utils');
|
||||
const {assertEventFired, assertEventNotFired, assertVariableValues, createFireChangeListenerSpy, sharedTestSetup, sharedTestTeardown, workspaceTeardown} = goog.require('Blockly.test.helpers');
|
||||
const {defineStackBlock} = goog.require('Blockly.test.helpers.blockDefinitions');
|
||||
const {testAWorkspace} = goog.require('Blockly.test.helpers.workspace');
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user