Renamed component
This commit is contained in:
parent
f38e6b6f25
commit
78eb65bca2
@ -1,6 +1,6 @@
|
|||||||
import React, { PropTypes } from 'react';
|
import React, { PropTypes } from 'react';
|
||||||
import { getSyntaxes } from './richText';
|
import { getSyntaxes } from './richText';
|
||||||
import MarkitupReactRenderer from './MarkitupReactRenderer';
|
import MarkupItReactRenderer from './MarkupItReactRenderer';
|
||||||
|
|
||||||
const schema = {
|
const schema = {
|
||||||
'mediaproxy': ({ token }) => (
|
'mediaproxy': ({ token }) => (
|
||||||
@ -18,7 +18,7 @@ const MarkdownPreview = ({ value }) => {
|
|||||||
|
|
||||||
const { markdown } = getSyntaxes();
|
const { markdown } = getSyntaxes();
|
||||||
return (
|
return (
|
||||||
<MarkitupReactRenderer
|
<MarkupItReactRenderer
|
||||||
value={value}
|
value={value}
|
||||||
syntax={markdown}
|
syntax={markdown}
|
||||||
schema={schema}
|
schema={schema}
|
||||||
|
@ -75,7 +75,7 @@ function renderToken(schema, token, index = 0, key = '0') {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class MarkitupReactRenderer extends React.Component {
|
export default class MarkupItReactRenderer extends React.Component {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
@ -96,7 +96,7 @@ export default class MarkitupReactRenderer extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MarkitupReactRenderer.propTypes = {
|
MarkupItReactRenderer.propTypes = {
|
||||||
value: PropTypes.string,
|
value: PropTypes.string,
|
||||||
syntax: PropTypes.instanceOf(Syntax).isRequired,
|
syntax: PropTypes.instanceOf(Syntax).isRequired,
|
||||||
schema: PropTypes.objectOf(PropTypes.oneOfType([
|
schema: PropTypes.objectOf(PropTypes.oneOfType([
|
@ -8,14 +8,14 @@ import MarkupIt from 'markup-it';
|
|||||||
import markdownSyntax from 'markup-it/syntaxes/markdown';
|
import markdownSyntax from 'markup-it/syntaxes/markdown';
|
||||||
import htmlSyntax from 'markup-it/syntaxes/html';
|
import htmlSyntax from 'markup-it/syntaxes/html';
|
||||||
import reInline from 'markup-it/syntaxes/markdown/re/inline';
|
import reInline from 'markup-it/syntaxes/markdown/re/inline';
|
||||||
import MarkitupReactRenderer from '../MarkitupReactRenderer';
|
import MarkupItReactRenderer from '../MarkupItReactRenderer';
|
||||||
|
|
||||||
describe('MarkitupReactRenderer', () => {
|
describe('MarkitupReactRenderer', () => {
|
||||||
|
|
||||||
describe('basics', () => {
|
describe('basics', () => {
|
||||||
it('should re-render properly after a value and syntax update', () => {
|
it('should re-render properly after a value and syntax update', () => {
|
||||||
const component = shallow(
|
const component = shallow(
|
||||||
<MarkitupReactRenderer
|
<MarkupItReactRenderer
|
||||||
value="# Title"
|
value="# Title"
|
||||||
syntax={markdownSyntax}
|
syntax={markdownSyntax}
|
||||||
/>
|
/>
|
||||||
@ -31,7 +31,7 @@ describe('MarkitupReactRenderer', () => {
|
|||||||
|
|
||||||
it('should not update the parser if syntax didn\'t change', () => {
|
it('should not update the parser if syntax didn\'t change', () => {
|
||||||
const component = shallow(
|
const component = shallow(
|
||||||
<MarkitupReactRenderer
|
<MarkupItReactRenderer
|
||||||
value="# Title"
|
value="# Title"
|
||||||
syntax={markdownSyntax}
|
syntax={markdownSyntax}
|
||||||
/>
|
/>
|
||||||
@ -75,7 +75,7 @@ Text with **bold** & _em_ elements
|
|||||||
###### H6
|
###### H6
|
||||||
`;
|
`;
|
||||||
const component = shallow(
|
const component = shallow(
|
||||||
<MarkitupReactRenderer
|
<MarkupItReactRenderer
|
||||||
value={value}
|
value={value}
|
||||||
syntax={markdownSyntax}
|
syntax={markdownSyntax}
|
||||||
/>
|
/>
|
||||||
@ -89,7 +89,7 @@ Text with **bold** & _em_ elements
|
|||||||
it(`should render Heading ${heading + 1}`, () => {
|
it(`should render Heading ${heading + 1}`, () => {
|
||||||
const value = padStart(' Title', heading + 7, '#');
|
const value = padStart(' Title', heading + 7, '#');
|
||||||
const component = shallow(
|
const component = shallow(
|
||||||
<MarkitupReactRenderer
|
<MarkupItReactRenderer
|
||||||
value={value}
|
value={value}
|
||||||
syntax={markdownSyntax}
|
syntax={markdownSyntax}
|
||||||
/>
|
/>
|
||||||
@ -113,7 +113,7 @@ Text with **bold** & _em_ elements
|
|||||||
1. ol item 3
|
1. ol item 3
|
||||||
`;
|
`;
|
||||||
const component = shallow(
|
const component = shallow(
|
||||||
<MarkitupReactRenderer
|
<MarkupItReactRenderer
|
||||||
value={value}
|
value={value}
|
||||||
syntax={markdownSyntax}
|
syntax={markdownSyntax}
|
||||||
/>
|
/>
|
||||||
@ -132,7 +132,7 @@ I get 10 times more traffic from [Google] [1] than from [Yahoo] [2] or [MSN] [3]
|
|||||||
[3]: http://search.msn.com/ "MSN Search"
|
[3]: http://search.msn.com/ "MSN Search"
|
||||||
`;
|
`;
|
||||||
const component = shallow(
|
const component = shallow(
|
||||||
<MarkitupReactRenderer
|
<MarkupItReactRenderer
|
||||||
value={value}
|
value={value}
|
||||||
syntax={markdownSyntax}
|
syntax={markdownSyntax}
|
||||||
/>
|
/>
|
||||||
@ -145,7 +145,7 @@ I get 10 times more traffic from [Google] [1] than from [Yahoo] [2] or [MSN] [3]
|
|||||||
it('should render code', () => {
|
it('should render code', () => {
|
||||||
const value = 'Use the `printf()` function.';
|
const value = 'Use the `printf()` function.';
|
||||||
const component = shallow(
|
const component = shallow(
|
||||||
<MarkitupReactRenderer
|
<MarkupItReactRenderer
|
||||||
value={value}
|
value={value}
|
||||||
syntax={markdownSyntax}
|
syntax={markdownSyntax}
|
||||||
/>
|
/>
|
||||||
@ -156,7 +156,7 @@ I get 10 times more traffic from [Google] [1] than from [Yahoo] [2] or [MSN] [3]
|
|||||||
it('should render code 2', () => {
|
it('should render code 2', () => {
|
||||||
const value = '``There is a literal backtick (`) here.``';
|
const value = '``There is a literal backtick (`) here.``';
|
||||||
const component = shallow(
|
const component = shallow(
|
||||||
<MarkitupReactRenderer
|
<MarkupItReactRenderer
|
||||||
value={value}
|
value={value}
|
||||||
syntax={markdownSyntax}
|
syntax={markdownSyntax}
|
||||||
/>
|
/>
|
||||||
@ -183,7 +183,7 @@ 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>
|
<h1 style="display: block; border: 10px solid #f00; width: 100%">Test</h1>
|
||||||
`;
|
`;
|
||||||
const component = shallow(
|
const component = shallow(
|
||||||
<MarkitupReactRenderer
|
<MarkupItReactRenderer
|
||||||
value={value}
|
value={value}
|
||||||
syntax={markdownSyntax}
|
syntax={markdownSyntax}
|
||||||
/>
|
/>
|
||||||
@ -225,7 +225,7 @@ I get 10 times more traffic from [Google] [1] than from [Yahoo] [2] or [MSN] [3]
|
|||||||

|

|
||||||
`;
|
`;
|
||||||
const component = shallow(
|
const component = shallow(
|
||||||
<MarkitupReactRenderer
|
<MarkupItReactRenderer
|
||||||
value={value}
|
value={value}
|
||||||
syntax={myMarkdownSyntax}
|
syntax={myMarkdownSyntax}
|
||||||
schema={myCustomSchema}
|
schema={myCustomSchema}
|
||||||
@ -239,7 +239,7 @@ I get 10 times more traffic from [Google] [1] than from [Yahoo] [2] or [MSN] [3]
|
|||||||
it('should render HTML', () => {
|
it('should render HTML', () => {
|
||||||
const value = '<p>Paragraph with <em>inline</em> element</p>';
|
const value = '<p>Paragraph with <em>inline</em> element</p>';
|
||||||
const component = shallow(
|
const component = shallow(
|
||||||
<MarkitupReactRenderer
|
<MarkupItReactRenderer
|
||||||
value={value}
|
value={value}
|
||||||
syntax={htmlSyntax}
|
syntax={htmlSyntax}
|
||||||
/>
|
/>
|
Loading…
x
Reference in New Issue
Block a user