Merge plainParser into mfm

This commit is contained in:
Aya Morisawa 2019-01-30 15:12:48 +09:00
parent ca26edbfce
commit 98795aad9a
No known key found for this signature in database
GPG key ID: 3E64865D70D579F2
3 changed files with 39 additions and 25 deletions

View file

@ -1091,6 +1091,38 @@ describe('MFM', () => {
});
});
describe('plainText', () => {
it('text', () => {
const tokens = analyze('foo', true);
assert.deepStrictEqual(tokens, [
text('foo'),
]);
});
it('emoji', () => {
const tokens = analyze(':foo:', true);
assert.deepStrictEqual(tokens, [
leaf('emoji', { name: 'foo' })
]);
});
it('emoji in text', () => {
const tokens = analyze('foo:bar:baz', true);
assert.deepStrictEqual(tokens, [
text('foo'),
leaf('emoji', { name: 'bar' }),
text('baz'),
]);
});
it('disallow other syntax', () => {
const tokens = analyze('foo **bar** baz', true);
assert.deepStrictEqual(tokens, [
text('foo **bar** baz'),
]);
});
});
describe('toHtml', () => {
it('br', () => {
const input = 'foo\nbar\nbaz';