angular - 单元测试 SyntaxError:DOM 异常 12 角度 5
问题描述
我正在使用Angular 5 and angular material
,并且在 HTML 中,当我使用ProgressSpinner
并运行单元测试时,出现该错误SyntaxError: DOM Exception 12
,有一个脚本
<div *ngIf="!loadingEmployees; else spinnerLoading">
<app-contributor *ngFor="let employee of employees"></app-contributor>
</div>
<ng-template #spinnerLoading>
<div class="loading row centralize">
<!-- <mat-spinner color="warn" diameter="80" strokeWidth="6"></mat-spinner> -->
<p>Loading...</p>
</div>
</ng-template>
当我推荐脚本时,测试就会通过。在单元测试中,我只导入具有 Material 模块的 Shared 模块。像那样
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
BrowserAnimationsModule,
SharedModule
],
providers: [
{ provide: ContributorContentService, useClass: ContributorContentServiceMock },
{ provide: MatDialog, useClass: MatDialogMock }
]
})
.compileComponents();
}))
有人有什么想法吗?我忘记了什么?非常感谢!
解决方案
通过css删除diameter="80"
和<mat-spinner>
更新直径可以帮助我解决问题。但应该是一些更好的方法。
推荐阅读
- php - 在php中从ajax传递数据
- laravel - 启动创建事件时模型没有查询结果
- angularjs - 不适用于错误消息的角度指令
- javascript - How to build an Ionic application in Production mode, Ionic build is behaving differently
- sql - 选择根据列的最小值获取行
- swift - 如何检查程序是否在 Swift 中以管理员权限运行
- javascript - 将 props 从组件传递到静态方法
- pycharm - PyCharm:在打字时关闭弹出窗口
- java - Lotus Domino c# LtpaToken class
- oracle - PLS-00103:遇到符号“提示”