angular - 如何以角度测试自定义事件气泡?
问题描述
如何以角度测试自定义事件气泡?如何测试自定义事件是否已发送?
testFn(detail) {
this.test.dispatchEvent(
new CustomEvent('custom-event', {
detail,
bubbles: true,
composed: true,
})
);
}
我该如何处理?
const spy1 = spyOn(component, 'testFn');
expect(spy1.calls.mostRecent()).toEqual(??);
解决方案
推荐阅读
- java - window.history(angularJS 代码)不存储在 IE 11 中访问的所有历史页面
- laravel-5 - Laravel 的最新更新
- android - 如何查看 RunTimeException 发生的位置?
- jquery - Jquery试图将值传递给输入框但是
- java-8 - 使用 Apache commons 电子邮件在我的硬盘上发送带有附件的邮件
- sql - 使用 OPTION (RECOMPILE) 与加入表的成本
- codeigniter - Codeigniter 3.1.9 MY_Form_validation 不起作用
- powershell - 将 PowerShell 数组转换为整数
- laravel - 在 laravel 上使用图表时出现错误
- javascript - 如何在 php 中检索 javascript 变量并将其添加到数据库中