我正在为我的其中一个组件文件编写规范文件,其中使用了window.location.reload() 。
toggleFloatingFilter() {
this.hasFloatingFilter = !this.hasFloatingFilter;
this.clearSelectedRows();
this.gridApi.setRowData(this.rowData);
if (!this.hasFloatingFilter) {
this.gridApi.setFilterModel(null);
this.loadData();
}
setTimeout(() => {
this.gridApi.refreshHeader();
}, 0);
window.location.reload();
}
当我运行测试时,一旦它命中window.location.reload()部分,测试就会从头开始并重复进行。我能知道如何在单元测试中跳过window.location.reload
明月笑刀无情
相关分类