summaryrefslogtreecommitdiff
path: root/packages/integrations/markdoc/test/render-html.test.js
diff options
context:
space:
mode:
authorGravatar Ben Holmes <hey@bholmes.dev> 2024-04-03 16:48:53 -0400
committerGravatar GitHub <noreply@github.com> 2024-04-03 16:48:53 -0400
commit90cfade88c2b9a34d8a5fe711ce329732d690409 (patch)
treeb76d0de544c8aebf0a8051aed6cb615af964295f /packages/integrations/markdoc/test/render-html.test.js
parent8ca8943ce2c10f06c90398f10c583002cd9a6bee (diff)
downloadastro-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.js23
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 */