Skip to content

Commit

Permalink
Add failing test for compiling HTML (#56)
Browse files Browse the repository at this point in the history
Add failing test for compiling HTML
  • Loading branch information
ndelangen authored May 24, 2019
2 parents e29999b + b868930 commit d5ad111
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,26 @@ exports[`should be able to compile list with html tag 1`] = `
</div>
`;

exports[`should be able to compile multiple html 1`] = `
<div>
<p>
&lt;div&gt;hello&lt;/div&gt;
&lt;strong&gt;there&lt;/strong&gt;
&lt;em&gt;world&lt;/em&gt;
</p>
</div>
`;

exports[`should be able to compile multiple html as components 1`] = `
<div>
<p>
&lt;div&gt;hello&lt;/div&gt;
&lt;strong&gt;there&lt;/strong&gt;
&lt;em&gt;world&lt;/em&gt;
</p>
</div>
`;

exports[`should be able to compile nested lists 1`] = `
<div>
<ul>
Expand Down
16 changes: 16 additions & 0 deletions src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ it('should be able to compile html', () => {
expect(container.firstChild).toMatchSnapshot();
});

it('should be able to compile multiple html', () => {
const compile = marksy({ createElement });
const compiled = compile('<div>hello</div>\n<strong>there</strong>\n<em>world</em>');
const { container } = render(<TestComponent>{compiled.tree}</TestComponent>);

expect(container.firstChild).toMatchSnapshot();
});

it('should be able to compile html as components', () => {
const compile = marksyComponents({ createElement });
const compiled = compile('<div>hello</div>');
Expand All @@ -161,6 +169,14 @@ it('should be able to compile html as components', () => {
expect(container.firstChild).toMatchSnapshot();
});

it('should be able to compile multiple html as components', () => {
const compile = marksyComponents({ createElement });
const compiled = compile('<div>hello</div>\n<strong>there</strong>\n<em>world</em>');
const { container } = render(<TestComponent>{compiled.tree}</TestComponent>);

expect(container.firstChild).toMatchSnapshot();
});

it('should be able to compile components', () => {
const compile = marksyComponents({
createElement,
Expand Down

0 comments on commit d5ad111

Please sign in to comment.