Skip to content

Commit

Permalink
test(xlf/renderer/xlf-md): html inline
Browse files Browse the repository at this point in the history
  • Loading branch information
moki committed Nov 21, 2023
1 parent 5685fde commit a34c57d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ exports[`renders xlf to markdown renders image with src title and width size wra
exports[`renders xlf to markdown renders image with src wrapped in <g> and <x> tags 1`] = `"Sentence ![image](image.png)."`;
exports[`renders xlf to markdown renders inline html wrapped in <x> tags 1`] = `"Sentence<br>with <b>html</b>."`;
exports[`renders xlf to markdown renders link with title wrapped in <g> and <x> tags 1`] = `"Предложение номер [один](one.md \\"one\\")."`;
exports[`renders xlf to markdown renders link wrapped in <g> and <x> tags 1`] = `"Предложение номер [два](two.md)."`;
Expand Down
36 changes: 36 additions & 0 deletions src/xlf/renderer/xlf-md/renderer-inline.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1102,4 +1102,40 @@ describe('renders xlf to markdown', () => {
const rendered = renderer.render(tokens);
expect(rendered).toMatchSnapshot();
});

it('renders inline html wrapped in <x> tags', () => {
const renderer = new XLFMDRenderer();
const tokens: Array<XLFToken> = [
{type: 'tag', data: 'target', nodeType: 'open'},
{type: 'text', data: 'Sentence'},
{
type: 'tag',
data: 'x',
nodeType: 'self-closing',
syntax: 'html_inline',
equivText: '<br>',
},
{type: 'text', data: 'with '},
{
type: 'tag',
data: 'x',
nodeType: 'self-closing',
syntax: 'html_inline',
equivText: '<b>',
},
{type: 'text', data: 'html'},
{
type: 'tag',
data: 'x',
nodeType: 'self-closing',
syntax: 'html_inline',
equivText: '</b>',
},
{type: 'text', data: '.'},
{type: 'tag', data: 'target', nodeType: 'close'},
];

const rendered = renderer.render(tokens);
expect(rendered).toMatchSnapshot();
});
});

0 comments on commit a34c57d

Please sign in to comment.