goog.testing.editor.TestHelper
Classgoog.testing.editor.TestHelper
> goog.Disposable
goog.testing.editor.TestHelper(root)
Create a new test controller.
root
{Element
}
.addOnDisposeCallback(callback, opt_scope)
Inherited from goog.Disposable
.
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.
callback
{!Function
}
opt_scope
{Object
=}
.assertHtmlMatches(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.
htmlPattern
{string
}
.creationStack
{string
}Inherited from goog.Disposable
.
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
.dispose()
Inherited from goog.Disposable
.
Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.
void
}
.disposeInternal()
[protected]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(textOrRegexp)
Finds the first text node descendant of root with the given content.
textOrRegexp
{string
|RegExp
}
Node
}
.getDisposed
[deprecated]Deprecated. Use {@link #isDisposed} instead.
Inherited from goog.Disposable
.
boolean
}
.isDisposed()
Inherited from goog.Disposable
.
boolean
}
.registerDisposable(disposable)
Inherited from goog.Disposable
.
Associates a disposable object with this object so that they will be disposed together.
disposable
{goog.disposable.IDisposable
}
.select(from, fromOffset, opt_to, 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.
from
{Node
|string
}
fromOffset
{number
}
opt_to
{Node
|string
=}
opt_toOffset
{number
=}
.setRoot(root)
Selects a new root element.
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.