Skip to content

Commit f3dc8a5

Browse files
committed
fix: udpate tailwind test
1 parent c4a3009 commit f3dc8a5

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

packages/integrations/cloudflare/test/prerender-styles.test.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,20 @@ describe('Prerendered page styles', () => {
4343
it('includes Tailwind styles in prerendered page', async () => {
4444
// With cloudflare adapter, prerendered pages are in dist/client/
4545
const html = await fixture.readFile('/client/index.html');
46-
// Check that the bg-amber-500 class has its styles included
47-
assert.ok(html.includes('.bg-amber-500'), 'Expected .bg-amber-500 class to be in the HTML');
46+
// Tailwind CSS is emitted as an external stylesheet linked from the HTML.
47+
// Verify the HTML references a stylesheet and that the stylesheet contains the expected class.
48+
assert.ok(html.includes('rel="stylesheet"'), 'Expected the HTML to reference a stylesheet');
49+
const cssFiles = await fixture.glob('client/_astro/*.css');
50+
assert.ok(cssFiles.length > 0, 'Expected at least one CSS file in _astro/');
51+
let foundClass = false;
52+
for (const cssFile of cssFiles) {
53+
const css = await fixture.readFile('/' + cssFile);
54+
if (css.includes('.bg-amber-500')) {
55+
foundClass = true;
56+
break;
57+
}
58+
}
59+
assert.ok(foundClass, 'Expected .bg-amber-500 class to be in a generated CSS file');
4860
});
4961
});
5062
});

0 commit comments

Comments
 (0)