setting up jsdom for testing in node
var jsdom = require('jsdom');
//Turn off all the things we don't want.
jsdom.defaultDocumentFeatures = {
//Don't bring in outside resources
FetchExternalResources : false,
//Don't process them
ProcessExternalResources : false,
//Don't expose Mutation events (for performance)
MutationEvents : false,
//Do not use their implementation of QSA
QuerySelector : false
};
var dom = jsdom.defaultLevel;
//Hack in focus and blur methods so they don't fail when a module calls them
dom.Element.prototype.blur = function() {};//will need to fire an event for testing
dom.Element.prototype.focus = function() {};//will need to fire an event for testing
//Create the document and window
var document = jsdom.jsdom("<html><head><title></title></head><body><h1>Hello from within node!</h1></body></html>"),
window = document.createWindow();