summaryrefslogtreecommitdiff
path: root/packages/markdown/remark/test/components.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/markdown/remark/test/components.test.js')
-rw-r--r--packages/markdown/remark/test/components.test.js22
1 files changed, 12 insertions, 10 deletions
diff --git a/packages/markdown/remark/test/components.test.js b/packages/markdown/remark/test/components.test.js
index 4e06d7301..e60469426 100644
--- a/packages/markdown/remark/test/components.test.js
+++ b/packages/markdown/remark/test/components.test.js
@@ -2,32 +2,34 @@ import { renderMarkdown } from '../dist/index.js';
import chai from 'chai';
describe('components', () => {
+ const renderAstroMd = (text) => renderMarkdown(text, { isAstroFlavoredMd: true });
+
it('should be able to serialize string', async () => {
- const { code } = await renderMarkdown(`<Component str="cool!" />`, {});
+ const { code } = await renderAstroMd(`<Component str="cool!" />`);
chai.expect(code).to.equal(`<Component str="cool!" />`);
});
it('should be able to serialize boolean attribute', async () => {
- const { code } = await renderMarkdown(`<Component bool={true} />`, {});
+ const { code } = await renderAstroMd(`<Component bool={true} />`);
chai.expect(code).to.equal(`<Component bool={true} />`);
});
it('should be able to serialize array', async () => {
- const { code } = await renderMarkdown(`<Component prop={["a", "b", "c"]} />`, {});
+ const { code } = await renderAstroMd(`<Component prop={["a", "b", "c"]} />`);
chai.expect(code).to.equal(`<Component prop={["a", "b", "c"]} />`);
});
it('should be able to serialize object', async () => {
- const { code } = await renderMarkdown(`<Component prop={{ a: 0, b: 1, c: 2 }} />`, {});
+ const { code } = await renderAstroMd(`<Component prop={{ a: 0, b: 1, c: 2 }} />`);
chai.expect(code).to.equal(`<Component prop={{ a: 0, b: 1, c: 2 }} />`);
});
it('should be able to serialize empty attribute', async () => {
- const { code } = await renderMarkdown(`<Component empty />`, {});
+ const { code } = await renderAstroMd(`<Component empty />`);
chai.expect(code).to.equal(`<Component empty />`);
});
@@ -35,25 +37,25 @@ describe('components', () => {
// Notable omission: shorthand attribute
it('should be able to serialize spread attribute', async () => {
- const { code } = await renderMarkdown(`<Component {...spread} />`, {});
+ const { code } = await renderAstroMd(`<Component {...spread} />`);
chai.expect(code).to.equal(`<Component {...spread} />`);
});
it('should allow client:* directives', async () => {
- const { code } = await renderMarkdown(`<Component client:load />`, {});
+ const { code } = await renderAstroMd(`<Component client:load />`);
chai.expect(code).to.equal(`<Component client:load />`);
});
it('should normalize children', async () => {
- const { code } = await renderMarkdown(`<Component bool={true}>Hello world!</Component>`, {});
+ const { code } = await renderAstroMd(`<Component bool={true}>Hello world!</Component>`);
chai.expect(code).to.equal(`<Component bool={true}>Hello world!</Component>`);
});
it('should be able to nest components', async () => {
- const { code } = await renderMarkdown(
+ const { code } = await renderAstroMd(
`<Component bool={true}><Component>Hello world!</Component></Component>`,
{}
);
@@ -64,7 +66,7 @@ describe('components', () => {
});
it('should allow markdown without many spaces', async () => {
- const { code } = await renderMarkdown(
+ const { code } = await renderAstroMd(
`<Component>
# Hello world!
</Component>`,