module Tapioca::TestHelpers

Constants

VERSION

Public Class Methods

disable_animations() click to toggle source

Public: generates JavasCript code to disable all animations so that tests won't timeout waiting for animations to run.

  • Turns off jQuery.fx.

  • Turns off bootstrap transition support.

  • Removes the fade class from modal boxes since that uses css animations.

  • Overrides collapsible elements to avoid waiting for the height css transition.

# File lib/tapioca/test_helpers.rb, line 18
    def self.disable_animations
      javascript_tag <<-JAVASCRIPT
        $.fx.off = true;
        $.support.transition = false;

        var disableBootstrapTransitions = function() {
          $('.modal').removeClass('fade');
          $('.collapse').css({ 'transition': 'height 0.005s', '-webkit-transition': 'height 0.005s' });
        };
        $(disableBootstrapTransitions); $(document).ajaxComplete(disableBootstrapTransitions);
      JAVASCRIPT
    end