dom-sandbox
super-simple dom sandboxing for tests
Why?
Often times during front-end testing you want to insert some HTML into the DOM or have a dummy element to render things into. This gives you a super-simple way to do that while also preventing you from:
- stomping on things that something like testling might need in the DOM
- creating tons of elements and forgetting to tear them down
- writing this boilerplate, albeit minimal
How?
var dom = var testWidget =
or
var dom = var testWidget = // pass the element directly
Notes
- Also provides a
.destroy()
method that removes the generated element from the DOM.
license
MIT