Jasmine出错 - 预期事件点击已在#DIV_ID上触发 [英] Error on Jasmine - Expected event click to have been triggered on #DIV_ID
本文介绍了Jasmine出错 - 预期事件点击已在#DIV_ID上触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我引用此链接在Jasmine框架中开发测试工具时触发事件:
I am referred this link to trigger a event when developing a testing tool in Jasmine framework:
我试图在触发后获取新应用的CSS属性Jasmine框架中#DIV_ID上的click事件。
I am trying to get the newly applied CSS attribute after triggering a click event on #DIV_ID in Jasmine framework.
我试过这段代码:
spyEvent = spyOnEvent('#DIV_ID', 'click');
$('#DIV_ID').trigger( "click" );
expect('click').toHaveBeenTriggeredOn('#DIV_ID');
expect(spyEvent).toHaveBeenTriggered();
但我收到错误:预期事件点击已在#DIV_ID
任何人都可以帮我解决我的问题。
Anyone help me to resolve my problem.
提前致谢。
推荐答案
您的代码中存在一些语法错误:
There is some syntax error in your code:
var spyEvent = spyOnEvent($('#DIV_ID'), 'click');
$('#DIV_ID').trigger( "click" );
expect('click').toHaveBeenTriggeredOn($('#DIV_ID'));
expect(spyEvent).toHaveBeenTriggered();
我希望这样做。
这篇关于Jasmine出错 - 预期事件点击已在#DIV_ID上触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文