Pulling in the latest changes from google/blockly/variables_by_id branch,

starting with commit 6218750 (December 19, 2017) through commit 80b397f (January 10, 2018).
This commit is contained in:
Rachel Fenichel 2017-12-19 11:28:23 -08:00 committed by Karishma Chadha
parent ddf61c146b
commit 855ec2665a
15 changed files with 507 additions and 232 deletions
tests/jsunit

View file

@ -140,14 +140,13 @@ function test_deleteVariable_InternalTrivial() {
function test_addTopBlock_TrivialFlyoutIsTrue() {
workspaceTest_setUp();
workspace.isFlyout = true;
var targetWorkspace = new Blockly.Workspace();
workspace.isFlyout = true;
workspace.targetWorkspace = targetWorkspace;
targetWorkspace.createVariable('name1', '', '1');
// Flyout.init usually does this binding.
workspace.getVariableById =
targetWorkspace.getVariableById.bind(targetWorkspace);
workspace.variableMap_ = targetWorkspace.getVariableMap();
try {
var block = createMockBlock('1');
@ -155,8 +154,11 @@ function test_addTopBlock_TrivialFlyoutIsTrue() {
workspace.addTopBlock(block);
checkVariableValues(workspace, 'name1', '', '1');
} finally {
targetWorkspace.dispose();
workspaceTest_tearDown();
// Have to dispose of the main workspace after the flyout workspace, because
// it holds the variable map.
// Normally the main workspace disposes of the flyout workspace.
targetWorkspace.dispose();
}
}