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

bugfix one param [url=param_value] tag support

This commit is contained in:
Nikolay Kostyurin
2018-06-23 00:29:24 +02:00
parent 44e8dbc3c7
commit 7449143ba0
2 changed files with 19 additions and 1 deletions
+1 -1
View File
@@ -66,7 +66,7 @@ module.exports = class Parser {
return this.curTagsAttrName[this.curTagsAttrName.length - 1];
}
return null;
return this.getCurTag().tag;
}
clearCurTagAttrName() {
+18
View File
@@ -1,7 +1,9 @@
const Parser = require('./Parser');
const TOKEN = require('./token');
const Tokenizer = require('./Tokenizer');
const parse = input => (new Parser(input).parse());
const tokenize = input => (new Tokenizer(input).tokenize());
describe('Parser', () => {
test('parse paired tags tokens', () => {
@@ -32,4 +34,20 @@ describe('Parser', () => {
},
]);
});
test('parse tag with value param', () => {
const tokens = tokenize('[url=https://github.com/jilizart/bbob]BBob[/url]');
const ast = parse(tokens);
expect(ast).toBeInstanceOf(Array);
expect(ast).toEqual([
{
tag: 'url',
attrs: {
url: 'https://github.com/jilizart/bbob',
},
content: ['BBob'],
},
]);
});
});