mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.2 KiB
36 lines
1.2 KiB
/*
|
|
* Squidex Headless CMS
|
|
*
|
|
* @license
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
|
|
*/
|
|
|
|
import { HelpMarkdownPipe } from './help-markdown.pipe';
|
|
|
|
describe('MarkdownPipe', () => {
|
|
it('should convert absolute link to html', () => {
|
|
const actual = new HelpMarkdownPipe().transform('[link-name](https://squidex.io)');
|
|
|
|
expect(actual).toBe('<p><a href="https://squidex.io" target="_blank", rel="noopener">link-name <i class="icon-external-link"></i></a></p>\n');
|
|
});
|
|
|
|
it('should convert relative link to html', () => {
|
|
const actual = new HelpMarkdownPipe().transform('[link-name](link-url)');
|
|
|
|
expect(actual).toBe('<p><a href="https://docs.squidex.io/link-url" target="_blank", rel="noopener">link-name <i class="icon-external-link"></i></a></p>\n');
|
|
});
|
|
|
|
it('should convert markdown to html', () => {
|
|
const actual = new HelpMarkdownPipe().transform('*bold*');
|
|
|
|
expect(actual).toBe('<p><em>bold</em></p>\n');
|
|
});
|
|
|
|
[null, undefined, ''].map(x => {
|
|
it('should return empty string for invalid value', () => {
|
|
const actual = new HelpMarkdownPipe().transform(x);
|
|
|
|
expect(actual).toBe('');
|
|
});
|
|
});
|
|
});
|