Skip to content

Commit

Permalink
update(code): リファクタ・コード整理
Browse files Browse the repository at this point in the history
  • Loading branch information
Himenon committed Nov 10, 2018
1 parent a45e41f commit cb9fd87
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 167 deletions.
17 changes: 13 additions & 4 deletions src/react-markdown/__tests__/markdown.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom/server';
import * as renderer from 'react-test-renderer';
import { Heading1, Heading1Props } from '../heading1';
import { defaultProps, Markdown, MarkdownProps } from '../markdown';
Expand All @@ -19,15 +20,23 @@ describe('MarkdownComponent', () => {
expect(jsonValue).toEqual({ type: 'h1', props: {}, children: ['sample text'] });
});

test('props.textを設定しない', () => {
const props: MarkdownProps = {
h1: {},
scope: { Title: (props1: Heading1Props) => <Heading1 {...props1} /> },
};
const result = ReactDOM.renderToStaticMarkup(<Markdown {...props} />);
expect(result).toEqual('<div></div>');
});

test('Rendering Value', () => {
const props: MarkdownProps = {
text: '<h1>Hello Gen</h1>',
text: '<h1>Hello React Markdown</h1>',
h1: {},
scope: { Title: (props1: Heading1Props) => <Heading1 {...props1} /> },
};
const result = renderer.create(<Markdown {...props} />);
const jsonValue = result.toJSON();
expect(jsonValue).toEqual({ type: 'div', props: {}, children: null });
const result = ReactDOM.renderToStaticMarkup(<Markdown {...props} />);
expect(result).not.toEqual('<div><h1>Hello React Markdown</h1></div>');
});

test('Rendering Value no scope', () => {
Expand Down
21 changes: 0 additions & 21 deletions src/remark-react-latest/__tests__/main.test.tsx

This file was deleted.

98 changes: 0 additions & 98 deletions src/remark-react-latest/index.ts

This file was deleted.

44 changes: 0 additions & 44 deletions src/remark-react-latest/sample.tsx

This file was deleted.

15 changes: 15 additions & 0 deletions src/remark-react/__tests__/options.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,19 @@ describe('remarkReactComponents', () => {
children: ['foo'],
});
});

test('a', () => {
const result = renderer.create(
Options.remarkReactComponents.a({
href: 'http://example.com',
children: 'foo',
}),
);
const jsonValue = result.toJSON();
expect(jsonValue).toEqual({
type: 'h1',
props: {},
children: ['foo'],
});
});
});

0 comments on commit cb9fd87

Please sign in to comment.