GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Docs
  • Tutorials
  • Playground
  • Reference
  • code
  • ComponentHarness
  • LocatorFactory
  • TestElement
  • LocatorFnResult
  • HarnessLoader

This view

  • Original page
  • New address

GeezerVison is showing next.angular.dev — LocatorFactory • Angular

API

    
      interface LocatorFactory {}
    
    

Gets a locator factory rooted at the document root.

@returnsLocatorFactory

The root element of this LocatorFactory as a TestElement.

Creates an asynchronous locator function that can be used to find a ComponentHarness instance or element under the root element of this LocatorFactory.

For example, given the following DOM and assuming DivHarness.hostSelector is 'div'

<div id="d1"></div><div id="d2"></div>

then we expect:

await lf.locatorFor(DivHarness, 'div')() // Gets a `DivHarness` instance for #d1
await lf.locatorFor('div', DivHarness)() // Gets a `TestElement` instance for #d1
await lf.locatorFor('span')()            // Throws because the `Promise` rejects
@paramqueriesT

A list of queries specifying which harnesses and elements to search for:

  • A string searches for elements matching the CSS selector specified by the string.
  • A ComponentHarness constructor searches for ComponentHarness instances matching the given class.
  • A HarnessPredicate searches for ComponentHarness instances matching the given predicate.
@returns() => Promise<LocatorFnResult<T>>

Creates an asynchronous locator function that can be used to find a ComponentHarness instance or element under the root element of this LocatorFactory.

For example, given the following DOM and assuming DivHarness.hostSelector is 'div'

<div id="d1"></div><div id="d2"></div>

then we expect:

await lf.locatorForOptional(DivHarness, 'div')() // Gets a `DivHarness` instance for #d1
await lf.locatorForOptional('div', DivHarness)() // Gets a `TestElement` instance for #d1
await lf.locatorForOptional('span')()            // Gets `null`
@paramqueriesT

A list of queries specifying which harnesses and elements to search for:

  • A string searches for elements matching the CSS selector specified by the string.
  • A ComponentHarness constructor searches for ComponentHarness instances matching the given class.
  • A HarnessPredicate searches for ComponentHarness instances matching the given predicate.
@returns() => Promise<LocatorFnResult<T> | null>

Creates an asynchronous locator function that can be used to find ComponentHarness instances or elements under the root element of this LocatorFactory.

For example, given the following DOM and assuming DivHarness.hostSelector is 'div' and IdIsD1Harness.hostSelector is '#d1'

<div id="d1"></div><div id="d2"></div>

then we expect:

// Gets [DivHarness for #d1, TestElement for #d1, DivHarness for #d2, TestElement for #d2]
await lf.locatorForAll(DivHarness, 'div')()
// Gets [TestElement for #d1, TestElement for #d2]
await lf.locatorForAll('div', '#d1')()
// Gets [DivHarness for #d1, IdIsD1Harness for #d1, DivHarness for #d2]
await lf.locatorForAll(DivHarness, IdIsD1Harness)()
// Gets []
await lf.locatorForAll('span')()
@paramqueriesT

A list of queries specifying which harnesses and elements to search for:

  • A string searches for elements matching the CSS selector specified by the string.
  • A ComponentHarness constructor searches for ComponentHarness instances matching the given class.
  • A HarnessPredicate searches for ComponentHarness instances matching the given predicate.
@returns() => Promise<LocatorFnResult<T>[]>
@returnsPromise<HarnessLoader>

Gets a HarnessLoader instance for an element under the root of this LocatorFactory.

@paramselectorstring

The selector for the root element.

@returnsPromise<HarnessLoader>

Gets a HarnessLoader instance for an element under the root of this LocatorFactory

@paramselectorstring

The selector for the root element.

@returnsPromise<HarnessLoader | null>

Gets a list of HarnessLoader instances, one for each matching element.

@paramselectorstring

The selector for the root element.

@returnsPromise<HarnessLoader[]>

Flushes change detection and async tasks captured in the Angular zone. In most cases it should not be necessary to call this manually. However, there may be some edge cases where it is needed to fully flush animation events.

@returnsPromise<void>

Waits for all scheduled or running async tasks to complete. This allows harness authors to wait for async tasks outside of the Angular zone.

@returnsPromise<void>
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.