dom-sandbox
super simple dom sandboxing for testing
Last updated 6 years ago by jarofghosts .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install dom-sandbox 
SYNC missed versions from official npm registry.

dom-sandbox

Build Status npm install

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 = require('dom-sandbox')

var testWidget = require('../widget/to/test')

dom('<div id="test-div"><span rel="something-necessary"></span></div>')

testWidget(document.getElementById('test-div'))

or

var dom = require('dom-sandbox')

var testWidget = require('../something/else')

testWidget(dom()) // pass the element directly

Notes

  • Also provides a .destroy() method that removes the generated element from the DOM.

license

MIT

Current Tags

  • 0.0.1                                ...           latest (6 years ago)

2 Versions

  • 0.0.1                                ...           6 years ago
  • 0.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (4)
Dependents (2)

Copyright 2014 - 2017 © taobao.org |