我有一个 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();
两个都返回 false... 我做错了什么?