javascript - AngularJS test - inject $location causes error -
So this is driving me crazy, whenever i $ location in one of my Attempts to insert the test I get the following error:
Writing error:. Undefined $ LocationProvider does not have a function organized in $ bower_components / angular.js (bower_components / angular / angular.js: 11,053: 34) at Object.invoke (bower_components / angular / angular.js: 4118: 17): 3936: 37 getService (bower_components / angular / Angular.js: 4077: 39) at Object.invoke (bower_components / angular / angular.js: 4109: 13) in Object.workFn (bower_components / angular-mocks / angular mocks.js : 2159: 20) Error: Declaration location at window.inject.angular.mock.inject (bower_components / angular-mocks / angular-mocks. JS: 2144: 25) on suit. & Lt; Anonymous & gt; (Examination / Unit / Controller / DashboardCtrlSpec.js: 8: 16) jasmineInterface.describe (/usr/local/lib/node_modules/karma-jasmine/lib/boot.js:59:18) on test / unit / controller / DashboardCtrlSpec.js: 1: 1 karma.conf.js:
module. Exports = function (config.conf) {config.set ({// base path that will be used to resolve all patterns (such as files, excluded) basePath: '../', // // Using available frameworks Framework for: https://npmjs.org/browse/keyword/karma-adapter Frameworks: ['Chameli'], // files / patterns to load in browser files: ['bower_components / angular / angular. Js ',' bower_components / angular-mocks / angular mocks.js ',' bower_components / angular bootstrap / ui-bootstrap.js ',' bower_components / angular-clean / angular sanitize.js ',' Bower_components / angular-translation / angular translate.js ',' bower_components / angular translate e-loader-static-files / angel-translate-loader-static-files.js ',' boost_comons / dist / asset.engular Max.js', 'script / ** / * .js',' test / * * / * .js'], // List of files to be extracted: ['** / *. SWP'], / Before pre-processors / pre-processed mailing files are available to the browser / http preprocessor available to them: https: // npmjs Org / browse / keyword / karma-preprocessor preprocessors: {}, // test results to report reporter // potential values: 'dots',' progress' // available reporters: https://npmjs.org/browse/keyword/ Karma-reporter reporters: [' Progress'], // Web server port port: 9876, // Enable / Disabled color in colors of output (reporter and log): true // // value of // logging: config LOG_DISABLE || Config.LOG_ERROR || Config.LOG_WARN || Config.LOG_INFO || Config.LOG_DEBUG logLevel: config.LOG_INFO, // Whenever a file changes to view / deactivate and execute the file, AutoWatch: Incorrect, // start these browsers // Available browser launcher: https: / /npmjs.org/browse/keyword/ Karma-Launcher Browser: ['FantagramJS'], // Continuous Integration Mode // If true, Karma captures the browser, runs the test and exits from the single: True }); }; Controller:
Angular. Module ('ecQDesktopApp'). Controller ('dashboardcoot', function ($ radius, $ window) {$ scope. GoToURL = function (url) {$ window.location = url;}}); Functionality Tip:
Description ('Unit: Test Dashboard Controller', Function () {'Strict Use; var Scope, Window; First (Modules ('ecQDesktopApp')) first (injection (function ($ rootscope, _ $ window_, $ controller) {scope = $ rootsecope $ New (); window = {location: ""}; $ controller ('dashboardcoot' ($ Scope: scope, $ window: window);});; This goes to 'url', function () {var url = "testUrl"; scope.goToURL (url); hopefully (window.location T.B. ("testUrl");});}); But if I before each (injection ($ Rootscope, _ $ window_, $ controller) to first (injection (function ($ I get an error.
It's weird, it seems that I can inject any AngularJS services, but when I also try to use $ space in any place
If you are version = 1.3 In angle Using the traditional, you have to use any type of socks in version = 1.3> Normally: the angular-socks version should always be at the same level.
Comments
Post a Comment