specs: fix disabling jQuery animations during tests

This commit is contained in:
Pierre de La Morinerie 2018-08-01 09:39:47 +00:00
parent 8d9b65e556
commit b7382375e2
5 changed files with 14 additions and 11 deletions

View file

@ -5,7 +5,8 @@ module.exports = {
sourceType: 'module'
},
globals: {
'$': true
'$': true,
'process': true
},
plugins: ['prettier'],
extends: ['eslint:recommended', 'prettier'],

View file

@ -18,8 +18,14 @@ Rails.start();
Turbolinks.start();
ActiveStorage.start();
// Disable jQuery-driven animations during tests
if (process.env['RAILS_ENV'] === 'test') {
jQuery.fx.off = true;
}
// Expose globals
window.Bloodhound = Bloodhound;
window.Chartkick = Chartkick;
// Export jQuery globally for legacy Javascript files used in the old design
window.$ = jQuery;
window.jQuery = jQuery;

View file

@ -4,6 +4,7 @@ import * as ActiveStorage from 'activestorage';
import Chartkick from 'chartkick';
import Highcharts from 'highcharts';
import jQuery from 'jquery';
import 'select2';
import 'typeahead.js';
@ -45,6 +46,11 @@ Rails.start();
Turbolinks.start();
ActiveStorage.start();
// Disable jQuery-driven animations during tests
if (process.env['RAILS_ENV'] === 'test') {
jQuery.fx.off = true;
}
// Expose globals
window.DS = window.DS || DS;
window.Chartkick = Chartkick;

View file

@ -14,7 +14,6 @@
= stylesheet_link_tag 'print', media: 'print', 'data-turbolinks-track': "reload"
= javascript_pack_tag 'application-old', defer: true, 'data-turbolinks-track': 'reload'
= javascript_include_tag 'application', defer: true, 'data-turbolinks-track': 'reload'
= csrf_meta_tags
:javascript
@ -26,14 +25,8 @@
#beta
Env Test
- if Rails.env == 'test'
%script{ type: 'text/javascript' }
(typeof jQuery !== 'undefined') && (jQuery.fx.off = true);
= render partial: 'layouts/ie_lt_10'
#wrap
.row
#header.navbar

View file

@ -44,6 +44,3 @@
= javascript_include_tag :xray
= yield :charts_js
- if Rails.env == "test"
%script{ type: "text/javascript" }
(typeof jQuery !== "undefined") && (jQuery.fx.off = true);