From 3c6a29c705a053bbf0289f62dfdd4be6b9594329 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Thu, 7 Jun 2018 16:58:58 -0700 Subject: [PATCH] Move a test function into utils --- tests/jsunit/event_test.js | 9 --------- tests/jsunit/test_utilities.js | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/tests/jsunit/event_test.js b/tests/jsunit/event_test.js index e0ba78f20..8e88d651e 100644 --- a/tests/jsunit/event_test.js +++ b/tests/jsunit/event_test.js @@ -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(); diff --git a/tests/jsunit/test_utilities.js b/tests/jsunit/test_utilities.js index 381e9134e..36469ee29 100644 --- a/tests/jsunit/test_utilities.js +++ b/tests/jsunit/test_utilities.js @@ -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.} array1 The first array.