add test for 3326

This commit is contained in:
Daniel Freedman 2016-01-27 15:24:00 -08:00
parent 3d2cb71c95
commit 854fdbf711

View File

@ -474,13 +474,36 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</script> </script>
</dom-module> </dom-module>
<style>
.variable-override {
border-top-width: 10px;
}
</style>
<dom-module id="x-variable-override">
<template>
<style>
:host {
--b: 2px solid black;
display: block;
border: var(--b);
}
</style>
</template>
<script>
Polymer({
is: 'x-variable-override'
});
</script>
</dom-module>
<script> <script>
suite('scoped-styling-var', function() { suite('scoped-styling-var', function() {
function assertComputed(element, value, pseudo) { function assertComputed(element, value, pseudo) {
var name = 'border-top-width'; var name = 'border-top-width';
var computed = element.getComputedStyleValue && !pseudo ? var computed = element.getComputedStyleValue && !pseudo ?
element.getComputedStyleValue(name) : element.getComputedStyleValue(name) :
getComputedStyle(element, pseudo)[name]; getComputedStyle(element, pseudo)[name];
assert.equal(computed, value, 'computed style incorrect'); assert.equal(computed, value, 'computed style incorrect');
} }
@ -675,6 +698,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
assertComputed(styled.$.endTerm, '19px'); assertComputed(styled.$.endTerm, '19px');
}); });
// skip for now, until #3326 is fixed
test.skip('custom style class overrides css variable', function() {
var d = document.createElement('x-variable-override');
d.classList.add('variable-override');
document.body.appendChild(d);
assertComputed(d, '10px');
});
// TODO(sorvell): fix for #1761 was reverted; include test once this issue is addressed // TODO(sorvell): fix for #1761 was reverted; include test once this issue is addressed
// test('var values can be overridden by subsequent concrete properties', function() { // test('var values can be overridden by subsequent concrete properties', function() {
// assertComputed(styled.$.overridesConcrete, '4px'); // assertComputed(styled.$.overridesConcrete, '4px');