diff options
author | 2023-04-06 18:33:47 -0400 | |
---|---|---|
committer | 2023-04-06 18:33:47 -0400 | |
commit | a98f6f418c92261a06ef79624a8c86e288c21eab (patch) | |
tree | cd069e8afd2b41ae037f8cd1d23dbfb435f9b1c4 /packages/integrations/mdx/test/css-head-mdx.test.js | |
parent | e0ee7765d0159913aca5fd1bc83c953be3afcf2e (diff) | |
download | astro-a98f6f418c92261a06ef79624a8c86e288c21eab.tar.gz astro-a98f6f418c92261a06ef79624a8c86e288c21eab.tar.zst astro-a98f6f418c92261a06ef79624a8c86e288c21eab.zip |
Prevent body head content injection in MDX when using layout (#6779)
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 781e4d62d..f4ece38d9 100644 --- a/packages/integrations/mdx/test/css-head-mdx.test.js +++ b/packages/integrations/mdx/test/css-head-mdx.test.js @@ -81,5 +81,18 @@ describe('Head injection w/ MDX', () => { const bodyLinks = $('body link[rel=stylesheet]'); expect(bodyLinks).to.have.a.lengthOf(0); }); + + it('Injection caused by delayed slots', async () => { + const html = await fixture.readFile('/componentwithtext/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); + }); }); }); |