diff options
author | 2023-01-30 11:55:10 -0500 | |
---|---|---|
committer | 2023-01-30 11:55:10 -0500 | |
commit | 071e1dee7e1943be67d1ded39a9af1b7a2aafd02 (patch) | |
tree | c4d84dbf7f537fd7288fad3c8cb88df806b87837 /packages/integrations/mdx/test/css-head-mdx.test.js | |
parent | cf604123fa4a4eeacf6427f4bbe2c3ba526c5949 (diff) | |
download | astro-071e1dee7e1943be67d1ded39a9af1b7a2aafd02.tar.gz astro-071e1dee7e1943be67d1ded39a9af1b7a2aafd02.tar.zst astro-071e1dee7e1943be67d1ded39a9af1b7a2aafd02.zip |
Simplified head injection (#6034)
* Simplified head injection
* Make renderHead also yield an instruction
* Add changeset
* Add mdx test
Diffstat (limited to 'packages/integrations/mdx/test/css-head-mdx.test.js')
-rw-r--r-- | packages/integrations/mdx/test/css-head-mdx.test.js | 33 |
1 files changed, 33 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 new file mode 100644 index 000000000..a6492c3ba --- /dev/null +++ b/packages/integrations/mdx/test/css-head-mdx.test.js @@ -0,0 +1,33 @@ +import mdx from '@astrojs/mdx'; + +import { expect } from 'chai'; +import { parseHTML } from 'linkedom'; +import { loadFixture } from '../../../astro/test/test-utils.js'; + +describe('Head injection w/ MDX', () => { + let fixture; + + before(async () => { + fixture = await loadFixture({ + root: new URL('./fixtures/css-head-mdx/', import.meta.url), + integrations: [mdx()], + }); + }); + + describe('build', () => { + before(async () => { + await fixture.build(); + }); + + it('only injects contents into head', async () => { + const html = await fixture.readFile('/indexThree/index.html'); + const { document } = parseHTML(html); + + const links = document.querySelectorAll('link[rel=stylesheet]'); + expect(links).to.have.a.lengthOf(1); + + const scripts = document.querySelectorAll('script[type=module]'); + expect(scripts).to.have.a.lengthOf(1); + }); + }); +}); |