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
}
actual
{!Element
}
opt_strictAttributes
{boolean
=}
.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
}
actual
{string
}
.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
}
array
{Array
.<Node
|number
|string
>}
.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
}
startOffset
{number
}
end
{Node
}
endOffset
{number
}
range
{goog.dom.AbstractRange
}
.exposeNode(node)
Exposes a node as a string.
node
{Node
}
string
}
.exposeRange(range)
Exposes the nodes of a range wrapper as a string.
range
{goog.dom.AbstractRange
}
string
}
.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
}
root
{Element
}
Node
}