我有一个文本区域,它已经使用 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/