Skip to content

Commit

Permalink
Add tests for calling Polymer() with ES6 class
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreedm committed Jan 29, 2019
1 parent 86db24c commit 3ff4ed1
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/runner.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@
'unit/disable-upgrade.html',
'unit/shady-unscoped-style.html',
'unit/html-tag.html',
'unit/legacy-data.html'
'unit/legacy-data.html',
// 'unit/multi-style.html'
'unit/class-properties.html'
];

function combinations(suites, flags) {
Expand Down
39 changes: 39 additions & 0 deletions test/unit/class-properties.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!doctype html>
<!--
@license
Copyright (c) 2017 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
-->
<html>
<head>
<meta charset="utf-8">
<script src="../../node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script>
<script src="wct-browser-config.js"></script>
<script src="../../node_modules/wct-browser-legacy/browser.js"></script>
</head>
<body>
<script type="module">
import {Polymer} from '../../polymer-legacy.js';
class Example {
ready() {}
foo() {}
}
Example.prototype.is = 'x-example';

suite('Polymer function w/Class', function() {
test('Polymer call works with a class', function() {
assert.doesNotThrow(() => Polymer(Example.prototype));
});
test('methods are copied from class input', function() {
const def = customElements.get('x-example');
assert(def.prototype.ready, 'ready should be defined');
assert(def.prototype.foo, 'foo should be defined');
});
});
</script>
</body>
</html>

0 comments on commit 3ff4ed1

Please sign in to comment.