mirror of
https://github.com/tenrok/BBob.git
synced 2026-05-15 11:59:37 +03:00
fix: img tag cannot be parsed (#263)
* fix: add img test with url * fix: add more tests
This commit is contained in:
@@ -849,6 +849,26 @@ sdfasdfasdf
|
||||
);
|
||||
});
|
||||
|
||||
test('parse with url in tag content', () => {
|
||||
const input = parse('[img]https://tw.greywool.com/i/e3Ph5.png[/img]');
|
||||
|
||||
expectOutput(input, [
|
||||
{
|
||||
tag: 'img',
|
||||
attrs: {},
|
||||
content: ['https://tw.greywool.com/i/e3Ph5.png'],
|
||||
start: {
|
||||
from: 0,
|
||||
to: 5,
|
||||
},
|
||||
end: {
|
||||
from: 40,
|
||||
to: 46,
|
||||
},
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
describe('html', () => {
|
||||
const parseHTML = (input: string) => parse(input, { openTag: '<', closeTag: '>' });
|
||||
|
||||
|
||||
@@ -55,6 +55,13 @@ describe('@bbob/preset-html5', () => {
|
||||
expect(parse(input)).toBe(result);
|
||||
});
|
||||
|
||||
test('[img]https://tw.greywool.com/i/e3Ph5.png[/img]', () => {
|
||||
const input = '[img]https://tw.greywool.com/i/e3Ph5.png[/img]';
|
||||
const result = '<img src="https://tw.greywool.com/i/e3Ph5.png"/>';
|
||||
|
||||
expect(parse(input)).toBe(result);
|
||||
});
|
||||
|
||||
test('[quote="author"]quoted text[/quote]', () => {
|
||||
const input = '[quote="author"]quoted text[/quote]';
|
||||
const result = '<blockquote><p>quoted text</p></blockquote>';
|
||||
|
||||
Reference in New Issue
Block a user