Skip to content

Commit 8043d4c

Browse files
committed
Add test for class$ binding
1 parent a0b83b2 commit 8043d4c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/unit/styling-scoped.html

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,31 @@
729729
</script>
730730
</dom-module>
731731

732+
<script type="module">
733+
import { PolymerElement, html } from '../../polymer-element.js';
734+
class ClassBindingUndefined extends PolymerElement {
735+
static get is() { return 'class-binding-undefined'; }
736+
static get properties() {
737+
return {
738+
data: {
739+
type: Object
740+
}
741+
};
742+
}
743+
static get template() {
744+
return html`
745+
<style>
746+
div {
747+
border: 10px solid black;
748+
}
749+
</style>
750+
<div id="div" class$="[[data.class]]">Foo</div>
751+
`;
752+
}
753+
}
754+
customElements.define(ClassBindingUndefined.is, ClassBindingUndefined);
755+
</script>
756+
732757
<script type="module">
733758
import { dom } from '../../lib/legacy/polymer.dom.js';
734759
import { flush } from '../../lib/utils/flush.js';
@@ -1015,6 +1040,13 @@
10151040
assert.isTrue(el.classList.contains('e'));
10161041
});
10171042

1043+
test('scoping classes are preserved when a class$ binding resolves to undefined', function() {
1044+
const e = document.createElement('class-binding-undefined');
1045+
document.body.appendChild(e);
1046+
const el = e.$.div;
1047+
assertComputed(el, '10px');
1048+
});
1049+
10181050
});
10191051

10201052
suite('double including style sheets', function() {

0 commit comments

Comments
 (0)