Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test case showing code element is blocks & spans #50

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ exports[`should allow overriding code element with components version 1`] = `
</div>
`;

exports[`should allow overriding codeblock element with components version 1`] = `
<div>
<div>
code
</div>
</div>
`;

exports[`should be able to combine in compilation 1`] = `
<div>
<h1
Expand Down
18 changes: 18 additions & 0 deletions src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,24 @@ it('should allow overriding code element with components version', () => {
expect(tree).toMatchSnapshot();
});

it('should allow overriding codeblock element with components version', () => {
const compile = marksyComponents({
createElement,
elements: {
code() {
return <div>code</div>
}
}
});
const compiled = compile('```js\nconst foo = "bar"\n```');

const tree = renderer.create(
<TestComponent>{compiled.tree}</TestComponent>
).toJSON();

expect(tree).toMatchSnapshot();
});

it('should highlight code with highlight.js', () => {
const compile = marksy({
createElement,
Expand Down