mirror of
https://github.com/google/blockly.git
synced 2026-03-08 06:10:12 +01:00
Adding test and updating TODO. (#3102)
* Adding test and updating TODO. * changing bug number referenced in TODO
This commit is contained in:
committed by
Sam El-Husseini
parent
40e0d55187
commit
f4136fdc2a
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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']);
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user