Migrate hideChaff() from Blockly to WorkspaceSvg (#5460)

* Add hideChaff() to core/workspace_svg.js

* Mark Blockly.hideChaff as deprecated

* Update uses of Blockly.hideChaff() to WorkspaceSvg.hideChaff() in core

* Update uses of Blockly.hideChaff() to WorkspaceSvg.hideChaff() in demos

* Style and formatting fixes

* Switch from accessor to stub wrapper for Blockly.hideChaff

Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>

Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>
This commit is contained in:
Aaron Dodson
2021-09-15 13:41:20 -07:00
committed by GitHub
parent 0e43ddc4ba
commit 6a4a359f7b
20 changed files with 73 additions and 58 deletions

View File

@@ -19,11 +19,9 @@ goog.provide('Blockly');
goog.require('Blockly.browserEvents'); goog.require('Blockly.browserEvents');
goog.require('Blockly.clipboard'); goog.require('Blockly.clipboard');
goog.require('Blockly.common'); goog.require('Blockly.common');
goog.require('Blockly.ComponentManager');
goog.require('Blockly.connectionTypes'); goog.require('Blockly.connectionTypes');
goog.require('Blockly.constants'); goog.require('Blockly.constants');
goog.require('Blockly.dialog'); goog.require('Blockly.dialog');
goog.require('Blockly.DropDownDiv');
goog.require('Blockly.Events'); goog.require('Blockly.Events');
/** @suppress {extraRequire} */ /** @suppress {extraRequire} */
goog.require('Blockly.Events.BlockCreate'); goog.require('Blockly.Events.BlockCreate');
@@ -42,7 +40,6 @@ goog.require('Blockly.internalConstants');
/** @suppress {extraRequire} */ /** @suppress {extraRequire} */
goog.require('Blockly.Procedures'); goog.require('Blockly.Procedures');
goog.require('Blockly.ShortcutRegistry'); goog.require('Blockly.ShortcutRegistry');
goog.require('Blockly.Tooltip');
/** @suppress {extraRequire} */ /** @suppress {extraRequire} */
goog.require('Blockly.Touch'); goog.require('Blockly.Touch');
goog.require('Blockly.utils'); goog.require('Blockly.utils');
@@ -52,7 +49,6 @@ goog.require('Blockly.utils.Size');
goog.require('Blockly.utils.toolbox'); goog.require('Blockly.utils.toolbox');
/** @suppress {extraRequire} */ /** @suppress {extraRequire} */
goog.require('Blockly.Variables'); goog.require('Blockly.Variables');
goog.require('Blockly.WidgetDiv');
goog.require('Blockly.WorkspaceSvg'); goog.require('Blockly.WorkspaceSvg');
/** @suppress {extraRequire} */ /** @suppress {extraRequire} */
goog.require('Blockly.Xml'); goog.require('Blockly.Xml');
@@ -184,7 +180,7 @@ Blockly.onKeyDown = function(e) {
Blockly.deleteBlock = function(selected) { Blockly.deleteBlock = function(selected) {
if (!selected.workspace.isFlyout) { if (!selected.workspace.isFlyout) {
Blockly.Events.setGroup(true); Blockly.Events.setGroup(true);
Blockly.hideChaff(); Blockly.common.getMainWorkspace().hideChaff();
if (selected.outputConnection) { if (selected.outputConnection) {
// Do not attempt to heal rows // Do not attempt to heal rows
// (https://github.com/google/blockly/issues/4832) // (https://github.com/google/blockly/issues/4832)
@@ -232,20 +228,13 @@ Blockly.onContextMenu_ = function(e) {
/** /**
* Close tooltips, context menus, dropdown selections, etc. * Close tooltips, context menus, dropdown selections, etc.
* @deprecated Use Blockly.common.getMainWorkspace().hideChaff()
* @param {boolean=} opt_onlyClosePopups Whether only popups should be closed. * @param {boolean=} opt_onlyClosePopups Whether only popups should be closed.
*/ */
Blockly.hideChaff = function(opt_onlyClosePopups) { Blockly.hideChaff = function(opt_onlyClosePopups) {
Blockly.Tooltip.hide(); Blockly.utils.deprecation.warn(
Blockly.WidgetDiv.hide(); 'Blockly.hideChaff', 'September 2021', 'September 2022');
Blockly.DropDownDiv.hideWithoutAnimation(); Blockly.common.getMainWorkspace().hideChaff(opt_onlyClosePopups);
var onlyClosePopups = !!opt_onlyClosePopups;
var workspace = Blockly.common.getMainWorkspace();
var autoHideables = workspace.getComponentManager().getComponents(
Blockly.ComponentManager.Capability.AUTOHIDEABLE, true);
autoHideables.forEach(function(autoHideable) {
autoHideable.autoHide(onlyClosePopups);
});
}; };
/** /**

View File

@@ -13,8 +13,6 @@
goog.module('Blockly.Bubble'); goog.module('Blockly.Bubble');
goog.module.declareLegacyNamespace(); goog.module.declareLegacyNamespace();
// TODO(#5073): Fix Blockly requires for Blockly.hideChaff()
// const Blockly = goog.require('Blockly');
/* eslint-disable-next-line no-unused-vars */ /* eslint-disable-next-line no-unused-vars */
const BlockDragSurfaceSvg = goog.requireType('Blockly.BlockDragSurfaceSvg'); const BlockDragSurfaceSvg = goog.requireType('Blockly.BlockDragSurfaceSvg');
/* eslint-disable-next-line no-unused-vars */ /* eslint-disable-next-line no-unused-vars */
@@ -396,7 +394,7 @@ Bubble.prototype.resizeMouseDown_ = function(e) {
document, 'mouseup', this, Bubble.bubbleMouseUp_); document, 'mouseup', this, Bubble.bubbleMouseUp_);
Bubble.onMouseMoveWrapper_ = browserEvents.conditionalBind( Bubble.onMouseMoveWrapper_ = browserEvents.conditionalBind(
document, 'mousemove', this, this.resizeMouseMove_); document, 'mousemove', this, this.resizeMouseMove_);
Blockly.hideChaff(); this.workspace_.hideChaff();
// This event has been handled. No need to bubble up to the document. // This event has been handled. No need to bubble up to the document.
e.stopPropagation(); e.stopPropagation();
}; };

View File

@@ -15,7 +15,6 @@ goog.module.declareLegacyNamespace();
/* eslint-disable-next-line no-unused-vars */ /* eslint-disable-next-line no-unused-vars */
const Block = goog.requireType('Blockly.Block'); const Block = goog.requireType('Blockly.Block');
const Blockly = goog.require('Blockly');
/* eslint-disable-next-line no-unused-vars */ /* eslint-disable-next-line no-unused-vars */
const BlockSvg = goog.requireType('Blockly.BlockSvg'); const BlockSvg = goog.requireType('Blockly.BlockSvg');
const ComponentManager = goog.require('Blockly.ComponentManager'); const ComponentManager = goog.require('Blockly.ComponentManager');
@@ -858,7 +857,7 @@ Flyout.prototype.createBlock = function(originalBlock) {
} }
// Close the flyout. // Close the flyout.
Blockly.hideChaff(); this.targetWorkspace.hideChaff();
const newVariables = Variables.getAddedVariables( const newVariables = Variables.getAddedVariables(
this.targetWorkspace, variablesBeforeCreation); this.targetWorkspace, variablesBeforeCreation);

View File

@@ -490,7 +490,7 @@ Gesture.prototype.doStart = function(e) {
// Hide chaff also hides the flyout, so don't do it if the click is in a // Hide chaff also hides the flyout, so don't do it if the click is in a
// flyout. // flyout.
Blockly.hideChaff(!!this.flyout_); this.startWorkspace_.hideChaff(!!this.flyout_);
this.startWorkspace_.markFocused(); this.startWorkspace_.markFocused();
this.mostRecentEvent_ = e; this.mostRecentEvent_ = e;
@@ -625,12 +625,12 @@ Gesture.prototype.cancel = function() {
Gesture.prototype.handleRightClick = function(e) { Gesture.prototype.handleRightClick = function(e) {
if (this.targetBlock_) { if (this.targetBlock_) {
this.bringBlockToFront_(); this.bringBlockToFront_();
Blockly.hideChaff(!!this.flyout_); this.targetBlock_.workspace.hideChaff(!!this.flyout_);
this.targetBlock_.showContextMenu(e); this.targetBlock_.showContextMenu(e);
} else if (this.startBubble_) { } else if (this.startBubble_) {
this.startBubble_.showContextMenu(e); this.startBubble_.showContextMenu(e);
} else if (this.startWorkspace_ && !this.flyout_) { } else if (this.startWorkspace_ && !this.flyout_) {
Blockly.hideChaff(); this.startWorkspace_.hideChaff();
this.startWorkspace_.showContextMenu(e); this.startWorkspace_.showContextMenu(e);
} }

View File

@@ -213,7 +213,7 @@ const init = function(mainWorkspace) {
const workspaceResizeHandler = const workspaceResizeHandler =
browserEvents.conditionalBind(window, 'resize', null, function() { browserEvents.conditionalBind(window, 'resize', null, function() {
Blockly.hideChaff(true); mainWorkspace.hideChaff(true);
Blockly.svgResize(mainWorkspace); Blockly.svgResize(mainWorkspace);
goog.module.get('Blockly.bumpObjects') goog.module.get('Blockly.bumpObjects')
.bumpTopObjectsIntoBounds(mainWorkspace); .bumpTopObjectsIntoBounds(mainWorkspace);

View File

@@ -6,7 +6,7 @@
/** /**
* @fileoverview The interface for a component that is automatically hidden * @fileoverview The interface for a component that is automatically hidden
* when Blockly.hideChaff is called. * when WorkspaceSvg.hideChaff is called.
* @author kozbial@google.com (Monica Kozbial) * @author kozbial@google.com (Monica Kozbial)
*/ */
@@ -27,7 +27,7 @@ const IComponent = goog.requireType('Blockly.IComponent');
const IAutoHideable = function() {}; const IAutoHideable = function() {};
/** /**
* Hides the component. Called in Blockly.hideChaff. * Hides the component. Called in WorkspaceSvg.hideChaff.
* @param {boolean} onlyClosePopups Whether only popups should be closed. * @param {boolean} onlyClosePopups Whether only popups should be closed.
* Flyouts should not be closed if this is true. * Flyouts should not be closed if this is true.
*/ */

View File

@@ -774,7 +774,7 @@ Scrollbar.prototype.onMouseUpHandle_ = function() {
* @private * @private
*/ */
Scrollbar.prototype.cleanUp_ = function() { Scrollbar.prototype.cleanUp_ = function() {
Blockly.hideChaff(true); this.workspace_.hideChaff(true);
if (Scrollbar.onMouseUpWrapper_) { if (Scrollbar.onMouseUpWrapper_) {
browserEvents.unbind(Scrollbar.onMouseUpWrapper_); browserEvents.unbind(Scrollbar.onMouseUpWrapper_);
Scrollbar.onMouseUpWrapper_ = null; Scrollbar.onMouseUpWrapper_ = null;

View File

@@ -47,8 +47,8 @@ const registerEscape = function() {
preconditionFn: function(workspace) { preconditionFn: function(workspace) {
return !workspace.options.readOnly; return !workspace.options.readOnly;
}, },
callback: function() { callback: function(workspace) {
Blockly.hideChaff(); workspace.hideChaff();
return true; return true;
} }
}; };
@@ -101,7 +101,7 @@ const registerCopy = function() {
// Prevent the default copy behavior, which may beep or otherwise indicate // Prevent the default copy behavior, which may beep or otherwise indicate
// an error due to the lack of a selection. // an error due to the lack of a selection.
e.preventDefault(); e.preventDefault();
Blockly.hideChaff(); workspace.hideChaff();
clipboard.copy(/** @type {!ICopyable} */ (Blockly.selected)); clipboard.copy(/** @type {!ICopyable} */ (Blockly.selected));
return true; return true;
} }
@@ -194,7 +194,7 @@ const registerUndo = function() {
}, },
callback: function(workspace) { callback: function(workspace) {
// 'z' for undo 'Z' is for redo. // 'z' for undo 'Z' is for redo.
Blockly.hideChaff(); workspace.hideChaff();
workspace.undo(false); workspace.undo(false);
return true; return true;
} }
@@ -228,7 +228,7 @@ const registerRedo = function() {
}, },
callback: function(workspace) { callback: function(workspace) {
// 'z' for undo 'Z' is for redo. // 'z' for undo 'Z' is for redo.
Blockly.hideChaff(); workspace.hideChaff();
workspace.undo(true); workspace.undo(true);
return true; return true;
} }

View File

@@ -113,7 +113,9 @@ ThemeManager.prototype.setTheme = function(theme) {
} }
} }
Blockly.hideChaff(); for (const workspace of this.subscribedWorkspaces_) {
workspace.hideChaff();
}
}; };
/** /**

View File

@@ -50,6 +50,7 @@ const WorkspaceSvg = goog.requireType('Blockly.WorkspaceSvg');
const aria = goog.require('Blockly.utils.aria'); const aria = goog.require('Blockly.utils.aria');
const browserEvents = goog.require('Blockly.browserEvents'); const browserEvents = goog.require('Blockly.browserEvents');
const dom = goog.require('Blockly.utils.dom'); const dom = goog.require('Blockly.utils.dom');
const common = goog.require('Blockly.common');
const keyCodes = goog.require('Blockly.utils.KeyCodes'); const keyCodes = goog.require('Blockly.utils.KeyCodes');
const object = goog.require('Blockly.utils.object'); const object = goog.require('Blockly.utils.object');
const registry = goog.require('Blockly.registry'); const registry = goog.require('Blockly.registry');
@@ -315,7 +316,7 @@ Toolbox.prototype.attachEvents_ = function(container, contentsContainer) {
Toolbox.prototype.onClick_ = function(e) { Toolbox.prototype.onClick_ = function(e) {
if (utils.isRightButton(e) || e.target == this.HtmlDiv) { if (utils.isRightButton(e) || e.target == this.HtmlDiv) {
// Close flyout. // Close flyout.
Blockly.hideChaff(false); common.getMainWorkspace().hideChaff(false);
} else { } else {
const targetElement = e.target; const targetElement = e.target;
const itemId = targetElement.getAttribute('id'); const itemId = targetElement.getAttribute('id');
@@ -327,7 +328,7 @@ Toolbox.prototype.onClick_ = function(e) {
} }
} }
// Just close popups. // Just close popups.
Blockly.hideChaff(true); common.getMainWorkspace().hideChaff(true);
} }
Touch.clearTouchIdentifier(); // Don't block future drags. Touch.clearTouchIdentifier(); // Don't block future drags.
}; };
@@ -847,7 +848,7 @@ Toolbox.prototype.setVisible = function(isVisible) {
}; };
/** /**
* Hides the component. Called in Blockly.hideChaff. * Hides the component. Called in WorkspaceSvg.hideChaff.
* @param {boolean} onlyClosePopups Whether only popups should be closed. * @param {boolean} onlyClosePopups Whether only popups should be closed.
* Flyouts should not be closed if this is true. * Flyouts should not be closed if this is true.
*/ */

View File

@@ -410,7 +410,7 @@ Trashcan.prototype.closeFlyout = function() {
}; };
/** /**
* Hides the component. Called in Blockly.hideChaff. * Hides the component. Called in WorkspaceSvg.hideChaff.
* @param {boolean} onlyClosePopups Whether only popups should be closed. * @param {boolean} onlyClosePopups Whether only popups should be closed.
* Flyouts should not be closed if this is true. * Flyouts should not be closed if this is true.
*/ */

View File

@@ -868,7 +868,7 @@ WorkspaceCommentSvg.prototype.resizeMouseDown_ = function(e) {
document, 'mouseup', this, this.resizeMouseUp_); document, 'mouseup', this, this.resizeMouseUp_);
this.onMouseMoveWrapper_ = browserEvents.conditionalBind( this.onMouseMoveWrapper_ = browserEvents.conditionalBind(
document, 'mousemove', this, this.resizeMouseMove_); document, 'mousemove', this, this.resizeMouseMove_);
Blockly.hideChaff(); this.workspace.hideChaff();
// This event has been handled. No need to bubble up to the document. // This event has been handled. No need to bubble up to the document.
e.stopPropagation(); e.stopPropagation();
}; };

View File

@@ -28,6 +28,7 @@ const ContextMenuRegistry = goog.require('Blockly.ContextMenuRegistry');
const Coordinate = goog.require('Blockly.utils.Coordinate'); const Coordinate = goog.require('Blockly.utils.Coordinate');
/* eslint-disable-next-line no-unused-vars */ /* eslint-disable-next-line no-unused-vars */
const Cursor = goog.requireType('Blockly.Cursor'); const Cursor = goog.requireType('Blockly.Cursor');
const DropDownDiv = goog.require('Blockly.DropDownDiv');
const Events = goog.require('Blockly.Events'); const Events = goog.require('Blockly.Events');
/* eslint-disable-next-line no-unused-vars */ /* eslint-disable-next-line no-unused-vars */
const FlyoutButton = goog.requireType('Blockly.FlyoutButton'); const FlyoutButton = goog.requireType('Blockly.FlyoutButton');
@@ -63,6 +64,7 @@ const Svg = goog.require('Blockly.utils.Svg');
/* eslint-disable-next-line no-unused-vars */ /* eslint-disable-next-line no-unused-vars */
const Theme = goog.requireType('Blockly.Theme'); const Theme = goog.requireType('Blockly.Theme');
const ThemeManager = goog.require('Blockly.ThemeManager'); const ThemeManager = goog.require('Blockly.ThemeManager');
const Tooltip = goog.require('Blockly.Tooltip');
const TouchGesture = goog.require('Blockly.TouchGesture'); const TouchGesture = goog.require('Blockly.TouchGesture');
/* eslint-disable-next-line no-unused-vars */ /* eslint-disable-next-line no-unused-vars */
const Trashcan = goog.requireType('Blockly.Trashcan'); const Trashcan = goog.requireType('Blockly.Trashcan');
@@ -72,6 +74,7 @@ const VariableModel = goog.requireType('Blockly.VariableModel');
const Variables = goog.requireType('Blockly.Variables'); const Variables = goog.requireType('Blockly.Variables');
/* eslint-disable-next-line no-unused-vars */ /* eslint-disable-next-line no-unused-vars */
const VariablesDynamic = goog.requireType('Blockly.VariablesDynamic'); const VariablesDynamic = goog.requireType('Blockly.VariablesDynamic');
const WidgetDiv = goog.require('Blockly.WidgetDiv');
const Workspace = goog.require('Blockly.Workspace'); const Workspace = goog.require('Blockly.Workspace');
const WorkspaceAudio = goog.require('Blockly.WorkspaceAudio'); const WorkspaceAudio = goog.require('Blockly.WorkspaceAudio');
/* eslint-disable-next-line no-unused-vars */ /* eslint-disable-next-line no-unused-vars */
@@ -1443,7 +1446,7 @@ WorkspaceSvg.prototype.setVisible = function(isVisible) {
this.toolbox_.position(); this.toolbox_.position();
} }
} else { } else {
Blockly.hideChaff(true); this.hideChaff(true);
} }
}; };
@@ -2273,7 +2276,7 @@ WorkspaceSvg.prototype.setScale = function(newScale) {
} }
this.scale = newScale; this.scale = newScale;
Blockly.hideChaff(false); this.hideChaff(false);
// Get the flyout, if any, whether our own or owned by the toolbox. // Get the flyout, if any, whether our own or owned by the toolbox.
const flyout = this.getFlyout(false); const flyout = this.getFlyout(false);
if (flyout && flyout.isVisible()) { if (flyout && flyout.isVisible()) {
@@ -2328,7 +2331,7 @@ WorkspaceSvg.prototype.getScale = function() {
* @package * @package
*/ */
WorkspaceSvg.prototype.scroll = function(x, y) { WorkspaceSvg.prototype.scroll = function(x, y) {
Blockly.hideChaff(/* opt_onlyClosePopups */ true); this.hideChaff(/* opt_onlyClosePopups= */ true);
// Keep scrolling within the bounds of the content. // Keep scrolling within the bounds of the content.
const metrics = this.getMetrics(); const metrics = this.getMetrics();
@@ -2644,4 +2647,20 @@ WorkspaceSvg.prototype.getGrid = function() {
return this.grid_; return this.grid_;
}; };
/**
* Close tooltips, context menus, dropdown selections, etc.
* @param {boolean=} opt_onlyClosePopups Whether only popups should be closed.
*/
WorkspaceSvg.prototype.hideChaff = function(opt_onlyClosePopups) {
Tooltip.hide();
WidgetDiv.hide();
DropDownDiv.hideWithoutAnimation();
var onlyClosePopups = !!opt_onlyClosePopups;
var autoHideables = this.getComponentManager().getComponents(
Blockly.ComponentManager.Capability.AUTOHIDEABLE, true);
autoHideables.forEach(
(autoHideable) => autoHideable.autoHide(onlyClosePopups));
};
exports = WorkspaceSvg; exports = WorkspaceSvg;

View File

@@ -631,7 +631,7 @@ AppController.prototype.confirmLeavePage = function(e) {
* @param {string} id ID of element to show. * @param {string} id ID of element to show.
*/ */
AppController.prototype.openModal = function(id) { AppController.prototype.openModal = function(id) {
Blockly.hideChaff(); Blockly.common.getMainWorkspace().hideChaff();
this.modalName_ = id; this.modalName_ = id;
document.getElementById(id).style.display = 'block'; document.getElementById(id).style.display = 'block';
document.getElementById('modalShadow').style.display = 'block'; document.getElementById('modalShadow').style.display = 'block';

View File

@@ -88,7 +88,7 @@ BlockFactory.formatChange = function() {
var languageTA = document.getElementById('languageTA'); var languageTA = document.getElementById('languageTA');
if (document.getElementById('format').value == 'Manual-JSON' || if (document.getElementById('format').value == 'Manual-JSON' ||
document.getElementById('format').value == 'Manual-JS') { document.getElementById('format').value == 'Manual-JS') {
Blockly.hideChaff(); Blockly.common.getMainWorkspace().hideChaff();
mask.style.display = 'block'; mask.style.display = 'block';
languagePre.style.display = 'none'; languagePre.style.display = 'none';
languageTA.style.display = 'block'; languageTA.style.display = 'block';

View File

@@ -35,7 +35,7 @@ function formatChange() {
var languagePre = document.getElementById('languagePre'); var languagePre = document.getElementById('languagePre');
var languageTA = document.getElementById('languageTA'); var languageTA = document.getElementById('languageTA');
if (document.getElementById('format').value == 'Manual') { if (document.getElementById('format').value == 'Manual') {
Blockly.hideChaff(); Blockly.common.getMainWorkspace().hideChaff();
mask.style.display = 'block'; mask.style.display = 'block';
languagePre.style.display = 'none'; languagePre.style.display = 'none';
languageTA.style.display = 'block'; languageTA.style.display = 'block';

View File

@@ -112,7 +112,7 @@
} }
function toggleEditable() { function toggleEditable() {
Blockly.hideChaff(); workspace.hideChaff();
var blocks = workspace.getAllBlocks(false); var blocks = workspace.getAllBlocks(false);
for(var i = 0, block; block = blocks[i]; i++) { for(var i = 0, block; block = blocks[i]; i++) {
block.setEditable(!block.isEditable()); block.setEditable(!block.isEditable());
@@ -120,7 +120,7 @@
} }
function toggleCollapsed() { function toggleCollapsed() {
Blockly.hideChaff(); workspace.hideChaff();
var blocks = workspace.getAllBlocks(false); var blocks = workspace.getAllBlocks(false);
for(var i = 0, block; block = blocks[i]; i++) { for(var i = 0, block; block = blocks[i]; i++) {
block.setCollapsed(!block.isCollapsed()); block.setCollapsed(!block.isCollapsed());

View File

@@ -12,7 +12,7 @@ goog.addDependency('../../core/block_animations.js', ['Blockly.blockAnimations']
goog.addDependency('../../core/block_drag_surface.js', ['Blockly.BlockDragSurfaceSvg'], ['Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.Svg', 'Blockly.utils.dom'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/block_drag_surface.js', ['Blockly.BlockDragSurfaceSvg'], ['Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.Svg', 'Blockly.utils.dom'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/block_dragger.js', ['Blockly.BlockDragger'], ['Blockly.Events', 'Blockly.Events.BlockDrag', 'Blockly.Events.BlockMove', 'Blockly.InsertionMarkerManager', 'Blockly.blockAnimations', 'Blockly.bumpObjects', 'Blockly.common', 'Blockly.registry', 'Blockly.utils.Coordinate', 'Blockly.utils.dom'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/block_dragger.js', ['Blockly.BlockDragger'], ['Blockly.Events', 'Blockly.Events.BlockDrag', 'Blockly.Events.BlockMove', 'Blockly.InsertionMarkerManager', 'Blockly.blockAnimations', 'Blockly.bumpObjects', 'Blockly.common', 'Blockly.registry', 'Blockly.utils.Coordinate', 'Blockly.utils.dom'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/block_svg.js', ['Blockly.BlockSvg'], ['Blockly.ASTNode', 'Blockly.Block', 'Blockly.ContextMenu', 'Blockly.ContextMenuRegistry', 'Blockly.Events', 'Blockly.Events.BlockMove', 'Blockly.Events.Selected', 'Blockly.FieldLabel', 'Blockly.MarkerManager', 'Blockly.Msg', 'Blockly.RenderedConnection', 'Blockly.TabNavigateCursor', 'Blockly.Tooltip', 'Blockly.Touch', 'Blockly.Xml', 'Blockly.blockAnimations', 'Blockly.browserEvents', 'Blockly.common', 'Blockly.connectionTypes', 'Blockly.constants', 'Blockly.internalConstants', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.Rect', 'Blockly.utils.Svg', 'Blockly.utils.deprecation', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.userAgent'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/block_svg.js', ['Blockly.BlockSvg'], ['Blockly.ASTNode', 'Blockly.Block', 'Blockly.ContextMenu', 'Blockly.ContextMenuRegistry', 'Blockly.Events', 'Blockly.Events.BlockMove', 'Blockly.Events.Selected', 'Blockly.FieldLabel', 'Blockly.MarkerManager', 'Blockly.Msg', 'Blockly.RenderedConnection', 'Blockly.TabNavigateCursor', 'Blockly.Tooltip', 'Blockly.Touch', 'Blockly.Xml', 'Blockly.blockAnimations', 'Blockly.browserEvents', 'Blockly.common', 'Blockly.connectionTypes', 'Blockly.constants', 'Blockly.internalConstants', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.Rect', 'Blockly.utils.Svg', 'Blockly.utils.deprecation', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.userAgent'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/blockly.js', ['Blockly'], ['Blockly.ComponentManager', 'Blockly.DropDownDiv', 'Blockly.Events', 'Blockly.Events.BlockCreate', 'Blockly.Events.FinishedLoading', 'Blockly.Events.Ui', 'Blockly.Events.UiBase', 'Blockly.Events.VarCreate', 'Blockly.Procedures', 'Blockly.ShortcutRegistry', 'Blockly.Tooltip', 'Blockly.Touch', 'Blockly.Variables', 'Blockly.WidgetDiv', 'Blockly.WorkspaceSvg', 'Blockly.Xml', 'Blockly.browserEvents', 'Blockly.clipboard', 'Blockly.common', 'Blockly.connectionTypes', 'Blockly.constants', 'Blockly.dialog', 'Blockly.inject', 'Blockly.inputTypes', 'Blockly.internalConstants', 'Blockly.utils', 'Blockly.utils.Size', 'Blockly.utils.colour', 'Blockly.utils.deprecation', 'Blockly.utils.toolbox']); goog.addDependency('../../core/blockly.js', ['Blockly'], ['Blockly.Events', 'Blockly.Events.BlockCreate', 'Blockly.Events.FinishedLoading', 'Blockly.Events.Ui', 'Blockly.Events.UiBase', 'Blockly.Events.VarCreate', 'Blockly.Procedures', 'Blockly.ShortcutRegistry', 'Blockly.Touch', 'Blockly.Variables', 'Blockly.WorkspaceSvg', 'Blockly.Xml', 'Blockly.browserEvents', 'Blockly.clipboard', 'Blockly.common', 'Blockly.connectionTypes', 'Blockly.constants', 'Blockly.dialog', 'Blockly.inject', 'Blockly.inputTypes', 'Blockly.internalConstants', 'Blockly.utils', 'Blockly.utils.Size', 'Blockly.utils.colour', 'Blockly.utils.deprecation', 'Blockly.utils.toolbox']);
goog.addDependency('../../core/blockly_options.js', ['Blockly.BlocklyOptions'], [], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/blockly_options.js', ['Blockly.BlocklyOptions'], [], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/blocks.js', ['Blockly.Blocks'], [], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/blocks.js', ['Blockly.Blocks'], [], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/browser_events.js', ['Blockly.browserEvents'], ['Blockly.Touch', 'Blockly.utils.global'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/browser_events.js', ['Blockly.browserEvents'], ['Blockly.Touch', 'Blockly.utils.global'], {'lang': 'es6', 'module': 'goog'});
@@ -78,7 +78,7 @@ goog.addDependency('../../core/field_number.js', ['Blockly.FieldNumber'], ['Bloc
goog.addDependency('../../core/field_registry.js', ['Blockly.fieldRegistry'], ['Blockly.registry'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/field_registry.js', ['Blockly.fieldRegistry'], ['Blockly.registry'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/field_textinput.js', ['Blockly.FieldTextInput'], ['Blockly.DropDownDiv', 'Blockly.Events', 'Blockly.Events.BlockChange', 'Blockly.Field', 'Blockly.Msg', 'Blockly.WidgetDiv', 'Blockly.browserEvents', 'Blockly.dialog', 'Blockly.fieldRegistry', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.KeyCodes', 'Blockly.utils.aria', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.userAgent'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/field_textinput.js', ['Blockly.FieldTextInput'], ['Blockly.DropDownDiv', 'Blockly.Events', 'Blockly.Events.BlockChange', 'Blockly.Field', 'Blockly.Msg', 'Blockly.WidgetDiv', 'Blockly.browserEvents', 'Blockly.dialog', 'Blockly.fieldRegistry', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.KeyCodes', 'Blockly.utils.aria', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.userAgent'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/field_variable.js', ['Blockly.FieldVariable'], ['Blockly.Events.BlockChange', 'Blockly.FieldDropdown', 'Blockly.Msg', 'Blockly.VariableModel', 'Blockly.Variables', 'Blockly.Xml', 'Blockly.fieldRegistry', 'Blockly.internalConstants', 'Blockly.utils', 'Blockly.utils.Size', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/field_variable.js', ['Blockly.FieldVariable'], ['Blockly.Events.BlockChange', 'Blockly.FieldDropdown', 'Blockly.Msg', 'Blockly.VariableModel', 'Blockly.Variables', 'Blockly.Xml', 'Blockly.fieldRegistry', 'Blockly.internalConstants', 'Blockly.utils', 'Blockly.utils.Size', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/flyout_base.js', ['Blockly.Flyout'], ['Blockly', 'Blockly.ComponentManager', 'Blockly.DeleteArea', 'Blockly.Events', 'Blockly.Events.BlockCreate', 'Blockly.Events.VarCreate', 'Blockly.FlyoutMetricsManager', 'Blockly.Gesture', 'Blockly.ScrollbarPair', 'Blockly.Tooltip', 'Blockly.Touch', 'Blockly.Variables', 'Blockly.WorkspaceSvg', 'Blockly.Xml', 'Blockly.blockRendering', 'Blockly.browserEvents', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.Svg', 'Blockly.utils.dom', 'Blockly.utils.idGenerator', 'Blockly.utils.object', 'Blockly.utils.toolbox', 'Blockly.utils.xml'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/flyout_base.js', ['Blockly.Flyout'], ['Blockly.ComponentManager', 'Blockly.DeleteArea', 'Blockly.Events', 'Blockly.Events.BlockCreate', 'Blockly.Events.VarCreate', 'Blockly.FlyoutMetricsManager', 'Blockly.Gesture', 'Blockly.ScrollbarPair', 'Blockly.Tooltip', 'Blockly.Touch', 'Blockly.Variables', 'Blockly.WorkspaceSvg', 'Blockly.Xml', 'Blockly.blockRendering', 'Blockly.browserEvents', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.Svg', 'Blockly.utils.dom', 'Blockly.utils.idGenerator', 'Blockly.utils.object', 'Blockly.utils.toolbox', 'Blockly.utils.xml'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/flyout_button.js', ['Blockly.FlyoutButton'], ['Blockly.Css', 'Blockly.browserEvents', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.Svg', 'Blockly.utils.dom', 'Blockly.utils.style'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/flyout_button.js', ['Blockly.FlyoutButton'], ['Blockly.Css', 'Blockly.browserEvents', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.Svg', 'Blockly.utils.dom', 'Blockly.utils.style'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/flyout_horizontal.js', ['Blockly.HorizontalFlyout'], ['Blockly.DropDownDiv', 'Blockly.Flyout', 'Blockly.Scrollbar', 'Blockly.WidgetDiv', 'Blockly.registry', 'Blockly.utils', 'Blockly.utils.Rect', 'Blockly.utils.object', 'Blockly.utils.toolbox'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/flyout_horizontal.js', ['Blockly.HorizontalFlyout'], ['Blockly.DropDownDiv', 'Blockly.Flyout', 'Blockly.Scrollbar', 'Blockly.WidgetDiv', 'Blockly.registry', 'Blockly.utils', 'Blockly.utils.Rect', 'Blockly.utils.object', 'Blockly.utils.toolbox'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/flyout_metrics_manager.js', ['Blockly.FlyoutMetricsManager'], ['Blockly.MetricsManager', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/flyout_metrics_manager.js', ['Blockly.FlyoutMetricsManager'], ['Blockly.MetricsManager', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
@@ -205,7 +205,7 @@ goog.addDependency('../../core/theme_manager.js', ['Blockly.ThemeManager'], ['Bl
goog.addDependency('../../core/toolbox/category.js', ['Blockly.ToolboxCategory'], ['Blockly', 'Blockly.Css', 'Blockly.ToolboxItem', 'Blockly.registry', 'Blockly.utils', 'Blockly.utils.aria', 'Blockly.utils.colour', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.toolbox'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/toolbox/category.js', ['Blockly.ToolboxCategory'], ['Blockly', 'Blockly.Css', 'Blockly.ToolboxItem', 'Blockly.registry', 'Blockly.utils', 'Blockly.utils.aria', 'Blockly.utils.colour', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.toolbox'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/toolbox/collapsible_category.js', ['Blockly.CollapsibleToolboxCategory'], ['Blockly.ToolboxCategory', 'Blockly.ToolboxSeparator', 'Blockly.registry', 'Blockly.utils.aria', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.toolbox'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/toolbox/collapsible_category.js', ['Blockly.CollapsibleToolboxCategory'], ['Blockly.ToolboxCategory', 'Blockly.ToolboxSeparator', 'Blockly.registry', 'Blockly.utils.aria', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.toolbox'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/toolbox/separator.js', ['Blockly.ToolboxSeparator'], ['Blockly.Css', 'Blockly.ToolboxItem', 'Blockly.registry', 'Blockly.utils.dom', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/toolbox/separator.js', ['Blockly.ToolboxSeparator'], ['Blockly.Css', 'Blockly.ToolboxItem', 'Blockly.registry', 'Blockly.utils.dom', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/toolbox/toolbox.js', ['Blockly.Toolbox'], ['Blockly', 'Blockly.BlockSvg', 'Blockly.CollapsibleToolboxCategory', 'Blockly.ComponentManager', 'Blockly.Css', 'Blockly.DeleteArea', 'Blockly.Events', 'Blockly.Events.ToolboxItemSelect', 'Blockly.Options', 'Blockly.Touch', 'Blockly.browserEvents', 'Blockly.registry', 'Blockly.utils', 'Blockly.utils.KeyCodes', 'Blockly.utils.Rect', 'Blockly.utils.aria', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.toolbox'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/toolbox/toolbox.js', ['Blockly.Toolbox'], ['Blockly', 'Blockly.BlockSvg', 'Blockly.CollapsibleToolboxCategory', 'Blockly.ComponentManager', 'Blockly.Css', 'Blockly.DeleteArea', 'Blockly.Events', 'Blockly.Events.ToolboxItemSelect', 'Blockly.Options', 'Blockly.Touch', 'Blockly.browserEvents', 'Blockly.common', 'Blockly.registry', 'Blockly.utils', 'Blockly.utils.KeyCodes', 'Blockly.utils.Rect', 'Blockly.utils.aria', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.toolbox'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/toolbox/toolbox_item.js', ['Blockly.ToolboxItem'], ['Blockly.utils.idGenerator'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/toolbox/toolbox_item.js', ['Blockly.ToolboxItem'], ['Blockly.utils.idGenerator'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/tooltip.js', ['Blockly.Tooltip'], ['Blockly.browserEvents', 'Blockly.common', 'Blockly.utils.deprecation', 'Blockly.utils.string'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/tooltip.js', ['Blockly.Tooltip'], ['Blockly.browserEvents', 'Blockly.common', 'Blockly.utils.deprecation', 'Blockly.utils.string'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/touch.js', ['Blockly.Touch'], ['Blockly.internalConstants', 'Blockly.utils.global', 'Blockly.utils.string'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/touch.js', ['Blockly.Touch'], ['Blockly.internalConstants', 'Blockly.utils.global', 'Blockly.utils.string'], {'lang': 'es6', 'module': 'goog'});
@@ -244,7 +244,7 @@ goog.addDependency('../../core/workspace_comment.js', ['Blockly.WorkspaceComment
goog.addDependency('../../core/workspace_comment_svg.js', ['Blockly.WorkspaceCommentSvg'], ['Blockly', 'Blockly.ContextMenu', 'Blockly.Css', 'Blockly.Events', 'Blockly.Events.CommentCreate', 'Blockly.Events.CommentDelete', 'Blockly.Events.CommentMove', 'Blockly.Events.Selected', 'Blockly.Touch', 'Blockly.WorkspaceComment', 'Blockly.browserEvents', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.Rect', 'Blockly.utils.Svg', 'Blockly.utils.dom', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/workspace_comment_svg.js', ['Blockly.WorkspaceCommentSvg'], ['Blockly', 'Blockly.ContextMenu', 'Blockly.Css', 'Blockly.Events', 'Blockly.Events.CommentCreate', 'Blockly.Events.CommentDelete', 'Blockly.Events.CommentMove', 'Blockly.Events.Selected', 'Blockly.Touch', 'Blockly.WorkspaceComment', 'Blockly.browserEvents', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.Rect', 'Blockly.utils.Svg', 'Blockly.utils.dom', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/workspace_drag_surface_svg.js', ['Blockly.WorkspaceDragSurfaceSvg'], ['Blockly.utils', 'Blockly.utils.Svg', 'Blockly.utils.dom'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/workspace_drag_surface_svg.js', ['Blockly.WorkspaceDragSurfaceSvg'], ['Blockly.utils', 'Blockly.utils.Svg', 'Blockly.utils.dom'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/workspace_dragger.js', ['Blockly.WorkspaceDragger'], ['Blockly.utils.Coordinate'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/workspace_dragger.js', ['Blockly.WorkspaceDragger'], ['Blockly.utils.Coordinate'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/workspace_svg.js', ['Blockly.WorkspaceSvg'], ['Blockly.BlockSvg', 'Blockly.ComponentManager', 'Blockly.ConnectionDB', 'Blockly.ContextMenu', 'Blockly.ContextMenuRegistry', 'Blockly.Events', 'Blockly.Events.BlockCreate', 'Blockly.Events.ThemeChange', 'Blockly.Events.ViewportChange', 'Blockly.Gesture', 'Blockly.Grid', 'Blockly.MarkerManager', 'Blockly.MetricsManager', 'Blockly.Msg', 'Blockly.Options', 'Blockly.ThemeManager', 'Blockly.Themes.Classic', 'Blockly.TouchGesture', 'Blockly.Workspace', 'Blockly.WorkspaceAudio', 'Blockly.Xml', 'Blockly.blockRendering', 'Blockly.browserEvents', 'Blockly.common', 'Blockly.internalConstants', 'Blockly.registry', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.Rect', 'Blockly.utils.Size', 'Blockly.utils.Svg', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.toolbox'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/workspace_svg.js', ['Blockly.WorkspaceSvg'], ['Blockly.BlockSvg', 'Blockly.ComponentManager', 'Blockly.ConnectionDB', 'Blockly.ContextMenu', 'Blockly.ContextMenuRegistry', 'Blockly.DropDownDiv', 'Blockly.Events', 'Blockly.Events.BlockCreate', 'Blockly.Events.ThemeChange', 'Blockly.Events.ViewportChange', 'Blockly.Gesture', 'Blockly.Grid', 'Blockly.MarkerManager', 'Blockly.MetricsManager', 'Blockly.Msg', 'Blockly.Options', 'Blockly.ThemeManager', 'Blockly.Themes.Classic', 'Blockly.Tooltip', 'Blockly.TouchGesture', 'Blockly.WidgetDiv', 'Blockly.Workspace', 'Blockly.WorkspaceAudio', 'Blockly.Xml', 'Blockly.blockRendering', 'Blockly.browserEvents', 'Blockly.common', 'Blockly.internalConstants', 'Blockly.registry', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.Rect', 'Blockly.utils.Size', 'Blockly.utils.Svg', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.utils.toolbox'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/xml.js', ['Blockly.Xml'], ['Blockly.Events', 'Blockly.inputTypes', 'Blockly.utils.Size', 'Blockly.utils.dom', 'Blockly.utils.xml'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/xml.js', ['Blockly.Xml'], ['Blockly.Events', 'Blockly.inputTypes', 'Blockly.utils.Size', 'Blockly.utils.dom', 'Blockly.utils.xml'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/zoom_controls.js', ['Blockly.ZoomControls'], ['Blockly.ComponentManager', 'Blockly.Css', 'Blockly.Events', 'Blockly.Events.Click', 'Blockly.Touch', 'Blockly.browserEvents', 'Blockly.internalConstants', 'Blockly.uiPosition', 'Blockly.utils.Rect', 'Blockly.utils.Size', 'Blockly.utils.Svg', 'Blockly.utils.dom'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/zoom_controls.js', ['Blockly.ZoomControls'], ['Blockly.ComponentManager', 'Blockly.Css', 'Blockly.Events', 'Blockly.Events.Click', 'Blockly.Touch', 'Blockly.browserEvents', 'Blockly.internalConstants', 'Blockly.uiPosition', 'Blockly.utils.Rect', 'Blockly.utils.Size', 'Blockly.utils.Svg', 'Blockly.utils.dom'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('base.js', [], []); goog.addDependency('base.js', [], []);

View File

@@ -39,7 +39,8 @@ suite('Key Down', function() {
suite('Escape', function() { suite('Escape', function() {
setup(function() { setup(function() {
this.event = createKeyDownEvent(Blockly.utils.KeyCodes.ESC, 'NotAField'); this.event = createKeyDownEvent(Blockly.utils.KeyCodes.ESC, 'NotAField');
this.hideChaffSpy = sinon.spy(Blockly, 'hideChaff'); this.hideChaffSpy = sinon.spy(
Blockly.WorkspaceSvg.prototype, 'hideChaff');
}); });
test('Simple', function() { test('Simple', function() {
Blockly.onKeyDown(this.event); Blockly.onKeyDown(this.event);
@@ -60,7 +61,8 @@ suite('Key Down', function() {
suite('Delete Block', function() { suite('Delete Block', function() {
setup(function() { setup(function() {
this.hideChaffSpy = sinon.spy(Blockly, 'hideChaff'); this.hideChaffSpy = sinon.spy(
Blockly.WorkspaceSvg.prototype, 'hideChaff');
setSelectedBlock(this.workspace); setSelectedBlock(this.workspace);
this.deleteSpy = sinon.spy(Blockly.selected, 'dispose'); this.deleteSpy = sinon.spy(Blockly.selected, 'dispose');
}); });
@@ -94,7 +96,8 @@ suite('Key Down', function() {
setup(function() { setup(function() {
setSelectedBlock(this.workspace); setSelectedBlock(this.workspace);
this.copySpy = sinon.spy(Blockly.clipboard, 'copy'); this.copySpy = sinon.spy(Blockly.clipboard, 'copy');
this.hideChaffSpy = sinon.spy(Blockly, 'hideChaff'); this.hideChaffSpy = sinon.spy(
Blockly.WorkspaceSvg.prototype, 'hideChaff');
}); });
var testCases = [ var testCases = [
['Control C', createKeyDownEvent(Blockly.utils.KeyCodes.C, 'NotAField', [Blockly.utils.KeyCodes.CTRL])], ['Control C', createKeyDownEvent(Blockly.utils.KeyCodes.C, 'NotAField', [Blockly.utils.KeyCodes.CTRL])],
@@ -165,7 +168,8 @@ suite('Key Down', function() {
suite('Undo', function() { suite('Undo', function() {
setup(function() { setup(function() {
this.undoSpy = sinon.spy(this.workspace, 'undo'); this.undoSpy = sinon.spy(this.workspace, 'undo');
this.hideChaffSpy = sinon.spy(Blockly, 'hideChaff'); this.hideChaffSpy = sinon.spy(
Blockly.WorkspaceSvg.prototype, 'hideChaff');
}); });
var testCases = [ var testCases = [
['Control Z', createKeyDownEvent(Blockly.utils.KeyCodes.Z, 'NotAField', [Blockly.utils.KeyCodes.CTRL])], ['Control Z', createKeyDownEvent(Blockly.utils.KeyCodes.Z, 'NotAField', [Blockly.utils.KeyCodes.CTRL])],
@@ -211,7 +215,8 @@ suite('Key Down', function() {
suite('Redo', function() { suite('Redo', function() {
setup(function() { setup(function() {
this.redoSpy = sinon.spy(this.workspace, 'undo'); this.redoSpy = sinon.spy(this.workspace, 'undo');
this.hideChaffSpy = sinon.spy(Blockly, 'hideChaff'); this.hideChaffSpy = sinon.spy(
Blockly.WorkspaceSvg.prototype, 'hideChaff');
}); });
var testCases = [ var testCases = [
['Control Shift Z', createKeyDownEvent(Blockly.utils.KeyCodes.Z, 'NotAField', [Blockly.utils.KeyCodes.CTRL, Blockly.utils.KeyCodes.SHIFT])], ['Control Shift Z', createKeyDownEvent(Blockly.utils.KeyCodes.Z, 'NotAField', [Blockly.utils.KeyCodes.CTRL, Blockly.utils.KeyCodes.SHIFT])],
@@ -258,7 +263,8 @@ suite('Key Down', function() {
setup(function() { setup(function() {
this.ctrlYEvent = createKeyDownEvent(Blockly.utils.KeyCodes.Y, 'NotAField', [Blockly.utils.KeyCodes.CTRL]); this.ctrlYEvent = createKeyDownEvent(Blockly.utils.KeyCodes.Y, 'NotAField', [Blockly.utils.KeyCodes.CTRL]);
this.undoSpy = sinon.spy(this.workspace, 'undo'); this.undoSpy = sinon.spy(this.workspace, 'undo');
this.hideChaffSpy = sinon.spy(Blockly, 'hideChaff'); this.hideChaffSpy = sinon.spy(
Blockly.WorkspaceSvg.prototype, 'hideChaff');
}); });
test('Simple', function() { test('Simple', function() {
Blockly.onKeyDown(this.ctrlYEvent); Blockly.onKeyDown(this.ctrlYEvent);

View File

@@ -135,7 +135,8 @@ suite('Toolbox', function() {
}); });
test('Toolbox clicked -> Should close flyout', function() { test('Toolbox clicked -> Should close flyout', function() {
var hideChaffStub = sinon.stub(Blockly, "hideChaff"); var hideChaffStub = sinon.stub(
Blockly.WorkspaceSvg.prototype, "hideChaff");
var evt = new MouseEvent('click', {}); var evt = new MouseEvent('click', {});
this.toolbox.HtmlDiv.dispatchEvent(evt); this.toolbox.HtmlDiv.dispatchEvent(evt);
sinon.assert.calledOnce(hideChaffStub); sinon.assert.calledOnce(hideChaffStub);