diff options
author | 2023-10-24 20:40:54 +1300 | |
---|---|---|
committer | 2023-10-24 08:40:54 +0100 | |
commit | 73b8d60f8c3eeae74035202b0ea0d4848e736c7d (patch) | |
tree | fd39ece28ab7ac3df82e37b2d11c37874d0ce57f /packages/integrations/markdoc/test/render.test.js | |
parent | 341ef6578528a00f89bf6da5e4243b0fde272816 (diff) | |
download | astro-73b8d60f8c3eeae74035202b0ea0d4848e736c7d.tar.gz astro-73b8d60f8c3eeae74035202b0ea0d4848e736c7d.tar.zst astro-73b8d60f8c3eeae74035202b0ea0d4848e736c7d.zip |
feat(markdoc): allowIndentation integration option (#8802)
Diffstat (limited to 'packages/integrations/markdoc/test/render.test.js')
-rw-r--r-- | packages/integrations/markdoc/test/render.test.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/packages/integrations/markdoc/test/render.test.js b/packages/integrations/markdoc/test/render.test.js index 86ffcb707..97c441b85 100644 --- a/packages/integrations/markdoc/test/render.test.js +++ b/packages/integrations/markdoc/test/render.test.js @@ -46,6 +46,19 @@ describe('Markdoc - render', () => { await server.stop(); }); + it('renders content - with indented components', async () => { + const fixture = await getFixture('render-with-indented-components'); + const server = await fixture.startDevServer(); + + const res = await fixture.fetch('/'); + const html = await res.text(); + + renderIndentedComponentsChecks(html); + + await server.stop(); + + }); + it('renders content - with `render: null` in document', async () => { const fixture = await getFixture('render-null'); const server = await fixture.startDevServer(); @@ -87,6 +100,15 @@ describe('Markdoc - render', () => { renderComponentsChecks(html); }); + it('renders content - with indented components', async () => { + const fixture = await getFixture('render-with-indented-components'); + await fixture.build(); + + const html = await fixture.readFile('/index.html'); + + renderIndentedComponentsChecks(html); + }); + it('renders content - with `render: null` in document', async () => { const fixture = await getFixture('render-null'); await fixture.build(); @@ -126,6 +148,26 @@ function renderComponentsChecks(html) { } /** @param {string} html */ +function renderIndentedComponentsChecks(html) { + const { document } = parseHTML(html); + const h2 = document.querySelector('h2'); + expect(h2.textContent).to.equal('Post with indented components'); + + // Renders custom shortcode components + const marquees = document.querySelectorAll('marquee'); + expect(marquees.length).to.equal(2); + + // Renders h3 + const h3 = document.querySelector('h3'); + expect(h3.textContent).to.equal('I am an h3!'); + + // Renders Astro Code component + const pre = document.querySelector('pre'); + expect(pre).to.not.be.null; + expect(pre.className).to.equal('astro-code github-dark'); +} + +/** @param {string} html */ function renderConfigChecks(html) { const { document } = parseHTML(html); const h2 = document.querySelector('h2'); |