Skip to content

Commit

Permalink
test(xlf/renderer/md-xlf): html inline
Browse files Browse the repository at this point in the history
  • Loading branch information
moki committed Nov 21, 2023
1 parent 01da4c3 commit 7ab4d19
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/xlf/renderer/md-xlf/__snapshots__/renderer-inline.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,25 @@ exports[`renders xlf from markdown renders heading with anchors wrapped in <x> t
"
`;

exports[`renders xlf from markdown renders html wrapped in <x> tags 1`] = `
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>
<xliff xmlns=\\"urn:oasis:names:tc:xliff:document:1.2\\" version=\\"1.2\\">
<file original=\\"text.md\\" source-language=\\"ru-RU\\" target-language=\\"en-US\\" datatype=\\"markdown\\">
<header>
<skeleton>
<external-file href=\\"text.skl.md\\"></external-file>
</skeleton>
</header>
<body>
<trans-unit id=\\"1\\">
<source>Sentence<x ctype=\\"x-html_inline\\" equiv-text=\\"&lt;br&gt;\\" />with <x ctype=\\"x-html_inline\\" equiv-text=\\"&lt;b&gt;\\" />html<x ctype=\\"x-html_inline\\" equiv-text=\\"&lt;/b&gt;\\" />.</source>
</trans-unit>
</body>
</file>
</xliff>
"
`;

exports[`renders xlf from markdown renders image with href, title and size wrapped in <g> and <x> tags 1`] = `
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>
<xliff xmlns=\\"urn:oasis:names:tc:xliff:document:1.2\\" version=\\"1.2\\">
Expand Down
10 changes: 10 additions & 0 deletions src/xlf/renderer/md-xlf/renderer-inline.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,14 @@ describe('renders xlf from markdown', () => {
const rendered = render(parameters);
expect(rendered).toMatchSnapshot();
});

it('renders html wrapped in <x> tags', () => {
const parameters: RenderParameters = {
...baseRendererParameters,
markdown: 'Sentence<br>with <b>html</b>.',
};

const rendered = render(parameters);
expect(rendered).toMatchSnapshot();
});
});

0 comments on commit 7ab4d19

Please sign in to comment.