mirror of
https://github.com/bendtherules/react-to-markdown.git
synced 2026-08-18 13:53:11 +00:00
tagHandler - Handle anchor tag + tests
This commit is contained in:
@@ -129,3 +129,29 @@ test('should render image without attributes', () => {
|
||||
''
|
||||
);
|
||||
});
|
||||
|
||||
test('should render link with text and title', () => {
|
||||
expect(
|
||||
(render(
|
||||
<a href="./test" title="some title">
|
||||
some text
|
||||
</a>
|
||||
) as string).trim()
|
||||
).toBe('[some text](./test "some title")');
|
||||
});
|
||||
|
||||
test('should render link with only text', () => {
|
||||
expect((render(<a href="./test">some text</a>) as string).trim()).toBe(
|
||||
'[some text](./test)'
|
||||
);
|
||||
});
|
||||
|
||||
test('should render link with only title', () => {
|
||||
expect(
|
||||
(render(<a href="./test" title="some title" />) as string).trim()
|
||||
).toBe('[](./test "some title")');
|
||||
});
|
||||
|
||||
test('should render link without title and text', () => {
|
||||
expect((render(<a href="./test" />) as string).trim()).toBe('[](./test)');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user