Ember使用getOwner在验收测试中访问配置

时间:2016-08-04 22:49:48

标签: ember.js

在集成测试中,我可以使用:

import getOwner from 'ember-owner/get';

然后

moduleForComponent('mycomponent', 'Integration | Component | mycomponent', {
    integration: true,
    beforeEach() {
        const config = getOwner(this).resolveRegistration('config:environment');

在验收测试getOwner(this)未定义且我必须在没有getOwner的情况下执行此操作的唯一选项是:

moduleForAcceptance('Acceptance | cool test', {
    beforeEach() {
        const config = this.application.__container__.lookupFactory('config:environment');

有什么建议吗?

0 个答案:

没有答案