Testability
Testability
服务提供了可以从浏览器和诸如 Protractor 之类的服务访问的测试钩子。页面上每个自举的 Angular 应用程序都会有一个 Testability 实例。
The Testability service provides testing hooks that can be accessed from the browser. Each bootstrapped Angular application on the page will have an instance of Testability.
class Testability implements PublicTestability {
increasePendingRequestCount(): number
decreasePendingRequestCount(): number
isStable(): boolean
whenStable(doneCb: Function, timeout?: number, updateCb?: Function): void
getPendingRequestCount(): number
findProviders(using: any, provider: string, exactMatch: boolean): any[]
}
Provided in
方法
增加待处理请求的数量 Increases the number of pending request |
现在可以使用 Zone 来跟踪未决请求。 Deprecated pending requests are now tracked with zones. 参数没有参数。 返回值 |
减少待处理的请求数 Decreases the number of pending request |
现在使用 Zone 跟踪待处理的请求 Deprecated pending requests are now tracked with zones 参数没有参数。 返回值 |
关联的应用程序是否稳定 Whether an associated application is stable |
参数没有参数。 返回值
|
等待应用程序稳定并超时。如果在此之前已达到超时,则回调将收到未决的宏任务的列表,否则为 null。 Wait for the application to be stable with a timeout. If the timeout is reached before that happens, the callback receives a list of the macro tasks that were pending, otherwise null. | |||||||||
参数
返回值
|
获取待处理的请求数 Get the number of pending requests |
现在使用 Zone 跟踪待处理的请求 Deprecated pending requests are now tracked with zones 参数没有参数。 返回值 |
按名称查找提供者 Find providers by name |