Skip to content

Commit

Permalink
Add test for class$ binding
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreedm committed May 3, 2019
1 parent a0b83b2 commit 8043d4c
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/unit/styling-scoped.html
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,31 @@
</script>
</dom-module>

<script type="module">
import { PolymerElement, html } from '../../polymer-element.js';
class ClassBindingUndefined extends PolymerElement {
static get is() { return 'class-binding-undefined'; }
static get properties() {
return {
data: {
type: Object
}
};
}
static get template() {
return html`
<style>
div {
border: 10px solid black;
}
</style>
<div id="div" class$="[[data.class]]">Foo</div>
`;
}
}
customElements.define(ClassBindingUndefined.is, ClassBindingUndefined);
</script>

<script type="module">
import { dom } from '../../lib/legacy/polymer.dom.js';
import { flush } from '../../lib/utils/flush.js';
Expand Down Expand Up @@ -1015,6 +1040,13 @@
assert.isTrue(el.classList.contains('e'));
});

test('scoping classes are preserved when a class$ binding resolves to undefined', function() {
const e = document.createElement('class-binding-undefined');
document.body.appendChild(e);
const el = e.$.div;
assertComputed(el, '10px');
});

});

suite('double including style sheets', function() {
Expand Down

0 comments on commit 8043d4c

Please sign in to comment.