admin管理员组文章数量:1327849
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 plete 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
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 plete 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
Share Improve this question asked Nov 16, 2016 at 17:40 JordanJordan 1014 bronze badges 1- Are you using the ember-cli? – kiwiupover Commented Nov 16, 2016 at 17:49
3 Answers
Reset to default 5Nevermind, 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.
You can use if (Ember.testing) { // don't animate }
http://emberjs./api/classes/Ember.Test.html#property_testing
I think the best way is to test the environment:
import ENV from 'app/config/environment';
myFunc() {
const isTesting = ENV.environment === ‘test’;
if (isTesting) {...};
}
Checkout https://github./emberjs/ember-qunit/issues/297#issuement-352408048.
本文标签: javascriptCheck if Ember is in testing modeStack Overflow
版权声明:本文标题:javascript - Check if Ember is in testing mode - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742219686a2435219.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论