mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
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:
committed by
GitHub
parent
fceba91c6c
commit
fb0f1b05dd
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user