diff --git a/core/variables.js b/core/variables.js index 16760ed3f..be9dcb681 100644 --- a/core/variables.js +++ b/core/variables.js @@ -340,7 +340,7 @@ Blockly.Variables.generateVariableFieldXml_ = function(variableModel) { // to be escaped to create valid XML. var element = goog.dom.createDom('field'); element.setAttribute('name', 'VAR'); - element.setAttribute('variableType', variableModel.type); + element.setAttribute('variabletype', variableModel.type); element.setAttribute('id', variableModel.getId()); element.textContent = variableModel.name; diff --git a/core/xml.js b/core/xml.js index 907b4a1ee..82e4040b4 100644 --- a/core/xml.js +++ b/core/xml.js @@ -113,7 +113,7 @@ Blockly.Xml.blockToDom = function(block, opt_noId) { var variable = block.workspace.getVariable(field.getValue()); if (variable) { container.setAttribute('id', variable.getId()); - container.setAttribute('variableType', variable.type); + container.setAttribute('variabletype', variable.type); } } element.appendChild(container); @@ -589,7 +589,7 @@ Blockly.Xml.domToBlockHeadless_ = function(xmlBlock, workspace) { // TODO (marisaleung): When we change setValue and getValue to // interact with IDs instead of names, update this so that we get // the variable based on ID instead of textContent. - var type = xmlChild.getAttribute('variableType') || ''; + var type = xmlChild.getAttribute('variabletype') || ''; var variable = workspace.getVariable(text); if (!variable) { variable = workspace.createVariable(text, type, diff --git a/tests/jsunit/xml_test.js b/tests/jsunit/xml_test.js index ea682dfb7..700f632f6 100644 --- a/tests/jsunit/xml_test.js +++ b/tests/jsunit/xml_test.js @@ -67,7 +67,7 @@ function xmlTest_setUpWithMockBlocks() { 'name': 'VAR', 'variable': 'item' } - ], + ] }]); } @@ -91,7 +91,7 @@ function xmlTest_checkNonVariableField(fieldDom, name, text) { assertEquals(text, fieldDom.textContent); assertEquals(name, fieldDom.getAttribute('name')); assertNull(fieldDom.getAttribute('id')); - assertNull(fieldDom.getAttribute('variableType')); + assertNull(fieldDom.getAttribute('variabletype')); } /** @@ -104,7 +104,7 @@ function xmlTest_checkNonVariableField(fieldDom, name, text) { */ function xmlTest_checkVariableFieldDomValues(fieldDom, name, type, id, text) { assertEquals(name, fieldDom.getAttribute('name')); - assertEquals(type, fieldDom.getAttribute('variableType')); + assertEquals(type, fieldDom.getAttribute('variabletype')); assertEquals(id, fieldDom.getAttribute('id')); assertEquals(text, fieldDom.textContent); } @@ -166,7 +166,7 @@ function test_domToWorkspace_VariablesAtTop() { ' name3' + ' ' + ' ' + - ' name3' + + ' name3' + ' ' + ''); Blockly.Xml.domToWorkspace(dom, workspace); @@ -210,7 +210,7 @@ function test_domToWorkspace_VariablesAtTop_MissingType() { ' name1' + ' ' + ' ' + - ' name3' + + ' name3' + ' ' + ''); Blockly.Xml.domToWorkspace(dom, workspace); @@ -233,7 +233,7 @@ function test_domToWorkspace_VariablesAtTop_MismatchBlockType() { ' name1' + ' ' + ' ' + - ' name1' + + ' name1' + ' ' + ''); Blockly.Xml.domToWorkspace(dom, workspace);