我jasmine
用来测试我的应用程序,现在我的代码中不存在任何按钮,
但我想编写一个测试,在其中我可以检查是否触发了单击事件。
您可以简单地认为我想在没有按钮的情况下触发点击事件。
这是我所做的
scenario('checking that click event is triggered or not', function () {
given('Sigin form is filled', function () {
});
when('signin button is clicked ', function () {
spyOn($, "click");
$.click();
});
then('Should click event is fired or not" ', function () {
expect($.click).toHaveBeenCalled();
});
});
提前致谢 。