diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-11-17 12:52:20 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-11-17 12:52:20 +0900 |
| commit | 6c72545fc811298feca1f7dc1d2200e3ccd137da (patch) | |
| tree | 23e3bf5de2fcf86839ab8e3d5346c453e42e43a3 | |
| parent | Update @types/webpack requirement from 4.4.18 to 4.4.19 (#3295) (diff) | |
| download | misskey-6c72545fc811298feca1f7dc1d2200e3ccd137da.tar.gz misskey-6c72545fc811298feca1f7dc1d2200e3ccd137da.tar.bz2 misskey-6c72545fc811298feca1f7dc1d2200e3ccd137da.zip | |
[Test] Add a test and some updtes
| -rw-r--r-- | test/mfm.ts | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/test/mfm.ts b/test/mfm.ts index 1c564be75a..017144545a 100644 --- a/test/mfm.ts +++ b/test/mfm.ts @@ -168,7 +168,7 @@ describe('Text', () => { }], tokens); }); - it('ignore trailing dot', () => { + it('ignore trailing period', () => { const tokens = analyze('https://example.com.'); assert.deepEqual([{ type: 'url', @@ -220,6 +220,19 @@ describe('Text', () => { type: 'text', content: ')' }], tokens); }); + + it('ignore parent brackets with internal brackets', () => { + const tokens = analyze('(https://example.com/foo(bar))'); + assert.deepEqual([{ + type: 'text', content: '(' + }, { + type: 'url', + content: 'https://example.com/foo(bar)', + url: 'https://example.com/foo(bar)' + }, { + type: 'text', content: ')' + }], tokens); + }); }); it('link', () => { @@ -265,7 +278,7 @@ describe('Text', () => { }); it('math', () => { - const fomula = 'x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}.'; + const fomula = 'x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}'; const text = `\\(${fomula}\\)`; const tokens = analyze(text); assert.deepEqual([ |