PERFORMANCE: disables jquery animations during testing

This commit is contained in:
Joffrey JAFFEUX 2018-04-24 18:29:26 +02:00 committed by GitHub
parent 18c27883e9
commit 59d4123316
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 10 deletions

View File

@ -416,18 +416,14 @@ export default createWidget('post-menu', {
const $heart = $(`[data-post-id=${attrs.id}] .toggle-like .d-icon`); const $heart = $(`[data-post-id=${attrs.id}] .toggle-like .d-icon`);
$heart.closest('button').addClass('has-like'); $heart.closest('button').addClass('has-like');
if (!Ember.testing) { const scale = [1.0, 1.5];
const scale = [1.0, 1.5]; return new Ember.RSVP.Promise(resolve => {
return new Ember.RSVP.Promise(resolve => { animateHeart($heart, scale[0], scale[1], () => {
animateHeart($heart, scale[0], scale[1], () => { animateHeart($heart, scale[1], scale[0], () => {
animateHeart($heart, scale[1], scale[0], () => { this.sendWidgetAction('toggleLike').then(() => resolve());
this.sendWidgetAction('toggleLike').then(() => resolve());
});
}); });
}); });
} else { });
this.sendWidgetAction('toggleLike');
}
}, },
refreshLikes() { refreshLikes() {

View File

@ -169,4 +169,7 @@ Object.keys(requirejs.entries).forEach(function(entry) {
} }
}); });
// forces 0 as duration for all jquery animations
jQuery.fx.off = true;
resetSite(); resetSite();