我想写一个测试,这样当我提交一个字符串时,@tracked array =0,0,0字段就会改变。我有一个简单的哈佛商学院<Textarea @value={{ input0 }} ></Textarea>。
如果输入为1,则跟踪的数组将变为[0,1,0]。我该怎么做??到目前为止,我有以下不起作用的代码:
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { click, render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | array', function(hooks) {
setupRenderingTest(hooks);
test('Textarea should display PLACE [0,1,0]"', async function(assert) {
await render(hbs`<Array />`);
assert.equal(find('textarea').value, 'testing"')
});
});发布于 2019-11-26 05:52:44
欢迎来到Stack Overflow!
看起来你被window.find欺骗了,这不是你想要的,你需要来自@ember/test-helpers的find。
替换:
import { click, render } from '@ember/test-helpers';
通过以下方式:
import { click, find, render } from '@ember/test-helpers';
祝好运!
https://stackoverflow.com/questions/58923944
复制相似问题