angular - 使用 Jasmine 进行角度的 Kendo-dropdown 单元测试
问题描述
我正在尝试使用 Jasmine/Karma 在我的 Angular 应用程序上运行集成测试。我们主要在应用程序中使用剑道控件。在编写测试套件来测试剑道下拉组件时,我无法在规范文件中获取剑道下拉控件的引用。非常感谢您的帮助。
TestBed.configureTestingModule({
declarations: [ XXXX,YYYY,ZZZZ],
imports:[HttpClientModule,RouterTestingModule,FormsModule ,ReactiveFormsModule ],
providers:[ WebApiService,YYYY,ZZZZ],
})
.compileComponents();
beforeEach(() => {
fixture = TestBed.createComponent(CreateCustomerComponent);
component = fixture.componentInstance;
datePipe=new DatePipe("en-US");
fixture.detectChanges();
});
it('#should the length of dropdown is greater than one',()=>{
const trigger = fixture.debugElement.query(By.css('#dropDownId')).nativeElement;
expect(trigger).toBeTruthy();
});
html
<kendo-floatinglabel
[text]="Customer"
>
<kendo-dropdownlist
[id]="'dropDownId'"
[data]="DataItems"
[textField]="'DataText'"
[valueField]="'DataValue'"
[(ngModel)]="selectedItem"
>
</kendo-dropdownlist>
</kendo-floatinglabel>
由于触发器变量中的未定义值,测试正在中断。
解决方案
推荐阅读
- c++ - 在类体内初始化数据成员
- java - Spring maven 应用程序在应用程序上下文加载后立即终止
- android - 如何将我 PC 上的所有 Android Studio 项目提交到私有 GitHub 存储库?
- powershell - IF 两次 powershell 之间
- angular - Angular - 如何确定 FormArray 中的新项目?
- html - Bootstrap 4 移动 flexbox 太宽了
- java - Json的Java对象无法使用Jackson Object Mapper工作
- php - php json_encode() 效果很好。但是,结果在客户端被破坏
- android - Android - 更改文本颜色
- php - 我的注册页面没有检查数据库以查看是否已使用用户名