Ensure properties is only called once

This commit is contained in:
Tim van der Lippe
2018-06-16 14:06:58 +02:00
parent 617cb4c995
commit 63c7fc0026
2 changed files with 11 additions and 2 deletions

View File

@@ -44,6 +44,8 @@ class Blar {}
class MyElement extends PropertiesMixin(HTMLElement) {
static get properties() {
this._calledProperties++;
return {
prop: String,
noStomp: String,
@@ -111,6 +113,8 @@ MyElement.prototype._calledConnectedCallback = 0;
MyElement.prototype._calledReady = 0;
MyElement.prototype._callAttributeChangedCallback = 0;
MyElement.constructor.prototype._calledProperties = 0;
customElements.define('my-element', MyElement);
window.MyElement = MyElement;
@@ -236,6 +240,7 @@ suite('class extends Polymer.PropertiesMixin', function() {
assert.equal(el._calledConnectedCallback, 1);
assert.equal(el._calledReady, 1);
assert.equal(el._callAttributeChangedCallback, 0);
assert.equal(el.constructor._calledProperties, 1);
});
test('listeners', function() {