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)

参数

token

token of application, root element

testability

Testability hook

Unregisters an application.

unregisterApplication(token: any)

参数

token

token of application, root element

Unregisters all applications

unregisterAllApplications()

参数

没有参数。

Get a testability hook associated with the application

getTestability(elem: any): Testability | null

参数

elem

root element

返回值

Testability | null

Get all registered testabilities

getAllTestabilities(): Testability[]

参数

没有参数。

返回值

Testability[]

Get all registered applications(root elements)

getAllRootElements(): any[]

参数

没有参数。

返回值

any[]

Find testability of a node in the Tree

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

参数

elem

node

findInAncestors

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

可选. 默认值是 true.

返回值

Testability | null

注解

@Injectable()