mercredi 10 juin 2020

How can I write unit test using Jest if I'm using setTimeout?

setTimeout(()=>{
var sortBtn = Array.from(document.querySelectorAll('.clsname'));
for(const item of sortBtn){
item.addEventListener('click',(e)=>{
    dataCollector('somestring',e.target);
  })
}
 },1000);

Data collector is a function that is performing some processing based on click

Aucun commentaire:

Enregistrer un commentaire