Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if Ember is in testing mode

Does anyone know how to check if Ember is in testing mode?

I'm writing acceptance tests in Ember, and they are made difficult by some jQuery animations in the app, which run asynchronously outside of Ember's run loop and won't complete until after the test has already finished. Using wait helpers like andThen(...) doesn't wait for the animations to finish, because they are outside the run loop.

I don't really need to do acceptance testing of the animations, just of the DOM state after the animations finish, so to make things simple I'd like to disable the animations during acceptance testing. So I need to be able to check if Ember is in testing mode.

I am using Ember version 1.10.1

like image 262
Jordan Avatar asked Mar 10 '23 15:03

Jordan


2 Answers

Nevermind, it's as simple as Ember.testing. This will be set to true in testing mode, but otherwise it's undefined, so I couldn't find it right away in the Chrome console.

like image 57
Jordan Avatar answered Mar 20 '23 11:03

Jordan


You can use if (Ember.testing) { // don't animate }

http://emberjs.com/api/classes/Ember.Test.html#property_testing

like image 30
kiwiupover Avatar answered Mar 20 '23 09:03

kiwiupover