diff options
author | 2024-02-08 07:54:40 +0100 | |
---|---|---|
committer | 2024-02-08 07:54:40 +0100 | |
commit | 14ce8a6ebfc9daf951d2dca54737d857c229667c (patch) | |
tree | f5a1215ca68ec7bbf20ed2acf8696b6e91eb0772 /packages/integrations/markdoc/test/image-assets.test.js | |
parent | 8fb67c81bb84530b39df4a1449c0862def0854af (diff) | |
download | astro-14ce8a6ebfc9daf951d2dca54737d857c229667c.tar.gz astro-14ce8a6ebfc9daf951d2dca54737d857c229667c.tar.zst astro-14ce8a6ebfc9daf951d2dca54737d857c229667c.zip |
feat(markdoc): Add support for using a custom component for images (#9958)
* feat(markdoc): Add support for using a custom component for images
* chore: changeset
* test: add test
* Update .changeset/shaggy-spies-sit.md
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
---------
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
Diffstat (limited to 'packages/integrations/markdoc/test/image-assets.test.js')
-rw-r--r-- | packages/integrations/markdoc/test/image-assets.test.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/integrations/markdoc/test/image-assets.test.js b/packages/integrations/markdoc/test/image-assets.test.js index ae576b5cf..880ee9b26 100644 --- a/packages/integrations/markdoc/test/image-assets.test.js +++ b/packages/integrations/markdoc/test/image-assets.test.js @@ -51,6 +51,13 @@ describe('Markdoc - Image assets', () => { /\/_image\?href=.*%2Fsrc%2Fassets%2Falias%2Fcityscape.jpg%3ForigWidth%3D420%26origHeight%3D280%26origFormat%3Djpg&f=webp/ ); }); + + it('passes images inside image tags to configured image component', async () => { + const res = await baseFixture.fetch('/'); + const html = await res.text(); + const { document } = parseHTML(html); + assert.equal(document.querySelector('#component > img')?.className, 'custom-styles'); + }); }); describe('build', () => { @@ -75,5 +82,12 @@ describe('Markdoc - Image assets', () => { const { document } = parseHTML(html); assert.match(document.querySelector('#alias > img')?.src, /^\/_astro\/cityscape.*\.webp$/); }); + + it('passes images inside image tags to configured image component', async () => { + const html = await baseFixture.readFile('/index.html'); + const { document } = parseHTML(html); + assert.equal(document.querySelector('#component > img')?.className, 'custom-styles'); + assert.match(document.querySelector('#component > img')?.src, /^\/_astro\/oar.*\.webp$/); + }); }); }); |