Adding test and updating TODO. (#3102)

* Adding test and updating TODO.

* changing bug number referenced in TODO
This commit is contained in:
Monica Kozbial
2019-09-27 11:12:38 -07:00
committed by Sam El-Husseini
parent 40e0d55187
commit f4136fdc2a
3 changed files with 9 additions and 14 deletions

View File

@@ -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']);

View File

@@ -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() {