关于工具提示的咕噜声测试时出错

时间:2022-08-21 12:05:53

I implement tooltip in my angular project but my project gives an error on grunt test as:

我在我的角度项目中实现了工具提示但是我的项目在grunt测试中给出了错误:

TypeError: 'undefined' is not a function (evaluating '$('[data-toggle=tooltip]').tooltip()')

My code to implement tooltip:

我的代码实现工具提示:

In Jquery:

$(document).ready(function(){
    $('[data-toggle="tooltip"]').tooltip(); 
});

and in html:

并在HTML中:

<div class="rating" data-toggle="tooltip">

I am not able to understand where I am going wrong.

我无法理解我哪里出错了。

1 个解决方案

#1


0  

For the record, OP was here missing bootstrap tooltip plugin from his karma configuration.

为了记录,OP在这里缺少来自他的业力配置的bootstrap tooltip插件。

Karma configuration file, usually karma.conf.js, contains the declaration of the files or patterns to load for the tests. For example:

Karma配置文件,通常是karma.conf.js,包含要为测试加载的文件或模式的声明。例如:

// Inside Karma configuration object
files: [
    'bower_components/jquery/jquery.js',
    'bower_components/angular/angular.js',
    // ...
    app/*.js
]

#1


0  

For the record, OP was here missing bootstrap tooltip plugin from his karma configuration.

为了记录,OP在这里缺少来自他的业力配置的bootstrap tooltip插件。

Karma configuration file, usually karma.conf.js, contains the declaration of the files or patterns to load for the tests. For example:

Karma配置文件,通常是karma.conf.js,包含要为测试加载的文件或模式的声明。例如:

// Inside Karma configuration object
files: [
    'bower_components/jquery/jquery.js',
    'bower_components/angular/angular.js',
    // ...
    app/*.js
]