diff --git a/tests/rendering/zelos/pxtblockly.html b/tests/rendering/zelos/pxtblockly.html
index 77a282ac4..d3aa9dffe 100644
--- a/tests/rendering/zelos/pxtblockly.html
+++ b/tests/rendering/zelos/pxtblockly.html
@@ -37,17 +37,28 @@
}
});
- try {
- Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(xml), workspace);
- var topBlock = workspace.getTopBlocks()[0];
- workspaceToSvg_(workspace, function (datauri) {
- window.parent.postMessage({
- type: 'svg',
- from: 'pxtblockly',
- text: datauri
- }, '*');
- });
- } catch { }
+ Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(xml), workspace);
+
+ function postChange() {
+ try {
+ var topBlock = workspace.getTopBlocks()[0];
+ workspaceToSvg_(workspace, function (datauri) {
+ window.parent.postMessage({
+ type: 'svg',
+ from: 'pxtblockly',
+ text: datauri
+ }, '*');
+ });
+ } catch { }
+ }
+
+ workspace.addChangeListener(function(e) {
+ if (e.type != 'ui') {
+ postChange();
+ }
+ });
+
+ postChange();
});