angular.js - angular 指令中包含webworker 在單元測試中一直報找不到worker 文件錯誤 如何解決?
問題描述
//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’ ], ...
報錯報錯提示
][2]
debug中的 resource
我看到有人說 這樣就可以了但是現在不行 誰能說說這是什么情況嗎??怎么解決呢??
問題解答
回答1:..把路徑寫好就好了。。。。 new work('base/webroot/js/myworker.js')
相關文章:
1. javascript - 關于css絕對定位在ios瀏覽器被橡皮筋遮擋的問題2. python - beautifulsoup獲取網頁內容的問題3. python - 能通過CAN控制一部普通的家用轎車嗎?4. mysql優化 - 關于mysql分區5. javascript - 請問 chrome 為什么會重復加載圖片資源?6. 人工智能 - python 機器學習 醫療數據 怎么學7. centos7 編譯安裝 Python 3.5.1 失敗8. mysql - 分庫分表、分區、讀寫分離 這些都是用在什么場景下 ,會帶來哪些效率或者其他方面的好處9. html5 - 只用CSS如何實現input框的寬度隨框里輸入的內容長短自動適應?10. c++ - 請問MySQL_Connection::isReadOnly 怎么解決?
