方法清除ST.future.Component的预填充数据



在使用ST.component("locator");API时,是否有方法清除输入字段?

使用ST.component("locator").setValue("");会导致以下错误:

TypeError: ST.component(...).setValue is not a function...




PS:旧论坛现在永久关闭了吗?有没有办法看待旧问题?

编辑:似乎其他论坛昨天关闭了,因此PS.

如果是ExtJS字段,则需要在Sencha Test中使用ST.fieldAPI,该字段具有setValue方法。此方法在更通用的ST.componentAPI上不可用。

ST.field('myfield')
.setValue('');

或者,如果它是一个普通的输入字段(而不是ExtJS组件(,那么您可以执行以下操作:

ST.element('@myfield')
.execute(function(field) {
field.dom.value = '';
});

最新更新