mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
e569f0a5c7
* 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>
32 lines
894 B
JavaScript
32 lines
894 B
JavaScript
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');
|
|
});
|
|
});
|