Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7576825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:01:00+00:00 2026-05-30T17:01:00+00:00

I have a 1 second jQuery .animate action that launches 5 seconds after page

  • 0

I have a 1 second jQuery .animate action that launches 5 seconds after page load. I set up a Sinon timer in my Jasmine unit testing code and test after a tick of 7 seconds to see if the post-animation properties are as they should be.

It doesn’t work right, so I’ve placed an instance of the animation itself on my Jasmine HTML test page to better see what’s going on.

  • In Firefox and Chrome, the page loads, the animation function is called, the unit test immediately fails, and then (also immediately) the animation visibly occurs.

  • In IE, Opera and Safari, the page loads, the animation function is called, the unit test immediately fails, and the animation never visibly occurs.

What I hoped for was the following (in all browsers):

  • The page loads, the animation function is called, the animation completes instantaneously, and the unit test immediately succeeds.

Looking at Sinon’s documentation, it’s fake timers cover the following processes:
setTimeout, clearTimeout, setInterval, clearInterval, Date

I don’t know how jQuery’s animation works, but I imagine it is using CSS to transition, and CSS transitions are not covered in Sinon’s useFakeTimers, so I imagine this is the problem. However, if I’m right about the problem I still need a solution.

Maybe I should try something other than Sinon? Jasmine’s waits() works perfectly in this test, but is incredibly impractical for impatient folks like myself.

Any other suggestions? Please keep in mind that I am new to JS unit testing, so vague answers will confuse me more than help me. ;o)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:01:02+00:00Added an answer on May 30, 2026 at 5:01 pm

    You can use jQuery off to turn off jQuery effects:

    jQuery.fx.off = true
    

    This won’t solve your problem of the inital 7 second wait for your event to fire but it does mean you can test that the DOM has been changed as you expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jQuery timer going and it seems to mess up after 2
I have this jquery code: $(.button-banc).hover(function() { $(.button-banc img) .animate({ top: -21px }, 200).animate({
I have a question about a function that I am writing with Jquery posted
I have made a Web page using jquery and php where all files are
I have these two things happen in my jQuery-animated website: $('#myFirstDiv').animate({top: 15%}, 3000); $('#mySecondDiv').animate({bottom:
Possible Duplicate: jQuery delay between animations I have created two functions: One that animates
I have two sets of items, one that I have my jQuery treating the
With event delegation in jQuery 1.6, you can respond to events that have bubbled
we want to have the second biggest element. We first use ANY to exclude
I have a table of music albums. I have a second table of album

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.