DEV: do not wait for closed composer event on test (#7221)

DEV: do not wait for closed composer event on test (#7221)

diff --git a/app/assets/javascripts/discourse/components/composer-editor.js.es6 b/app/assets/javascripts/discourse/components/composer-editor.js.es6
index 97a4237..c73d364 100644
--- a/app/assets/javascripts/discourse/components/composer-editor.js.es6
+++ b/app/assets/javascripts/discourse/components/composer-editor.js.es6
@@ -916,7 +916,10 @@ export default Ember.Component.extend({
     Ember.run.next(() => {
       $("#main-outlet").css("padding-bottom", 0);
       // need to wait a bit for the "slide down" transition of the composer
-      Ember.run.later(() => this.appEvents.trigger("composer:closed"), 400);
+      Ember.run.later(
+        () => this.appEvents.trigger("composer:closed"),
+        Ember.testing ? 0 : 400
+      );
     });
 
     if (this._enableAdvancedEditorPreviewSync())

GitHub sha: 45ef2ec8

2 Likes

Note… if we only have a handful of tests we can always use sinon which we already include.

https://sinonjs.org/releases/v1.17.6/fake-timers/

Its a balancing act cc @pmusaraj

2 Likes