diff --git a/src/elements/element.html b/src/elements/element.html
index 316db14b40..9b6b76b30e 100644
--- a/src/elements/element.html
+++ b/src/elements/element.html
@@ -195,6 +195,7 @@
disconnectedCallback() {}
ready() {
+ super.ready();
if (!this.root) {
if (this._template) {
if (this.attachShadow) {
diff --git a/src/elements/legacy-element.html b/src/elements/legacy-element.html
index efec382dc1..08c09c18a0 100644
--- a/src/elements/legacy-element.html
+++ b/src/elements/legacy-element.html
@@ -43,7 +43,6 @@
constructor() {
super();
- this._applyConfigMetaData();
this.created();
}
@@ -65,6 +64,7 @@
}
ready() {
+ this._applyConfigMetaData();
super.ready();
}
diff --git a/src/properties/property-effects.html b/src/properties/property-effects.html
index a40ef5af02..154f482a51 100644
--- a/src/properties/property-effects.html
+++ b/src/properties/property-effects.html
@@ -706,7 +706,6 @@
_flushProperties(fromAbove) {
if (!this.__dataInitialized) {
- this.__dataInitialized = true;
this.ready();
}
if (this.__dataPending || this.__dataPendingClients) {
@@ -716,7 +715,9 @@
}
}
- ready() {}
+ ready() {
+ this.__dataInitialized = true;
+ }
_stampTemplate(template) {
let dom = super._stampTemplate(template);
diff --git a/test/unit/attributes-elements.html b/test/unit/attributes-elements.html
index 892d7304f7..73a318a27f 100644
--- a/test/unit/attributes-elements.html
+++ b/test/unit/attributes-elements.html
@@ -172,10 +172,11 @@
},
properties: {
+ attr1: String,
prop2: String
},
- created: function() {
+ ready: function() {
this.setAttribute('prop2', 'hi');
}
});
diff --git a/test/unit/attributes.html b/test/unit/attributes.html
index f2d7e8e107..de0e7ba144 100644
--- a/test/unit/attributes.html
+++ b/test/unit/attributes.html
@@ -260,60 +260,50 @@
configuredObject = {foo: 'bar', nested: {'meaning': 42}, arr: [0, 'foo', true]};
});
- test('hostAttributes set correctly', function(done) {
+ test('hostAttributes set correctly', function() {
var element = fixture('basic');
+ assert.strictEqual(element.getAttribute('attr1'), 'this is attr 1');
+ assert.strictEqual(element.getAttribute('attr2'), '42');
+ assert.strictEqual(element.getAttribute('attr3'), 'instance', 'host attribute overrode instance attribute and should not');
+ assert.strictEqual(element.getAttribute('aria-role'), 'button');
+ assert.strictEqual(element.getAttribute('title'), 'awesome');
+ assert.strictEqual(element.title, 'awesome');
+ assert.equal(element.getAttribute('attr-object'), JSON.stringify(configuredObject));
+ assert.equal(element.hasAttribute('attr-stupid'), false);
+ // class *is* serialized
+ // TODO: reenable the next lines when https://github.com/PolymerLabs/alacarte/issues/41 is fixed
+ // BREAKME(sorvell): document breaking change.
+ assert.ok(element.classList.contains('foo'));
+ assert.ok(element.classList.contains('bar'));
+ assert.ok(element.classList.contains('baz'));
- Polymer.RenderStatus.afterNextRender(element, function() {
- assert.strictEqual(this.getAttribute('attr1'), 'this is attr 1');
- assert.strictEqual(this.getAttribute('attr2'), '42');
- assert.strictEqual(this.getAttribute('attr3'), 'instance', 'host attribute overrode instance attribute and should not');
- assert.strictEqual(this.getAttribute('aria-role'), 'button');
- assert.strictEqual(this.getAttribute('title'), 'awesome');
- assert.strictEqual(this.title, 'awesome');
- assert.equal(this.getAttribute('attr-object'), JSON.stringify(configuredObject));
- assert.equal(this.hasAttribute('attr-stupid'), false);
-
- // class is not serialized
- // TODO: reenable the next lines when https://github.com/PolymerLabs/alacarte/issues/41 is fixed
- //assert.notOk(this.classList.contains('foo'));
- //assert.notOk(this.classList.contains('bar'));
- //assert.notOk(this.classList.contains('baz'));
-
- done();
- });
});
- test('hostAttributes set correctly in composed element', function(done) {
+ test('hostAttributes set correctly in composed element', function() {
var element = fixture('compose');
-
- Polymer.RenderStatus.afterNextRender(element, function() {
- // TODO: reenable the next line when https://github.com/PolymerLabs/alacarte/issues/43 is fixed
- //assert.strictEqual(this.$.basic.getAttribute('attr1'), 'compose');
- assert.strictEqual(this.$.basic.getAttribute('attr2'), '42');
- assert.strictEqual(this.$.basic.getAttribute('aria-role'), 'button');
- assert.strictEqual(this.$.basic.getAttribute('title'), 'awesome');
- assert.strictEqual(this.$.basic.title, 'awesome');
-
- assert.equal(this.$.basic.getAttribute('attr-object'), JSON.stringify(configuredObject));
- assert.equal(this.$.basic.hasAttribute('attr-stupid'), false);
-
- // class is not serialized
- // TODO: reenable the next lines when https://github.com/PolymerLabs/alacarte/issues/41 is fixed
- //assert.notOk(this.$.basic.classList.contains('foo'));
- //assert.notOk(this.$.basic.classList.contains('bar'));
- //assert.notOk(this.$.basic.classList.contains('baz'));
-
- assert(this.$.basic.classList.contains('should-not-override'));
-
- // applied to property with effect
- // TODO: reenable the next lines when https://github.com/PolymerLabs/alacarte/issues/43 is fixed
- //assert.strictEqual(this.$.basic.prop, 'compose');
- //assert.equal(this.$.basic.propChangedCount, 1);
- //assert.equal(this.$.basic.attr1ChangedCount, 1);
- assert.equal(this.prop2, 'hi');
-
- done();
- });
+ // TODO: reenable the next line when https://github.com/PolymerLabs/alacarte/issues/43 is fixed
+ //assert.strictEqual(this.$.basic.getAttribute('attr1'), 'compose');
+ assert.strictEqual(element.$.basic.getAttribute('attr2'), '42');
+ assert.strictEqual(element.$.basic.getAttribute('aria-role'), 'button');
+ assert.strictEqual(element.$.basic.getAttribute('title'), 'awesome');
+ assert.strictEqual(element.$.basic.title, 'awesome');
+
+ assert.equal(element.$.basic.getAttribute('attr-object'), JSON.stringify(configuredObject));
+ assert.equal(element.$.basic.hasAttribute('attr-stupid'), false);
+
+ // class does not overwrite user setting
+ assert.notOk(element.$.basic.classList.contains('foo'));
+ assert.notOk(element.$.basic.classList.contains('bar'));
+ assert.notOk(element.$.basic.classList.contains('baz'));
+
+ assert(element.$.basic.classList.contains('should-not-override'));
+
+ // applied to property with effect
+ // TODO: reenable the next lines when https://github.com/PolymerLabs/alacarte/issues/43 is fixed
+ //assert.strictEqual(element.$.basic.prop, 'compose');
+ assert.equal(element.$.basic.propChangedCount, 1);
+ assert.equal(element.$.basic.attr1ChangedCount, 1);
+ assert.equal(element.prop2, 'hi');
});
});