diff options
author | 2023-02-09 11:50:04 -0500 | |
---|---|---|
committer | 2023-02-09 11:50:04 -0500 | |
commit | 3390cb84443a43eb997f3efeb5ca298a8477aaf0 (patch) | |
tree | c54683aa2e3354eff5454b3c31a4ce9ffdbc22e9 /packages/integrations/mdx/test/css-head-mdx.test.js | |
parent | 0c3485ab0703e38205df232eda75a163a2c2a47a (diff) | |
download | astro-3390cb84443a43eb997f3efeb5ca298a8477aaf0.tar.gz astro-3390cb84443a43eb997f3efeb5ca298a8477aaf0.tar.zst astro-3390cb84443a43eb997f3efeb5ca298a8477aaf0.zip |
Fix head injection misplacement with Astro.slots.render() (#6196)
* Fix head injection misplacement with Astro.slots.render()
* Adding a changeset
* Fix case of JSX with no layout
* missing break
Diffstat (limited to 'packages/integrations/mdx/test/css-head-mdx.test.js')
-rw-r--r-- | packages/integrations/mdx/test/css-head-mdx.test.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/packages/integrations/mdx/test/css-head-mdx.test.js b/packages/integrations/mdx/test/css-head-mdx.test.js index c38f23701..82a86e5d2 100644 --- a/packages/integrations/mdx/test/css-head-mdx.test.js +++ b/packages/integrations/mdx/test/css-head-mdx.test.js @@ -3,6 +3,7 @@ import mdx from '@astrojs/mdx'; import { expect } from 'chai'; import { parseHTML } from 'linkedom'; import { loadFixture } from '../../../astro/test/test-utils.js'; +import * as cheerio from 'cheerio'; describe('Head injection w/ MDX', () => { let fixture; @@ -56,5 +57,17 @@ describe('Head injection w/ MDX', () => { const links = document.querySelectorAll('head link[rel=stylesheet]'); expect(links).to.have.a.lengthOf(1); }); + + it('Using component but no layout', async () => { + const html = await fixture.readFile('/noLayoutWithComponent/index.html'); + // Using cheerio here because linkedom doesn't support head tag injection + const $ = cheerio.load(html); + + const headLinks = $('head link[rel=stylesheet]'); + expect(headLinks).to.have.a.lengthOf(1); + + const bodyLinks = $('body link[rel=stylesheet]'); + expect(bodyLinks).to.have.a.lengthOf(0); + }); }); }); |