diff --git a/core/block_events.js b/core/block_events.js index c016bca46..b57fe3ee3 100644 --- a/core/block_events.js +++ b/core/block_events.js @@ -429,7 +429,7 @@ Blockly.Events.Move.prototype.fromJson = function(json) { if (json['newCoordinate']) { var xy = json['newCoordinate'].split(','); this.newCoordinate = - new Blockly.utils.Coordinate(parseFloat(xy[0]), parseFloat(xy[1])); + new Blockly.utils.Coordinate(Number(xy[0]), Number(xy[1])); } }; diff --git a/core/block_svg.js b/core/block_svg.js index 99dcc9cf1..cb8708cb7 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -605,7 +605,7 @@ Blockly.BlockSvg.prototype.createTabList_ = function() { var list = []; for (var i = 0, input; input = this.inputList[i]; i++) { for (var j = 0, field; field = input.fieldRow[j]; j++) { - if (field instanceof Blockly.FieldTextInput) { + if (field instanceof Blockly.FieldTextInput && field.isVisible()) { // TODO (#1276): Also support dropdown fields. list.push(field); } diff --git a/core/field_angle.js b/core/field_angle.js index 4f2da5ade..f4871ba7b 100644 --- a/core/field_angle.js +++ b/core/field_angle.js @@ -340,11 +340,10 @@ Blockly.FieldAngle.prototype.updateGraph_ = function() { * @override */ Blockly.FieldAngle.prototype.doClassValidation_ = function(opt_newValue) { - if (isNaN(opt_newValue)) { + var n = Number(opt_newValue) % 360; + if (isNaN(n)) { return null; } - var n = parseFloat(opt_newValue || 0); - n %= 360; if (n < 0) { n += 360; } diff --git a/core/field_number.js b/core/field_number.js index 5603b728c..d430145c8 100644 --- a/core/field_number.js +++ b/core/field_number.js @@ -77,7 +77,7 @@ Blockly.FieldNumber.prototype.SERIALIZABLE = true; /** * Set the maximum, minimum and precision constraints on this field. - * Any of these properties may be undefiend or NaN to be disabled. + * Any of these properties may be undefined or NaN to be disabled. * Setting precision (usually a power of 10) enforces a minimum step between * values. That is, the user's value will rounded to the closest multiple of * precision. The least significant digit place is inferred from the precision. @@ -87,15 +87,15 @@ Blockly.FieldNumber.prototype.SERIALIZABLE = true; * @param {number|string|undefined} precision Precision for value. */ Blockly.FieldNumber.prototype.setConstraints = function(min, max, precision) { - precision = parseFloat(precision); + precision = Number(precision); this.precision_ = isNaN(precision) ? 0 : precision; var precisionString = this.precision_.toString(); var decimalIndex = precisionString.indexOf('.'); this.fractionalDigits_ = (decimalIndex == -1) ? -1 : precisionString.length - (decimalIndex + 1); - min = parseFloat(min); + min = Number(min); this.min_ = isNaN(min) ? -Infinity : min; - max = parseFloat(max); + max = Number(max); this.max_ = isNaN(max) ? Infinity : max; this.setValue(this.getValue()); }; @@ -121,7 +121,7 @@ Blockly.FieldNumber.prototype.doClassValidation_ = function(opt_newValue) { newValue = newValue.replace(/,/g, ''); // Clean up number. - var n = parseFloat(newValue || 0); + var n = Number(newValue || 0); if (isNaN(n)) { // Invalid number. return null; diff --git a/core/field_textinput.js b/core/field_textinput.js index 68180abb6..923807ea1 100644 --- a/core/field_textinput.js +++ b/core/field_textinput.js @@ -410,7 +410,7 @@ Blockly.FieldTextInput.numberValidator = function(text) { text = text.replace(/O/ig, '0'); // Strip out thousands separators. text = text.replace(/,/g, ''); - var n = parseFloat(text || 0); + var n = Number(text || 0); return isNaN(n) ? null : String(n); }; diff --git a/core/field_variable.js b/core/field_variable.js index dd6bed075..209d9be57 100644 --- a/core/field_variable.js +++ b/core/field_variable.js @@ -59,7 +59,7 @@ Blockly.FieldVariable = function(varname, opt_validator, opt_variableTypes, this.menuGenerator_ = Blockly.FieldVariable.dropdownCreate; this.size_ = new Blockly.utils.Size(0, Blockly.BlockSvg.MIN_BLOCK_Y); opt_validator && this.setValidator(opt_validator); - this.defaultVariableName = (varname || ''); + this.defaultVariableName = varname || ''; this.setTypes_(opt_variableTypes, opt_defaultType); this.value_ = null; diff --git a/core/keyboard_nav/ast_node.js b/core/keyboard_nav/ast_node.js index 842a5d7d4..cd30dc9bb 100644 --- a/core/keyboard_nav/ast_node.js +++ b/core/keyboard_nav/ast_node.js @@ -132,7 +132,7 @@ Blockly.ASTNode.createFieldNode = function(field) { * @return {Blockly.ASTNode} An AST node pointing to a connection. */ Blockly.ASTNode.createConnectionNode = function(connection) { - if (!connection){ + if (!connection) { return null; } if (connection.type === Blockly.INPUT_VALUE) { @@ -209,7 +209,7 @@ Blockly.ASTNode.createWorkspaceNode = function(workspace, wsCoordinate) { * @param {Object} params The user specified parameters. * @private */ -Blockly.ASTNode.prototype.processParams_ = function(params){ +Blockly.ASTNode.prototype.processParams_ = function(params) { if (!params) { return; } @@ -608,8 +608,8 @@ Blockly.ASTNode.prototype.in = function() { return Blockly.ASTNode.createConnectionNode(targetConnection); } break; - } + return null; }; @@ -682,9 +682,8 @@ Blockly.ASTNode.prototype.out = function() { var target = this.location_.targetConnection; if (target) { return Blockly.ASTNode.createConnectionNode(target); - } else { - return Blockly.ASTNode.createStackNode(this.location_.getSourceBlock()); } + return Blockly.ASTNode.createStackNode(this.location_.getSourceBlock()); case Blockly.ASTNode.types.FIELD: return Blockly.ASTNode.createBlockNode(this.location_.getSourceBlock()); diff --git a/core/options.js b/core/options.js index d584ae86d..ecd5497d0 100644 --- a/core/options.js +++ b/core/options.js @@ -219,22 +219,22 @@ Blockly.Options.parseZoomOptions_ = function(options) { if (zoom['startScale'] === undefined) { zoomOptions.startScale = 1; } else { - zoomOptions.startScale = parseFloat(zoom['startScale']); + zoomOptions.startScale = Number(zoom['startScale']); } if (zoom['maxScale'] === undefined) { zoomOptions.maxScale = 3; } else { - zoomOptions.maxScale = parseFloat(zoom['maxScale']); + zoomOptions.maxScale = Number(zoom['maxScale']); } if (zoom['minScale'] === undefined) { zoomOptions.minScale = 0.3; } else { - zoomOptions.minScale = parseFloat(zoom['minScale']); + zoomOptions.minScale = Number(zoom['minScale']); } if (zoom['scaleSpeed'] === undefined) { zoomOptions.scaleSpeed = 1.2; } else { - zoomOptions.scaleSpeed = parseFloat(zoom['scaleSpeed']); + zoomOptions.scaleSpeed = Number(zoom['scaleSpeed']); } return zoomOptions; }; @@ -250,9 +250,9 @@ Blockly.Options.parseZoomOptions_ = function(options) { Blockly.Options.parseGridOptions_ = function(options) { var grid = options['grid'] || {}; var gridOptions = {}; - gridOptions.spacing = parseFloat(grid['spacing']) || 0; + gridOptions.spacing = Number(grid['spacing']) || 0; gridOptions.colour = grid['colour'] || '#888'; - gridOptions.length = parseFloat(grid['length']) || 1; + gridOptions.length = Number(grid['length']) || 1; gridOptions.snap = gridOptions.spacing > 0 && !!grid['snap']; return gridOptions; }; diff --git a/core/renderers/block_rendering_rewrite/block_render_info.js b/core/renderers/block_rendering_rewrite/block_render_info.js index 11920b7a9..9859e2e62 100644 --- a/core/renderers/block_rendering_rewrite/block_render_info.js +++ b/core/renderers/block_rendering_rewrite/block_render_info.js @@ -357,7 +357,7 @@ Blockly.blockRendering.RenderInfo.prototype.getInRowSpacing_ = function(prev, ne if (prev.isIcon()) { return (Blockly.blockRendering.constants.LARGE_PADDING * 2) + 1; } - if (prev.isHat()){ + if (prev.isHat()) { return Blockly.blockRendering.constants.NO_PADDING; } // Establish a minimum width for a block with a previous or next connection. @@ -442,7 +442,7 @@ Blockly.blockRendering.RenderInfo.prototype.getInRowSpacing_ = function(prev, ne } // Spacing between a rounded corner and a previous or next connection. - if (prev.isRoundedCorner()){ + if (prev.isRoundedCorner()) { if (next.isPreviousConnection()) { return Blockly.blockRendering.constants.NOTCH_OFFSET_ROUNDED_CORNER_PREV; } else if (next.isNextConnection()) { diff --git a/core/utils.js b/core/utils.js index a3a5bb97a..dfbdec90a 100644 --- a/core/utils.js +++ b/core/utils.js @@ -85,9 +85,9 @@ Blockly.utils.getRelativeXY = function(element) { var transform = element.getAttribute('transform'); var r = transform && transform.match(Blockly.utils.getRelativeXY.XY_REGEX_); if (r) { - xy.x += parseFloat(r[1]); + xy.x += Number(r[1]); if (r[3]) { - xy.y += parseFloat(r[3]); + xy.y += Number(r[3]); } } @@ -97,9 +97,9 @@ Blockly.utils.getRelativeXY = function(element) { var styleComponents = style.match(Blockly.utils.getRelativeXY.XY_STYLE_REGEX_); if (styleComponents) { - xy.x += parseFloat(styleComponents[1]); + xy.x += Number(styleComponents[1]); if (styleComponents[3]) { - xy.y += parseFloat(styleComponents[3]); + xy.y += Number(styleComponents[3]); } } } diff --git a/core/ws_comment_events.js b/core/ws_comment_events.js index 953f1a7d3..70ca6d0cd 100644 --- a/core/ws_comment_events.js +++ b/core/ws_comment_events.js @@ -345,8 +345,8 @@ Blockly.Events.CommentMove.prototype.type = Blockly.Events.COMMENT_MOVE; /** * Override the location before the move. Use this if you don't create the * event until the end of the move, but you know the original location. - * @param {!Blockly.utils.Coordinate} xy The location before the move, in workspace - * coordinates. + * @param {!Blockly.utils.Coordinate} xy The location before the move, + * in workspace coordinates. */ Blockly.Events.CommentMove.prototype.setOldCoordinate = function(xy) { this.oldCoordinate_ = xy; @@ -376,7 +376,7 @@ Blockly.Events.CommentMove.prototype.fromJson = function(json) { if (json['newCoordinate']) { var xy = json['newCoordinate'].split(','); this.newCoordinate_ = - new Blockly.utils.Coordinate(parseFloat(xy[0]), parseFloat(xy[1])); + new Blockly.utils.Coordinate(Number(xy[0]), Number(xy[1])); } }; @@ -385,7 +385,8 @@ Blockly.Events.CommentMove.prototype.fromJson = function(json) { * @return {boolean} False if something changed. */ Blockly.Events.CommentMove.prototype.isNull = function() { - return Blockly.utils.Coordinate.equals(this.oldCoordinate_, this.newCoordinate_); + return Blockly.utils.Coordinate.equals(this.oldCoordinate_, + this.newCoordinate_); }; /** diff --git a/demos/blockfactory/block_exporter_controller.js b/demos/blockfactory/block_exporter_controller.js index 6ae094f6e..aac4a93c4 100644 --- a/demos/blockfactory/block_exporter_controller.js +++ b/demos/blockfactory/block_exporter_controller.js @@ -253,8 +253,8 @@ BlockExporterController.prototype.selectUsedBlocks = function() { } this.view.listSelectedBlocks(); - if (unstoredCustomBlockTypes.length > 0){ - // Warn user to import block defifnitions and generator code for blocks + if (unstoredCustomBlockTypes.length > 0) { + // Warn user to import block definitions and generator code for blocks // not in their Block Library nor Blockly's standard library. var blockTypesText = unstoredCustomBlockTypes.join(', '); var customWarning = 'Custom blocks used in workspace factory but not ' + diff --git a/demos/blockfactory/factory.css b/demos/blockfactory/factory.css index e4b6ec258..10afa4dcf 100644 --- a/demos/blockfactory/factory.css +++ b/demos/blockfactory/factory.css @@ -335,7 +335,7 @@ button, .buttonStyle { padding: 5px 19px; } -.tab:hover:not(.tabon){ +.tab:hover:not(.tabon) { background-color: #e8e8e8; } diff --git a/demos/blockfactory/factory_utils.js b/demos/blockfactory/factory_utils.js index ee1b32807..b02bfa034 100644 --- a/demos/blockfactory/factory_utils.js +++ b/demos/blockfactory/factory_utils.js @@ -443,7 +443,7 @@ FactoryUtils.getFieldsJs_ = function(block) { case 'field_angle': // Result: new Blockly.FieldAngle(90), 'ANGLE' fields.push('new Blockly.FieldAngle(' + - parseFloat(block.getFieldValue('ANGLE')) + '), ' + + Number(block.getFieldValue('ANGLE')) + '), ' + JSON.stringify(block.getFieldValue('FIELDNAME'))); break; case 'field_checkbox': @@ -536,17 +536,17 @@ FactoryUtils.getFieldsJson_ = function(block) { var obj = { type: block.type, name: block.getFieldValue('FIELDNAME'), - value: parseFloat(block.getFieldValue('VALUE')) + value: Number(block.getFieldValue('VALUE')) }; - var min = parseFloat(block.getFieldValue('MIN')); + var min = Number(block.getFieldValue('MIN')); if (min > -Infinity) { obj.min = min; } - var max = parseFloat(block.getFieldValue('MAX')); + var max = Number(block.getFieldValue('MAX')); if (max < Infinity) { obj.max = max; } - var precision = parseFloat(block.getFieldValue('PRECISION')); + var precision = Number(block.getFieldValue('PRECISION')); if (precision) { obj.precision = precision; } @@ -902,9 +902,9 @@ FactoryUtils.defineAndGetBlockTypes = function(blockDefsString, format) { FactoryUtils.injectCode = function(code, id) { var pre = document.getElementById(id); pre.textContent = code; - code = pre.textContent; - code = PR.prettyPrintOne(code, 'js'); - pre.innerHTML = code; + // Remove the 'prettyprinted' class, so that Prettify will recalculate. + pre.className = pre.className.replace('prettyprinted', ''); + PR.prettyPrint(); }; /** diff --git a/demos/blockfactory/index.html b/demos/blockfactory/index.html index 868d20542..0c1fc87b9 100644 --- a/demos/blockfactory/index.html +++ b/demos/blockfactory/index.html @@ -124,11 +124,11 @@

Export Preview

Block Definitions:

-

+        

       

Generator Stubs:

-

+        

       
@@ -378,7 +378,7 @@ -

+              

               
             
           
@@ -397,7 +397,7 @@
           
           
             
-              

+              

             
           
         
diff --git a/demos/blockfactory/workspacefactory/wfactory_controller.js b/demos/blockfactory/workspacefactory/wfactory_controller.js
index 67b656e4d..578d0a964 100644
--- a/demos/blockfactory/workspacefactory/wfactory_controller.js
+++ b/demos/blockfactory/workspacefactory/wfactory_controller.js
@@ -1179,19 +1179,19 @@ WorkspaceFactoryController.prototype.readOptions_ = function() {
     var startScaleValue =
         document.getElementById('zoomOption_startScale_number').value;
     zoom['startScale'] = typeof startScaleValue == 'string' ?
-        parseFloat(startScaleValue) : startScaleValue;
+        Number(startScaleValue) : startScaleValue;
     var maxScaleValue =
         document.getElementById('zoomOption_maxScale_number').value;
     zoom['maxScale'] = typeof maxScaleValue == 'string' ?
-        parseFloat(maxScaleValue) : maxScaleValue;
+        Number(maxScaleValue) : maxScaleValue;
     var minScaleValue =
         document.getElementById('zoomOption_minScale_number').value;
     zoom['minScale'] = typeof minScaleValue == 'string' ?
-        parseFloat(minScaleValue) : minScaleValue;
+        Number(minScaleValue) : minScaleValue;
     var scaleSpeedValue =
         document.getElementById('zoomOption_scaleSpeed_number').value;
     zoom['scaleSpeed'] = typeof scaleSpeedValue == 'string' ?
-        parseFloat(scaleSpeedValue) : scaleSpeedValue;
+        Number(scaleSpeedValue) : scaleSpeedValue;
     optionsObj['zoom'] = zoom;
   }
 
diff --git a/demos/blockfactory_old/factory.js b/demos/blockfactory_old/factory.js
index 338349f8a..28e508b95 100644
--- a/demos/blockfactory_old/factory.js
+++ b/demos/blockfactory_old/factory.js
@@ -416,17 +416,17 @@ function getFieldsJson_(block) {
           var obj = {
             type: block.type,
             name: block.getFieldValue('FIELDNAME'),
-            value: parseFloat(block.getFieldValue('VALUE'))
+            value: Number(block.getFieldValue('VALUE'))
           };
-          var min = parseFloat(block.getFieldValue('MIN'));
+          var min = Number(block.getFieldValue('MIN'));
           if (min > -Infinity) {
             obj.min = min;
           }
-          var max = parseFloat(block.getFieldValue('MAX'));
+          var max = Number(block.getFieldValue('MAX'));
           if (max < Infinity) {
             obj.max = max;
           }
-          var precision = parseFloat(block.getFieldValue('PRECISION'));
+          var precision = Number(block.getFieldValue('PRECISION'));
           if (precision) {
             obj.precision = precision;
           }
@@ -748,9 +748,9 @@ function updatePreview() {
 function injectCode(code, id) {
   var pre = document.getElementById(id);
   pre.textContent = code;
-  code = pre.textContent;
-  code = PR.prettyPrintOne(code, 'js');
-  pre.innerHTML = code;
+  // Remove the 'prettyprinted' class, so that Prettify will recalculate.
+  pre.className = pre.className.replace('prettyprinted', '');
+  PR.prettyPrint();
 }
 
 /**
diff --git a/demos/blockfactory_old/index.html b/demos/blockfactory_old/index.html
index 98029d48a..a3d733735 100644
--- a/demos/blockfactory_old/index.html
+++ b/demos/blockfactory_old/index.html
@@ -148,7 +148,7 @@
           
           
             
-              

+              

               
             
           
@@ -167,7 +167,7 @@
           
           
             
-              

+              

             
           
         
diff --git a/generators/dart/loops.js b/generators/dart/loops.js
index 617768ce6..12e5e3dc4 100644
--- a/generators/dart/loops.js
+++ b/generators/dart/loops.js
@@ -89,11 +89,11 @@ Blockly.Dart['controls_for'] = function(block) {
   if (Blockly.isNumber(argument0) && Blockly.isNumber(argument1) &&
       Blockly.isNumber(increment)) {
     // All arguments are simple numbers.
-    var up = parseFloat(argument0) <= parseFloat(argument1);
+    var up = Number(argument0) <= Number(argument1);
     code = 'for (' + variable0 + ' = ' + argument0 + '; ' +
         variable0 + (up ? ' <= ' : ' >= ') + argument1 + '; ' +
         variable0;
-    var step = Math.abs(parseFloat(increment));
+    var step = Math.abs(Number(increment));
     if (step == 1) {
       code += up ? '++' : '--';
     } else {
diff --git a/generators/dart/math.js b/generators/dart/math.js
index a79e2ddb6..c26cf791f 100644
--- a/generators/dart/math.js
+++ b/generators/dart/math.js
@@ -33,7 +33,7 @@ Blockly.Dart.addReservedWords('Math');
 
 Blockly.Dart['math_number'] = function(block) {
   // Numeric value.
-  var code = parseFloat(block.getFieldValue('NUM'));
+  var code = Number(block.getFieldValue('NUM'));
   var order;
   if (code == Infinity) {
     code = 'double.infinity';
diff --git a/generators/javascript.js b/generators/javascript.js
index 9d20ca974..f78e6aaf7 100644
--- a/generators/javascript.js
+++ b/generators/javascript.js
@@ -103,7 +103,7 @@ Blockly.JavaScript.ORDER_LOGICAL_AND = 13;     // &&
 Blockly.JavaScript.ORDER_LOGICAL_OR = 14;      // ||
 Blockly.JavaScript.ORDER_CONDITIONAL = 15;     // ?:
 Blockly.JavaScript.ORDER_ASSIGNMENT = 16;      // = += -= **= *= /= %= <<= >>= ...
-Blockly.JavaScript.ORDER_YIELD = 17;         // yield
+Blockly.JavaScript.ORDER_YIELD = 17;           // yield
 Blockly.JavaScript.ORDER_COMMA = 18;           // ,
 Blockly.JavaScript.ORDER_NONE = 99;            // (...)
 
@@ -304,7 +304,7 @@ Blockly.JavaScript.getAdjusted = function(block, atId, opt_delta, opt_negate,
 
   if (Blockly.isNumber(at)) {
     // If the index is a naked number, adjust it right now.
-    at = parseFloat(at) + delta;
+    at = Number(at) + delta;
     if (opt_negate) {
       at = -at;
     }
diff --git a/generators/javascript/lists.js b/generators/javascript/lists.js
index 45430162c..2dc538993 100644
--- a/generators/javascript/lists.js
+++ b/generators/javascript/lists.js
@@ -354,7 +354,7 @@ Blockly.JavaScript['lists_sort'] = function(block) {
           '(type, direction) {',
        '  var compareFuncs = {',
        '    "NUMERIC": function(a, b) {',
-       '        return parseFloat(a) - parseFloat(b); },',
+       '        return Number(a) - Number(b); },',
        '    "TEXT": function(a, b) {',
        '        return a.toString() > b.toString() ? 1 : -1; },',
        '    "IGNORE_CASE": function(a, b) {',
diff --git a/generators/javascript/loops.js b/generators/javascript/loops.js
index 79dda13c1..f49323c18 100644
--- a/generators/javascript/loops.js
+++ b/generators/javascript/loops.js
@@ -90,11 +90,11 @@ Blockly.JavaScript['controls_for'] = function(block) {
   if (Blockly.isNumber(argument0) && Blockly.isNumber(argument1) &&
       Blockly.isNumber(increment)) {
     // All arguments are simple numbers.
-    var up = parseFloat(argument0) <= parseFloat(argument1);
+    var up = Number(argument0) <= Number(argument1);
     code = 'for (' + variable0 + ' = ' + argument0 + '; ' +
         variable0 + (up ? ' <= ' : ' >= ') + argument1 + '; ' +
         variable0;
-    var step = Math.abs(parseFloat(increment));
+    var step = Math.abs(Number(increment));
     if (step == 1) {
       code += up ? '++' : '--';
     } else {
diff --git a/generators/javascript/math.js b/generators/javascript/math.js
index fa7d7714b..7137a39ac 100644
--- a/generators/javascript/math.js
+++ b/generators/javascript/math.js
@@ -31,7 +31,7 @@ goog.require('Blockly.JavaScript');
 
 Blockly.JavaScript['math_number'] = function(block) {
   // Numeric value.
-  var code = parseFloat(block.getFieldValue('NUM'));
+  var code = Number(block.getFieldValue('NUM'));
   var order = code >= 0 ? Blockly.JavaScript.ORDER_ATOMIC :
               Blockly.JavaScript.ORDER_UNARY_NEGATION;
   return [code, order];
diff --git a/generators/javascript/text.js b/generators/javascript/text.js
index 32ced3fb1..fbada57e4 100644
--- a/generators/javascript/text.js
+++ b/generators/javascript/text.js
@@ -316,7 +316,7 @@ Blockly.JavaScript['text_prompt_ext'] = function(block) {
   var code = 'window.prompt(' + msg + ')';
   var toNumber = block.getFieldValue('TYPE') == 'NUMBER';
   if (toNumber) {
-    code = 'parseFloat(' + code + ')';
+    code = 'Number(' + code + ')';
   }
   return [code, Blockly.JavaScript.ORDER_FUNCTION_CALL];
 };
diff --git a/generators/lua/loops.js b/generators/lua/loops.js
index d229a9402..8b64bd004 100644
--- a/generators/lua/loops.js
+++ b/generators/lua/loops.js
@@ -116,8 +116,8 @@ Blockly.Lua['controls_for'] = function(block) {
   if (Blockly.isNumber(startVar) && Blockly.isNumber(endVar) &&
       Blockly.isNumber(increment)) {
     // All arguments are simple numbers.
-    var up = parseFloat(startVar) <= parseFloat(endVar);
-    var step = Math.abs(parseFloat(increment));
+    var up = Number(startVar) <= Number(endVar);
+    var step = Math.abs(Number(increment));
     incValue = (up ? '' : '-') + step;
   } else {
     code = '';
diff --git a/generators/lua/math.js b/generators/lua/math.js
index a105371e5..bc80d1597 100644
--- a/generators/lua/math.js
+++ b/generators/lua/math.js
@@ -31,7 +31,7 @@ goog.require('Blockly.Lua');
 
 Blockly.Lua['math_number'] = function(block) {
   // Numeric value.
-  var code = parseFloat(block.getFieldValue('NUM'));
+  var code = Number(block.getFieldValue('NUM'));
   var order = code < 0 ? Blockly.Lua.ORDER_UNARY :
               Blockly.Lua.ORDER_ATOMIC;
   return [code, order];
@@ -434,4 +434,4 @@ Blockly.Lua['math_atan2'] = function(block) {
       Blockly.Lua.ORDER_NONE) || '0';
   return ['math.deg(math.atan2(' + argument1 + ', ' + argument0 + '))',
       Blockly.Lua.ORDER_HIGH];
-};
\ No newline at end of file
+};
diff --git a/generators/php.js b/generators/php.js
index 0c926e90b..84a7bc755 100644
--- a/generators/php.js
+++ b/generators/php.js
@@ -285,7 +285,7 @@ Blockly.PHP.getAdjusted = function(block, atId, opt_delta, opt_negate,
 
   if (Blockly.isNumber(at)) {
     // If the index is a naked number, adjust it right now.
-    at = parseFloat(at) + delta;
+    at = Number(at) + delta;
     if (opt_negate) {
       at = -at;
     }
diff --git a/generators/php/lists.js b/generators/php/lists.js
index 47262d6a5..d82cfa314 100644
--- a/generators/php/lists.js
+++ b/generators/php/lists.js
@@ -430,7 +430,7 @@ Blockly.PHP['lists_getSublist'] = function(block) {
          '    $at1 = count($list) - 1 - $at1;',
          '  } else if ($where1 == \'FIRST\') {',
          '    $at1 = 0;',
-         '  } else if ($where1 != \'FROM_START\'){',
+         '  } else if ($where1 != \'FROM_START\') {',
          '    throw new Exception(\'Unhandled option (lists_get_sublist).\');',
          '  }',
          '  $length = 0;',
diff --git a/generators/php/loops.js b/generators/php/loops.js
index 09d54de0a..c311d27c9 100644
--- a/generators/php/loops.js
+++ b/generators/php/loops.js
@@ -89,11 +89,11 @@ Blockly.PHP['controls_for'] = function(block) {
   if (Blockly.isNumber(argument0) && Blockly.isNumber(argument1) &&
       Blockly.isNumber(increment)) {
     // All arguments are simple numbers.
-    var up = parseFloat(argument0) <= parseFloat(argument1);
+    var up = Number(argument0) <= Number(argument1);
     code = 'for (' + variable0 + ' = ' + argument0 + '; ' +
         variable0 + (up ? ' <= ' : ' >= ') + argument1 + '; ' +
         variable0;
-    var step = Math.abs(parseFloat(increment));
+    var step = Math.abs(Number(increment));
     if (step == 1) {
       code += up ? '++' : '--';
     } else {
diff --git a/generators/php/math.js b/generators/php/math.js
index 478faa8c6..a9478e73e 100644
--- a/generators/php/math.js
+++ b/generators/php/math.js
@@ -31,7 +31,7 @@ goog.require('Blockly.PHP');
 
 Blockly.PHP['math_number'] = function(block) {
   // Numeric value.
-  var code = parseFloat(block.getFieldValue('NUM'));
+  var code = Number(block.getFieldValue('NUM'));
   var order = code >= 0 ? Blockly.PHP.ORDER_ATOMIC :
               Blockly.PHP.ORDER_UNARY_NEGATION;
   if (code == Infinity) {
diff --git a/generators/php/text.js b/generators/php/text.js
index db50094c4..469ec28fe 100644
--- a/generators/php/text.js
+++ b/generators/php/text.js
@@ -174,7 +174,7 @@ Blockly.PHP['text_getSubstring'] = function(block) {
          '    $at1 = strlen($text) - 1 - $at1;',
          '  } else if ($where1 == \'FIRST\') {',
          '    $at1 = 0;',
-         '  } else if ($where1 != \'FROM_START\'){',
+         '  } else if ($where1 != \'FROM_START\') {',
          '    throw new Exception(\'Unhandled option (text_get_substring).\');',
          '  }',
          '  $length = 0;',
diff --git a/generators/python/loops.js b/generators/python/loops.js
index 4e331f089..bcbccfaf6 100644
--- a/generators/python/loops.js
+++ b/generators/python/loops.js
@@ -113,9 +113,9 @@ Blockly.Python['controls_for'] = function(block) {
   if (Blockly.isNumber(argument0) && Blockly.isNumber(argument1) &&
       Blockly.isNumber(increment)) {
     // All parameters are simple numbers.
-    argument0 = parseFloat(argument0);
-    argument1 = parseFloat(argument1);
-    increment = Math.abs(parseFloat(increment));
+    argument0 = Number(argument0);
+    argument1 = Number(argument1);
+    increment = Math.abs(Number(increment));
     if (argument0 % 1 === 0 && argument1 % 1 === 0 && increment % 1 === 0) {
       // All parameters are integers.
       if (argument0 <= argument1) {
@@ -151,7 +151,7 @@ Blockly.Python['controls_for'] = function(block) {
     var scrub = function(arg, suffix) {
       if (Blockly.isNumber(arg)) {
         // Simple number.
-        arg = parseFloat(arg);
+        arg = Number(arg);
       } else if (arg.match(/^\w+$/)) {
         // Variable.
         arg = 'float(' + arg + ')';
diff --git a/generators/python/math.js b/generators/python/math.js
index 11e8466e2..c2d49d735 100644
--- a/generators/python/math.js
+++ b/generators/python/math.js
@@ -34,7 +34,7 @@ Blockly.Python.addReservedWords('math,random,Number');
 
 Blockly.Python['math_number'] = function(block) {
   // Numeric value.
-  var code = parseFloat(block.getFieldValue('NUM'));
+  var code = Number(block.getFieldValue('NUM'));
   var order;
   if (code == Infinity) {
     code = 'float("inf")';
diff --git a/tests/generators/golden/generated.js b/tests/generators/golden/generated.js
index f59298f40..a24dd0bdd 100644
--- a/tests/generators/golden/generated.js
+++ b/tests/generators/golden/generated.js
@@ -1440,7 +1440,7 @@ function test_split() {
 function listsGetSortCompare(type, direction) {
   var compareFuncs = {
     "NUMERIC": function(a, b) {
-        return parseFloat(a) - parseFloat(b); },
+        return Number(a) - Number(b); },
     "TEXT": function(a, b) {
         return a.toString() > b.toString() ? 1 : -1; },
     "IGNORE_CASE": function(a, b) {
diff --git a/tests/generators/golden/generated.php b/tests/generators/golden/generated.php
index 0cd270bf6..a2d470de4 100644
--- a/tests/generators/golden/generated.php
+++ b/tests/generators/golden/generated.php
@@ -778,7 +778,7 @@ function text_get_substring($text, $where1, $at1, $where2, $at2) {
     $at1 = strlen($text) - 1 - $at1;
   } else if ($where1 == 'FIRST') {
     $at1 = 0;
-  } else if ($where1 != 'FROM_START'){
+  } else if ($where1 != 'FROM_START') {
     throw new Exception('Unhandled option (text_get_substring).');
   }
   $length = 0;
@@ -1296,7 +1296,7 @@ function lists_get_sublist($list, $where1, $at1, $where2, $at2) {
     $at1 = count($list) - 1 - $at1;
   } else if ($where1 == 'FIRST') {
     $at1 = 0;
-  } else if ($where1 != 'FROM_START'){
+  } else if ($where1 != 'FROM_START') {
     throw new Exception('Unhandled option (lists_get_sublist).');
   }
   $length = 0;
diff --git a/tests/generators/unittest_dart.js b/tests/generators/unittest_dart.js
index 28b14e670..cf87e1d79 100644
--- a/tests/generators/unittest_dart.js
+++ b/tests/generators/unittest_dart.js
@@ -166,7 +166,7 @@ Blockly.Dart['unittest_adjustindex'] = function(block) {
   if (block.workspace.options.oneBasedIndex) {
     if (Blockly.isNumber(index)) {
       // If the index is a naked number, adjust it right now.
-      return [parseFloat(index) + 1, Blockly.Dart.ORDER_ATOMIC];
+      return [Number(index) + 1, Blockly.Dart.ORDER_ATOMIC];
     } else {
       // If the index is dynamic, adjust it in code.
       index = index + ' + 1';
diff --git a/tests/generators/unittest_javascript.js b/tests/generators/unittest_javascript.js
index e483be1b8..2afac9d45 100644
--- a/tests/generators/unittest_javascript.js
+++ b/tests/generators/unittest_javascript.js
@@ -170,7 +170,7 @@ Blockly.JavaScript['unittest_adjustindex'] = function(block) {
   if (block.workspace.options.oneBasedIndex) {
     if (Blockly.isNumber(index)) {
       // If the index is a naked number, adjust it right now.
-      return [parseFloat(index) + 1, Blockly.JavaScript.ORDER_ATOMIC];
+      return [Number(index) + 1, Blockly.JavaScript.ORDER_ATOMIC];
     } else {
       // If the index is dynamic, adjust it in code.
       index = index + ' + 1';
diff --git a/tests/generators/unittest_lua.js b/tests/generators/unittest_lua.js
index 1d0860bdc..bdeba49a1 100644
--- a/tests/generators/unittest_lua.js
+++ b/tests/generators/unittest_lua.js
@@ -173,7 +173,7 @@ Blockly.Lua['unittest_adjustindex'] = function(block) {
       Blockly.Lua.ORDER_ADDITIVE) || '0';
   if (Blockly.isNumber(index)) {
     // If the index is a naked number, adjust it right now.
-    return [parseFloat(index) + 1, Blockly.Lua.ORDER_ATOMIC];
+    return [Number(index) + 1, Blockly.Lua.ORDER_ATOMIC];
   }
   // If the index is dynamic, adjust it in code.
   return [index + ' + 1', Blockly.Lua.ORDER_ATOMIC];
diff --git a/tests/generators/unittest_php.js b/tests/generators/unittest_php.js
index 4d030ea83..b2f499bda 100644
--- a/tests/generators/unittest_php.js
+++ b/tests/generators/unittest_php.js
@@ -157,7 +157,7 @@ Blockly.PHP['unittest_adjustindex'] = function(block) {
   if (block.workspace.options.oneBasedIndex) {
     if (Blockly.isNumber(index)) {
       // If the index is a naked number, adjust it right now.
-      return [parseFloat(index) + 1, Blockly.PHP.ORDER_ATOMIC];
+      return [Number(index) + 1, Blockly.PHP.ORDER_ATOMIC];
     } else {
       // If the index is dynamic, adjust it in code.
       index = index + ' + 1';
diff --git a/tests/generators/unittest_python.js b/tests/generators/unittest_python.js
index 70f6773e1..637be2830 100644
--- a/tests/generators/unittest_python.js
+++ b/tests/generators/unittest_python.js
@@ -141,7 +141,7 @@ Blockly.Python['unittest_adjustindex'] = function(block) {
   if (block.workspace.options.oneBasedIndex) {
     if (Blockly.isNumber(index)) {
       // If the index is a naked number, adjust it right now.
-      return [parseFloat(index) + 1, Blockly.Python.ORDER_ATOMIC];
+      return [Number(index) + 1, Blockly.Python.ORDER_ATOMIC];
     } else {
       // If the index is dynamic, adjust it in code.
       index = index + ' + 1';
diff --git a/tests/mocha/field_angle_test.js b/tests/mocha/field_angle_test.js
index fee8f813e..d86a6b365 100644
--- a/tests/mocha/field_angle_test.js
+++ b/tests/mocha/field_angle_test.js
@@ -24,7 +24,7 @@ suite('Angle Fields', function() {
     var actualText = angleField.getText();
     opt_expectedText = opt_expectedText || String(expectedValue);
     assertEquals(String(actualValue), String(expectedValue));
-    assertEquals(parseFloat(actualValue), expectedValue);
+    assertEquals(Number(actualValue), expectedValue);
     assertEquals(actualText, opt_expectedText);
   }
   function assertValueDefault(angleField) {
@@ -35,10 +35,6 @@ suite('Angle Fields', function() {
       var angleField = new Blockly.FieldAngle();
       assertValueDefault(angleField);
     });
-    test('Null', function() {
-      var angleField = new Blockly.FieldAngle(null);
-      assertValueDefault(angleField);
-    });
     test('Undefined', function() {
       var angleField = new Blockly.FieldAngle(undefined);
       assertValueDefault(angleField);
@@ -71,16 +67,20 @@ suite('Angle Fields', function() {
       var angleField = new Blockly.FieldAngle(362);
       assertValue(angleField, 2);
     });
+    test('Infinity', function() {
+      var angleField = new Blockly.FieldAngle(Infinity);
+      assertValueDefault(angleField);
+    });
+    test('Negative Infinity String', function() {
+      var angleField = new Blockly.FieldAngle('-Infinity');
+      assertValueDefault(angleField);
+    });
   });
   suite('fromJson', function() {
     test('Empty', function() {
       var angleField = Blockly.FieldAngle.fromJson({});
       assertValueDefault(angleField);
     });
-    test('Null', function() {
-      var angleField = Blockly.FieldAngle.fromJson({ angle:null });
-      assertValueDefault(angleField);
-    });
     test('Undefined', function() {
       var angleField = Blockly.FieldAngle.fromJson({ angle:undefined });
       assertValueDefault(angleField);
@@ -113,6 +113,14 @@ suite('Angle Fields', function() {
       var angleField = Blockly.FieldAngle.fromJson({ angle:362 });
       assertValue(angleField, 2);
     });
+    test('Infinity', function() {
+      var angleField = Blockly.FieldAngle.fromJson({ angle:Infinity });
+      assertValueDefault(angleField);
+    });
+    test('Negative Infinity String', function() {
+      var angleField = Blockly.FieldAngle.fromJson({ angle:'-Infinity' });
+      assertValueDefault(angleField);
+    });
   });
   suite('setValue', function() {
     suite('Empty -> New Value', function() {
@@ -155,6 +163,14 @@ suite('Angle Fields', function() {
         this.angleField.setValue(362);
         assertValue(this.angleField, 2);
       });
+      test('Infinity', function() {
+        this.angleField.setValue(Infinity);
+        assertValueDefault(this.angleField);
+      });
+      test('Negative Infinity String', function() {
+        this.angleField.setValue('-Infinity');
+        assertValueDefault(this.angleField);
+      });
     });
     suite('Value -> New Value', function() {
       setup(function() {
@@ -196,6 +212,14 @@ suite('Angle Fields', function() {
         this.angleField.setValue(362);
         assertValue(this.angleField, 2);
       });
+      test('Infinity', function() {
+        this.angleField.setValue(Infinity);
+        assertValue(this.angleField, 1);
+      });
+      test('Negative Infinity String', function() {
+        this.angleField.setValue('-Infinity');
+        assertValue(this.angleField, 1);
+      });
     });
   });
   suite('Validators', function() {
diff --git a/tests/mocha/field_checkbox_test.js b/tests/mocha/field_checkbox_test.js
index dc55e2b3b..8ef2f322d 100644
--- a/tests/mocha/field_checkbox_test.js
+++ b/tests/mocha/field_checkbox_test.js
@@ -29,8 +29,8 @@ suite('Checkbox Fields', function() {
     assertValue(checkboxField, 'FALSE', 'false');
   }
   suite('Constructor', function() {
-    test('Null', function() {
-      var checkboxField = new Blockly.FieldCheckbox(null);
+    test('Empty', function() {
+      var checkboxField = new Blockly.FieldCheckbox();
       assertValueDefault(checkboxField);
     });
     test('Undefined', function() {
@@ -59,8 +59,8 @@ suite('Checkbox Fields', function() {
     });
   });
   suite('fromJson', function() {
-    test('Null', function() {
-      var checkboxField = Blockly.FieldCheckbox.fromJson({ checked: null});
+    test('Empty', function() {
+      var checkboxField = Blockly.FieldCheckbox.fromJson({});
       assertValueDefault(checkboxField);
     });
     test('Undefined', function() {
diff --git a/tests/mocha/field_colour_test.js b/tests/mocha/field_colour_test.js
index 39ef4c631..28d5cc43f 100644
--- a/tests/mocha/field_colour_test.js
+++ b/tests/mocha/field_colour_test.js
@@ -49,10 +49,6 @@ suite('Colour Fields', function() {
       var colourField = new Blockly.FieldColour();
       assertValueDefault(colourField);
     });
-    test('Null', function() {
-      var colourField = new Blockly.FieldColour(null);
-      assertValueDefault(colourField);
-    });
     test('Undefined', function() {
       var colourField = new Blockly.FieldColour(undefined);
       assertValueDefault(colourField);
@@ -107,10 +103,6 @@ suite('Colour Fields', function() {
       var colourField = new Blockly.FieldColour.fromJson({});
       assertValueDefault(colourField);
     });
-    test('Null', function() {
-      var colourField = new Blockly.FieldColour.fromJson({ colour:null });
-      assertValueDefault(colourField);
-    });
     test('Undefined', function() {
       var colourField = new Blockly.FieldColour.fromJson({ colour:undefined });
       assertValueDefault(colourField);
diff --git a/tests/mocha/field_date_test.js b/tests/mocha/field_date_test.js
index 05620e95b..6945882c8 100644
--- a/tests/mocha/field_date_test.js
+++ b/tests/mocha/field_date_test.js
@@ -34,10 +34,6 @@ suite('Date Fields', function() {
       var dateField = new Blockly.FieldDate();
       assertValueDefault(dateField);
     });
-    test('Null', function() {
-      var dateField = new Blockly.FieldDate(null);
-      assertValueDefault(dateField);
-    });
     test('Undefined', function() {
       var dateField = new Blockly.FieldDate(undefined);
       assertValueDefault(dateField);
@@ -64,10 +60,6 @@ suite('Date Fields', function() {
       var dateField = Blockly.FieldDate.fromJson({});
       assertValueDefault(dateField);
     });
-    test('Null', function() {
-      var dateField = Blockly.FieldDate.fromJson({ date: null });
-      assertValueDefault(dateField);
-    });
     test('Undefined', function() {
       var dateField = Blockly.FieldDate.fromJson({ date: undefined });
       assertValueDefault(dateField);
diff --git a/tests/mocha/field_dropdown_test.js b/tests/mocha/field_dropdown_test.js
index c7499fd26..307e52edf 100644
--- a/tests/mocha/field_dropdown_test.js
+++ b/tests/mocha/field_dropdown_test.js
@@ -31,11 +31,6 @@ suite('Dropdown Fields', function() {
         new Blockly.FieldDropdown();
       });
     });
-    test('Null', function() {
-      chai.assert.throws(function() {
-        new Blockly.FieldDropdown(null);
-      });
-    });
     test('Undefined', function() {
       chai.assert.throws(function() {
         new Blockly.FieldDropdown(undefined);
@@ -102,11 +97,6 @@ suite('Dropdown Fields', function() {
         Blockly.FieldDropdown.fromJson({});
       });
     });
-    test('Null', function() {
-      chai.assert.throws(function() {
-        Blockly.FieldDropdown.fromJson({ options: null });
-      });
-    });
     test('Undefined', function() {
       chai.assert.throws(function() {
         Blockly.FieldDropdown.fromJson({ options: undefined });
diff --git a/tests/mocha/field_image_test.js b/tests/mocha/field_image_test.js
index e7a317cbe..fda439641 100644
--- a/tests/mocha/field_image_test.js
+++ b/tests/mocha/field_image_test.js
@@ -31,21 +31,11 @@ suite('Image Fields', function() {
         new Blockly.FieldImage();
       });
     });
-    test('Null Src', function() {
-      chai.assert.throws(function() {
-        new Blockly.FieldImage(null, 1, 1);
-      });
-    });
     test('Undefined Src', function() {
       chai.assert.throws(function() {
         new Blockly.FieldImage(undefined, 1, 1);
       });
     });
-    test('Null Size', function() {
-      chai.assert.throws(function() {
-        new Blockly.FieldImage('src', null, null);
-      });
-    });
     test('Undefined Size', function() {
       chai.assert.throws(function() {
         new Blockly.FieldImage('src', undefined, undefined);
@@ -79,15 +69,6 @@ suite('Image Fields', function() {
         Blockly.FieldImage.fromJson({});
       });
     });
-    test('Null Src', function() {
-      chai.assert.throws(function() {
-        Blockly.FieldImage.fromJson({
-          src: null,
-          width: 1,
-          height: 1
-        });
-      });
-    });
     test('Undefined Src', function() {
       chai.assert.throws(function() {
         Blockly.FieldImage.fromJson({
@@ -97,15 +78,6 @@ suite('Image Fields', function() {
         });
       });
     });
-    test('Null Size', function() {
-      chai.assert.throws(function() {
-        Blockly.FieldImage.fromJson({
-          src: 'src',
-          width: null,
-          height: null
-        });
-      });
-    });
     test('Undefined Size', function() {
       chai.assert.throws(function() {
         Blockly.FieldImage.fromJson({
diff --git a/tests/mocha/field_label_test.js b/tests/mocha/field_label_test.js
index 8cba0f472..8e6e53358 100644
--- a/tests/mocha/field_label_test.js
+++ b/tests/mocha/field_label_test.js
@@ -33,10 +33,6 @@ suite('Label Fields', function() {
       var labelField = new Blockly.FieldLabel();
       assertValueDefault(labelField);
     });
-    test('Null', function() {
-      var labelField = new Blockly.FieldLabel(null);
-      assertValueDefault(labelField);
-    });
     test('Undefined', function() {
       var labelField = new Blockly.FieldLabel(undefined);
       assertValueDefault(labelField);
@@ -67,10 +63,6 @@ suite('Label Fields', function() {
       var labelField = new Blockly.FieldLabel.fromJson({});
       assertValueDefault(labelField);
     });
-    test('Null', function() {
-      var labelField = new Blockly.FieldLabel.fromJson({ text:null });
-      assertValueDefault(labelField);
-    });
     test('Undefined', function() {
       var labelField = new Blockly.FieldLabel.fromJson({ text:undefined });
       assertValueDefault(labelField);
diff --git a/tests/mocha/field_number_test.js b/tests/mocha/field_number_test.js
index d78b5e29c..95ff1b3dd 100644
--- a/tests/mocha/field_number_test.js
+++ b/tests/mocha/field_number_test.js
@@ -24,7 +24,7 @@ suite('Number Fields', function() {
     var actualText = numberField.getText();
     opt_expectedText = opt_expectedText || String(expectedValue);
     assertEquals(String(actualValue), String(expectedValue));
-    assertEquals(parseFloat(actualValue), expectedValue);
+    assertEquals(Number(actualValue), expectedValue);
     assertEquals(actualText, opt_expectedText);
   }
   function assertValueDefault(numberField) {
@@ -55,10 +55,6 @@ suite('Number Fields', function() {
       var numberField = new Blockly.FieldNumber();
       assertNumberFieldDefault(numberField);
     });
-    test('Null', function() {
-      var numberField = createNumberFieldSameValuesConstructor(null);
-      assertNumberFieldDefault(numberField);
-    });
     test('Undefined', function() {
       var numberField = createNumberFieldSameValuesConstructor(undefined);
       assertNumberFieldDefault(numberField);
@@ -87,16 +83,20 @@ suite('Number Fields', function() {
       var numberField = createNumberFieldSameValuesConstructor('1.5');
       assertNumberFieldSameValues(numberField, 1.5);
     });
+    test('Infinity', function() {
+      var numberField = createNumberFieldSameValuesConstructor('Infinity');
+      assertNumberFieldSameValues(numberField, Infinity);
+    });
+    test('Negative Infinity String', function() {
+      var numberField = createNumberFieldSameValuesConstructor('-Infinity');
+      assertNumberFieldSameValues(numberField, -Infinity);
+    });
   });
   suite('fromJson', function() {
     test('Empty', function() {
       var numberField = Blockly.FieldNumber.fromJson({});
       assertNumberFieldDefault(numberField);
     });
-    test('Null', function() {
-      var numberField = createNumberFieldSameValuesJson(null);
-      assertNumberFieldDefault(numberField);
-    });
     test('Undefined', function() {
       var numberField = createNumberFieldSameValuesJson(undefined);
       assertNumberFieldDefault(numberField);
@@ -125,6 +125,14 @@ suite('Number Fields', function() {
       var numberField = createNumberFieldSameValuesJson('1.5');
       assertNumberFieldSameValues(numberField, 1.5);
     });
+    test('Infinity', function() {
+      var numberField = createNumberFieldSameValuesJson('Infinity');
+      assertNumberFieldSameValues(numberField, Infinity);
+    });
+    test('Negative Infinity String', function() {
+      var numberField = createNumberFieldSameValuesJson('-Infinity');
+      assertNumberFieldSameValues(numberField, -Infinity);
+    });
   });
   suite('setValue', function() {
     suite('Value Types', function() {
@@ -164,6 +172,14 @@ suite('Number Fields', function() {
           this.numberField.setValue('2.5');
           assertValue(this.numberField, 2.5);
         });
+        test('Infinity', function() {
+          this.numberField.setValue(Infinity);
+          assertValue(this.numberField, Infinity);
+        });
+        test('Negative Infinity String', function() {
+          this.numberField.setValue('-Infinity');
+          assertValue(this.numberField, -Infinity);
+        });
       });
       suite('Value -> New Value', function() {
         setup(function() {
@@ -201,6 +217,14 @@ suite('Number Fields', function() {
           this.numberField.setValue('2.5');
           assertValue(this.numberField, 2.5);
         });
+        test('Infinity', function() {
+          this.numberField.setValue(Infinity);
+          assertValue(this.numberField, Infinity);
+        });
+        test('Negative Infinity String', function() {
+          this.numberField.setValue('-Infinity');
+          assertValue(this.numberField, -Infinity);
+        });
       });
     });
     suite('Constraints', function() {
diff --git a/tests/mocha/field_textinput_test.js b/tests/mocha/field_textinput_test.js
index 27855a90e..4177330a5 100644
--- a/tests/mocha/field_textinput_test.js
+++ b/tests/mocha/field_textinput_test.js
@@ -34,10 +34,6 @@ suite('Text Input Fields', function() {
       var textInputField = new Blockly.FieldTextInput();
       assertValueDefault(textInputField);
     });
-    test('Null', function() {
-      var textInputField = new Blockly.FieldTextInput(null);
-      assertValueDefault(textInputField);
-    });
     test('Undefined', function() {
       var textInputField = new Blockly.FieldTextInput(undefined);
       assertValueDefault(textInputField);
@@ -68,10 +64,6 @@ suite('Text Input Fields', function() {
       var textInputField = new Blockly.FieldTextInput.fromJson({});
       assertValueDefault(textInputField);
     });
-    test('Null', function() {
-      var textInputField = new Blockly.FieldTextInput.fromJson({ text: null});
-      assertValueDefault(textInputField);
-    });
     test('Undefined', function() {
       var textInputField = new Blockly.FieldTextInput
           .fromJson({ text: undefined});