Unit tests for JSON block definitions (just the start) (#850)

* Beginnings of a JSON block definition unit test set.
 * Dispose of unit test workspaces and blocks in finally blocks.
 * Clarify JSON error message by echoing arg notation.
This commit is contained in:
Andrew n marshall
2017-01-20 14:18:33 -08:00
committed by GitHub
parent fceba91c6c
commit fb0f1b05dd
6 changed files with 280 additions and 65 deletions

View File

@@ -68,17 +68,19 @@ function test_domToWorkspace() {
}
};
var workspace = new Blockly.Workspace();
try {
var dom = Blockly.Xml.textToDom(
'<xml xmlns="http://www.w3.org/1999/xhtml">' +
' <block type="test_block" inline="true" x="21" y="23">' +
' </block>' +
'</xml>');
var workspace = new Blockly.Workspace();
Blockly.Xml.domToWorkspace(dom, workspace);
assertEquals('Block count', 1, workspace.getAllBlocks().length);
} finally {
delete Blockly.Blocks.test_block;
workspace.dispose();
}
}