Skip to content

Commit

Permalink
Fixes #2113: ensures custom-style rules that use @apply combined with…
Browse files Browse the repository at this point in the history
… defining properties apply correctly.
  • Loading branch information
Steven Orvell committed Jul 29, 2015
1 parent 720f2c0 commit 69a4aa5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/lib/custom-style.html
Expand Up @@ -125,10 +125,6 @@
function(rule) {
var css = rule.cssText = rule.parsedCssText;
if (rule.propertyInfo && rule.propertyInfo.cssText) {
// TODO(sorvell): factor better
// remove property assignments so next function isn't confused
css = css.replace(propertyUtils.rx.VAR_ASSIGN, '');
// replace with reified properties, scenario is same as mixin
rule.cssText = propertyUtils.valueForProperties(css, props);
}
styleTransformer.documentRule(rule);
Expand Down
11 changes: 11 additions & 0 deletions test/unit/custom-style.html
Expand Up @@ -41,6 +41,12 @@
display: block;
}

:root {
--bag2: {
border: 12px solid beige;
};
}


:root {

Expand All @@ -59,6 +65,7 @@
--special: var(--primary);

--after: 11px solid orange;
@apply(--bag2);
}

x-foo {
Expand Down Expand Up @@ -242,6 +249,10 @@
assertComputed(e, '11px', null, '::after');
});

test('@apply in :root rule that also defines properties', function() {
assertComputed(document.body, '12px');
});

});


Expand Down

0 comments on commit 69a4aa5

Please sign in to comment.