forked from AkkomaGang/akkoma-fe
fix tests and add CI (#5)
Co-authored-by: FloatingGhost <hannah@coffee-and-dreams.uk> Reviewed-on: http://akkoma.dev/AkkomaGang/pleroma-fe/pulls/5
This commit is contained in:
parent
1ad17fc2bf
commit
a0305e90f0
3 changed files with 50 additions and 22 deletions
48
.woodpecker.yml
Normal file
48
.woodpecker.yml
Normal file
|
@ -0,0 +1,48 @@
|
|||
pipeline:
|
||||
lint:
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
image: node:16
|
||||
commands:
|
||||
- yarn
|
||||
- yarn lint
|
||||
- yarn stylelint
|
||||
|
||||
test:
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
image: node:16
|
||||
commands:
|
||||
- apt update
|
||||
- apt install firefox-esr -y --no-install-recommends
|
||||
- yarn
|
||||
- yarn unit
|
||||
|
||||
build:
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
image: node:16
|
||||
commands:
|
||||
- yarn
|
||||
- yarn build
|
||||
|
||||
release:
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
image: node:16
|
||||
secrets:
|
||||
- SCW_ACCESS_KEY
|
||||
- SCW_SECRET_KEY
|
||||
- SCW_DEFAULT_ORGANIZATION_ID
|
||||
commands:
|
||||
- apt-get update && apt-get install -y rclone wget zip
|
||||
- wget https://github.com/scaleway/scaleway-cli/releases/download/v2.5.1/scaleway-cli_2.5.1_linux_amd64
|
||||
- mv scaleway-cli_2.5.1_linux_amd64 scaleway-cli
|
||||
- chmod +x scaleway-cli
|
||||
- ./scaleway-cli object config install type=rclone
|
||||
- zip akkoma-fe.zip -r dist
|
||||
- rclone copyto akkoma-fe.zip scaleway:akkoma-updates/frontend/akkoma-fe.zip
|
|
@ -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