Skip to content

Commit

Permalink
fix tests and add dependency import
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreedm committed Feb 21, 2018
1 parent 8f8135b commit a37ba7e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 44 deletions.
1 change: 1 addition & 0 deletions lib/mixins/disable-upgrade-mixin.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
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="element-mixin.html">
<script>
(function() {
'use strict';
Expand Down
92 changes: 48 additions & 44 deletions test/unit/disable-upgrade.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,28 @@ <h2 id="element">[[prop]]</h2>
</template>

<script>
const Disabled = Polymer.DisableUpgradeMixin(class extends Polymer.Element {
static get is() { return 'x-disabled'; }
static get properties() {
return {
prop: {
type: String
}
};
}
constructor() {
super();
this.prop = 'enabled!';
}
addEventListener('WebComponentsReady', function() {
const Disabled = Polymer.DisableUpgradeMixin(class extends Polymer.Element {
static get is() { return 'x-disabled'; }
static get properties() {
return {
prop: {
type: String
}
};
}
constructor() {
super();
this.prop = 'enabled!';
}

ready() {
super.ready();
this.enabled = true;
}
ready() {
super.ready();
this.enabled = true;
}
});
customElements.define(Disabled.is, Disabled);
});
customElements.define(Disabled.is, Disabled);

</script>

</dom-module>
Expand All @@ -72,7 +73,7 @@ <h2 id="element">[[prop]]</h2>
</template>

<script>
(function() {
addEventListener('WebComponentsReady', function() {

// enable disable upgrade!
const polymerClass = Polymer.Class;
Expand Down Expand Up @@ -111,7 +112,7 @@ <h2 id="element">[[prop]]</h2>
}
});

})();
});
</script>

</dom-module>
Expand All @@ -125,20 +126,21 @@ <h2 id="element">[[prop]]</h2>
</template>

<script>
class MyElement extends Polymer.Element {
static get is() { return 'my-element'; }
static get properties() {
return {
upgradeDisabled: {value: true}
};
}
enable() {
this.$.disabledEl.removeAttribute('disable-upgrade');
this.upgradeDisabled = false;
addEventListener('WebComponentsReady', function() {
class MyElement extends Polymer.Element {
static get is() { return 'my-element'; }
static get properties() {
return {
upgradeDisabled: {value: true}
};
}
enable() {
this.$.disabledEl.removeAttribute('disable-upgrade');
this.upgradeDisabled = false;
}
}
}
customElements.define(MyElement.is, MyElement);

customElements.define(MyElement.is, MyElement);
});
</script>

</dom-module>
Expand All @@ -155,16 +157,18 @@ <h2 id="element">[[prop]]</h2>
</template>

<script>
Polymer({
is: 'my-element-legacy',
properties: {
upgradeDisabled: { type: String, value: true }
},
enable() {
this.$.disabledEl.removeAttribute('disable-upgrade');
this.$.disabledRegEl.removeAttribute('disable-upgrade');
this.upgradeDisabled = false;
}
addEventListener('WebComponentsReady', function() {
Polymer({
is: 'my-element-legacy',
properties: {
upgradeDisabled: { type: String, value: true }
},
enable() {
this.$.disabledEl.removeAttribute('disable-upgrade');
this.$.disabledRegEl.removeAttribute('disable-upgrade');
this.upgradeDisabled = false;
}
});
});
</script>

Expand Down

0 comments on commit a37ba7e

Please sign in to comment.