How to wait for the end of grid.refresh() in the jasmine test?

Hi, When refreshing the grid in the jasmine test after update dataSource, refreshing occurs after the end of the test. How to wait for the end of grid.refresh()? 

https://stackblitz.com/edit/grid-refresh-test?embed=1&file=src/app/app.component.spec.ts


Maybe something like "await grid.refreshAsync()" or something similar to?


1 Reply

SK Sujith Kumar Rajkumar Syncfusion Team May 12, 2020 10:49 AM UTC

Hi Turboshurik, 
 
Greetings from Syncfusion support. 
 
Since your requirement is to update the Grid cell value, we suggest you to use the Grid’s setCellValue method to achieve this requirement. Using this method the cell value will be automatically updated in the Grid and you need refresh the Grid and wait till it is completed. 
 
it("should refresh the grid by updating the model", () => { 
    component.grid.setCellValue(3, 'name', 'NewValue'); 
    expect(component.grid.getCellFromIndex(2, 1).innerHTML).toBe("NewValue","grid not refreshing"); 
}); 
 
Modified sample, 
 
 
 
Please get back to us if you require any further assistance. 
 
Regards, 
Sujith R 


Loader.
Up arrow icon