angular.js - angular 指令中包含webworker 在單元測試中一直報(bào)找不到worker 文件錯(cuò)誤 如何解決?
問題描述
//directive.js var option = { ’typeNumber’: 4, ’errorCorrectLevel’:’L’, ’text’: $scope.text }$scope.worker = new Worker(’/js/myworkers.js’);$scope.myworker.postMessage(option);//test.jsdescribe(’Directives test’, function(){ var $compile, $scope, $templateCache, $httpBackend,workerValue,$timeout; beforeEach(module(’directives’)); ... ... ...it(’qrcode test’, function(){$httpBackend.expectGET(’webroot/js/myworkers.js’).respond(200,’woker’);var link = $compile(’<my-qrcode value='qrcode_text' change='false'></my-qrcode>’);var element = link($scope);$scope.$digest();console.log(element.html());//expect(element.html()).toEqual(workerValue)});//karma.conf.js... // list of files / patterns to load in the browser files: [ ’testjs/jquery.js’, ’webroot/js/lib/angular/angular.js’, ’webroot/js/lib/angular/angular-route.js’, // ’webroot/js/lib/angular/angular-animate.js’, ’webroot/js/lib/angular/angular-resource.js’, ’webroot/js/lib/angular/angular-sanitize.js’, ’webroot/js/lib/angular/*.min.js’, ’webroot/js/lib/bootstrap-ui/*.js’, // ’webroot/js/lib/angular/angular-loader.js’, ’webroot/js/lib/angular/angular-mocks.js’, ’webroot/js/myworkers.js’, ’webroot/js/bootstrap.js’, ’webroot/js/services.js’, ’webroot/js/directives.js’, ’webroot/js/filters.js’, ’webroot/js/app.js’, ’webroot/js/controllers.js’, ’testjs/*.js’ ], ...
報(bào)錯(cuò)報(bào)錯(cuò)提示
][2]
debug中的 resource
我看到有人說 這樣就可以了但是現(xiàn)在不行 誰能說說這是什么情況嗎??怎么解決呢??
問題解答
回答1:..把路徑寫好就好了。。。。 new work('base/webroot/js/myworker.js')
相關(guān)文章:
1. Docker for Mac 創(chuàng)建的dnsmasq容器連不上/不工作的問題2. javascript - (_a = [""], _a.raw = [""],....); js一個(gè)小括號的是什么意思?3. javascript - 關(guān)于微信掃一掃的技術(shù)問題4. 小白學(xué)python的問題 關(guān)于%d和%s的區(qū)別5. javascript - 關(guān)于js高級程序中的問題6. html5 - 請問利用font-face定義的字體怎么在canvas里應(yīng)用?7. html - Python2 BeautifulSoup 提取網(wǎng)頁中的表格數(shù)據(jù)及連接8. html5 - css 這種六邊形的邊框怎么畫?9. javascript - vuex中子組件無法調(diào)用公共狀態(tài)10. javascript - js正則替換日期格式問題
