astro/packages/astro/test/page-level-styles.test.js
Houston (Bot) e5c13881f1
[ci] release (beta) (#8073)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-18 11:46:47 -04:00

29 lines
877 B
JavaScript

import { expect } from 'chai';
import { load as cheerioLoad } from 'cheerio';
import { loadFixture } from './test-utils.js';
// Asset bundling
describe('Page-level styles', () => {
let fixture;
before(async () => {
fixture = await loadFixture({
root: './fixtures/page-level-styles/',
// test suite was authored when inlineStylesheets defaulted to never
build: { inlineStylesheets: 'never' },
});
await fixture.build();
});
it("Doesn't add page styles for a page without style imports", async () => {
let html = await fixture.readFile('/index.html');
let $ = await cheerioLoad(html);
expect($('link').length).to.equal(0);
});
it('Does add page styles for pages with style imports (or deps)', async () => {
let html = await fixture.readFile('/blog/index.html');
let $ = await cheerioLoad(html);
expect($('link').length).to.equal(1);
});
});