Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
* Add test for implementing `observedAttributes`
* Remove call to `super.id` for legacy browser support.
  • Loading branch information
Steven Orvell committed Nov 21, 2017
1 parent feac932 commit 82cf96b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions test/unit/polymer.properties-element.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@
set noStomp(value) {}

get id() {
return super.id;
return this._getProperty('id');
}

set id(value) {
this._setProperty('id', value);
super.id = value;
// cannot call super cuz older browsers
this._propertyToAttribute('id');
}

connectedCallback() {
Expand Down Expand Up @@ -93,6 +94,10 @@

class SubElement extends window.MyElement {

static get observedAttributes() {
return ['custom-observed-attr'].concat(super.observedAttributes);
}

static get properties() {
return {
prop2: String
Expand Down Expand Up @@ -203,13 +208,13 @@

<test-fixture id="sub-element-attr">
<template>
<sub-element prop="attr" prop2="attr"></sub-element>
<sub-element prop="attr" prop2="attr" custom-observed-attr="custom"></sub-element>
</template>
</test-fixture>

<test-fixture id="sub-mixin-element-attr">
<template>
<sub-mixin-element prop="attr" prop2="attr" prop3="attr" mixin="5"></sub-mixin-element>
<sub-mixin-element prop="attr" prop2="attr" prop3="attr" mixin="5" custom-observed-attr="custom"></sub-mixin-element>
</template>
</test-fixture>

Expand Down Expand Up @@ -321,7 +326,7 @@
var fixtureEl = fixture('sub-element-attr');
assert.equal(fixtureEl.prop, 'attr');
assert.equal(fixtureEl.prop2, 'attr');
assert.equal(fixtureEl._callAttributeChangedCallback, 2);
assert.equal(fixtureEl._callAttributeChangedCallback, 3);
});

});
Expand Down Expand Up @@ -374,7 +379,7 @@
assert.strictEqual(fixtureEl.prop2, 'attr');
assert.strictEqual(fixtureEl.prop3, 'attr');
assert.strictEqual(fixtureEl.mixin, 5);
assert.equal(fixtureEl._callAttributeChangedCallback, 4);
assert.equal(fixtureEl._callAttributeChangedCallback, 5);
});

});
Expand Down

0 comments on commit 82cf96b

Please sign in to comment.