The goog.testing.dom Namespace

.assertHtmlContentsMatch(htmlPattern, actual, opt_strictAttributes)

Assert that the html in {@code actual} is substantially similar to htmlPattern. This method tests for the same set of styles, for the same order of nodes, and the presence of attributes. Breaking whitespace nodes are ignored. Elements can be annotated with classnames corresponding to keys in goog.userAgent and will be expected to show up in that user agent and expected not to show up in others.

htmlPattern {string}
The pattern to match.
actual {!Element}
The element to check: its contents are matched against the HTML pattern.
opt_strictAttributes {boolean=}
If false, attributes that appear in htmlPattern must be in actual, but actual can have attributes not present in htmlPattern. If true, htmlPattern and actual must have the same set of attributes. Default is false.

.assertHtmlMatches(htmlPattern, actual)

Assert that the html in {@code actual} is substantially similar to htmlPattern. This method tests for the same set of styles, and for the same order of nodes. Breaking whitespace nodes are ignored. Elements can be annotated with classnames corresponding to keys in goog.userAgent and will be expected to show up in that user agent and expected not to show up in others.

htmlPattern {string}
The pattern to match.
actual {string}
The html to check.

.assertNodesMatch(it, array)

Tests if the given iterator over nodes matches the given Array of node descriptors. Throws an error if any match fails.

it {goog.iter.Iterator}
An iterator over nodes.
array {Array.<Node|number|string>}
Array of node descriptors to match against. Node descriptors can be any of the following: Node: Test if the two nodes are equal. number: Test node.nodeType == number. string starting with '#': Match the node's id with the text after "#". other string: Match the text node's contents.

.assertRangeEquals(start, startOffset, end, endOffset, range)

Assert the end points of a range. Notice that "Are two ranges visually identical?" and "Do two ranges have the same endpoint?" are independent questions. Two visually identical ranges may have different endpoints. And two ranges with the same endpoints may be visually different.

start {Node}
The expected start node.
startOffset {number}
The expected start offset.
end {Node}
The expected end node.
endOffset {number}
The expected end offset.
range {goog.dom.AbstractRange}
The actual range.

.exposeNode(node)

Exposes a node as a string.

node {Node}
A node.
returns {string}
A string representation of the node.

.exposeRange(range)

Exposes the nodes of a range wrapper as a string.

range {goog.dom.AbstractRange}
A range.
returns {string}
A string representation of the range.

.findTextNode(textOrRegexp, root)

Finds the first text node descendant of root with the given content. Note that this operates on a text node level, so if text nodes get split this may not match the user visible text. Using normalize() may help here.

textOrRegexp {string|RegExp}
The text to find, or a regular expression to find a match of.
root {Element}
The element to search in.
returns {Node}
The first text node that matches, or null if none is found.