Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
Angular has a new websiteHead to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

TestabilityRegistry

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 }

Provided in

  • 'platform'

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