import MarkdownIt from 'markdown-it'; import betterLink from './betterLink'; // ariaLabel?: false | string; // asButton?: boolean; // iconAlt?: string; // iconClassName?: string; // className?: false | string; // rel?: false | string; // target?: false | string; // title?: false | string; test('should render "ariaLabel"', () => { const html = new MarkdownIt() .use(betterLink, () => ({ ariaLabel: 'Hello, World!' })) .render('This is a [link](https://bing.com/).'); expect(html).toBe('

This is a link.

\n'); }); test('should render "asButton"', () => { const html = new MarkdownIt() .use(betterLink, () => ({ asButton: true })) .render('This is a [link](https://bing.com/).'); expect(html).toBe('

This is a .

\n'); }); test('should render "className"', () => { const html = new MarkdownIt() .use(betterLink, () => ({ className: 'link' })) .render('This is a [link](https://bing.com/).'); expect(html).toBe('

This is a link.

\n'); }); test('should render "iconClassName"', () => { const html = new MarkdownIt() .use(betterLink, () => ({ iconClassName: 'icon' })) .render('This is a [link](https://bing.com/).'); expect(html).toBe( '

This is a link.

\n' ); }); test('should render "iconClassName" with "iconAlt"', () => { const html = new MarkdownIt() .use(betterLink, () => ({ iconAlt: 'open in new window', iconClassName: 'icon' })) .render('This is a [link](https://bing.com/).'); expect(html).toBe( '

This is a link.

\n' ); }); test('should render "rel"', () => { const html = new MarkdownIt() .use(betterLink, () => ({ rel: 'noopener noreferrer' })) .render('This is a [link](https://bing.com/).'); expect(html).toBe('

This is a link.

\n'); }); test('should render "target"', () => { const html = new MarkdownIt() .use(betterLink, () => ({ target: '_blank' })) .render('This is a [link](https://bing.com/).'); expect(html).toBe('

This is a link.

\n'); }); test('should render "title"', () => { const html = new MarkdownIt() .use(betterLink, () => ({ title: 'Hello, World!' })) .render('This is a [link](https://bing.com/).'); expect(html).toBe('

This is a link.

\n'); });