Make tests pass

This commit is contained in:
Rachel Fenichel 2016-06-15 14:34:02 -07:00
parent 4f28d1fb61
commit fd67f358e8
2 changed files with 24 additions and 12 deletions

View file

@ -324,6 +324,9 @@ Blockly.Connection.prototype.isConnected = function() {
* @private
*/
Blockly.Connection.prototype.canConnectWithReason_ = function(target) {
if (!target) {
return Blockly.Connection.REASON_TARGET_NULL;
}
if (this.isSuperior()) {
var blockA = this.sourceBlock_;
var blockB = target.getSourceBlock();
@ -331,9 +334,8 @@ Blockly.Connection.prototype.canConnectWithReason_ = function(target) {
var blockB = this.sourceBlock_;
var blockA = target.getSourceBlock();
}
if (!target) {
return Blockly.Connection.REASON_TARGET_NULL;
} else if (blockA && blockA == blockB) {
if (blockA && blockA == blockB) {
return Blockly.Connection.REASON_SELF_CONNECTION;
} else if (target.type != Blockly.OPPOSITE_TYPE[this.type]) {
return Blockly.Connection.REASON_WRONG_TYPE;