我想编写一个测试,当我提交一个字符串时,@tracked array =[0,0,0] 字段将会改变。
我有一个简单的 <Textarea @value={{ input0 }} ></Textarea>
对于 hbs。
如果输入是 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"')
});
});
最佳答案
欢迎来到 Stack Overflow!
看起来你正被 window.find
控制,这不是你想要的,你需要 @ember/test-helpers 的
。find
替换:
从 '@ember/test-helpers' 导入 { click, render };
与:
从 '@ember/test-helpers' 导入 { click, find, render };
祝你好运!
关于javascript - 编写 Ember Octane Component 测试以检查我提交表单后状态是否正确?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58923944/