[50:7] extends: object
tharness.aus Component test harness. Provides an isolated mount container, helpers to mount, find, interact with, and unmount a single UI component, and a clean teardown so multiple test methods can share one setUp. Usage: class MyTests { h = null; @Before public setUp() { this.h = new TestHarness(); } @After public tearDown() { this.h.destroy(); } @Test(name = "renders the name") public rendersName() { this.h.mount(new HelloBadge("Sarah")); test.expectElementText(".hello-badge", "Hello, Sarah"); } } Every TestHarness creates its own div with id "test-harness-mount" and appends it to document.body. find / findAll queries are scoped to that div so a stale component left behind by a sibling test cannot leak into queries.
container
The test container Div this harness mounted into the body.
mounted
The last mount()-ed HNode.
TestHarness ()
Construct. Creates a detached container Div with a known id and appends it to document.body so the component under test sees a real live DOM subtree.
mount (Node)
Mount one component into the harness container. Replaces any previously-mounted component in the same container so multiple test methods can share one setUp.
Node Any HNode (typically a component under test).The mounted HNode.destroy ()
Tear down. Removes the container from the document; safe to call twice.
this objectfind (string Selector)
CSS selector query scoped to the harness container.
Selector CSS selector.HNode or null.findAll (string Selector)
CSS selector query returning every match, scoped to the harness container.
Selector CSS selector.List of HNode (possibly empty).resolve (SelectorOrEl)
Resolve a selector or HNode argument to an HNode. Selectors are scoped to the harness container.
SelectorOrEl CSS selector or HNode.HNode.click (SelectorOrEl)
Fire a real "click" event on the matching element. Listeners attached via HNode.addListener are invoked.
SelectorOrEl CSS selector or HNode.this objectfill (SelectorOrEl, string Value)
Set the value of an input / textarea / select-like element and fire "input" and "change" events so listeners observe the change the same way they would for a real user keystroke.
SelectorOrEl CSS selector or HNode.Value Value to set.this objectselectOption (SelectorOrEl, string OptionValue)
Select an option in a
SelectorOrEl CSS selector or HNode of the select element.OptionValue Option value attribute to select.this objecttoggle (SelectorOrEl)
Toggle a checkbox / radio by clicking it.
SelectorOrEl CSS selector or HNode.this objecttextOf (SelectorOrEl)
Return the innerHTML of an element. Use textOf for the most common "what's inside" check; Aussom HNode wrappers surface innerHTML as the user-visible text in setHtml/getHtml.
SelectorOrEl CSS selector or HNode.String text content.classesOf (SelectorOrEl)
Return the classList of an element as a list of strings.
SelectorOrEl CSS selector or HNode.List of class names (possibly empty).attrOf (SelectorOrEl, string Attr)
Read an attribute value, or null when missing.
SelectorOrEl CSS selector or HNode.Attr Attribute name.String value or null.html ()
Dump the mount container's innerHTML, useful for a failure diagnostic. Callers print it themselves.
innerHTML string of the container, or empty string after destroy().