Describe the bug
When constructing a number field, one passes in 4 constraints, a validator and a config object. If the config object is present, the constructor constraints are ignored, even if the config object does not replace them.
To Reproduce
.appendField(newBlockly.FieldNumber(this.state.minLength.value,0,Number.MAX_SAFE_INTEGER,1,(value)=>{if(this.state.maxLength.enabled&&value>this.state.maxLength.value){returnnull}this.state.minLength.value=valuereturnvalue},{tooltip: 'Minimum length of the string'}))This constructed field ignores the precision setting of 1. FieldNumber's constructor (lines 69-74) has this logic which produces the bug:
Blockly.FieldNumber.superClass_.constructor.call(this,opt_value||0,opt_validator,opt_config);if(!opt_config){// Only do one kind of configuration or the other.this.setConstraints(opt_min,opt_max,opt_precision);}Expected behavior
Constructor constraints should be used unless overridden in the config.
Ideally one would have a separate constructor with just the config object providing the constraints and validators.
Desktop (please complete the following information):
- OS:MacOS 10.15.5
- Browser chrome 83, safari 13.1
Describe the bug
When constructing a number field, one passes in 4 constraints, a validator and a config object. If the config object is present, the constructor constraints are ignored, even if the config object does not replace them.
To Reproduce
This constructed field ignores the precision setting of 1. FieldNumber's constructor (lines 69-74) has this logic which produces the bug:
Expected behavior
Constructor constraints should be used unless overridden in the config.
Ideally one would have a separate constructor with just the config object providing the constraints and validators.
Desktop (please complete the following information):