Angular jasmine单元测试框架fixture.detectChanges的实现原理
2023-09-14 09:04:02 时间
源代码:
fixture的类型是component-fixture,里面会调用_tick方法:
具体执行的detectChange逻辑,取决于Change Detect reference:
RootViewRef,执行view方面的change detect:
class RootViewRef extends ViewRef {
constructor(_view) {
super(_view);
this._view = _view;
}
detectChanges() {
detectChangesInRootView(this._view);
}
checkNoChanges() {
checkNoChangesInRootView(this._view);
}
get context() {
return null;
}
}
tickRootContext里要执行RenderComponentOrTemplate:
最后进入RefreshView的执行:
更多Jerry的原创文章,尽在:“汪子熙”:
相关文章
- 【华为云技术分享】三大前端技术(React,Vue,Angular)探密(上)
- [Angular] Using the platform agnostic Renderer & ElementRef
- [Angular 2] Inject Service with "Providers"
- [Angular 2] Component relative paths
- 使用Angular和Nodejs搭建聊天室
- [Angular] State provider solutions
- [Angular] HttpParams
- [Angular 2] Angular 2 Smart Components vs Presentation Components
- [Angular 2] More on *ngFor, @ContentChildren & QueryList<>
- [Angular 2] Handle Reactive Async opreations in Service
- [Angular 2] Rendering an Observable Date with the Async and Date Pipes
- 三种Web前端框架比较与介绍--Vue, react, angular
- Angular 依赖注入框架里 useExisting 和 useClass 的使用场景
- Angular reducer第一次被框架调用的单步调试细节
- 深入学习SAP UI5框架代码系列之八:谈谈 SAP UI5 的视图控件 ID,以及 SAP UI5 视图和 Angular 视图的异同
- Angular单元测试框架beforeEach和it的执行顺序
- Angular jasmine单元测试框架spec的运行时数据结构
- Angular jasmine单元测试框架里expect.toHaveBeenCalled的工作原理
- Angular 自定义 structural 指令的一个例子
- Angular reducer第一次被框架调用的单步调试细节
- Angular FormBuilder的工作原理