summaryrefslogtreecommitdiff
path: root/packages/astro/test/0-css.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/astro/test/0-css.test.js')
-rw-r--r--packages/astro/test/0-css.test.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/astro/test/0-css.test.js b/packages/astro/test/0-css.test.js
index e3f182b16..71dc29db1 100644
--- a/packages/astro/test/0-css.test.js
+++ b/packages/astro/test/0-css.test.js
@@ -95,6 +95,16 @@ describe('CSS', function () {
it('<style lang="scss">', async () => {
assert.match(bundledCSS, /h1\[data-astro-cid-[^{]*\{color:#ff69b4\}/);
});
+
+ it('Styles through barrel files should only include used Astro scoped styles', async () => {
+ const barrelHtml = await fixture.readFile('/barrel-styles/index.html');
+ const barrel$ = cheerio.load(barrelHtml);
+ const barrelBundledCssHref = barrel$('link[rel=stylesheet][href^=/_astro/]').attr('href');
+ const style = await fixture.readFile(barrelBundledCssHref.replace(/^\/?/, '/'));
+ assert.match(style, /\.comp-a\[data-astro-cid/);
+ assert.match(style, /\.comp-c\{/);
+ assert.doesNotMatch(style, /\.comp-b/);
+ });
});
describe('Styles in src/', () => {