diff --git a/blockly_uncompressed.js b/blockly_uncompressed.js index 111ba6fd6..5c69d5ac9 100644 --- a/blockly_uncompressed.js +++ b/blockly_uncompressed.js @@ -37,7 +37,7 @@ goog.addDependency('../../core/components/tree/basenode.js', ['Blockly.tree.Base goog.addDependency('../../core/components/tree/treecontrol.js', ['Blockly.tree.TreeControl'], ['Blockly.tree.BaseNode', 'Blockly.tree.TreeNode', 'Blockly.utils.aria', 'Blockly.utils.object', 'Blockly.utils.style'], {}); goog.addDependency('../../core/components/tree/treenode.js', ['Blockly.tree.TreeNode'], ['Blockly.tree.BaseNode', 'Blockly.utils.KeyCodes', 'Blockly.utils.object'], {}); goog.addDependency('../../core/connection.js', ['Blockly.Connection'], ['Blockly.Events', 'Blockly.Events.BlockMove', 'Blockly.Xml'], {}); -goog.addDependency('../../core/connection_checks.js', ['Blockly.ConnectionTypeChecker'], [], {}); +goog.addDependency('../../core/connection_checker.js', ['Blockly.ConnectionChecker'], [], {}); goog.addDependency('../../core/connection_db.js', ['Blockly.ConnectionDB'], ['Blockly.RenderedConnection'], {}); goog.addDependency('../../core/constants.js', ['Blockly.constants'], [], {}); goog.addDependency('../../core/contextmenu.js', ['Blockly.ContextMenu'], ['Blockly.Events', 'Blockly.Events.BlockCreate', 'Blockly.Menu', 'Blockly.MenuItem', 'Blockly.Msg', 'Blockly.Xml', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.Rect', 'Blockly.utils.dom', 'Blockly.utils.userAgent'], {}); @@ -184,7 +184,7 @@ goog.addDependency('../../core/variables.js', ['Blockly.Variables'], ['Blockly.B goog.addDependency('../../core/variables_dynamic.js', ['Blockly.VariablesDynamic'], ['Blockly.Blocks', 'Blockly.Msg', 'Blockly.VariableModel', 'Blockly.Variables', 'Blockly.utils.xml'], {}); goog.addDependency('../../core/warning.js', ['Blockly.Warning'], ['Blockly.Bubble', 'Blockly.Events', 'Blockly.Events.Ui', 'Blockly.Icon', 'Blockly.utils.dom', 'Blockly.utils.object'], {}); goog.addDependency('../../core/widgetdiv.js', ['Blockly.WidgetDiv'], ['Blockly.utils.style'], {}); -goog.addDependency('../../core/workspace.js', ['Blockly.Workspace'], ['Blockly.ConnectionTypeChecker', 'Blockly.Events', 'Blockly.Options', 'Blockly.VariableMap', 'Blockly.utils', 'Blockly.utils.math'], {}); +goog.addDependency('../../core/workspace.js', ['Blockly.Workspace'], ['Blockly.ConnectionChecker', 'Blockly.Events', 'Blockly.Options', 'Blockly.VariableMap', 'Blockly.utils', 'Blockly.utils.math'], {}); goog.addDependency('../../core/workspace_audio.js', ['Blockly.WorkspaceAudio'], ['Blockly.utils', 'Blockly.utils.global', 'Blockly.utils.userAgent'], {'lang': 'es5'}); goog.addDependency('../../core/workspace_comment.js', ['Blockly.WorkspaceComment'], ['Blockly.Events', 'Blockly.Events.CommentChange', 'Blockly.Events.CommentCreate', 'Blockly.Events.CommentDelete', 'Blockly.Events.CommentMove', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.xml'], {}); goog.addDependency('../../core/workspace_comment_render_svg.js', ['Blockly.WorkspaceCommentSvg.render'], ['Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.dom'], {}); diff --git a/blocks/logic.js b/blocks/logic.js index bc46c82d6..afec94d3f 100644 --- a/blocks/logic.js +++ b/blocks/logic.js @@ -543,7 +543,7 @@ Blockly.Constants.Logic.LOGIC_COMPARE_ONCHANGE_MIXIN = { var blockB = this.getInputTargetBlock('B'); // Disconnect blocks that existed prior to this change if they don't match. if (blockA && blockB && - !this.workspace.connectionTypeChecker.doTypeChecks( + !this.workspace.connectionChecker.doTypeChecks( blockA.outputConnection, blockB.outputConnection)) { // Mismatch between two inputs. Revert the block connections, // bumping away the newly connected block(s). @@ -612,7 +612,7 @@ Blockly.Constants.Logic.LOGIC_TERNARY_ONCHANGE_MIXIN = { for (var i = 0; i < 2; i++) { var block = (i == 1) ? blockA : blockB; if (block && - !block.workspace.connectionTypeChecker.doTypeChecks( + !block.workspace.connectionChecker.doTypeChecks( block.outputConnection, parentConnection)) { // Ensure that any disconnections are grouped with the causing event. Blockly.Events.setGroup(e.group); diff --git a/core/block.js b/core/block.js index ff513cd8b..706ac2575 100644 --- a/core/block.js +++ b/core/block.js @@ -456,7 +456,7 @@ Blockly.Block.prototype.unplugFromRow_ = function(opt_healStack) { // Disconnect the child block. childConnection.disconnect(); // Connect child to the parent if possible, otherwise bump away. - if (this.workspace.connectionTypeChecker.canConnect( + if (this.workspace.connectionChecker.canConnect( childConnection, parentConnection, false)) { parentConnection.connect(childConnection); } else { @@ -510,7 +510,7 @@ Blockly.Block.prototype.unplugFromStack_ = function(opt_healStack) { var nextTarget = this.nextConnection.targetConnection; nextTarget.disconnect(); if (previousTarget && - this.workspace.connectionTypeChecker.canConnect( + this.workspace.connectionChecker.canConnect( previousTarget, nextTarget, false)) { // Attach the next statement to the previous statement. previousTarget.connect(nextTarget); diff --git a/core/connection.js b/core/connection.js index ab4fec6bc..b15b437ff 100644 --- a/core/connection.js +++ b/core/connection.js @@ -16,7 +16,7 @@ goog.require('Blockly.Events'); goog.require('Blockly.Events.BlockMove'); goog.require('Blockly.Xml'); -goog.requireType('Blockly.ConnectionTypeChecker'); +goog.requireType('Blockly.ConnectionChecker'); goog.requireType('Blockly.IASTNodeLocationWithBlock'); @@ -147,8 +147,8 @@ Blockly.Connection.prototype.connect_ = function(childConnection) { if (nextBlock && !nextBlock.isShadow()) { newBlock = nextBlock; } else { - var typeChecker = orphanBlock.workspace.connectionTypeChecker; - if (typeChecker.canConnect( + var checker = orphanBlock.workspace.connectionChecker; + if (checker.canConnect( orphanBlock.previousConnection, newBlock.nextConnection, false)) { newBlock.nextConnection.connect(orphanBlock.previousConnection); orphanBlock = null; @@ -252,7 +252,7 @@ Blockly.Connection.prototype.isConnected = function() { */ Blockly.Connection.prototype.canConnectWithReason = function(target) { // TODO: deprecation warning with date, plus tests. - return this.getConnectionTypeChecker().canConnectWithReason( + return this.getConnectionChecker().canConnectWithReason( this, target); }; @@ -267,7 +267,7 @@ Blockly.Connection.prototype.canConnectWithReason = function(target) { Blockly.Connection.prototype.checkConnection = function(target) { // TODO: Add deprecation warning notices *and* add tests to make sure these // still work (for any blocks that use them). - var checker = this.getConnectionTypeChecker(); + var checker = this.getConnectionChecker(); var reason = !checker.canConnectWithReason(this, target, false); if (reason != Blockly.Connection.CAN_CONNECT) { throw new Error(checker.getErrorMessage(this, target, reason)); @@ -276,12 +276,12 @@ Blockly.Connection.prototype.checkConnection = function(target) { /** * Get the workspace's connection type checker object. - * @return {!Blockly.ConnectionTypeChecker} The connection type checker for the + * @return {!Blockly.ConnectionChecker} The connection type checker for the * source block's workspace. * @package */ -Blockly.Connection.prototype.getConnectionTypeChecker = function() { - return this.sourceBlock_.workspace.connectionTypeChecker; +Blockly.Connection.prototype.getConnectionChecker = function() { + return this.sourceBlock_.workspace.connectionChecker; }; /** @@ -291,7 +291,7 @@ Blockly.Connection.prototype.getConnectionTypeChecker = function() { * @deprecated July 2020 */ Blockly.Connection.prototype.isConnectionAllowed = function(candidate) { - return this.getConnectionTypeChecker().canConnect(this, candidate, true); + return this.getConnectionChecker().canConnect(this, candidate, true); }; /** @@ -314,7 +314,7 @@ Blockly.Connection.prototype.connect = function(otherConnection) { return; } - var checker = this.getConnectionTypeChecker(); + var checker = this.getConnectionChecker(); if (checker.canConnect(this, otherConnection, false)) { var eventGroup = Blockly.Events.getGroup(); if (!eventGroup) { @@ -362,7 +362,7 @@ Blockly.Connection.singleConnection_ = function(block, orphanBlock) { var output = orphanBlock.outputConnection; for (var i = 0; i < block.inputList.length; i++) { var thisConnection = block.inputList[i].connection; - var typeChecker = output.getConnectionTypeChecker(); + var typeChecker = output.getConnectionChecker(); if (thisConnection && thisConnection.type == Blockly.INPUT_VALUE && typeChecker.canConnect(output, thisConnection, false)) { if (connection) { @@ -495,7 +495,7 @@ Blockly.Connection.prototype.targetBlock = function() { */ Blockly.Connection.prototype.checkType = function(otherConnection) { // TODO (fenichel): Add deprecation warnings. - return this.getConnectionTypeChecker().canConnect(this, otherConnection, + return this.getConnectionChecker().canConnect(this, otherConnection, false); }; @@ -521,7 +521,7 @@ Blockly.Connection.prototype.checkType_ = function(otherConnection) { Blockly.Connection.prototype.onCheckChanged_ = function() { // The new value type may not be compatible with the existing connection. if (this.isConnected() && (!this.targetConnection || - !this.getConnectionTypeChecker().canConnect( + !this.getConnectionChecker().canConnect( this, this.targetConnection, false))) { var child = this.isSuperior() ? this.targetBlock() : this.sourceBlock_; child.unplug(); diff --git a/core/connection_checks.js b/core/connection_checker.js similarity index 88% rename from core/connection_checks.js rename to core/connection_checker.js index 849f91979..a5fa84c65 100644 --- a/core/connection_checks.js +++ b/core/connection_checker.js @@ -11,7 +11,7 @@ */ 'use strict'; -goog.provide('Blockly.ConnectionTypeChecker'); +goog.provide('Blockly.ConnectionChecker'); goog.requireType('Blockly.Connection'); @@ -19,7 +19,7 @@ goog.requireType('Blockly.Connection'); * Class for connection type checking logic. * @constructor */ -Blockly.ConnectionTypeChecker = function() { +Blockly.ConnectionChecker = function() { }; /** @@ -32,7 +32,7 @@ Blockly.ConnectionTypeChecker = function() { * @return {boolean} Whether the connection is legal. * @public */ -Blockly.ConnectionTypeChecker.prototype.canConnect = function(one, two, +Blockly.ConnectionChecker.prototype.canConnect = function(one, two, isDragging) { return this.canConnectWithReason(one, two, isDragging) == Blockly.Connection.CAN_CONNECT; @@ -40,7 +40,7 @@ Blockly.ConnectionTypeChecker.prototype.canConnect = function(one, two, /** * Checks whether the current connection can connect with the target - * connection. + * connection, and return an error code if there are problems. * @param {Blockly.Connection} one Connection to check compatibility with. * @param {Blockly.Connection} two Connection to check compatibility with. * @param {boolean} isDragging [description] @@ -48,13 +48,14 @@ Blockly.ConnectionTypeChecker.prototype.canConnect = function(one, two, * an error code otherwise. * @public */ -Blockly.ConnectionTypeChecker.prototype.canConnectWithReason = function( +Blockly.ConnectionChecker.prototype.canConnectWithReason = function( one, two, isDragging) { var safety = this.doSafetyChecks(one, two); if (safety != Blockly.Connection.CAN_CONNECT) { return safety; } + // If the safety checks passed, both connections are non-null. var connOne = /** @type {!Blockly.Connection} **/ (one); var connTwo = /** @type {!Blockly.Connection} **/ (two); if (!this.doTypeChecks(connOne, connTwo)) { @@ -77,7 +78,7 @@ Blockly.ConnectionTypeChecker.prototype.canConnectWithReason = function( * @return {string} A developer-readable error string. * @public */ -Blockly.ConnectionTypeChecker.prototype.getErrorMessage = function(errorCode, +Blockly.ConnectionChecker.prototype.getErrorMessage = function(errorCode, one, two) { switch (errorCode) { case Blockly.Connection.REASON_SELF_CONNECTION: @@ -90,8 +91,10 @@ Blockly.ConnectionTypeChecker.prototype.getErrorMessage = function(errorCode, case Blockly.Connection.REASON_TARGET_NULL: return 'Target connection is null.'; case Blockly.Connection.REASON_CHECKS_FAILED: + var connOne = /** @type {!Blockly.Connection} **/ (one); + var connTwo = /** @type {!Blockly.Connection} **/ (two); var msg = 'Connection checks failed. '; - msg += one + ' expected ' + one.getCheck() + ', found ' + two.getCheck(); + msg += connOne + ' expected ' + connOne.getCheck() + ', found ' + connTwo.getCheck(); return msg; case Blockly.Connection.REASON_SHADOW_PARENT: return 'Connecting non-shadow to shadow block.'; @@ -104,13 +107,13 @@ Blockly.ConnectionTypeChecker.prototype.getErrorMessage = function(errorCode, /** * Check that connecting the given connections is safe, meaning that it would - * not break any of Blockly's basic assumptions--no self connections, etc. + * not break any of Blockly's basic assumptions (e.g. no self connections). * @param {Blockly.Connection} one The first of the connections to check. * @param {Blockly.Connection} two The second of the connections to check. * @return {number} An enum with the reason this connection is safe or unsafe. * @public */ -Blockly.ConnectionTypeChecker.prototype.doSafetyChecks = function(one, two) { +Blockly.ConnectionChecker.prototype.doSafetyChecks = function(one, two) { if (!one || !two) { return Blockly.Connection.REASON_TARGET_NULL; } @@ -142,7 +145,7 @@ Blockly.ConnectionTypeChecker.prototype.doSafetyChecks = function(one, two) { * @return {boolean} True if the connections share a type. * @public */ -Blockly.ConnectionTypeChecker.prototype.doTypeChecks = function(one, two) { +Blockly.ConnectionChecker.prototype.doTypeChecks = function(one, two) { var checkArrayOne = one.getCheck(); var checkArrayTwo = two.getCheck(); @@ -167,7 +170,7 @@ Blockly.ConnectionTypeChecker.prototype.doTypeChecks = function(one, two) { * @return {boolean} True if the connections share a type. * @public */ -Blockly.ConnectionTypeChecker.prototype.doDragChecks = function(one, two) { +Blockly.ConnectionChecker.prototype.doDragChecks = function(one, two) { // Don't consider insertion markers. if (two.getSourceBlock().isInsertionMarker()) { return false; @@ -224,7 +227,7 @@ Blockly.ConnectionTypeChecker.prototype.doDragChecks = function(one, two) { }; /** - * Helper function for drag checking + * Helper function for drag checking. * @param {!Blockly.Connection} one The connection to check, which must be a * statement input or next connection. * @param {!Blockly.Connection} two A nearby connection to check, which @@ -232,7 +235,7 @@ Blockly.ConnectionTypeChecker.prototype.doDragChecks = function(one, two) { * @return {boolean} True if the connection is allowed, false otherwise. * @protected */ -Blockly.ConnectionTypeChecker.prototype.canConnectToPrevious_ = function(one, two) { +Blockly.ConnectionChecker.prototype.canConnectToPrevious_ = function(one, two) { if (one.targetConnection) { // This connection is already occupied. // A next connection will never disconnect itself mid-drag. diff --git a/core/connection_db.js b/core/connection_db.js index 104ad46b0..4dca293bb 100644 --- a/core/connection_db.js +++ b/core/connection_db.js @@ -16,24 +16,26 @@ goog.provide('Blockly.ConnectionDB'); goog.require('Blockly.RenderedConnection'); +goog.requireType('Blockly.ConnectionChecker'); + /** * Database of connections. * Connections are stored in order of their vertical component. This way * connections in an area may be looked up quickly using a binary search. - * @param {!Blockly.ConnectionTypeChecker} typeChecker The workspace's + * @param {!Blockly.ConnectionChecker} checker The workspace's * connection type checker, used to decide if connections are valid during a * drag. * @constructor */ -Blockly.ConnectionDB = function(typeChecker) { +Blockly.ConnectionDB = function(checker) { /** * Array of connections sorted by y position in workspace units. * @type {!Array.} * @private */ this.connections_ = []; - this.typeChecker_ = typeChecker; + this.connectionChecker_ = checker; }; /** @@ -247,7 +249,7 @@ Blockly.ConnectionDB.prototype.searchForClosest = function(conn, maxRadius, temp = this.connections_[pointerMin]; curDistance = temp.distanceFrom(conn); if (curDistance <= bestRadius && - this.typeChecker_.canConnect(conn, temp, true)) { + this.connectionChecker_.canConnect(conn, temp, true)) { bestConnection = temp; bestRadius = curDistance; } @@ -260,7 +262,7 @@ Blockly.ConnectionDB.prototype.searchForClosest = function(conn, maxRadius, temp = this.connections_[pointerMax]; curDistance = temp.distanceFrom(conn); if (curDistance <= bestRadius && - this.typeChecker_.canConnect(conn, temp, true)) { + this.connectionChecker_.canConnect(conn, temp, true)) { bestConnection = temp; bestRadius = curDistance; } @@ -277,17 +279,16 @@ Blockly.ConnectionDB.prototype.searchForClosest = function(conn, maxRadius, /** * Initialize a set of connection DBs for a workspace. - * @param {!Blockly.ConnectionTypeChecker} typeChecker The workspace's - * connection type checker, used to decide if connections are valid during a - * drag. + * @param {!Blockly.ConnectionChecker} checker The workspace's + * connection checker, used to decide if connections are valid during a drag. * @return {!Array.} Array of databases. */ -Blockly.ConnectionDB.init = function(typeChecker) { +Blockly.ConnectionDB.init = function(checker) { // Create four databases, one for each connection type. var dbList = []; - dbList[Blockly.INPUT_VALUE] = new Blockly.ConnectionDB(typeChecker); - dbList[Blockly.OUTPUT_VALUE] = new Blockly.ConnectionDB(typeChecker); - dbList[Blockly.NEXT_STATEMENT] = new Blockly.ConnectionDB(typeChecker); - dbList[Blockly.PREVIOUS_STATEMENT] = new Blockly.ConnectionDB(typeChecker); + dbList[Blockly.INPUT_VALUE] = new Blockly.ConnectionDB(checker); + dbList[Blockly.OUTPUT_VALUE] = new Blockly.ConnectionDB(checker); + dbList[Blockly.NEXT_STATEMENT] = new Blockly.ConnectionDB(checker); + dbList[Blockly.PREVIOUS_STATEMENT] = new Blockly.ConnectionDB(checker); return dbList; }; diff --git a/core/keyboard_nav/navigation.js b/core/keyboard_nav/navigation.js index 33b68cfc4..fcf9fdfa8 100644 --- a/core/keyboard_nav/navigation.js +++ b/core/keyboard_nav/navigation.js @@ -18,7 +18,6 @@ goog.require('Blockly.ASTNode'); goog.require('Blockly.utils.Coordinate'); goog.require('Blockly.user.keyMap'); -goog.requireType('Blockly.ConnectionTypeChecker'); /** * A function to call to give feedback to the user about logs, warnings, and @@ -411,7 +410,7 @@ Blockly.navigation.moveAndConnect_ = function(movingConnection, destConnection) } var movingBlock = movingConnection.getSourceBlock(); - var checker = movingConnection.getConnectionTypeChecker(); + var checker = movingConnection.getConnectionChecker(); if (checker.canConnect(movingConnection, destConnection, false)) { Blockly.navigation.disconnectChild_(movingConnection, destConnection); @@ -501,7 +500,7 @@ Blockly.navigation.connect_ = function(movingConnection, destConnection) { } else if (Blockly.navigation.moveAndConnect_(movingConnection, destConnection)){ return true; } else { - var checker = movingConnection.getConnectionTypeChecker(); + var checker = movingConnection.getConnectionChecker(); var reason = checker.canConnectWithReason( movingConnection, destConnection, false); Blockly.navigation.warn_('Connection failed with error: ' + diff --git a/core/rendered_connection.js b/core/rendered_connection.js index e450db3dd..0046446b3 100644 --- a/core/rendered_connection.js +++ b/core/rendered_connection.js @@ -19,7 +19,7 @@ goog.require('Blockly.utils.Coordinate'); goog.require('Blockly.utils.dom'); goog.require('Blockly.utils.object'); -goog.requireType('Blockly.ConnectionTypeChecker'); +goog.requireType('Blockly.ConnectionChecker'); /** @@ -552,7 +552,7 @@ Blockly.RenderedConnection.prototype.connect_ = function(childConnection) { Blockly.RenderedConnection.prototype.onCheckChanged_ = function() { // The new value type may not be compatible with the existing connection. if (this.isConnected() && (!this.targetConnection || - !this.getConnectionTypeChecker().canConnect( + !this.getConnectionChecker().canConnect( this, this.targetConnection, false))) { var child = this.isSuperior() ? this.targetBlock() : this.sourceBlock_; child.unplug(); diff --git a/core/renderers/common/renderer.js b/core/renderers/common/renderer.js index 2807ec8c5..d0d8c1691 100644 --- a/core/renderers/common/renderer.js +++ b/core/renderers/common/renderer.js @@ -254,7 +254,7 @@ Blockly.blockRendering.Renderer.prototype.orphanCanConnectAtEnd = if (!lastConnection) { return false; } - return orphanConnection.getConnectionTypeChecker().canConnect( + return orphanConnection.getConnectionChecker().canConnect( lastConnection, orphanConnection, false); }; diff --git a/core/workspace.js b/core/workspace.js index 9275f7a32..b79ab340c 100644 --- a/core/workspace.js +++ b/core/workspace.js @@ -12,7 +12,7 @@ goog.provide('Blockly.Workspace'); -goog.require('Blockly.ConnectionTypeChecker'); +goog.require('Blockly.ConnectionChecker'); goog.require('Blockly.Events'); goog.require('Blockly.Options'); goog.require('Blockly.utils'); @@ -43,6 +43,12 @@ Blockly.Workspace = function(opt_options) { /** @type {number} */ this.toolboxPosition = this.options.toolboxPosition; + /** + * An object that encapsulates logic for safety, type, and dragging checks. + * @type {Blockly} + */ + this.connectionChecker = new Blockly.ConnectionChecker(); + /** * @type {!Array.} * @private @@ -104,8 +110,6 @@ Blockly.Workspace = function(opt_options) { * @private */ this.potentialVariableMap_ = null; - /** @type {!Blockly.ConnectionTypeChecker} [description] */ - this.connectionTypeChecker = new Blockly.ConnectionTypeChecker(); }; /** diff --git a/core/workspace_svg.js b/core/workspace_svg.js index e2fe81cd3..97739c44d 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -44,7 +44,6 @@ goog.require('Blockly.Xml'); goog.requireType('Blockly.blockRendering.Renderer'); goog.requireType('Blockly.IASTNodeLocationSvg'); goog.requireType('Blockly.IBoundedElement'); -goog.requireType('Blockly.ConnectionTypeChecker'); /** @@ -70,7 +69,7 @@ Blockly.WorkspaceSvg = function(options, options.setMetrics || Blockly.WorkspaceSvg.setTopLevelWorkspaceMetrics_; - this.connectionDBList = Blockly.ConnectionDB.init(this.connectionTypeChecker); + this.connectionDBList = Blockly.ConnectionDB.init(this.connectionChecker); if (opt_blockDragSurface) { this.blockDragSurface_ = opt_blockDragSurface; diff --git a/tests/mocha/connection_db_test.js b/tests/mocha/connection_db_test.js index 52f926391..f8dccd5d0 100644 --- a/tests/mocha/connection_db_test.js +++ b/tests/mocha/connection_db_test.js @@ -6,7 +6,7 @@ suite('Connection Database', function() { setup(function() { - this.database = new Blockly.ConnectionDB(new Blockly.ConnectionTypeChecker()); + this.database = new Blockly.ConnectionDB(new Blockly.ConnectionChecker()); this.assertOrder = function() { var length = this.database.connections_.length; @@ -194,8 +194,8 @@ suite('Connection Database', function() { suite('Search For Closest', function() { setup(function() { this.allowedStub = null; - this.allowedStub = sinon.stub(this.database.typeChecker_, 'canConnect') - .callsFake(function(dragging, candidate) { + this.allowedStub = sinon.stub(this.database.connectionChecker_, 'canConnect') + .callsFake(function(_dragging, _candidate) { return true; }); this.createCheckConnection = function(x, y) { diff --git a/tests/mocha/connection_test.js b/tests/mocha/connection_test.js index f105bcbe2..4f058126b 100644 --- a/tests/mocha/connection_test.js +++ b/tests/mocha/connection_test.js @@ -6,7 +6,7 @@ suite('Connection type checker', function() { suiteSetup(function() { - this.checker = new Blockly.ConnectionTypeChecker(); + this.checker = new Blockly.ConnectionChecker(); }); suite('Safety checks', function() { function assertReasonHelper(checker, one, two, reason) {