Skip to content

Instantly share code, notes, and snippets.

View nitrosx's full-sized avatar

Max Novelli nitrosx

  • European Spallation Source
View GitHub Profile
@jdhenckel
jdhenckel / MockElement.ts
Last active July 26, 2024 08:58
Mock DOM Document and Element in TypeScript for Unit testing in Headless environment.
/*
This can be used in unit tests to simulate a DOM document.
I have implemented the bare minimum. Feel free to add more, or to change my implementation.
Sample Usage:
import 'jasmine';
import { MockElement } from './support/mock-element';