diff --git a/core/block.js b/core/block.js index 71453bf6c..1d4b50163 100644 --- a/core/block.js +++ b/core/block.js @@ -639,7 +639,7 @@ Blockly.Block.prototype.getRootBlock = function() { * the top block of the sub stack. If we are nested in a statement input only * find the top-most nested block. Do not go all the way to the root block. * @return {!Blockly.Block} The top block in a stack. - * @private + * @package */ Blockly.Block.prototype.getTopStackBlock = function() { var block = this; diff --git a/core/connection.js b/core/connection.js index 3c0f1ace0..cbe6a217a 100644 --- a/core/connection.js +++ b/core/connection.js @@ -224,7 +224,7 @@ Blockly.Connection.prototype.dispose = function() { /** * Get the source block for this connection. - * @return {Blockly.Block} The source block, or null if there is none. + * @return {!Blockly.Block} The source block. */ Blockly.Connection.prototype.getSourceBlock = function() { return this.sourceBlock_; @@ -253,9 +253,9 @@ Blockly.Connection.prototype.isConnected = function() { * @param {Blockly.Connection} target Connection to check compatibility with. * @return {number} Blockly.Connection.CAN_CONNECT if the connection is legal, * an error code otherwise. - * @private + * @package */ -Blockly.Connection.prototype.canConnectWithReason_ = function(target) { +Blockly.Connection.prototype.canConnectWithReason = function(target) { if (!target) { return Blockly.Connection.REASON_TARGET_NULL; } @@ -285,10 +285,10 @@ Blockly.Connection.prototype.canConnectWithReason_ = function(target) { * and throws an exception if they are not. * @param {Blockly.Connection} target The connection to check compatibility * with. - * @private + * @package */ -Blockly.Connection.prototype.checkConnection_ = function(target) { - switch (this.canConnectWithReason_(target)) { +Blockly.Connection.prototype.checkConnection = function(target) { + switch (this.canConnectWithReason(target)) { case Blockly.Connection.CAN_CONNECT: break; case Blockly.Connection.REASON_SELF_CONNECTION: @@ -358,7 +358,7 @@ Blockly.Connection.prototype.isConnectionAllowed = function(candidate) { return false; } // Type checking. - var canConnect = this.canConnectWithReason_(candidate); + var canConnect = this.canConnectWithReason(candidate); if (canConnect != Blockly.Connection.CAN_CONNECT) { return false; } @@ -431,7 +431,7 @@ Blockly.Connection.prototype.connect = function(otherConnection) { // Already connected together. NOP. return; } - this.checkConnection_(otherConnection); + this.checkConnection(otherConnection); var eventGroup = Blockly.Events.getGroup(); if (!eventGroup) { Blockly.Events.setGroup(true); diff --git a/core/keyboard_nav/ast_node.js b/core/keyboard_nav/ast_node.js index f4328a0ae..b1ee7c70f 100644 --- a/core/keyboard_nav/ast_node.js +++ b/core/keyboard_nav/ast_node.js @@ -30,7 +30,7 @@ goog.provide('Blockly.ASTNode'); * creating a node directly. * @param {string} type The type of the location. * Must be in Bockly.ASTNode.types. - * @param {Blockly.Block|Blockly.Connection|Blockly.Field|Blockly.Workspace} + * @param {!(Blockly.Block|Blockly.Connection|Blockly.Field|Blockly.Workspace)} * location The position in the AST. * @param {!Object=} opt_params Optional dictionary of options. * @constructor @@ -107,10 +107,13 @@ Blockly.ASTNode.isConnectionType_ = function(type) { /** * Create an AST node pointing to a field. - * @param {!Blockly.Field} field The location of the AST node. - * @return {!Blockly.ASTNode} An AST node pointing to a field. + * @param {Blockly.Field} field The location of the AST node. + * @return {Blockly.ASTNode} An AST node pointing to a field. */ Blockly.ASTNode.createFieldNode = function(field) { + if (!field) { + return null; + } return new Blockly.ASTNode(Blockly.ASTNode.types.FIELD, field); }; @@ -144,10 +147,10 @@ Blockly.ASTNode.createConnectionNode = function(connection) { * Creates an AST node pointing to an input. Stores the input connection as the * location. * @param {Blockly.Input} input The input used to create an AST node. - * @return {!Blockly.ASTNode} An AST node pointing to a input. + * @return {Blockly.ASTNode} An AST node pointing to a input. */ Blockly.ASTNode.createInputNode = function(input) { - if (!input) { + if (!input || !input.connection) { return null; } return new Blockly.ASTNode(Blockly.ASTNode.types.INPUT, input.connection); @@ -155,22 +158,28 @@ Blockly.ASTNode.createInputNode = function(input) { /** * Creates an AST node pointing to a block. - * @param {!Blockly.Block} block The block used to create an AST node. - * @return {!Blockly.ASTNode} An AST node pointing to a block. + * @param {Blockly.Block} block The block used to create an AST node. + * @return {Blockly.ASTNode} An AST node pointing to a block. */ Blockly.ASTNode.createBlockNode = function(block) { + if (!block) { + return null; + } return new Blockly.ASTNode(Blockly.ASTNode.types.BLOCK, block); }; /** * Create an AST node of type stack. A stack, represented by its top block, is * the set of all blocks connected to a top block, including the top block. - * @param {!Blockly.Block} topBlock A top block has no parent and can be found + * @param {Blockly.Block} topBlock A top block has no parent and can be found * in the list returned by workspace.getTopBlocks(). - * @return {!Blockly.ASTNode} An AST node of type stack that points to the top + * @return {Blockly.ASTNode} An AST node of type stack that points to the top * block on the stack. */ Blockly.ASTNode.createStackNode = function(topBlock) { + if (!topBlock) { + return null; + } return new Blockly.ASTNode(Blockly.ASTNode.types.STACK, topBlock); }; @@ -179,10 +188,13 @@ Blockly.ASTNode.createStackNode = function(topBlock) { * @param {!Blockly.Workspace} workspace The workspace that we are on. * @param {Blockly.utils.Coordinate} wsCoordinate The position on the workspace * for this node. - * @return {!Blockly.ASTNode} An AST node pointing to a workspace and a position + * @return {Blockly.ASTNode} An AST node pointing to a workspace and a position * on the workspace. */ Blockly.ASTNode.createWorkspaceNode = function(workspace, wsCoordinate) { + if (!wsCoordinate || !workspace) { + return null; + } var params = { wsCoordinate: wsCoordinate }; @@ -278,7 +290,7 @@ Blockly.ASTNode.prototype.findNextForInput_ = function() { * @private */ Blockly.ASTNode.prototype.findNextForField_ = function() { - var location = this.location_; + var location = /** @type {!Blockly.Field} */ (this.location_); var input = location.getParentInput(); var block = location.getSourceBlock(); var curIdx = block.inputList.indexOf(input); @@ -332,7 +344,7 @@ Blockly.ASTNode.prototype.findPrevForInput_ = function() { * @private */ Blockly.ASTNode.prototype.findPrevForField_ = function() { - var location = this.location_; + var location = /** @type {!Blockly.Field} */ (this.location_); var parentInput = location.getParentInput(); var block = location.getSourceBlock(); var curIdx = block.inputList.indexOf(parentInput); @@ -398,9 +410,11 @@ Blockly.ASTNode.prototype.navigateBetweenStacks_ = function(forward) { Blockly.ASTNode.prototype.findTopASTNodeForBlock_ = function(block) { var topConnection = block.previousConnection || block.outputConnection; if (topConnection) { - return Blockly.ASTNode.createConnectionNode(topConnection); + return /** @type {!Blockly.ASTNode} */ (Blockly.ASTNode.createConnectionNode( + topConnection)); } else { - return Blockly.ASTNode.createBlockNode(block); + return /** @type {!Blockly.ASTNode} */ (Blockly.ASTNode.createBlockNode( + block)); } }; @@ -477,20 +491,14 @@ Blockly.ASTNode.prototype.next = function() { case Blockly.ASTNode.types.BLOCK: var nextConnection = this.location_.nextConnection; - if (nextConnection) { - return Blockly.ASTNode.createConnectionNode(nextConnection); - } - break; + return Blockly.ASTNode.createConnectionNode(nextConnection); case Blockly.ASTNode.types.PREVIOUS: return Blockly.ASTNode.createBlockNode(this.location_.getSourceBlock()); case Blockly.ASTNode.types.NEXT: var targetConnection = this.location_.targetConnection; - if (targetConnection) { - return Blockly.ASTNode.createConnectionNode(targetConnection); - } - break; + return Blockly.ASTNode.createConnectionNode(targetConnection); } return null; @@ -517,14 +525,11 @@ Blockly.ASTNode.prototype.in = function() { case Blockly.ASTNode.types.BLOCK: var block = /** @type {!Blockly.Block} */ (this.location_); - return this.findFirstFieldOrInput_(this.location_); + return this.findFirstFieldOrInput_(block); case Blockly.ASTNode.types.INPUT: var targetConnection = this.location_.targetConnection; - if (targetConnection) { - return Blockly.ASTNode.createConnectionNode(targetConnection); - } - break; + return Blockly.ASTNode.createConnectionNode(targetConnection); } return null; @@ -551,13 +556,9 @@ Blockly.ASTNode.prototype.prev = function() { return this.findPrevForInput_(); case Blockly.ASTNode.types.BLOCK: - var prevConnection = this.location_.previousConnection; - var outputConnection = this.location_.outputConnection; - var topConnection = prevConnection || outputConnection; - if (topConnection) { - return Blockly.ASTNode.createConnectionNode(topConnection); - } - break; + var block = this.location_; + var topConnection = block.previousConnection || block.outputConnection; + return Blockly.ASTNode.createConnectionNode(topConnection); case Blockly.ASTNode.types.PREVIOUS: var targetConnection = this.location_.targetConnection; diff --git a/core/keyboard_nav/cursor_svg.js b/core/keyboard_nav/cursor_svg.js index 0151d4881..0c33aa8a7 100644 --- a/core/keyboard_nav/cursor_svg.js +++ b/core/keyboard_nav/cursor_svg.js @@ -274,7 +274,7 @@ Blockly.CursorSvg.prototype.showWithField_ = function(curNode) { Blockly.CursorSvg.prototype.showWithInput_ = function(curNode) { var connection = /** @type {Blockly.Connection} */ (curNode.getLocation()); - var sourceBlock = /** @type {Blockly.BlockSvg} */ (connection.getSourceBlock()); + var sourceBlock = /** @type {!Blockly.BlockSvg} */ (connection.getSourceBlock()); this.positionInput_(connection); this.setParent_(sourceBlock); diff --git a/core/keyboard_nav/key_map.js b/core/keyboard_nav/key_map.js index 2491cbc5b..e8bc32c54 100644 --- a/core/keyboard_nav/key_map.js +++ b/core/keyboard_nav/key_map.js @@ -30,7 +30,7 @@ goog.require('Blockly.utils.object'); /** * Holds the serialized key to key action mapping. - * @type {Object} + * @type {!Object} */ Blockly.user.keyMap.map_ = {}; @@ -63,7 +63,7 @@ Blockly.user.keyMap.setActionForKey = function(keyCode, action) { /** * Creates a new key map. - * @param {Object} keyMap The object holding the key + * @param {!Object} keyMap The object holding the key * to action mapping. * @package */ diff --git a/core/keyboard_nav/navigation.js b/core/keyboard_nav/navigation.js index 6aaecacff..90577c187 100644 --- a/core/keyboard_nav/navigation.js +++ b/core/keyboard_nav/navigation.js @@ -283,7 +283,7 @@ Blockly.navigation.modifyWarn_ = function() { /** * Disconnect the block from its parent and move to the position of the * workspace node. - * @param {!Blockly.Block} block The block to be moved to the workspace. + * @param {Blockly.Block} block The block to be moved to the workspace. * @param {!Blockly.ASTNode} wsNode The workspace node holding the position the * block will be moved to. * @return {boolean} True if the block can be moved to the workspace, @@ -291,6 +291,9 @@ Blockly.navigation.modifyWarn_ = function() { * @private */ Blockly.navigation.moveBlockToWorkspace_ = function(block, wsNode) { + if (!block) { + return false; + } if (block.isShadow()) { Blockly.navigation.warn_('Cannot move a shadow block to the workspace.'); return false; @@ -323,10 +326,14 @@ Blockly.navigation.modify_ = function() { var markerLoc = markerNode.getLocation(); if (markerNode.isConnection() && cursorNode.isConnection()) { + cursorLoc = /** @type {!Blockly.Connection} */ (cursorLoc); + markerLoc = /** @type {!Blockly.Connection} */ (markerLoc); return Blockly.navigation.connect_(cursorLoc, markerLoc); } else if (markerNode.isConnection() && (cursorType == Blockly.ASTNode.types.BLOCK || cursorType == Blockly.ASTNode.types.STACK)) { + cursorLoc = /** @type {!Blockly.Block} */ (cursorLoc); + markerLoc = /** @type {!Blockly.Connection} */ (markerLoc); return Blockly.navigation.insertBlock(cursorLoc, markerLoc); } else if (markerType == Blockly.ASTNode.types.WORKSPACE) { var block = Blockly.navigation.getSourceBlock_(cursorNode); @@ -372,7 +379,7 @@ Blockly.navigation.moveAndConnect_ = function(movingConnection, destConnection) } var movingBlock = movingConnection.getSourceBlock(); - if (destConnection.canConnectWithReason_(movingConnection) == + if (destConnection.canConnectWithReason(movingConnection) == Blockly.Connection.CAN_CONNECT) { Blockly.navigation.disconnectChild_(movingConnection, destConnection); @@ -458,7 +465,7 @@ Blockly.navigation.connect_ = function(movingConnection, destConnection) { return true; } else { try { - destConnection.checkConnection_(movingConnection); + destConnection.checkConnection(movingConnection); } catch (e) { // If nothing worked report the error from the original connections. @@ -472,7 +479,7 @@ Blockly.navigation.connect_ = function(movingConnection, destConnection) { * Tries to connect the given block to the destination connection, making an * intelligent guess about which connection to use to on the moving block. * @param {!Blockly.Block} block The block to move. - * @param {Blockly.Connection} destConnection The connection to connect to. + * @param {!Blockly.Connection} destConnection The connection to connect to. * @return {boolean} Whether the connection was successful. */ Blockly.navigation.insertBlock = function(block, destConnection) { @@ -525,7 +532,7 @@ Blockly.navigation.disconnectBlocks_ = function() { Blockly.navigation.log_('Cannot disconnect blocks when the cursor is not on a connection'); return; } - var curConnection = curNode.getLocation(); + var curConnection = /** @type {!Blockly.Connection} */ (curNode.getLocation()); if (!curConnection.isConnected()) { Blockly.navigation.log_('Cannot disconnect unconnected connection'); return; @@ -652,7 +659,7 @@ Blockly.navigation.moveCursorOnBlockDelete = function(deletedBlock) { } // If the cursor is on a block whose parent is being deleted, move the // cursor to the workspace. - } else if (deletedBlock.getChildren(false).indexOf(block) > -1) { + } else if (block && deletedBlock.getChildren(false).indexOf(block) > -1) { cursor.setCurNode(Blockly.ASTNode.createWorkspaceNode(block.workspace, block.getRelativeToSurfaceXY())); } diff --git a/core/workspace.js b/core/workspace.js index cd1514bc5..cefd46038 100644 --- a/core/workspace.js +++ b/core/workspace.js @@ -168,7 +168,7 @@ Blockly.Workspace.prototype.connectionDBList = null; /** * Sets the cursor for keyboard navigation. - * @param {Blockly.Cursor} cursor The cursor used to navigate around the Blockly + * @param {!Blockly.Cursor} cursor The cursor used to navigate around the Blockly * AST for keyboard navigation. */ Blockly.Workspace.prototype.setCursor = function(cursor) { @@ -177,7 +177,7 @@ Blockly.Workspace.prototype.setCursor = function(cursor) { /** * Sets the marker for keyboard navigation. - * @param {Blockly.MarkerCursor} marker The marker used to mark a location for + * @param {!Blockly.MarkerCursor} marker The marker used to mark a location for * keyboard navigation. */ Blockly.Workspace.prototype.setMarker = function(marker) { diff --git a/core/workspace_svg.js b/core/workspace_svg.js index f318c4364..6b01121cd 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -415,35 +415,31 @@ Blockly.WorkspaceSvg.prototype.getRenderer = function() { /** * Sets the cursor for use with keyboard navigation. * - * @param {Blockly.Cursor} cursor The cursor used to move around this workspace. + * @param {!Blockly.Cursor} cursor The cursor used to move around this workspace. * @override */ Blockly.WorkspaceSvg.prototype.setCursor = function(cursor) { - if (this.cursor_ && this.cursor_.getDrawer()) { + if (this.cursor_.getDrawer()) { this.cursor_.getDrawer().dispose(); } this.cursor_ = cursor; - if (this.cursor_) { - this.cursor_.setDrawer(this.getRenderer().makeCursorDrawer(this, false)); - this.setCursorSvg(this.cursor_.getDrawer().createDom()); - } + this.cursor_.setDrawer(this.getRenderer().makeCursorDrawer(this, false)); + this.setCursorSvg(this.cursor_.getDrawer().createDom()); }; /** * Sets the marker for use with keyboard navigation. - * @param {Blockly.MarkerCursor} marker The immovable cursor used to mark a + * @param {!Blockly.MarkerCursor} marker The immovable cursor used to mark a * location on the workspace. * @override */ Blockly.WorkspaceSvg.prototype.setMarker = function(marker) { - if (this.marker_ && this.marker_.getDrawer()) { + if (this.marker_.getDrawer()) { this.marker_.getDrawer().dispose(); } this.marker_ = marker; - if (this.marker_) { - this.marker_.setDrawer(this.getRenderer().makeCursorDrawer(this, true)); - this.setMarkerSvg(this.marker_.getDrawer().createDom()); - } + this.marker_.setDrawer(this.getRenderer().makeCursorDrawer(this, true)); + this.setMarkerSvg(this.marker_.getDrawer().createDom()); }; /** @@ -1187,8 +1183,11 @@ Blockly.WorkspaceSvg.prototype.pasteBlock_ = function(xmlBlock) { // Handle paste for keyboard navigation var markedNode = this.getMarker().getCurNode(); - if (Blockly.keyboardAccessibilityMode && markedNode) { - Blockly.navigation.insertBlock(block, markedNode.getLocation()); + if (Blockly.keyboardAccessibilityMode && markedNode && + markedNode.isConnection()) { + var markedLocation = + /** @type {!Blockly.Connection} */ (markedNode.getLocation()); + Blockly.navigation.insertBlock(block, markedLocation); return; } diff --git a/tests/mocha/connection_test.js b/tests/mocha/connection_test.js index 0e8776425..6a7faaf97 100644 --- a/tests/mocha/connection_test.js +++ b/tests/mocha/connection_test.js @@ -19,7 +19,7 @@ suite('Connections', function() { suite('Can Connect With Reason', function() { test('Target Null', function() { var connection = new Blockly.Connection({}, Blockly.INPUT_VALUE); - chai.assert.equal(connection.canConnectWithReason_(null), + chai.assert.equal(connection.canConnectWithReason(null), Blockly.Connection.REASON_TARGET_NULL); }); test('Target Self', function() { @@ -27,7 +27,7 @@ suite('Connections', function() { var connection1 = new Blockly.Connection(block, Blockly.INPUT_VALUE); var connection2 = new Blockly.Connection(block, Blockly.OUTPUT_VALUE); - chai.assert.equal(connection1.canConnectWithReason_(connection2), + chai.assert.equal(connection1.canConnectWithReason(connection2), Blockly.Connection.REASON_SELF_CONNECTION); }); test('Different Workspaces', function() { @@ -36,7 +36,7 @@ suite('Connections', function() { var connection2 = new Blockly.Connection( {workspace: 2}, Blockly.OUTPUT_VALUE); - chai.assert.equal(connection1.canConnectWithReason_(connection2), + chai.assert.equal(connection1.canConnectWithReason(connection2), Blockly.Connection.REASON_DIFFERENT_WORKSPACES); }); suite('Types', function() { @@ -57,51 +57,51 @@ suite('Connections', function() { inBlock, Blockly.INPUT_VALUE); }); test('Previous, Next', function() { - chai.assert.equal(this.previous.canConnectWithReason_(this.next), + chai.assert.equal(this.previous.canConnectWithReason(this.next), Blockly.Connection.CAN_CONNECT); }); test('Previous, Output', function() { - chai.assert.equal(this.previous.canConnectWithReason_(this.output), + chai.assert.equal(this.previous.canConnectWithReason(this.output), Blockly.Connection.REASON_WRONG_TYPE); }); test('Previous, Input', function() { - chai.assert.equal(this.previous.canConnectWithReason_(this.input), + chai.assert.equal(this.previous.canConnectWithReason(this.input), Blockly.Connection.REASON_WRONG_TYPE); }); test('Next, Previous', function() { - chai.assert.equal(this.next.canConnectWithReason_(this.previous), + chai.assert.equal(this.next.canConnectWithReason(this.previous), Blockly.Connection.CAN_CONNECT); }); test('Next, Output', function() { - chai.assert.equal(this.next.canConnectWithReason_(this.output), + chai.assert.equal(this.next.canConnectWithReason(this.output), Blockly.Connection.REASON_WRONG_TYPE); }); test('Next, Input', function() { - chai.assert.equal(this.next.canConnectWithReason_(this.input), + chai.assert.equal(this.next.canConnectWithReason(this.input), Blockly.Connection.REASON_WRONG_TYPE); }); test('Output, Previous', function() { - chai.assert.equal(this.output.canConnectWithReason_(this.previous), + chai.assert.equal(this.output.canConnectWithReason(this.previous), Blockly.Connection.REASON_WRONG_TYPE); }); test('Output, Next', function() { - chai.assert.equal(this.output.canConnectWithReason_(this.next), + chai.assert.equal(this.output.canConnectWithReason(this.next), Blockly.Connection.REASON_WRONG_TYPE); }); test('Output, Input', function() { - chai.assert.equal(this.output.canConnectWithReason_(this.input), + chai.assert.equal(this.output.canConnectWithReason(this.input), Blockly.Connection.CAN_CONNECT); }); test('Input, Previous', function() { - chai.assert.equal(this.input.canConnectWithReason_(this.previous), + chai.assert.equal(this.input.canConnectWithReason(this.previous), Blockly.Connection.REASON_WRONG_TYPE); }); test('Input, Next', function() { - chai.assert.equal(this.input.canConnectWithReason_(this.next), + chai.assert.equal(this.input.canConnectWithReason(this.next), Blockly.Connection.REASON_WRONG_TYPE); }); test('Input, Output', function() { - chai.assert.equal(this.input.canConnectWithReason_(this.output), + chai.assert.equal(this.input.canConnectWithReason(this.output), Blockly.Connection.CAN_CONNECT); }); }); @@ -112,7 +112,7 @@ suite('Connections', function() { var prev = new Blockly.Connection(prevBlock, Blockly.PREVIOUS_STATEMENT); var next = new Blockly.Connection(nextBlock, Blockly.NEXT_STATEMENT); - chai.assert.equal(prev.canConnectWithReason_(next), + chai.assert.equal(prev.canConnectWithReason(next), Blockly.Connection.CAN_CONNECT); }); test('Next Shadow', function() { @@ -121,7 +121,7 @@ suite('Connections', function() { var prev = new Blockly.Connection(prevBlock, Blockly.PREVIOUS_STATEMENT); var next = new Blockly.Connection(nextBlock, Blockly.NEXT_STATEMENT); - chai.assert.equal(prev.canConnectWithReason_(next), + chai.assert.equal(prev.canConnectWithReason(next), Blockly.Connection.REASON_SHADOW_PARENT); }); test('Prev and Next Shadow', function() { @@ -130,7 +130,7 @@ suite('Connections', function() { var prev = new Blockly.Connection(prevBlock, Blockly.PREVIOUS_STATEMENT); var next = new Blockly.Connection(nextBlock, Blockly.NEXT_STATEMENT); - chai.assert.equal(prev.canConnectWithReason_(next), + chai.assert.equal(prev.canConnectWithReason(next), Blockly.Connection.CAN_CONNECT); }); test('Output Shadow', function() { @@ -139,7 +139,7 @@ suite('Connections', function() { var outCon = new Blockly.Connection(outBlock, Blockly.OUTPUT_VALUE); var inCon = new Blockly.Connection(inBlock, Blockly.INPUT_VALUE); - chai.assert.equal(outCon.canConnectWithReason_(inCon), + chai.assert.equal(outCon.canConnectWithReason(inCon), Blockly.Connection.CAN_CONNECT); }); test('Input Shadow', function() { @@ -148,7 +148,7 @@ suite('Connections', function() { var outCon = new Blockly.Connection(outBlock, Blockly.OUTPUT_VALUE); var inCon = new Blockly.Connection(inBlock, Blockly.INPUT_VALUE); - chai.assert.equal(outCon.canConnectWithReason_(inCon), + chai.assert.equal(outCon.canConnectWithReason(inCon), Blockly.Connection.REASON_SHADOW_PARENT); }); test('Output and Input Shadow', function() { @@ -157,7 +157,7 @@ suite('Connections', function() { var outCon = new Blockly.Connection(outBlock, Blockly.OUTPUT_VALUE); var inCon = new Blockly.Connection(inBlock, Blockly.INPUT_VALUE); - chai.assert.equal(outCon.canConnectWithReason_(inCon), + chai.assert.equal(outCon.canConnectWithReason(inCon), Blockly.Connection.CAN_CONNECT); }); });