2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-14 18:42:24 +03:00

fix(parser): don't eat not allowed tags with params (#58) fixes #54

* feat(parser): write test for only allowed tags parsing

* chore(parser): rename only allowed test

* fix(parser): only allowed tag rendering

* fix(plugin-helper): add new TagNode toString tests
This commit is contained in:
Nikolay Kostyurin
2020-04-12 21:14:52 +02:00
committed by GitHub
parent f28f19e64c
commit a16b9f73b0
4 changed files with 122 additions and 27 deletions
+26
View File
@@ -119,6 +119,32 @@ describe('Parser', () => {
expect(onError).toHaveBeenCalled();
});
test('parse only allowed tags with params', () => {
const options = {
onlyAllowTags: ['b', 'i', 'u']
};
const ast = parse('hello [blah foo="bar"]world[/blah]', options);
expectOutput(ast, [
'hello',
' ',
'[blah foo="bar"]world[/blah]',
])
});
test('parse only allowed tags with named param', () => {
const options = {
onlyAllowTags: ['b', 'i', 'u']
};
const ast = parse('hello [blah="bar"]world[/blah]', options);
expectOutput(ast, [
'hello',
' ',
'[blah="bar"]world[/blah]',
])
});
describe('html', () => {
const parseHTML = input => parse(input, { openTag: '<', closeTag: '>' });