Move a test function into utils

This commit is contained in:
Rachel Fenichel
2018-06-07 16:58:58 -07:00
parent d5795b8828
commit 3c6a29c705
2 changed files with 17 additions and 9 deletions

View File

@@ -29,15 +29,6 @@ goog.require('goog.testing.MockControl');
var mockControl_;
var workspace;
var savedFireFunc = Blockly.Events.fire;
function temporary_fireEvent(event) {
if (!Blockly.Events.isEnabled()) {
return;
}
Blockly.Events.FIRE_QUEUE_.push(event);
Blockly.Events.fireNow_();
}
function eventTest_setUp() {
workspace = new Blockly.Workspace();

View File

@@ -27,6 +27,23 @@
goog.require('goog.testing');
/**
* The normal blockly event fire function. We sometimes override this. This
* handle lets us reset after an override.
*/
var savedFireFunc = Blockly.Events.fire;
/**
* A helper function to replace Blockly.Events.fire in tests.
*/
function temporary_fireEvent(event) {
if (!Blockly.Events.isEnabled()) {
return;
}
Blockly.Events.FIRE_QUEUE_.push(event);
Blockly.Events.fireNow_();
}
/**
* Check that two arrays have the same content.
* @param {!Array.<string>} array1 The first array.