测试错误:在状态root.deleted.saved中尝试处理`didSetProperty` ...

时间:2014-11-19 21:03:19

标签: ember.js ember-data ember-cli

我将一些模型传递给一个组件,如下所示:

//templates/index.hbs
{{user-list users=controller}}

//templates/components/user-list.hbs
<button {{action 'newUser'}}>New user</button>

{{#each user in users}}
  {{#if user.isNew}}
    {{new-user-card user=user}}

  {{else}}
    {{user-card user=user}}

  {{/if}}
{{/each}}

//templates/components/new-user-card.hbs
{{input value=user.name}}

<button {{action='save'}}>Save</button>
<button {{action='cancel'}}>Cancel</button>

newUser操作仅在客户端上创建新模型,并仅在用户点击save时提交。 cancel上的NewUserCardComponent操作看起来像这样:

cancel: function() {
  this.get('user').deleteRecord();
}

当我点击我的应用程序时,这是有效的,但是当我在验收测试中运行此用户交互时,我收到以下错误:

Uncaught Error: Attempted to handle event `didSetProperty` on <admin@model:user::ember578:null> while in state root.deleted.saved. Called with {name: name, oldValue: undefined, originalValue: undefined, value: }.

有趣的是,测试在我开始ember server后第一次运行时完成,但每次失败后都会完成。

0 个答案:

没有答案