vendredi 24 juin 2016

karma jasmine and angular ng-cookies

I have written a test for my application but get the following error from ng-cookies:

 TypeError: $browser.addPollFn is not a function in static/js/angular/ng-cookies_1.3.13.js (line 60)

I googled and found that the version of ng-cookies must match the version of angular which is does. Here my karma config:

files: [
    'static/js/jquery-1.11.2.js'
    ,'static/js/jquery-ui-1.11.4.min.js'
    ,'static/js/bootstrap.min.js'
    ,'static/js/angular/angular_1.3.13.js'
    ,'static/js/angular/ng-cookies_1.3.13.js'
    ,'static/js/angular/angular-common-libs.min.js'
    ,'static/js/angular/angular-ui-sortable.js'
    ,'static/js/angular/angular-route.min_1.3.13.js'

I though that would fix it or the order that it is being loaded but it made no difference.

This is the app.js initialisation that calls the ng-cookies:

var app = angular.module('myapp',[ 
    'ui.router'
    , 'ui.bootstrap'
            , 'ui.sortable'
    , 'fileUpload'
    , 'angular-loading-bar'
    , 'ncy-angular-breadcrumb'
    , 'ngSanitize'
    , 'ngMessages'
    , 'ngCookies'

What am I missing? Is karma loading a different version of angular somewhere I would presume the one I specified in the files array is the correct one?

Aucun commentaire:

Enregistrer un commentaire