diff options
| author | MeiMei <30769358+mei23@users.noreply.github.com> | 2021-02-06 21:44:46 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-06 21:44:46 +0900 |
| commit | 4ecd036d0ad59bb17925b1491b2ed67b20014d65 (patch) | |
| tree | 771942f0f3099a448033550388f20b46f5518e65 /test | |
| parent | Add AiScript console widget (diff) | |
| download | sharkey-4ecd036d0ad59bb17925b1491b2ed67b20014d65.tar.gz sharkey-4ecd036d0ad59bb17925b1491b2ed67b20014d65.tar.bz2 sharkey-4ecd036d0ad59bb17925b1491b2ed67b20014d65.zip | |
Fix HTML to MFM (#7150)
* Fix type
* Fix HTML to MFM
Diffstat (limited to 'test')
| -rw-r--r-- | test/mfm.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/mfm.ts b/test/mfm.ts index a32457e89f..0a120f96e1 100644 --- a/test/mfm.ts +++ b/test/mfm.ts @@ -1167,6 +1167,10 @@ describe('fromHtml', () => { assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/b">c</a> d</p>'), 'a [c](https://example.com/b) d'); }); + it('link with different text, but not encoded', () => { + assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/ä">c</a> d</p>'), 'a [c](<https://example.com/ä>) d'); + }); + it('link with same text', () => { assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/b">https://example.com/b</a> d</p>'), 'a https://example.com/b d'); }); @@ -1183,6 +1187,14 @@ describe('fromHtml', () => { assert.deepStrictEqual(fromHtml('<p>a <a>c</a> d</p>'), 'a c d'); }); + it('link without text', () => { + assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/b"></a> d</p>'), 'a https://example.com/b d'); + }); + + it('link without both', () => { + assert.deepStrictEqual(fromHtml('<p>a <a></a> d</p>'), 'a d'); + }); + it('mention', () => { assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/@user" class="u-url mention">@user</a> d</p>'), 'a @user@example.com d'); }); |