从 polymer-starter-kit 1.1.0 开始,我将套件中的所有现有代码修改为 ES6/ES2015,包括以下内容:gulpfile.js, app.js, routing.html, my-greeting.html, my-list.html, my-greeting-basic.html and my-listing-basic.html
. 按照 es6 babel 配方的说明(在 docs 文件夹中找到)后,我运行gulp serve
以验证应用程序是否正常工作,但所有现有测试都失败并显示以下消息...
chrome 48 ✖ Test Suite Initialization
Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
chrome 48 Tests failed: 2 failed tests
以上对chrome 41
,firefox 44
也是safari 9.0
如此
似乎 wct 运行未编译的代码,我找不到任何允许 wct gulp 任务首先编译的选项,或者就此而言指向要测试的.tmp
或dist
文件夹。
这是修改后的示例之一...
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../../bower_components/polymer/polymer.html">
<dom-module id="my-list">
<template>
<style>
:host {
display: block;
}
</style>
<ul>
<template is="dom-repeat" items="{{items}}">
<li><span class="paper-font-body1">{{item}}</span></li>
</template>
</ul>
</template>
<script>
(() => {
'use strict';
class MyList {
beforeRegister() {
let is = this.constructor.name
.replace(/\W+/g, '-')
.replace(/([a-z\d])([A-Z])/g, '$1-$2')
.toLowerCase();
this.is = is;
this.properties = {
items : {
type : Array,
notify : true,
}
};
}
ready() {
this.items = [
'Responsive Web App boilerplate',
'Iron Elements and Paper Elements',
'End-to-end Build Tooling (including Vulcanize)',
'Unit testing with Web Component Tester',
'Routing with Page.js',
'Offline support with the Platinum Service Worker Elements'
];
}
}
Polymer(MyList);
})();
</script>
</dom-module>