testing - 如何使用 fillIn 附加预填充的文本区域内容

标签 testing ember.js ember-testing

我有一个文本区域,它已经使用 fillIn 函数填充了值。但现在我想在同一个文本区域中附加另一个字符“@”。但是当我再次尝试使用 fillIn 时;它重写文本区域。我怎样才能附加文本。我需要它分两步进行。

HTML:

<textarea data-test-id='descriptor'></textarea>

测试:

test('testing-fillIn', async function(assert){
await fillIn(testSelector('descriptor'), 'First text ');
await fillIn(testSelector('descriptor'), '@');
});

输出应该是:第一个文本@

最佳答案

test('testing-fillIn', async function(assert){
await fillIn(testSelector('descriptor'), 'First text ');
var textVal =document.getElementById('textArea').val();
await fillIn(testSelector('descriptor'), textVal+'@');
});
<textarea id="textArea" data-test-id='descriptor'></textarea>

关于testing - 如何使用 fillIn 附加预填充的文本区域内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44885471/

相关文章:

testing - 在等待构建/测试/数据库迁移运行时我应该做什么?

javascript - EmberJS调用父组件方法的方法

javascript - ember 集成测试错误。处理异步副作用

java - 测试 Thymeleaf 表单/Spring MVC Controller 交互的最佳方法

apache-flex - AIR 图形用户界面测试

javascript - Ember在ember-data 1.13.8中获取相关记录

javascript - 使用 handlebars 或 markdown 输出模型属性

ember.js - 应用程序和测试中的 ember 事件触发顺序不同

ember.js - 如何为 ember-addon 中定义的组件添加集成测试

testing - 如何与 SWT_Window0 中的对象进行交互?