Use Capybara to disable animations in tests

We were doing it manually, but Capybara offers an option which does the
exact same thing.

This way we also apply the NoJavascriptTagHelper ERB rule, which
reported one error in the `disable_animations_in_tests` partial.
This commit is contained in:
Javi Martín
2021-02-05 17:01:46 +01:00
parent 1c2886debb
commit b214205d8f
4 changed files with 3 additions and 9 deletions

View File

@@ -8,6 +8,8 @@ linters:
enabled: true enabled: true
FinalNewline: FinalNewline:
enabled: true enabled: true
NoJavascriptTagHelper:
enabled: true
SelfClosingTag: SelfClosingTag:
enabled: false enabled: false
SpaceAroundErbTag: SpaceAroundErbTag:

View File

@@ -6,4 +6,3 @@
<%= javascript_include_tag "application", "data-turbolinks-track" => "reload" %> <%= javascript_include_tag "application", "data-turbolinks-track" => "reload" %>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<%= favicon_link_tag "favicon.ico" %> <%= favicon_link_tag "favicon.ico" %>
<%= render "layouts/disable_animations_in_tests" if Rails.env.test? %>

View File

@@ -1,8 +0,0 @@
<%= javascript_tag "jQuery.fx.off = true" %>
<style>
* {
transition: none !important;
animation-duration: 0s !important;
animation-delay: 0s !important;
}
</style>

View File

@@ -47,5 +47,6 @@ end
Capybara.exact = true Capybara.exact = true
Capybara.enable_aria_label = true Capybara.enable_aria_label = true
Capybara.disable_animation = true
OmniAuth.config.test_mode = true OmniAuth.config.test_mode = true