diff --git a/.travis.yml b/.travis.yml index 6370db6d5..98803f097 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ before_install: before_script: - export DISPLAY=:99.0 - - if [ "${TRAVIS_OS_NAME}" == "linux" ]; then ( tests/scripts/setup_linux_env.sh ) fi + - if [ "${TRAVIS_OS_NAME}" == "linux" ]; then ( tests/scripts/setup_linux_env.sh ) fi - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then ( tests/scripts/setup_osx_env.sh ) fi - sleep 2 diff --git a/blocks/text.js b/blocks/text.js index 208972e14..72815a860 100644 --- a/blocks/text.js +++ b/blocks/text.js @@ -751,10 +751,10 @@ Blockly.Constants.Text.TEXT_JOIN_MUTATOR_MIXIN = { Blockly.Constants.Text.TEXT_JOIN_EXTENSION = function() { // Add the quote mixin for the itemCount_ = 0 case. this.mixin(Blockly.Constants.Text.QUOTE_IMAGE_MIXIN); - // initialize the mutator values + // Initialize the mutator values. this.itemCount_ = 2; this.updateShape_(); - // Configure the mutator ui + // Configure the mutator UI. this.setMutator(new Blockly.Mutator(['text_create_join_item'])); }; diff --git a/core/block.js b/core/block.js index 15b4a68df..554144853 100644 --- a/core/block.js +++ b/core/block.js @@ -293,10 +293,11 @@ Blockly.Block.prototype.unplug = function(opt_healStack) { /** * Returns all connections originating from this block. + * @param {boolean} all If true, return all connections even hidden ones. * @return {!Array.} Array of connections. * @private */ -Blockly.Block.prototype.getConnections_ = function() { +Blockly.Block.prototype.getConnections_ = function(all) { var myConnections = []; if (this.outputConnection) { myConnections.push(this.outputConnection); @@ -1423,8 +1424,10 @@ Blockly.Block.prototype.setCommentText = function(text) { /** * Set this block's warning text. * @param {?string} text The text, or null to delete. + * @param {string=} opt_id An optional ID for the warning text to be able to + * maintain multiple warnings. */ -Blockly.Block.prototype.setWarningText = function(/* text */) { +Blockly.Block.prototype.setWarningText = function(text, opt_id) { // NOP. }; @@ -1432,7 +1435,7 @@ Blockly.Block.prototype.setWarningText = function(/* text */) { * Give this block a mutator dialog. * @param {Blockly.Mutator} mutator A mutator dialog instance or null to remove. */ -Blockly.Block.prototype.setMutator = function(/* mutator */) { +Blockly.Block.prototype.setMutator = function(mutator) { // NOP. }; diff --git a/core/events.js b/core/events.js index c2762b8bf..940861662 100644 --- a/core/events.js +++ b/core/events.js @@ -305,7 +305,7 @@ Blockly.Events.fromJson = function(json, workspace) { event = new Blockly.Events.Delete(null); break; case Blockly.Events.CHANGE: - event = new Blockly.Events.Change(null); + event = new Blockly.Events.Change(null, '', null, null, null); break; case Blockly.Events.MOVE: event = new Blockly.Events.Move(null); @@ -317,7 +317,7 @@ Blockly.Events.fromJson = function(json, workspace) { event = new Blockly.Events.VarDelete(null); break; case Blockly.Events.VAR_RENAME: - event = new Blockly.Events.VarRename(null); + event = new Blockly.Events.VarRename(null, ''); break; case Blockly.Events.UI: event = new Blockly.Events.Ui(null); @@ -573,8 +573,8 @@ Blockly.Events.Delete.prototype.run = function(forward) { * @param {Blockly.Block} block The changed block. Null for a blank event. * @param {string} element One of 'field', 'comment', 'disabled', etc. * @param {?string} name Name of input or field affected, or null. - * @param {string} oldValue Previous value of element. - * @param {string} newValue New value of element. + * @param {*} oldValue Previous value of element. + * @param {*} newValue New value of element. * @extends {Blockly.Events.Abstract} * @constructor */ @@ -595,8 +595,8 @@ goog.inherits(Blockly.Events.Change, Blockly.Events.Abstract); * @param {Blockly.Block} block The changed block. Null for a blank event. * @param {string} element One of 'field', 'comment', 'disabled', etc. * @param {?string} name Name of input or field affected, or null. - * @param {string} oldValue Previous value of element. - * @param {string} newValue New value of element. + * @param {*} oldValue Previous value of element. + * @param {*} newValue New value of element. * @extends {Blockly.Events.Abstract} * @constructor */ diff --git a/core/extensions.js b/core/extensions.js index cba4d63c0..b6f4a25c2 100644 --- a/core/extensions.js +++ b/core/extensions.js @@ -322,7 +322,7 @@ Blockly.Extensions.buildTooltipForDropdown = function(dropdownName, // Wait for load, in case Blockly.Msg is not yet populated. // runAfterPageLoad() does not run in a Node.js environment due to lack of // document object, in which case skip the validation. - if (document) { // Relies on document.readyState + if (document) { // Relies on document.readyState Blockly.utils.runAfterPageLoad(function() { for (var key in lookupTable) { // Will print warnings if reference is missing. diff --git a/core/flyout_vertical.js b/core/flyout_vertical.js index 838befcab..3a12b2fbb 100644 --- a/core/flyout_vertical.js +++ b/core/flyout_vertical.js @@ -188,7 +188,7 @@ Blockly.VerticalFlyout.prototype.setBackgroundPath_ = function(width, height) { atRight ? this.CORNER_RADIUS : -this.CORNER_RADIUS, this.CORNER_RADIUS); // Bottom. - path.push('h', atRight ? width : -width); + path.push('h', atRight ? width : -width); path.push('z'); this.svgBackground_.setAttribute('d', path.join(' ')); }; diff --git a/core/workspace.js b/core/workspace.js index e10e7d364..2b937bc8f 100644 --- a/core/workspace.js +++ b/core/workspace.js @@ -497,8 +497,7 @@ Blockly.Workspace.prototype.undo = function(redo) { for (var i = 0, event; event = events[i]; i++) { event.run(redo); } - } - finally { + } finally { Blockly.Events.recordUndo = true; } }; diff --git a/core/workspace_svg.js b/core/workspace_svg.js index 522253f66..754d2bf0f 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -1357,7 +1357,7 @@ Blockly.WorkspaceSvg.prototype.setBrowserFocus = function() { try { // Focus the workspace SVG - this is for Chrome and Firefox. this.getParentSvg().focus(); - } catch (e) { + } catch (e) { // IE and Edge do not support focus on SVG elements. When that fails // above, get the injectionDiv (the workspace's parent) and focus that // instead. This doesn't work in Chrome. diff --git a/core/xml.js b/core/xml.js index debe77c59..907b4a1ee 100644 --- a/core/xml.js +++ b/core/xml.js @@ -353,11 +353,10 @@ Blockly.Xml.domToWorkspace = function(xml, workspace) { } else if (name == 'shadow') { goog.asserts.fail('Shadow block cannot be a top-level block.'); variablesFirst = false; - } else if (name == 'variables') { + } else if (name == 'variables') { if (variablesFirst) { Blockly.Xml.domToVariables(xmlChild, workspace); - } - else { + } else { throw Error('\'variables\' tag must exist once before block and ' + 'shadow tag elements in the workspace XML, but it was found in ' + 'another location.'); @@ -365,8 +364,7 @@ Blockly.Xml.domToWorkspace = function(xml, workspace) { variablesFirst = false; } } - } - finally { + } finally { if (!existingGroup) { Blockly.Events.setGroup(false); } diff --git a/tests/jsunit/variable_map_test.js b/tests/jsunit/variable_map_test.js index 023377b14..b2c0ccb95 100644 --- a/tests/jsunit/variable_map_test.js +++ b/tests/jsunit/variable_map_test.js @@ -131,8 +131,7 @@ function test_createVariableNullId() { try { variable_map.createVariable('name1', 'type1', null); checkVariableValues(variable_map, 'name1', 'type1', '1'); - } - finally { + } finally { variableMapTest_tearDown(); } } @@ -143,8 +142,7 @@ function test_createVariableUndefinedId() { try { variable_map.createVariable('name1', 'type1', undefined); checkVariableValues(variable_map, 'name1', 'type1', '1'); - } - finally { + } finally { variableMapTest_tearDown(); } } diff --git a/tests/jsunit/workspace_test.js b/tests/jsunit/workspace_test.js index 17755f158..a96a34ac4 100644 --- a/tests/jsunit/workspace_test.js +++ b/tests/jsunit/workspace_test.js @@ -66,8 +66,7 @@ function test_emptyWorkspace() { assertEquals('Empty workspace (4).', 0, workspace.getTopBlocks(true).length); assertEquals('Empty workspace (5).', 0, workspace.getTopBlocks(false).length); assertEquals('Empty workspace (6).', 0, workspace.getAllBlocks().length); - } - finally { + } finally { workspaceTest_tearDown(); } } @@ -187,8 +186,7 @@ function test_updateVariableStore_TrivialNoClear() { workspace.updateVariableStore(); checkVariableValues(workspace, 'name1', 'type1', 'id1'); checkVariableValues(workspace, 'name2', 'type2', 'id2'); - } - finally { + } finally { workspaceTest_tearDown(); } } @@ -202,8 +200,7 @@ function test_updateVariableStore_NameNotInvariableMap_NoClear() { try { workspace.updateVariableStore(); checkVariableValues(workspace, 'name1', '', '1'); - } - finally { + } finally { workspaceTest_tearDown(); } } @@ -219,8 +216,7 @@ function test_updateVariableStore_ClearAndAllInUse() { workspace.updateVariableStore(true); checkVariableValues(workspace, 'name1', 'type1', 'id1'); checkVariableValues(workspace, 'name2', 'type2', 'id2'); - } - finally { + } finally { workspaceTest_tearDown(); } } @@ -237,8 +233,7 @@ function test_updateVariableStore_ClearAndOneInUse() { checkVariableValues(workspace, 'name1', 'type1', 'id1'); var variabe = workspace.getVariable('name2'); assertNull(variable); - } - finally { + } finally { workspaceTest_tearDown(); } } @@ -255,8 +250,7 @@ function test_addTopBlock_TrivialFlyoutIsTrue() { try { workspace.addTopBlock(block); checkVariableValues(workspace, 'name1', '', '1'); - } - finally { + } finally { workspaceTest_tearDown(); } } @@ -274,8 +268,7 @@ function test_clear_Trivial() { var varMapLength = Object.keys(workspace.variableMap_.variableMap_).length; assertEquals(0, topBlocks_length); assertEquals(0, varMapLength); - } - finally { + } finally { workspaceTest_tearDown(); } } @@ -291,8 +284,7 @@ function test_clear_NoVariables() { var varMapLength = Object.keys(workspace.variableMap_.variableMap_).length; assertEquals(0, topBlocks_length); assertEquals(0, varMapLength); - } - finally { + } finally { workspaceTest_tearDown(); } } @@ -312,8 +304,7 @@ function test_renameVariable_NoBlocks() { checkVariableValues(workspace, 'name2', '', '1'); var variable = workspace.getVariable(oldName); assertNull(variable); - } - finally { + } finally { workspaceTest_tearDown(); } }