forked from AkkomaGang/akkoma-fe
fix tests
This commit is contained in:
parent
079035670a
commit
93bca5f851
2 changed files with 2 additions and 22 deletions
|
@ -112,23 +112,6 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
const renderLink = (attrs, children) => {
|
||||
const updatedLink = attrs['href'].replace(/&/g, '&')
|
||||
const updatedChildren = children.map(child => {
|
||||
if (typeof child === 'string') {
|
||||
return child.replace(attrs['href'], updatedLink)
|
||||
}
|
||||
if (child[0] === '<span>') {
|
||||
return <span>
|
||||
{ child[1] }
|
||||
</span>
|
||||
}
|
||||
return child[1]
|
||||
})
|
||||
return <a {...{ attrs }} href={updatedLink}>
|
||||
{ ...updatedChildren }
|
||||
</a>
|
||||
}
|
||||
// Processor to use with html_tree_converter
|
||||
const processItem = (item, index, array, what) => {
|
||||
// Handle text nodes - just add emoji
|
||||
|
@ -193,9 +176,6 @@ export default {
|
|||
return renderMention(attrs, children)
|
||||
} else {
|
||||
currentMentions = null
|
||||
if (attrs['href']) {
|
||||
return renderLink(attrs, children)
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'span':
|
||||
|
|
|
@ -44,12 +44,12 @@ describe('RichContent', () => {
|
|||
const html = [
|
||||
p('Testing 'em all'),
|
||||
'Testing 'em all',
|
||||
'<a href="http://example.com?a=1&b=2">http://example.com?a=1&b=2</a>'
|
||||
'<a href="http://example.com?a=1">http://example.com?a=1</a>'
|
||||
].join('')
|
||||
const expected = [
|
||||
p('Testing \'em all'),
|
||||
'Testing \'em all',
|
||||
'<a href="http://example.com?a=1&b=2">http://example.com?a=1&b=2</a>'
|
||||
'<a href="http://example.com?a=1" target="_blank">http://example.com?a=1</a>'
|
||||
].join('')
|
||||
const wrapper = shallowMount(RichContent, {
|
||||
global,
|
||||
|
|
Loading…
Reference in a new issue