我有一个这样定义的 jquery ui 小部件:
$.widget("ui.someWidget",
options: {}, _create = function() { doSomething();
});
现在我试图像这样监视它:
var ui_spy = spyOn($.fn, "someWidget");
$('#something').someWidget();
expect(ui_spy).toHaveBeenCalled();
var ui_spy = spyOn($.ui, "someWidget");
$('#something').someWidget();
expect(ui_spy).toHaveBeenCalled();
两者都返回假......我做错了什么?