Fixed insertFieldAt (#2939)

* Fixed insertFieldAt.
* Updated tests to reflect upcomming config changes.
This commit is contained in:
Beka Westberg
2019-09-16 11:11:18 -07:00
committed by Sam El-Husseini
parent b149aabd16
commit e05e26ab45
5 changed files with 315 additions and 205 deletions

View File

@@ -106,8 +106,9 @@ Blockly.Input.prototype.insertFieldAt = function(index, field, opt_name) {
throw Error('index ' + index + ' out of bounds.');
}
// Empty string, Null or undefined generates no field, unless field is named.
if (!field && !opt_name) {
// Falsy field values don't generate a field, unless the field is an empty
// string and named.
if (!field && !(field == '' && opt_name)) {
return index;
}
// Generate a FieldLabel when given a plain text field.