Skip to content

Commit

Permalink
test(xlf/renderer/xlf-md): liquid filters
Browse files Browse the repository at this point in the history
  • Loading branch information
moki committed Nov 15, 2023
1 parent 347ffe8 commit 173c6c3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ exports[`renders xlf to markdown renders link wrapped in <g> and <x> tags 1`] =
exports[`renders xlf to markdown renders liquid conditions wrapped in <x> tags 1`] = `"Sentence with {% if var == \\"val\\" %} val {% else %} other val {% endif %}."`;
exports[`renders xlf to markdown renders liquid filter wrapped in <x> tags 1`] = `"Sentence with filter {{ users | length }}."`;
exports[`renders xlf to markdown renders liquid function wrapped in <x> tags 1`] = `"Sentence with function {{ user.name.slice(1, 2) }}."`;
exports[`renders xlf to markdown renders liquid loop wrapped in <x> tags 1`] = `"Sentence {% for x in xs %} x {% endfor %}."`;
Expand Down
20 changes: 20 additions & 0 deletions src/xlf/renderer/xlf-md/renderer-inline.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1054,4 +1054,24 @@ describe('renders xlf to markdown', () => {
const rendered = renderer.render(tokens);
expect(rendered).toMatchSnapshot();
});

it('renders liquid filter wrapped in <x> tags', () => {
const renderer = new XLFMDRenderer();
const tokens: Array<XLFToken> = [
{type: 'tag', data: 'target', nodeType: 'open'},
{type: 'text', data: 'Sentence with filter '},
{
type: 'tag',
data: 'x',
nodeType: 'self-closing',
syntax: 'liquid_Filter',
equivText: '{{ users | length }}',
},
{type: 'text', data: '.'},
{type: 'tag', data: 'target', nodeType: 'close'},
];

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

0 comments on commit 173c6c3

Please sign in to comment.