From 53e7050ce0c1bd873f239bce8ad81ba42c19d57a Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Fri, 1 Mar 2019 15:10:28 +0100 Subject: [PATCH] [REF] mail: stop using jQuery animate Problem is that jQuery animate uses jQuery deferreds, so it may happen in tests that we fold a thread window, and we have to wait for 2 (?) nextTick to see that the window is actually folded. We use a css transition instead, which produces the exact same result. --- .../js/thread_windows/abstract_thread_window.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/addons/mail/static/src/js/thread_windows/abstract_thread_window.js b/addons/mail/static/src/js/thread_windows/abstract_thread_window.js index ff5acfea0d2..7a38d337f24 100644 --- a/addons/mail/static/src/js/thread_windows/abstract_thread_window.js +++ b/addons/mail/static/src/js/thread_windows/abstract_thread_window.js @@ -83,6 +83,8 @@ var AbstractThreadWindow = Widget.extend({ displayStars: this.options.displayStars, }); + // animate the (un)folding of thread windows + this.$el.css({transition: 'height ' + this.FOLD_ANIMATION_DURATION + 'ms linear'}); if (this.isFolded()) { this.$el.css('height', this.HEIGHT_FOLDED); } else if (this.options.autofocus) { @@ -319,24 +321,14 @@ var AbstractThreadWindow = Widget.extend({ this._focusInput(); } } - this._animateFold(); + var height = this.isFolded() ? this.HEIGHT_FOLDED : this.HEIGHT_OPEN; + this.$el.css({height: height}); }, //-------------------------------------------------------------------------- // Private //-------------------------------------------------------------------------- - /** - * Called when there is a change of the fold state of the thread window. - * This method animates the change of fold state of this thread window. - * - * @private - */ - _animateFold: function () { - this.$el.animate({ - height: this.isFolded() ? this.HEIGHT_FOLDED : this.HEIGHT_OPEN - }, this.FOLD_ANIMATION_DURATION); - }, /** * Set the focus on the composer of the thread window. This operation is * ignored in mobile context.