Added tests/setFieldValue error message

* Added tests for getting/setting field (values) when names are not supplied and test for getting a field value, setting it to a new value, and getting it again.
* Added more user-friendly error message for setFieldValue telling the developer that he/she is missing the name rather than Field "undefined" not found.
* Fixed lint error by removing trailing space
This commit is contained in:
jschanker
2021-06-12 03:22:22 -04:00
committed by Christopher Allen
parent f9c5260fb0
commit 62bb663b38

View File

@@ -1128,7 +1128,7 @@ Blockly.Block.prototype.getFieldValue = function(name) {
*/
Blockly.Block.prototype.setFieldValue = function(newValue, name) {
if (typeof name === "undefined") {
throw Error("Call to Blockly.Block.prototype.setFieldValue without " +
throw Error("Call to Blockly.Block.prototype.setFieldValue without " +
"required second argument of field name.");
}
var field = this.getField(name);