Fix error by init of dropdown in case the value is "" (#2308)

I have following dropdown options

```
[
    ["no matter", ""]
    ["Update", "true"]
    ["Command", "false"]
]
```
In case my value is "" the text is not filled with "no matter" by the initial draw and the empty selector is shown. I expect the text "no matter"

This PR fixes that
This commit is contained in:
Bluefox
2019-02-22 19:02:14 +01:00
committed by RoboErikG
parent c0ab30b8e9
commit e84a740d3d

View File

@@ -392,8 +392,8 @@ Blockly.FieldDropdown.prototype.getValue = function() {
* @param {string} newValue New value to set.
*/
Blockly.FieldDropdown.prototype.setValue = function(newValue) {
if (newValue === null || newValue === this.value_) {
return; // No change if null.
if (newValue === null || (newValue === this.value_ && this.text_)) {
return; // No change if null and text_ was initialized.
}
if (this.sourceBlock_ && Blockly.Events.isEnabled()) {
Blockly.Events.fire(new Blockly.Events.BlockChange(