diff --git a/tests/jsunit/xml_test.js b/tests/jsunit/xml_test.js index 7487b6f3e..25e2655ea 100644 --- a/tests/jsunit/xml_test.js +++ b/tests/jsunit/xml_test.js @@ -59,6 +59,29 @@ function test_domToText() { text.replace(/\s+/g, '')); } +function test_domToWorkspace() { + Blockly.Blocks.test_block = { + init: function() { + this.jsonInit({ + message0: 'test', + }); + } + }; + + try { + var dom = Blockly.Xml.textToDom( + '' + + ' ' + + ' ' + + ''); + var workspace = new Blockly.Workspace(); + Blockly.Xml.domToWorkspace(dom, workspace); + assertEquals('Block count', 1, workspace.getAllBlocks().length); + } finally { + delete Blockly.Blocks.test_block; + } +} + function test_domToPrettyText() { var dom = Blockly.Xml.textToDom(XML_TEXT); var text = Blockly.Xml.domToPrettyText(dom);