summaryrefslogtreecommitdiff
path: root/packages/integrations/markdoc/test
diff options
context:
space:
mode:
Diffstat (limited to 'packages/integrations/markdoc/test')
-rw-r--r--packages/integrations/markdoc/test/fixtures/render-typographer/astro.config.mjs7
-rw-r--r--packages/integrations/markdoc/test/fixtures/render-typographer/package.json9
-rw-r--r--packages/integrations/markdoc/test/fixtures/render-typographer/src/content/blog/typographer.mdoc7
-rw-r--r--packages/integrations/markdoc/test/fixtures/render-typographer/src/pages/index.astro19
-rw-r--r--packages/integrations/markdoc/test/render.test.js22
5 files changed, 64 insertions, 0 deletions
diff --git a/packages/integrations/markdoc/test/fixtures/render-typographer/astro.config.mjs b/packages/integrations/markdoc/test/fixtures/render-typographer/astro.config.mjs
new file mode 100644
index 000000000..408e036c7
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/render-typographer/astro.config.mjs
@@ -0,0 +1,7 @@
+import markdoc from '@astrojs/markdoc';
+import { defineConfig } from 'astro/config';
+
+// https://astro.build/config
+export default defineConfig({
+ integrations: [markdoc({ typographer: true })],
+});
diff --git a/packages/integrations/markdoc/test/fixtures/render-typographer/package.json b/packages/integrations/markdoc/test/fixtures/render-typographer/package.json
new file mode 100644
index 000000000..02fd6788f
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/render-typographer/package.json
@@ -0,0 +1,9 @@
+{
+ "name": "@test/markdoc-render-typographer",
+ "version": "0.0.0",
+ "private": true,
+ "dependencies": {
+ "@astrojs/markdoc": "workspace:*",
+ "astro": "workspace:*"
+ }
+}
diff --git a/packages/integrations/markdoc/test/fixtures/render-typographer/src/content/blog/typographer.mdoc b/packages/integrations/markdoc/test/fixtures/render-typographer/src/content/blog/typographer.mdoc
new file mode 100644
index 000000000..2180e7a47
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/render-typographer/src/content/blog/typographer.mdoc
@@ -0,0 +1,7 @@
+---
+title: Typographer
+---
+
+## Typographer's post
+
+This is a post to test the "typographer" option.
diff --git a/packages/integrations/markdoc/test/fixtures/render-typographer/src/pages/index.astro b/packages/integrations/markdoc/test/fixtures/render-typographer/src/pages/index.astro
new file mode 100644
index 000000000..88fc531fa
--- /dev/null
+++ b/packages/integrations/markdoc/test/fixtures/render-typographer/src/pages/index.astro
@@ -0,0 +1,19 @@
+---
+import { getEntryBySlug } from "astro:content";
+
+const post = await getEntryBySlug('blog', 'typographer');
+const { Content } = await post.render();
+---
+
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Content</title>
+</head>
+<body>
+ <Content />
+</body>
+</html>
diff --git a/packages/integrations/markdoc/test/render.test.js b/packages/integrations/markdoc/test/render.test.js
index d439adcd2..4c6d1b415 100644
--- a/packages/integrations/markdoc/test/render.test.js
+++ b/packages/integrations/markdoc/test/render.test.js
@@ -117,6 +117,15 @@ describe('Markdoc - render', () => {
renderWithRootFolderContainingSpace(html);
});
+
+ it('renders content - with typographer option', async () => {
+ const fixture = await getFixture('render-typographer');
+ await fixture.build()
+
+ const html = await fixture.readFile('/index.html');
+
+ renderTypographerChecks(html);
+ });
});
});
@@ -173,3 +182,16 @@ function renderWithRootFolderContainingSpace(html) {
const p = document.querySelector('p');
assert.equal(p.textContent, 'This is a simple Markdoc post with root folder containing a space.');
}
+
+/**
+ * @param {string} html
+ */
+function renderTypographerChecks(html) {
+ const { document } = parseHTML(html);
+
+ const h2 = document.querySelector('h2');
+ assert.equal(h2.textContent, 'Typographer’s post');
+
+ const p = document.querySelector('p');
+ assert.equal(p.textContent, 'This is a post to test the “typographer” option.');
+}