TestabilityRegistry

A global registry of Testabilityinstances 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
}
    

方法

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

registerApplication(token: any, testability: Testability)
      
      registerApplication(token: any, testability: Testability)
    
参数
token any

token of application, root element

testability Testability

Testability hook

Unregisters an application.

unregisterApplication(token: any)
      
      unregisterApplication(token: any)
    
参数
token any

token of application, root element

Unregisters all applications

unregisterAllApplications()
      
      unregisterAllApplications()
    
参数

没有参数。

Get a testability hook associated with the application

getTestability(elem: any): Testability | null
      
      getTestability(elem: any): Testability | null
    
参数
elem any

root element

返回值

Testability | null

Get all registered testabilities

getAllTestabilities(): Testability[]
      
      getAllTestabilities(): Testability[]
    
参数

没有参数。

返回值

Testability[]

Get all registered applications(root elements)

getAllRootElements(): any[]
      
      getAllRootElements(): any[]
    
参数

没有参数。

返回值

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
    
参数
elem Node

node

findInAncestors boolean

可选. 默认值是 true.

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

返回值

Testability | null