From f42cc34caea8fdb79780feac665bcff7765faa1e Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Thu, 19 May 2022 15:40:57 -0500 Subject: [PATCH] fix(#3319): add regression test for component children --- packages/astro/test/astro-markdown.test.js | 7 +++++++ .../src/components/TextBlock.jsx | 20 +++++++++++++++++++ .../astro-markdown/src/pages/children.md | 12 +++++++++++ 3 files changed, 39 insertions(+) create mode 100644 packages/astro/test/fixtures/astro-markdown/src/components/TextBlock.jsx create mode 100644 packages/astro/test/fixtures/astro-markdown/src/pages/children.md diff --git a/packages/astro/test/astro-markdown.test.js b/packages/astro/test/astro-markdown.test.js index 7c52f8d730b13..63a49d5faf1da 100644 --- a/packages/astro/test/astro-markdown.test.js +++ b/packages/astro/test/astro-markdown.test.js @@ -42,6 +42,13 @@ describe('Astro Markdown', () => { expect($('h1').attr("id")).to.equal('my-blog-post'); }); + it('Correctly handles component children in markdown pages (#3319)', async () => { + const html = await fixture.readFile('/children/index.html'); + + console.log(html); + expect(html).not.to.contain('

'); + }); + it('Can load more complex jsxy stuff', async () => { const html = await fixture.readFile('/complex/index.html'); const $ = cheerio.load(html); diff --git a/packages/astro/test/fixtures/astro-markdown/src/components/TextBlock.jsx b/packages/astro/test/fixtures/astro-markdown/src/components/TextBlock.jsx new file mode 100644 index 0000000000000..d9ea2534fec24 --- /dev/null +++ b/packages/astro/test/fixtures/astro-markdown/src/components/TextBlock.jsx @@ -0,0 +1,20 @@ +import { h } from 'preact'; + +const TextBlock = ({ + title, + children, + noPadding = false, +}) => { + return ( +
+

{title}

+

{children}

+
+ ); +}; + +export default TextBlock; diff --git a/packages/astro/test/fixtures/astro-markdown/src/pages/children.md b/packages/astro/test/fixtures/astro-markdown/src/pages/children.md new file mode 100644 index 0000000000000..a22ee5f961486 --- /dev/null +++ b/packages/astro/test/fixtures/astro-markdown/src/pages/children.md @@ -0,0 +1,12 @@ +--- +setup: import TextBlock from '../components/TextBlock' +--- +{/* https://github.com/withastro/astro/issues/3319 */} + + + +