我正在用integration component进行ember-qunit测试。因此,如何获得弹出模态正文文本一旦它从一个动作打开。
文本-bar-test
test('it renders with title', function(assert) {
assert.expect(1);
this.render(hbs`{{text-bar}}`);
this.$('.open-app').click(); // opening from text-bar hbs template
assert.equal(this.$('.body-text').html(), 'its modal-body text', 'Modal body text test once opens');
});发布于 2018-07-23 13:53:55
您将需要使用一个成员的异步测试助手,以帮助管理这一点。单击事件发生,然后会有一些额外的任务正在运行(比如动画和诸如此类的事情)。
有一个名为ember的包,您需要使用wait或waitFor助手:https://github.com/emberjs/ember-test-helpers/blob/master/API.md#waitfor。
ember指南在这里展示了这个示例:waiting-on-asynchronous-behavior
如果您使用的是3.x版本,可以使用async/await语法,这会使事情变得更好:waiting-on-asynchronous-behavior
https://stackoverflow.com/questions/51437758
复制相似问题