Skip to content

Instantly share code, notes, and snippets.

@farnoy
Created January 25, 2012 22:15
Show Gist options
  • Save farnoy/1679200 to your computer and use it in GitHub Desktop.
Save farnoy/1679200 to your computer and use it in GitHub Desktop.
goog.require('goog.testing.jsunit');
goog.require('example');
goog.require('goog.dom');
goog.require('goog.dom.NodeType');
var testHtmlEscaping = function() {
example.sayHello('<b>greeting</b>');
var greetingEl = goog.dom.getElement('greeting');
assertEquals('The <h1 id="greeting"> element should only have one child node',
1, greetingEl.childNodes.length);
assertEquals('The <h1 id="greeting"> element should only contain text',
goog.dom.NodeType.TEXT, greetingEl.firstChild.nodeType);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment