diff --git a/.eslintrc.js b/.eslintrc.js index 1edb6bd3d..48dcefa38 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -5,7 +5,8 @@ module.exports = { sourceType: 'module' }, globals: { - '$': true + '$': true, + 'process': true }, plugins: ['prettier'], extends: ['eslint:recommended', 'prettier'], diff --git a/app/javascript/packs/application-old.js b/app/javascript/packs/application-old.js index fd96d7653..a4f7c54ed 100644 --- a/app/javascript/packs/application-old.js +++ b/app/javascript/packs/application-old.js @@ -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; diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 611627650..78649f91c 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -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; diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 4a238cbaf..eda75709c 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -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 diff --git a/app/views/layouts/new_application.html.haml b/app/views/layouts/new_application.html.haml index e3d475479..493377efc 100644 --- a/app/views/layouts/new_application.html.haml +++ b/app/views/layouts/new_application.html.haml @@ -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);