[Angular] Using NO_ERRORS_SCHEMA
2024-08-26 02:05:39
For example, when testing container component we might import lots of children components, but we didn't actually testing those children components. So we don't need to provide all those stuff:
TestBed.configureTestingModule({
imports: [
ReactiveFormsModule
],
declarations: [
StockBranchComponent,
StockCounterComponent,
StockProductsComponent,
StockSelectorComponent,
StockInventoryComponent
],
providers: [
{provide: StockInventoryService, useClass: MockStockInventoryService }
]
})
One way to sovle this is by providing '
NO_ERRORS_SCHEMA
'
import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; TestBed.configureTestingModule({
imports: [
ReactiveFormsModule
],
declarations: [
StockInventoryComponent
],
schemas: [NO_ERRORS_SCHEMA],
providers: [
{ provide: StockInventoryService, useClass: MockStockInventoryService }
]
});
最新文章
- 关于VS2010无法编译问题
- web接口开发与测试
- JavaWeb chapter9 JSP基础
- JavaScript:变量对象(Variable Object)
- 菜鸟学习Spring——60s利用JoinPoint获取参数的值和方法名称
- Struts2 cookie的存取
- Oracle的三种高可用集群方案
- 获取鼠标点击相对于Canva位置的2种方法
- 【转载】matlab如何判断一个点是否在多面体内
- formidable 表单文件和数据提交
- JSON序列化类
- Open Source BI Platform List
- oracle使用数据泵进行数据的导入导出
- Spring+SpringMVC+Mybatis框架整合流程
- 从Windows到linux小记
- https连接器
- 常见注入手法第四讲,SetWindowsHookEx全局钩子注入.以及注入QQ32位实战.
- blfs(systemd版本)学习笔记-编译安装openssh软件包
- 多点触控 TouchAction
- Java中的继承抽象类和接口