你好,我有一个关于使用Jasmine(插件:jQuery)进行单元测试的问题。
我应该如何测试对象是否在文档的DOM中。问题是我使用了一个提示功能,只有在模拟事件时才会被激活。当效果模拟成功后,对象将附加到DOM中,我想检查它是否可见。
it("test 1: should invoke the Tooltip() function.", function () {
spyEvent = spyOnEvent('.span_width', "mouseover");
$('.span_width').simulate('mouseover');
expect('mouseover').toHaveBeenTriggeredOn('.span_width');
expect(spyEvent).toHaveBeenTriggered();
# A TEST TO check if .tooltip is visible???
# IN JQUERY would that be: $('.tooltip').is(':visible');
});