-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: Velocity mock setting for UI testing #109
Comments
Do you mean you want all Velocity calls to do nothing? I can't speak on behalf of jQuery itself, but if you want Velocity calls to do nothing, just reassign Velocity to an empty function using |
Thanks for your quick reply! I should have been more clear but basically make it so the duration of all the animations is zero. I am running into an issue where I need to wait for the animation to be completed before continuing to the next step while testing. |
My pleasure. It's a good Q. For unit testing animations, I do asynchronous testing with qUnit. I presume you're doing UI testing, in which case I understand the unique problem you're trying to tackle, and I can't think of a solution off the top of my head. I'd have to hardcode in a feature for doing this directly inside of Velocity, e.g. passing in a flag to tell Velocity you want instantaneous changes. Can anyone else chime in if they would like this as well? The more +1's I get, the more likely I'll be to implement this. |
@julianshapiro, IMHO either users test it as is using an async testing library like you said or you (or someone) implement a new module - e.g. velocity.mock.js - that will allow this functionality. |
In contrary, I think it's could be a great feature. I'm working on a card game using Velocity, and that might be cool enough if I could let the players choose if they want skip all animation or not... It's maybe not a big feature in a card game, but a game containing longer animations... Like the "skip skill animations" in Pokemon, do you see what I mean ? |
@Oliboy50: For your specific case, just set the animation duration to @ydaniv: After some testing, it's apparent that it's incredibly convoluted and redundant to extract this into a mock file. In comparison, it'll take 2 lines of code to implement this directly into Velocity. @edance: So, I've concluded that I'll build this into Velocity. Expect it shortly. |
With the latest version of Velocity, you can now set Can you please test this out for your purposes and report back to me if this is sufficient and if you have any related requests/suggestions? |
Thanks so much @julianshapiro! I will check it out tonight and let you know. Thanks for making such an awesome product! |
Thank you for the awesome suggestion :-D @ydaniv was ultimately right, but a compromise had to be made. (I started building out a mock file, but it was ballooning in size due to Velocity's variable arguments syntax.) |
I would like to disable all my javascript animations while testing. Is there a way to do this with velocity? Something like $.fx.off?
The text was updated successfully, but these errors were encountered: