migrate test framework
This commit is contained in:
@ -1,13 +1,60 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Markdown Preview renderer HTML rendering should render HTML 1`] = `"<div class=\\"nc-widgetPreview\\"><p>Paragraph with <em>inline</em> element</p></div>"`;
|
||||
exports[`Markdown Preview renderer HTML rendering should render HTML 1`] = `
|
||||
.emotion-0 {
|
||||
margin: 15px 2px;
|
||||
}
|
||||
|
||||
exports[`Markdown Preview renderer Markdown rendering Code should render code 1`] = `"<div class=\\"nc-widgetPreview\\"><p>Use the <code>printf()</code> function.</p></div>"`;
|
||||
<div
|
||||
className="emotion-0 emotion-1"
|
||||
dangerouslySetInnerHTML={
|
||||
Object {
|
||||
"__html": "<p>Paragraph with <em>inline</em> element</p>",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`Markdown Preview renderer Markdown rendering Code should render code 2 1`] = `"<div class=\\"nc-widgetPreview\\"><p><code>There is a literal backtick (\`) here.</code></p></div>"`;
|
||||
exports[`Markdown Preview renderer Markdown rendering Code should render code 1`] = `
|
||||
.emotion-0 {
|
||||
margin: 15px 2px;
|
||||
}
|
||||
|
||||
<div
|
||||
className="emotion-0 emotion-1"
|
||||
dangerouslySetInnerHTML={
|
||||
Object {
|
||||
"__html": "<p>Use the <code>printf()</code> function.</p>",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`Markdown Preview renderer Markdown rendering Code should render code 2 1`] = `
|
||||
.emotion-0 {
|
||||
margin: 15px 2px;
|
||||
}
|
||||
|
||||
<div
|
||||
className="emotion-0 emotion-1"
|
||||
dangerouslySetInnerHTML={
|
||||
Object {
|
||||
"__html": "<p><code>There is a literal backtick (\`) here.</code></p>",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`Markdown Preview renderer Markdown rendering General should render markdown 1`] = `
|
||||
"<div class=\\"nc-widgetPreview\\"><h1>H1</h1>
|
||||
.emotion-0 {
|
||||
margin: 15px 2px;
|
||||
}
|
||||
|
||||
<div
|
||||
className="emotion-0 emotion-1"
|
||||
dangerouslySetInnerHTML={
|
||||
Object {
|
||||
"__html": "<h1>H1</h1>
|
||||
<p>Text with <strong>bold</strong> & <em>em</em> elements</p>
|
||||
<h2>H2</h2>
|
||||
<ul>
|
||||
@ -24,11 +71,22 @@ exports[`Markdown Preview renderer Markdown rendering General should render mark
|
||||
<p><a href=\\"http://google.com\\">link title</a></p>
|
||||
<h5>H5</h5>
|
||||
<p></p>
|
||||
<h6>H6</h6></div>"
|
||||
<h6>H6</h6>",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`Markdown Preview renderer Markdown rendering HTML should render HTML as is when using Markdown 1`] = `
|
||||
"<div class=\\"nc-widgetPreview\\"><h1>Title</h1>
|
||||
.emotion-0 {
|
||||
margin: 15px 2px;
|
||||
}
|
||||
|
||||
<div
|
||||
className="emotion-0 emotion-1"
|
||||
dangerouslySetInnerHTML={
|
||||
Object {
|
||||
"__html": "<h1>Title</h1>
|
||||
<form action=\\"test\\">
|
||||
<label for=\\"input\\">
|
||||
<input type=\\"checkbox\\" checked=\\"checked\\" id=\\"input\\"/> My label
|
||||
@ -38,25 +96,127 @@ exports[`Markdown Preview renderer Markdown rendering HTML should render HTML as
|
||||
<dt>Testing HTML in Markdown</dt>
|
||||
</dl>
|
||||
</form>
|
||||
<h1 style=\\"display: block; border: 10px solid #f00; width: 100%\\">Test</h1></div>"
|
||||
<h1 style=\\"display: block; border: 10px solid #f00; width: 100%\\">Test</h1>",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`Markdown Preview renderer Markdown rendering Headings should render Heading 1 1`] = `"<div class=\\"nc-widgetPreview\\"><h1>Title</h1></div>"`;
|
||||
exports[`Markdown Preview renderer Markdown rendering Headings should render Heading 1 1`] = `
|
||||
.emotion-0 {
|
||||
margin: 15px 2px;
|
||||
}
|
||||
|
||||
exports[`Markdown Preview renderer Markdown rendering Headings should render Heading 2 1`] = `"<div class=\\"nc-widgetPreview\\"><h2>Title</h2></div>"`;
|
||||
<div
|
||||
className="emotion-0 emotion-1"
|
||||
dangerouslySetInnerHTML={
|
||||
Object {
|
||||
"__html": "<h1>Title</h1>",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`Markdown Preview renderer Markdown rendering Headings should render Heading 3 1`] = `"<div class=\\"nc-widgetPreview\\"><h3>Title</h3></div>"`;
|
||||
exports[`Markdown Preview renderer Markdown rendering Headings should render Heading 2 1`] = `
|
||||
.emotion-0 {
|
||||
margin: 15px 2px;
|
||||
}
|
||||
|
||||
exports[`Markdown Preview renderer Markdown rendering Headings should render Heading 4 1`] = `"<div class=\\"nc-widgetPreview\\"><h4>Title</h4></div>"`;
|
||||
<div
|
||||
className="emotion-0 emotion-1"
|
||||
dangerouslySetInnerHTML={
|
||||
Object {
|
||||
"__html": "<h2>Title</h2>",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`Markdown Preview renderer Markdown rendering Headings should render Heading 5 1`] = `"<div class=\\"nc-widgetPreview\\"><h5>Title</h5></div>"`;
|
||||
exports[`Markdown Preview renderer Markdown rendering Headings should render Heading 3 1`] = `
|
||||
.emotion-0 {
|
||||
margin: 15px 2px;
|
||||
}
|
||||
|
||||
exports[`Markdown Preview renderer Markdown rendering Headings should render Heading 6 1`] = `"<div class=\\"nc-widgetPreview\\"><h6>Title</h6></div>"`;
|
||||
<div
|
||||
className="emotion-0 emotion-1"
|
||||
dangerouslySetInnerHTML={
|
||||
Object {
|
||||
"__html": "<h3>Title</h3>",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`Markdown Preview renderer Markdown rendering Links should render links 1`] = `"<div class=\\"nc-widgetPreview\\"><p>I get 10 times more traffic from <a href=\\"http://google.com/\\" title=\\"Google\\">Google</a> than from <a href=\\"http://search.yahoo.com/\\" title=\\"Yahoo Search\\">Yahoo</a> or <a href=\\"http://search.msn.com/\\" title=\\"MSN Search\\">MSN</a>.</p></div>"`;
|
||||
exports[`Markdown Preview renderer Markdown rendering Headings should render Heading 4 1`] = `
|
||||
.emotion-0 {
|
||||
margin: 15px 2px;
|
||||
}
|
||||
|
||||
<div
|
||||
className="emotion-0 emotion-1"
|
||||
dangerouslySetInnerHTML={
|
||||
Object {
|
||||
"__html": "<h4>Title</h4>",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`Markdown Preview renderer Markdown rendering Headings should render Heading 5 1`] = `
|
||||
.emotion-0 {
|
||||
margin: 15px 2px;
|
||||
}
|
||||
|
||||
<div
|
||||
className="emotion-0 emotion-1"
|
||||
dangerouslySetInnerHTML={
|
||||
Object {
|
||||
"__html": "<h5>Title</h5>",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`Markdown Preview renderer Markdown rendering Headings should render Heading 6 1`] = `
|
||||
.emotion-0 {
|
||||
margin: 15px 2px;
|
||||
}
|
||||
|
||||
<div
|
||||
className="emotion-0 emotion-1"
|
||||
dangerouslySetInnerHTML={
|
||||
Object {
|
||||
"__html": "<h6>Title</h6>",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`Markdown Preview renderer Markdown rendering Links should render links 1`] = `
|
||||
.emotion-0 {
|
||||
margin: 15px 2px;
|
||||
}
|
||||
|
||||
<div
|
||||
className="emotion-0 emotion-1"
|
||||
dangerouslySetInnerHTML={
|
||||
Object {
|
||||
"__html": "<p>I get 10 times more traffic from <a href=\\"http://google.com/\\" title=\\"Google\\">Google</a> than from <a href=\\"http://search.yahoo.com/\\" title=\\"Yahoo Search\\">Yahoo</a> or <a href=\\"http://search.msn.com/\\" title=\\"MSN Search\\">MSN</a>.</p>",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`Markdown Preview renderer Markdown rendering Lists should render lists 1`] = `
|
||||
"<div class=\\"nc-widgetPreview\\"><ol>
|
||||
.emotion-0 {
|
||||
margin: 15px 2px;
|
||||
}
|
||||
|
||||
<div
|
||||
className="emotion-0 emotion-1"
|
||||
dangerouslySetInnerHTML={
|
||||
Object {
|
||||
"__html": "<ol>
|
||||
<li>ol item 1</li>
|
||||
<li>
|
||||
<p>ol item 2</p>
|
||||
@ -74,5 +234,8 @@ exports[`Markdown Preview renderer Markdown rendering Lists should render lists
|
||||
</ul>
|
||||
</li>
|
||||
<li>ol item 3</li>
|
||||
</ol></div>"
|
||||
</ol>",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
@ -2,9 +2,10 @@
|
||||
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import renderer from 'react-test-renderer';
|
||||
import { padStart } from 'lodash';
|
||||
import MarkdownPreview from '../index';
|
||||
import { markdownToHtml } from '../../serializers';
|
||||
import MarkdownPreview from '../MarkdownPreview';
|
||||
import { markdownToHtml } from '../serializers';
|
||||
|
||||
const parser = markdownToHtml;
|
||||
|
||||
@ -38,8 +39,9 @@ Text with **bold** & _em_ elements
|
||||
|
||||
###### H6
|
||||
`;
|
||||
const component = shallow(<MarkdownPreview value={markdownToHtml(value)} />);
|
||||
expect(component.html()).toMatchSnapshot();
|
||||
expect(
|
||||
renderer.create(<MarkdownPreview value={markdownToHtml(value)} />).toJSON()
|
||||
).toMatchSnapshot()
|
||||
});
|
||||
});
|
||||
|
||||
@ -47,8 +49,9 @@ Text with **bold** & _em_ elements
|
||||
for (const heading of [...Array(6).keys()]) {
|
||||
it(`should render Heading ${ heading + 1 }`, () => {
|
||||
const value = padStart(' Title', heading + 7, '#');
|
||||
const component = shallow(<MarkdownPreview value={markdownToHtml(value)} />);
|
||||
expect(component.html()).toMatchSnapshot();
|
||||
expect(
|
||||
renderer.create(<MarkdownPreview value={markdownToHtml(value)} />).toJSON()
|
||||
).toMatchSnapshot()
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -66,8 +69,9 @@ Text with **bold** & _em_ elements
|
||||
1. Sub-Sublist 3
|
||||
1. ol item 3
|
||||
`;
|
||||
const component = shallow(<MarkdownPreview value={markdownToHtml(value)} />);
|
||||
expect(component.html()).toMatchSnapshot();
|
||||
expect(
|
||||
renderer.create(<MarkdownPreview value={markdownToHtml(value)} />).toJSON()
|
||||
).toMatchSnapshot()
|
||||
});
|
||||
});
|
||||
|
||||
@ -80,22 +84,25 @@ I get 10 times more traffic from [Google] [1] than from [Yahoo] [2] or [MSN] [3]
|
||||
[2]: http://search.yahoo.com/ "Yahoo Search"
|
||||
[3]: http://search.msn.com/ "MSN Search"
|
||||
`;
|
||||
const component = shallow(<MarkdownPreview value={markdownToHtml(value)} />);
|
||||
expect(component.html()).toMatchSnapshot();
|
||||
expect(
|
||||
renderer.create(<MarkdownPreview value={markdownToHtml(value)} />).toJSON()
|
||||
).toMatchSnapshot()
|
||||
});
|
||||
});
|
||||
|
||||
describe('Code', () => {
|
||||
it('should render code', () => {
|
||||
const value = 'Use the `printf()` function.';
|
||||
const component = shallow(<MarkdownPreview value={markdownToHtml(value)} />);
|
||||
expect(component.html()).toMatchSnapshot();
|
||||
expect(
|
||||
renderer.create(<MarkdownPreview value={markdownToHtml(value)} />).toJSON()
|
||||
).toMatchSnapshot()
|
||||
});
|
||||
|
||||
it('should render code 2', () => {
|
||||
const value = '``There is a literal backtick (`) here.``';
|
||||
const component = shallow(<MarkdownPreview value={markdownToHtml(value)} />);
|
||||
expect(component.html()).toMatchSnapshot();
|
||||
expect(
|
||||
renderer.create(<MarkdownPreview value={markdownToHtml(value)} />).toJSON()
|
||||
).toMatchSnapshot()
|
||||
});
|
||||
});
|
||||
|
||||
@ -116,8 +123,9 @@ I get 10 times more traffic from [Google] [1] than from [Yahoo] [2] or [MSN] [3]
|
||||
|
||||
<h1 style="display: block; border: 10px solid #f00; width: 100%">Test</h1>
|
||||
`;
|
||||
const component = shallow(<MarkdownPreview value={markdownToHtml(value)} />);
|
||||
expect(component.html()).toMatchSnapshot();
|
||||
expect(
|
||||
renderer.create(<MarkdownPreview value={markdownToHtml(value)} />).toJSON()
|
||||
).toMatchSnapshot()
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -125,8 +133,9 @@ I get 10 times more traffic from [Google] [1] than from [Yahoo] [2] or [MSN] [3]
|
||||
describe('HTML rendering', () => {
|
||||
it('should render HTML', () => {
|
||||
const value = '<p>Paragraph with <em>inline</em> element</p>';
|
||||
const component = shallow(<MarkdownPreview value={markdownToHtml(value)} />);
|
||||
expect(component.html()).toMatchSnapshot();
|
||||
expect(
|
||||
renderer.create(<MarkdownPreview value={markdownToHtml(value)} />).toJSON()
|
||||
).toMatchSnapshot()
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user