From 929abd29baa218a8b4a9f7fd102bbdb4632509d7 Mon Sep 17 00:00:00 2001 From: Monica Kozbial Date: Wed, 12 Aug 2020 14:07:28 -0700 Subject: [PATCH] Update events fire stub. (#4165) --- tests/mocha/test_helpers.js | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/tests/mocha/test_helpers.js b/tests/mocha/test_helpers.js index 366d97d02..69f9a0261 100644 --- a/tests/mocha/test_helpers.js +++ b/tests/mocha/test_helpers.js @@ -66,20 +66,10 @@ function workspaceTeardown(workspace) { function createEventsFireStubFireImmediately_(clock) { var stub = sinon.stub(Blockly.Events, 'fire'); stub.callsFake(function(event) { - // TODO(#4070) Replace the fake function content with the following code - // that uses wrappedMethod after cleanup is added to ALL tests. - // Calling the original method will not consistently work if other tests - // add things to the event queue because the setTimeout call will not be - // added to the stubbed clock (so runAll cannot be used to control). - // // Call original method. - // stub.wrappedMethod.call(this, ...arguments); - // // Advance clock forward to run any queued events. - // clock.runAll(); - if (!Blockly.Events.isEnabled()) { - return; - } - Blockly.Events.FIRE_QUEUE_.push(event); - Blockly.Events.fireNow_(); + // Call original method. + stub.wrappedMethod.call(this, ...arguments); + // Advance clock forward to run any queued events. + clock.runAll(); }); return stub; }