mirror of
https://github.com/tenrok/BBob.git
synced 2026-06-14 18:42:24 +03:00
* 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:
committed by
GitHub
parent
f28f19e64c
commit
a16b9f73b0
@@ -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: '>' });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user