Skip to content

Instantly share code, notes, and snippets.

@JerrySievert
Created May 16, 2011 00:38
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 JerrySievert/973725 to your computer and use it in GitHub Desktop.
Save JerrySievert/973725 to your computer and use it in GitHub Desktop.
test for jsdom src attribute
env_with_src : function() {
var
html = "<html><body><p>hello world!</p></body></html>",
src = "window.attachedHere = 123";
jsdom.env({
html : html,
src : src,
done : function(errors, window) {
assertNull("error should not be null", errors);
assertNotNull("window should be valid", window.location);
assertEquals("script should execute on our window", window.attachedHere, 123);
assertEquals("anchor text", window.document.getElementsByTagName("a").item(0).innerHTML, 'World');
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment