使用select时,Ember.js测试失败 [英] Ember.js tests fail when using select

查看:107
本文介绍了使用select时,Ember.js测试失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ember 1.8.1,并从

I am using Ember 1.8.1 and I updated my code from

{{view Ember.Select content=items}}

to

{{view "select" content=items}}

现在的问题是我的测试失败,我得到这个错误:

The problem now is that my tests fail and I get this error:

Error: Assertion Failed: select must be a subclass or an instance of Ember.View, not 
at new Error (native)
at Error.EmberError (http://0.0.0.0:4201/assets/vendor.js:27425:23)
at Object.Ember.assert (http://0.0.0.0:4201/assets/vendor.js:17039:15)
at handlebarsGetView (http://0.0.0.0:4201/assets/vendor.js:20093:13)
at EmberObject.create.helper (http://0.0.0.0:4201/assets/vendor.js:22801:19)
at viewHelper (http://0.0.0.0:4201/assets/vendor.js:23051:25)
at Object.anonymous (nea-client/templates/components/modal-workflow-create.js:18:54)
at http://0.0.0.0:4201/assets/vendor.js:10863:33
at CoreView.extend.render (http://0.0.0.0:4201/assets/vendor.js:55473:20)
at EmberRenderer_createElement [as createElement] (http://0.0.0.0:4201/assets/vendor.js:52700:16)

任何想法如何解决这个问题?如果我将代码恢复为旧样式,则测试通过,但是我会收到一个弃用通知。

Any ideas how to fix this? If I revert the code to the old style the tests pass but I get a deprecation notice.

推荐答案

在您的测试中,

import Ember from 'ember';

moduleForComponent('my-foobar', 'MyFoobarComponent', {
  setup: function() {
    this.container.register('view:select', Ember.Select);
  }
}

这样的事情让我们有点动更接近于集成测试。现在谈论如何改进当前状态: https: //github.com/rwjblue/ember-qunit/issues/74

Doing this type of thing moves us a bit closer to integration tests. There is talk about how to improve the current state of things here: https://github.com/rwjblue/ember-qunit/issues/74

这篇关于使用select时,Ember.js测试失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆