Home

# Class goog.testing.editor.TestHelper

Create a new test controller.

extends goog.Disposable

Instance Method Summary

`assertHtmlMatches(string htmlPattern)`

Assert that the html in 'root' 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.

`disposeInternal()`

Deletes or nulls out any references to COM objects, DOM nodes, or other disposable objects. Classes that extend {@code goog.Disposable} should override this method. Not reentrant. To avoid calling it twice, it must only be called from the subclass' {@code disposeInternal} method. Everywhere else the public {@code dispose} method must be used. For example:

    mypackage.MyClass = function() {
    goog.base(this);
    // Constructor logic specific to MyClass.
    ...
    };
    goog.inherits(mypackage.MyClass, goog.Disposable);

    mypackage.MyClass.prototype.disposeInternal = function() {
    goog.base(this, 'disposeInternal');
    // Dispose logic specific to MyClass.
    ...
    };

| `findTextNode((RegExp|null|string) textOrRegexp) ⇒ ?Node` Finds the first text node descendant of root with the given content.
| `select((Node|null|string) from, number fromOffset, (Node|null|string=) opt_to, number= opt_toOffset)` Select from the given from offset in the given from node to the given to offset in the optionally given to node. If nodes are passed in, uses them, otherwise uses findTextNode to find the nodes to select. Selects a caret if opt_to and opt_toOffset are not given.
| `setRoot(?Element root)` Selects a new root element.
| `setUpEditableElement()` Make the root element editable. Alse saves its HTML to be restored in tearDown.
| `tearDownEditableElement()` Reset the element previously initialized, restoring its HTML and making it non editable.