W3cubDocs

/Angular 12

TestabilityRegistry

class final

A global registry of Testability instances for specific elements.

class TestabilityRegistry {
  registerApplication(token: any, testability: Testability)
  unregisterApplication(token: any)
  unregisterAllApplications()
  getTestability(elem: any): Testability | null
  getAllTestabilities(): Testability[]
  getAllRootElements(): any[]
  findTestabilityInTree(elem: Node, findInAncestors: boolean = true): Testability | null
}

Methods

Registers an application with a testability hook so that it can be tracked

registerApplication(token: any, testability: Testability)

Parameters
token any

token of application, root element

testability Testability

Testability hook

Unregisters an application.

unregisterApplication(token: any)

Parameters
token any

token of application, root element

Unregisters all applications

unregisterAllApplications()

Parameters

There are no parameters.

Get a testability hook associated with the application

getTestability(elem: any): Testability | null

Parameters
elem any

root element

Returns

Testability | null

Get all registered testabilities

getAllTestabilities(): Testability[]

Parameters

There are no parameters.

Returns

Testability[]

Get all registered applications(root elements)

getAllRootElements(): any[]

Parameters

There are no parameters.

Returns

any[]

Find testability of a node in the Tree

findTestabilityInTree(elem: Node, findInAncestors: boolean = true): Testability | null

Parameters
elem Node

node

findInAncestors boolean

whether finding testability in ancestors if testability was not found in current node

Optional. Default is true.

Returns

Testability | null

© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v12.angular.io/api/core/TestabilityRegistry