Add a test for case-sensitivity in the variable names, ids, etc. in the flyout

This commit is contained in:
Rachel Fenichel
2017-11-03 15:15:32 -07:00
parent 30716fbd78
commit 66586bf622

View File

@@ -364,3 +364,28 @@ function test_variablesToDom_noVariables() {
assertEquals(1, resultDom.children.length);
xmlTest_tearDown();
}
function test_variableFieldXml_caseSensitive() {
var id = 'testId';
var type = 'testType';
var name = 'testName';
var mockVariableModel = {
type: type,
name: name,
getId: function() {
return id;
}
};
var generatedXml = Blockly.Variables.generateVariableFieldXml_(mockVariableModel);
// The field contains this XML tag as a result of how we're generating this
// XML. This is not desirable, but the goal of this test is to make sure
// we're preserving case-sensitivity.
var xmlns = 'xmlns="http://www.w3.org/1999/xhtml"';
var goldenXml =
'<field ' + xmlns + ' name="VAR"' +
' variabletype="' + type + '"' +
' id="' + id + '">' + name + '</field>';
assertEquals(goldenXml, generatedXml);
}