mirror of
https://github.com/google/blockly.git
synced 2026-01-10 18:37:09 +01:00
switch to variabletype everywhere
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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() {
|
||||
' <variable type="" id="id3">name3</variable>' +
|
||||
' </variables>' +
|
||||
' <block type="field_variable_test_block">' +
|
||||
' <field name="VAR" id="id3" variableType="">name3</field>' +
|
||||
' <field name="VAR" id="id3" variabletype="">name3</field>' +
|
||||
' </block>' +
|
||||
'</xml>');
|
||||
Blockly.Xml.domToWorkspace(dom, workspace);
|
||||
@@ -210,7 +210,7 @@ function test_domToWorkspace_VariablesAtTop_MissingType() {
|
||||
' <variable id="id1">name1</variable>' +
|
||||
' </variables>' +
|
||||
' <block type="field_variable_test_block">' +
|
||||
' <field name="VAR" id="id1" variableType="">name3</field>' +
|
||||
' <field name="VAR" id="id1" variabletype="">name3</field>' +
|
||||
' </block>' +
|
||||
'</xml>');
|
||||
Blockly.Xml.domToWorkspace(dom, workspace);
|
||||
@@ -233,7 +233,7 @@ function test_domToWorkspace_VariablesAtTop_MismatchBlockType() {
|
||||
' <variable type="type1" id="id1">name1</variable>' +
|
||||
' </variables>' +
|
||||
' <block type="field_variable_test_block">' +
|
||||
' <field name="VAR" id="id1" variableType="">name1</field>' +
|
||||
' <field name="VAR" id="id1" variabletype="">name1</field>' +
|
||||
' </block>' +
|
||||
'</xml>');
|
||||
Blockly.Xml.domToWorkspace(dom, workspace);
|
||||
|
||||
Reference in New Issue
Block a user