我正在尝试使用karma-polymer-test来查看它是否与聚合物元素一起使用以及angularjs。我有bolierplate html test js文件和同一目录中的元素。
我的测试:
(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>
Karma 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 :(得分:0)
PhantomJS&lt; v2没有实现Function.prototype.bind函数。你需要一个垫片。
This shim适用于2之前的版本,对于版本2.0.0以上版本不再需要。