testing.editor.TestHelper Extends goog.Disposable
Create a new test controller.

Inheritance

Constructor

goog.testing.editor.TestHelper(root)

Parameters

root : Element
The root editable element.

Instance Methods

Public Protected Private
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.
Arguments:
htmlPattern : string
The pattern to match.
code »
disposeInternal()
No description.
code »
findTextNode(textOrRegexp) Node
Finds the first text node descendant of root with the given content.
Arguments:
textOrRegexp : string | RegExp
The text to find, or a regular expression to find a match of.
Returns: Node  The first text node that matches, or null if none is found.
code »
select(fromfromOffsetopt_toopt_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.
Arguments:
from : Node | string
Node or text of the node to start the selection at.
fromOffset : number
Offset within the above node to start the selection at.
opt_to : Node | string=
Node or text of the node to end the selection at.
opt_toOffset : number=
Offset within the above node to end the selection at.
code »
setRoot(root)
Selects a new root element.
Arguments:
root : Element
The root editable element.
code »
setUpEditableElement()
Make the root element editable. Alse saves its HTML to be restored in tearDown.
code »
tearDownEditableElement()
Reset the element previously initialized, restoring its HTML and making it non editable.
code »
addOnDisposeCallback(callbackopt_scope)
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.
Arguments:
callback : function(this:T):?
The callback function.
opt_scope : T=
An optional scope to call the callback in.
code »
dispose() void
Disposes of the object. If the object hasn't already been disposed of, calls #disposeInternal. Classes that extend goog.Disposable should override #disposeInternal in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.
Returns: void  Nothing.
code »
disposeInternal()
Deletes or nulls out any references to COM objects, DOM nodes, or other disposable objects. Classes that extend goog.Disposable should override this method. Not reentrant. To avoid calling it twice, it must only be called from the subclass' disposeInternal method. Everywhere else the public dispose method must be used. For example:
  mypackage.MyClass = function() {
    mypackage.MyClass.base(this, 'constructor');
    // Constructor logic specific to MyClass.
    ...
  };
  goog.inherits(mypackage.MyClass, goog.Disposable);

  mypackage.MyClass.prototype.disposeInternal = function() {
    // Dispose logic specific to MyClass.
    ...
    // Call superclass's disposeInternal at the end of the subclass's, like
    // in C++, to avoid hard-to-catch issues.
    mypackage.MyClass.base(this, 'disposeInternal');
  };
code »
getDisposed() boolean
Use #isDisposed instead. No description.
Returns: boolean  Whether the object has been disposed of.
code »
isDisposed() boolean
No description.
Returns: boolean  Whether the object has been disposed of.
code »
registerDisposable(disposable)
Associates a disposable object with this object so that they will be disposed together.
Arguments:
disposable : goog.disposable.IDisposable
that will be disposed when this object is disposed.
code »

Instance Properties

constructor :
No description.
Code »
root_ :
Convenience variable for root DOM element.
Code »
savedHtml_ :
The starting HTML of the editable element.
Code »
creationStack :
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
Code »
disposed_ :
Whether the object has been disposed of.
Code »
onDisposeCallbacks_ :
Callbacks to invoke when this object is disposed.
Code »

Static Properties

goog.testing.editor.TestHelper.superClass_ :
No description.
Code »

Package testing.editor

Package Reference