mirror of
https://github.com/bendtherules/react-to-markdown.git
synced 2026-08-18 13:53:11 +00:00
tagHandler - Handle H6 + tests
This commit is contained in:
@@ -58,6 +58,10 @@ test('should render plain h5 with text', () => {
|
|||||||
expect((render(<h5>abcd</h5>) as string).trim()).toBe('##### abcd');
|
expect((render(<h5>abcd</h5>) as string).trim()).toBe('##### abcd');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should render plain h6 with text', () => {
|
||||||
|
expect((render(<h6>abcd</h6>) as string).trim()).toBe('###### abcd');
|
||||||
|
});
|
||||||
|
|
||||||
test('should render plain strong with text', () => {
|
test('should render plain strong with text', () => {
|
||||||
expect((render(<strong>abcd</strong>) as string).trim()).toBe('**abcd**');
|
expect((render(<strong>abcd</strong>) as string).trim()).toBe('**abcd**');
|
||||||
});
|
});
|
||||||
@@ -110,24 +114,18 @@ test('should render image with alt text and title', () => {
|
|||||||
|
|
||||||
test('should render image with only alt text', () => {
|
test('should render image with only alt text', () => {
|
||||||
expect(
|
expect(
|
||||||
(render(
|
(render(<img src="./test.jpg" alt="some alt" />) as string).trim()
|
||||||
<img src="./test.jpg" alt="some alt" />
|
|
||||||
) as string).trim()
|
|
||||||
).toBe('');
|
).toBe('');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should render image with only title', () => {
|
test('should render image with only title', () => {
|
||||||
expect(
|
expect(
|
||||||
(render(
|
(render(<img src="./test.jpg" title="some title" />) as string).trim()
|
||||||
<img src="./test.jpg" title="some title" />
|
|
||||||
) as string).trim()
|
|
||||||
).toBe('');
|
).toBe('');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should render image without attributes', () => {
|
test('should render image without attributes', () => {
|
||||||
expect(
|
expect((render(<img src="./test.jpg" />) as string).trim()).toBe(
|
||||||
(render(
|
''
|
||||||
<img src="./test.jpg" />
|
);
|
||||||
) as string).trim()
|
|
||||||
).toBe('');
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ export default function handleTag(
|
|||||||
case 'h5':
|
case 'h5':
|
||||||
newParentASTNode = childASTNode = heading(5);
|
newParentASTNode = childASTNode = heading(5);
|
||||||
break;
|
break;
|
||||||
|
case 'h6':
|
||||||
|
newParentASTNode = childASTNode = heading(6);
|
||||||
|
break;
|
||||||
// END - Handle all headings
|
// END - Handle all headings
|
||||||
|
|
||||||
// START - Handle strong and em
|
// START - Handle strong and em
|
||||||
|
|||||||
Reference in New Issue
Block a user