2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-05-15 11:59:37 +03:00

fix(parser): only allowed tags error

This commit is contained in:
Nikolay Kostyurin
2018-07-11 01:10:43 +02:00
parent 9310b1e919
commit d3e8e4a289
2 changed files with 24 additions and 2 deletions
+22
View File
@@ -20,6 +20,28 @@ describe('Parser', () => {
]);
});
test('parse only allowed tags', () => {
const ast = parse('[h1 name=value]Foo [Bar] [/h1]', {
onlyAllowTags: ['h1']
});
expect(ast).toBeInstanceOf(Array);
expect(ast).toEqual([
{
tag: 'h1',
attrs: {
name: 'value',
},
content: [
'Foo',
' ',
'[Bar]',
' '
],
},
]);
});
test('parse tag with value param', () => {
const ast = parse('[url=https://github.com/jilizart/bbob]BBob[/url]');