Skip to content

Instantly share code, notes, and snippets.

@screamingworld
Created January 16, 2022 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save screamingworld/2ff1e99bdc0e6a853cad35dd9b8a38f9 to your computer and use it in GitHub Desktop.
Save screamingworld/2ff1e99bdc0e6a853cad35dd9b8a38f9 to your computer and use it in GitHub Desktop.
Base class for testing js/ts event listener
class TestSetting {
protected element:HTMLElement | null;
constructor () {
let div = document.createElement('div');
div.setAttribute('id', 'elementToClick');
document.body.appendChild(div);
this.element = document.getElementById('elementToClick');
}
public simulateOnClick(): void {
if (this.element == null) {
return;
}
this.element.click();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment