创建间谍时,Jasmine找不到功能

时间:2017-12-27 05:59:41

标签: javascript jasmine

如何为下面的代码行创建间谍

this.$('#crumb').dropdown('toggle');

我尝试过使用:spyOn($, 'dropdown');

但收到以下错误消息

TypeError: this.$(...).dropdown is not a function

1 个答案:

答案 0 :(得分:0)

在Karma配置文件中,您需要添加来自供应商或node_modules文件夹的文件路径:

"node_modules/jquery/dist/jquery.js",
"node_modules/bootstrap/dist/js/bootstrap.min.js",