更新时间:2023-11-08 22:01:40
看着jQuery脚本(版本3.5.1),我发现处理选择器的函数是 $.fn.init
Looking at the jQuery script (version 3.5.1), I found that the function that handles the selector is $.fn.init
jQuery.fn.init = function( selector, context, root ) {...}
在#3133行.
因此您的茉莉花期望
为:
expect($.fn.init).toHaveBeenCalledWith('#test1', undefined, jasmine.anything());
您可以忽略一些参数.参考