diff options
author | 2024-04-03 16:48:53 -0400 | |
---|---|---|
committer | 2024-04-03 16:48:53 -0400 | |
commit | 90cfade88c2b9a34d8a5fe711ce329732d690409 (patch) | |
tree | b76d0de544c8aebf0a8051aed6cb615af964295f /packages/integrations/markdoc/test/render-html.test.js | |
parent | 8ca8943ce2c10f06c90398f10c583002cd9a6bee (diff) | |
download | astro-90cfade88c2b9a34d8a5fe711ce329732d690409.tar.gz astro-90cfade88c2b9a34d8a5fe711ce329732d690409.tar.zst astro-90cfade88c2b9a34d8a5fe711ce329732d690409.zip |
feat: automatic Markdoc partial resolution (#10649)
* wip: react counter example
* feat: resolve markdoc partials by file path
* test: components within partials
* test: html within partial
* chore: changeset
* fix: respect user configured partials
* test: basic partials
* chore: lock
* chore: fix lock
* chore: minor -> patch
* fix: use --parallel for dev server timeout error
* refactor: move component tests to separate file
* fix: build indent fixture
* fix: check before addWatchFile
* refactor: rootRelative -> relativePartial
* deps: use workspace react integration
* refactor: split test files by fixture
* refactor: switch to preact to avoid react prod build error
* feat: use vite pluginContext
* fix: handle missing ./
* chore: bump timeout
Diffstat (limited to 'packages/integrations/markdoc/test/render-html.test.js')
-rw-r--r-- | packages/integrations/markdoc/test/render-html.test.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/packages/integrations/markdoc/test/render-html.test.js b/packages/integrations/markdoc/test/render-html.test.js index 785599ae5..4780444bf 100644 --- a/packages/integrations/markdoc/test/render-html.test.js +++ b/packages/integrations/markdoc/test/render-html.test.js @@ -54,6 +54,13 @@ describe('Markdoc - render html', () => { renderRandomlyCasedHTMLAttributesChecks(html); }); + + it('renders content - html within partials', async () => { + const res = await fixture.fetch('/with-partial'); + const html = await res.text(); + + renderHTMLWithinPartialChecks(html); + }); }); describe('build', () => { @@ -84,6 +91,12 @@ describe('Markdoc - render html', () => { renderRandomlyCasedHTMLAttributesChecks(html); }); + + it('renders content - html within partials', async () => { + const html = await fixture.readFile('/with-partial/index.html'); + + renderHTMLWithinPartialChecks(html); + }); }); }); @@ -187,6 +200,16 @@ function renderRandomlyCasedHTMLAttributesChecks(html) { } /** + * @param {string} html + */ +function renderHTMLWithinPartialChecks(html) { + const { document } = parseHTML(html); + + const li = document.querySelector('ul > li#partial'); + assert.equal(li.textContent, 'List item'); +} + +/** * Asserts that the rendered HTML tags with interleaved Markdoc tags (both block and inline) rendered in the expected nested graph of elemements * * @param {string} html */ |