diff --git a/core/flyout_base.ts b/core/flyout_base.ts index 547dac15ed8..94657ade3ec 100644 --- a/core/flyout_base.ts +++ b/core/flyout_base.ts @@ -255,7 +255,7 @@ export abstract class Flyout extends DeleteArea implements IFlyout { this.workspace_.setMetricsManager( new FlyoutMetricsManager(this.workspace_, this)); - this.workspace_.isFlyout = true; + this.workspace_.internalIsFlyout = true; // Keep the workspace visibility consistent with the flyout's visibility. this.workspace_.setVisible(this.isVisible_); diff --git a/core/mutator.ts b/core/mutator.ts index de85081c488..1d0ad364b85 100644 --- a/core/mutator.ts +++ b/core/mutator.ts @@ -191,7 +191,7 @@ export class Mutator extends Icon { workspaceOptions.languageTree = toolbox.convertToolboxDefToJson(quarkXml); } this.workspace_ = this.newWorkspaceSvg(workspaceOptions); - this.workspace_.isMutator = true; + this.workspace_.internalIsMutator = true; this.workspace_.addChangeListener(eventUtils.disableOrphans); // Mutator flyouts go inside the mutator workspace's rather than in diff --git a/core/workspace.ts b/core/workspace.ts index 0782c0fe611..fca1ce771b6 100644 --- a/core/workspace.ts +++ b/core/workspace.ts @@ -61,14 +61,27 @@ export class Workspace implements IASTNodeLocation { */ rendered = false; + /** + * Is this workspace the surface for a flyout? + * @internal + */ + internalIsFlyout = false; + /** Is this workspace the surface for a flyout? */ - isFlyout = false; + get isFlyout(): boolean { + return this.internalIsFlyout; + } /** * Is this workspace the surface for a mutator? * @internal */ - isMutator = false; + internalIsMutator = false; + + /** Is this workspace the surface for a mutator? */ + get isMutator(): boolean { + return this.internalIsMutator; + } /** * Returns `true` if the workspace is currently in the process of a bulk diff --git a/tests/mocha/workspace_svg_test.js b/tests/mocha/workspace_svg_test.js index 568b2d2adfe..d30374c10c0 100644 --- a/tests/mocha/workspace_svg_test.js +++ b/tests/mocha/workspace_svg_test.js @@ -124,48 +124,6 @@ suite('WorkspaceSvg', function() { }); }); - suite('addTopBlock', function() { - setup(function() { - this.targetWorkspace = new Blockly.Workspace(); - this.workspace.isFlyout = true; - this.workspace.targetWorkspace = this.targetWorkspace; - Blockly.defineBlocksWithJsonArray([{ - "type": "get_var_block", - "message0": "%1", - "args0": [ - { - "type": "field_variable", - "name": "VAR", - "variableTypes": ["", "type1", "type2"], - }, - ], - }]); - }); - - teardown(function() { - // 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. - workspaceTeardown.call(this, this.targetWorkspace); - }); - - test('Trivial Flyout is True', function() { - this.targetWorkspace.createVariable('name1', '', '1'); - - // Flyout.init usually does this binding. - this.workspace.variableMap_ = this.targetWorkspace.getVariableMap(); - - Blockly.Events.disable(); - const block = new Blockly.Block(this.workspace, 'get_var_block'); - block.inputList[0].fieldRow[0].setValue('1'); - Blockly.Events.enable(); - - this.workspace.removeTopBlock(block); - this.workspace.addTopBlock(block); - assertVariableValues(this.workspace, 'name1', '', '1'); - }); - }); - suite('Viewport change events', function() { function resetEventHistory(eventsFireStub, changeListenerSpy) { eventsFireStub.resetHistory();