Home

# Library goog.testing.dom

Function Summary
| `assertAttributesEqual_(string errorSuffix, ?Node expectedNode, ?Node actualNode, boolean strictAttributes)` Assert that the attributes of two Nodes are the same (ignoring any instances of the style attribute).

`assertHtmlContentsMatch(string htmlPattern, !Element actual, boolean= 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.

`assertHtmlMatches(string htmlPattern, string 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.

| `assertNodesMatch(?goog.iter.Iterator it, ?Array array)` Tests if the given iterator over nodes matches the given Array of node descriptors. Throws an error if any match fails.
| `assertRangeEquals(?Node start, number startOffset, ?Node end, number endOffset, ?goog.dom.AbstractRange 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.
| `checkUserAgents_(string userAgents) ⇒ boolean` Determines if the current user agent matches the specified string. Returns false if the string does specify at least one user agent but does not match the running agent.
| `compareClassAttribute_(?Node expectedNode, ?Node actualNode)` Assert the class attribute of actualNode is the same as the one in expectedNode, ignoring classes that are useragents.
| `compareIdAttributeForIe_(string expectedValue, ?Attr actualAttribute, boolean strictAttributes, string errorSuffix)` Compare id attributes for IE. In IE, if an element lacks an id attribute in the original HTML, the element object will still have such an attribute, but its value will be the empty string.
| `describeNode_(?Node node) ⇒ string` Describes the given node.
| `endTagMap_(?Node node, ?Object ignore, ?goog.dom.TagIterator iterator) ⇒ (Node|Object|null)` Map function that converts end tags to a specific object.
| `exposeNode(?Node node) ⇒ string` Exposes a node as a string.
| `exposeRange(?goog.dom.AbstractRange range) ⇒ string` Exposes the nodes of a range wrapper as a string.
| `findTextNode((RegExp|null|string) textOrRegexp, ?Element root) ⇒ ?Node` 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.
| `getAttributeValue_(!Node node, string name) ⇒ <Any Type>` Gets the value of a DOM attribute in deterministic way.
| `getExpectedText_(?Node node) ⇒ string` Determines the text to match from the given node, removing browser specification strings.
| `ignoreAttribute_(string name) ⇒ boolean` Whether to ignore the attribute.
| `nodeFilter_(?Node node) ⇒ boolean` Check if the given node is important. A node is important if it is a non-empty text node, a non-annotated element, or an element annotated to match on this user agent.