Help Angular by taking a 1 minute survey!Go to surveyHome

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
}
    

Methods

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

registerApplication(token: any, testability: Testability)
      
      registerApplication(token: any, testability: Testability)
    
Parameters
token any

token of application, root element

testability Testability

Testability hook

Unregisters an application.

unregisterApplication(token: any)
      
      unregisterApplication(token: any)
    
Parameters
token any

token of application, root element

Unregisters all applications

unregisterAllApplications()
      
      unregisterAllApplications()
    
Parameters

There are no parameters.

Get a testability hook associated with the application

getTestability(elem: any): Testability | null
      
      getTestability(elem: any): Testability | null
    
Parameters
elem any

root element

Returns

Testability | null

Get all registered testabilities

getAllTestabilities(): Testability[]
      
      getAllTestabilities(): Testability[]
    
Parameters

There are no parameters.

Returns

Testability[]

Get all registered applications(root elements)

getAllRootElements(): any[]
      
      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
      
      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