2015-05-28 52 views
1

我試圖使用業力聚合物測試,看看它是否會與聚合物元素與angularjs一起工作。我有bolierplate html測試js文件和元素在同一個目錄中。karma聚合物測試使用phantomjs在元素失敗

我的測試:

(function() { 
'use strict'; 
elementSuite('seed-element', 'boilerplate', function() { 
    suite('attributes', function() { 
     test('testing polymer element', function(done) { 

     }); 
    }); 
}); 
}()); 

bolierplate.html:

<!doctype html> 
<html> 
<head> 
<title>Polymer Element Test</title> 
<meta charset="UTF-8"> 

<!-- Make sure the web components polyfill is loaded --> 
<script src="../../public/bower_components/platform/platform.js"></script> 
<script src="../../public/bower_components/webcomponentsjs/webcomponents.min.js"></script> 
</head> 
<body> 
<seed-element> 
<p>This is <content/></p> 
</seed-element> 
</body> 
</html> 

噶的conf:

frameworks: [ 
     'requirejs', 
     'polymerTest', 
     'jasmine' 
    ], 

    files: [ 
     {pattern:'test/polymer/*.html', included: false, watched: true, served: true}, 
     'test/polymer/*.js' 
    ], 

    polymerTest: { 
     platform: 'public/bower_components/platform/platform.js', 
     src: [ 
      'public/bower_components/polymer/polymer.html' 
     ] 
    }, 

錯誤,同時運行因緣:

PhantomJS 1.9.7 (Mac OS X) ERROR 
TypeError: 'undefined' is not a function (evaluating 'elementSetup.bind(this, name, boilerplate)') 
at /Users/212437040/dev/APM_Code/Avid/apm-application/node_modules/karma-polymer-test/elementSuite.js:141 

有人有任何指針?

回答

0

PhantomJS < v2沒有實現Function.prototype.bind函數。你需要一個墊片。

This shim適用於2之前的版本,並且從版本2.0.0開始不再需要。

+0

我對業力和聚合物幾乎沒有經驗,因此建議你使用這種墊片。 –

+0

謝謝。我確實從你給出的URL安裝了poly,並且在我的樣板