summaryrefslogtreecommitdiff
path: root/packages/integrations/mdx/test/mdx-escape.test.js
diff options
context:
space:
mode:
authorGravatar Nate Moore <natemoo-re@users.noreply.github.com> 2022-08-05 10:35:47 -0500
committerGravatar GitHub <noreply@github.com> 2022-08-05 10:35:47 -0500
commite569f0a5c7b56c4cce7afe95335b0aee6ac3d298 (patch)
tree9d008a74846e49fd7e13d3979c4db44162bdd8f4 /packages/integrations/mdx/test/mdx-escape.test.js
parente7bee22d18c6f1299d99793da9bea00915d144a4 (diff)
downloadastro-e569f0a5c7b56c4cce7afe95335b0aee6ac3d298.tar.gz
astro-e569f0a5c7b56c4cce7afe95335b0aee6ac3d298.tar.zst
astro-e569f0a5c7b56c4cce7afe95335b0aee6ac3d298.zip
Handle edge case in jsx-runtime (#4158)
* fix(#4135): handle edge case in jsx-runtime * test: add mdx test case * chore: fix utils reference * test: fix mdx escape test Co-authored-by: Nate Moore <nate@astro.build>
Diffstat (limited to 'packages/integrations/mdx/test/mdx-escape.test.js')
-rw-r--r--packages/integrations/mdx/test/mdx-escape.test.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/packages/integrations/mdx/test/mdx-escape.test.js b/packages/integrations/mdx/test/mdx-escape.test.js
new file mode 100644
index 000000000..d2a4e79ca
--- /dev/null
+++ b/packages/integrations/mdx/test/mdx-escape.test.js
@@ -0,0 +1,32 @@
+import mdx from '@astrojs/mdx';
+
+import { expect } from 'chai';
+import { parseHTML } from 'linkedom';
+import { loadFixture } from '../../../astro/test/test-utils.js';
+
+const FIXTURE_ROOT = new URL('./fixtures/mdx-escape/', import.meta.url);
+
+describe('MDX frontmatter', () => {
+ let fixture;
+ before(async () => {
+ fixture = await loadFixture({
+ root: FIXTURE_ROOT,
+ integrations: [mdx()],
+ });
+ await fixture.build();
+ });
+
+ it('does not have unescaped HTML at top-level', async () => {
+ const html = await fixture.readFile('/index.html');
+ const { document } = parseHTML(html);
+
+ expect(document.body.textContent).to.not.include('<em');
+ });
+
+ it('does not have unescaped HTML inside html tags', async () => {
+ const html = await fixture.readFile('/html-tag/index.html');
+ const { document } = parseHTML(html);
+
+ expect(document.body.textContent).to.not.include('<em');
+ });
+});