Added Field Value Tests (#2459)

* Added field value tests.

* Fixed field image src param.

* Fixed falsy values with label fields.

* Fixed falsy values with text input fields.

* Fixed some angle field tests.

* Fixed other text input when editing tests.

* Fixed colour tests.

* Cleaned up some number and variable field tests.

* Added angle field > 360 degrees tests.

* Fixed variable validator tests.

* Split setValue tests into sub-suites.

* Fixed angle >360 tests

* Changed var declarations to property declarations.
This commit is contained in:
Beka Westberg
2019-05-17 15:19:14 -07:00
committed by RoboErikG
parent 05253d0766
commit acd96aa2c5
20 changed files with 2274 additions and 56 deletions

View File

@@ -32,7 +32,8 @@ goog.require('Blockly.utils');
/**
* Class for a checkbox field.
* @param {string} state The initial state of the field ('TRUE' or 'FALSE').
* @param {string=} opt_state The initial state of the field ('TRUE' or
* 'FALSE'), defaults to 'FALSE'.
* @param {Function=} opt_validator A function that is executed when a new
* option is selected. Its sole argument is the new checkbox state. If
* it returns a value, this becomes the new checkbox state, unless the
@@ -40,10 +41,10 @@ goog.require('Blockly.utils');
* @extends {Blockly.Field}
* @constructor
*/
Blockly.FieldCheckbox = function(state, opt_validator) {
Blockly.FieldCheckbox = function(opt_state, opt_validator) {
Blockly.FieldCheckbox.superClass_.constructor.call(this, '', opt_validator);
// Set the initial state.
this.setValue(state);
this.setValue(opt_state);
};
goog.inherits(Blockly.FieldCheckbox, Blockly.Field);