parent
b2fb92cf0f
commit
4ecd036d0a
2 changed files with 55 additions and 19 deletions
12
test/mfm.ts
12
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');
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue