A
A
Absky2021-01-23 13:16:53
JavaScript
Absky, 2021-01-23 13:16:53

How to test the creation of a home element in a function using jest?

Good afternoon, I have a function that creates a dom element inside itself.

const myFunction = () => {
const myVariable= document.createElement('script');

window.addEventListener('event', () => {
// some content
}
 document.body.appendChild(myFunction);
}


How to catch using jest actions with dom inside this function?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question