diff --git a/core/workspace.js b/core/workspace.js index 9f266d207..106a1dd21 100644 --- a/core/workspace.js +++ b/core/workspace.js @@ -578,7 +578,7 @@ Blockly.Workspace.prototype.variableIndexOf = function(_name) { * defaults to the empty string, which is a specific type. * @return {Blockly.VariableModel} The variable with the given name. */ -// TODO (#1199): Possibly delete this function. +// TODO (#1559): Possibly delete this function after resolving #1559. Blockly.Workspace.prototype.getVariable = function(name, opt_type) { return this.variableMap_.getVariable(name, opt_type); }; diff --git a/tests/jsunit/xml_test.js b/tests/jsunit/xml_test.js index 0374245f1..33804fc1e 100644 --- a/tests/jsunit/xml_test.js +++ b/tests/jsunit/xml_test.js @@ -281,19 +281,6 @@ function test_appendDomToWorkspace() { } } -function test_blockToDom_fieldToDom_trivial() { - xmlTest_setUpWithMockBlocks(); - // TODO (#1199): make a similar test where the variable is given a non-empty - // type.f - workspace.createVariable('name1', '', 'id1'); - var block = new Blockly.Block(workspace, 'field_variable_test_block'); - block.inputList[0].fieldRow[0].setValue('id1'); - var resultFieldDom = Blockly.Xml.blockToDom(block).childNodes[0]; - xmlTest_checkVariableFieldDomValues(resultFieldDom, 'VAR', null, 'id1', - 'name1'); - xmlTest_tearDownWithMockBlocks(); -} - function test_blockToDom_fieldToDom_defaultCase() { xmlTest_setUpWithMockBlocks(); mockControl_ = setUpMockMethod(Blockly.utils, 'genUid', null, ['1', '1']); diff --git a/tests/mocha/xml_test.js b/tests/mocha/xml_test.js index 66ab5ae92..3037f178c 100644 --- a/tests/mocha/xml_test.js +++ b/tests/mocha/xml_test.js @@ -276,6 +276,14 @@ suite('XML', function() { var resultFieldDom = Blockly.Xml.blockToDom(block).childNodes[0]; assertVariableField(resultFieldDom, 'VAR', null, 'id1', 'name1'); }); + test('Variable Typed', function() { + this.workspace.createVariable('name1', 'string', 'id1'); + var block = new Blockly.Block(this.workspace, + 'field_variable_test_block'); + block.inputList[0].fieldRow[0].setValue('id1'); + var resultFieldDom = Blockly.Xml.blockToDom(block).childNodes[0]; + assertVariableField(resultFieldDom, 'VAR', 'string', 'id1', 'name1'); + }); test('Variable Default Case', function() { var cacheGenUid = Blockly.utils.genUid; Blockly.utils.genUid = function() {