remove related dispatches

This commit is contained in:
Henry Jameson 2026-08-20 21:00:36 +03:00
commit ae5984d2f1
29 changed files with 260 additions and 236 deletions

View file

@ -1,9 +1,9 @@
import { createTestingPinia } from '@pinia/testing'
import { setActivePinia } from 'pinia'
import { mount, shallowMount } from '@vue/test-utils'
import { mountOpts } from '../../../fixtures/setup_test'
import { setActivePinia } from 'pinia'
import RichContent from 'src/components/rich_content/rich_content.jsx'
import { mountOpts } from '../../../fixtures/setup_test'
const attentions = []
@ -30,15 +30,18 @@ describe('RichContent', () => {
it('renders simple post without exploding', () => {
const html = p('Hello world!')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html().replaceAll('\n', '')).to.eql(compwrap(html))
})
@ -46,30 +49,36 @@ describe('RichContent', () => {
it('unescapes everything as needed', () => {
const html = [p('Testing 'em all'), 'Testing 'em all'].join('')
const expected = [p("Testing 'em all"), "Testing 'em all"].join('')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html().replaceAll('\n', '')).to.eql(compwrap(expected))
})
it('replaces mention with mentionsline', () => {
const html = p(makeMention('John'), ' how are you doing today?')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html().replaceAll('\n', '')).to.eql(
compwrap(p(mentionsLine(1), ' how are you doing today?')),
@ -93,15 +102,18 @@ describe('RichContent', () => {
),
].join('')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html().replaceAll('\n', '')).to.eql(compwrap(expected))
})
@ -128,15 +140,18 @@ describe('RichContent', () => {
].join(''),
].join('\n')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: false,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: false,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html()).to.eql(compwrap(strippedHtml))
})
@ -148,15 +163,18 @@ describe('RichContent', () => {
'<span class="greentext">&gt;any year</span>',
].join('\n')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: false,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: false,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html()).to.eql(compwrap(expected))
})
@ -164,15 +182,18 @@ describe('RichContent', () => {
it('Does not add greentext and cyantext if setting is set to false', () => {
const html = ['&gt;preordering videogames', '&gt;any year'].join('\n')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: false,
greentext: false,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: false,
greentext: false,
emoji: [],
html,
},
}),
)
expect(wrapper.html()).to.eql(compwrap(html))
})
@ -184,15 +205,18 @@ describe('RichContent', () => {
'<anonymous-stub shortcode="spurdo" islocal="true" class="emoji img" src="about:blank" title=":spurdo:" alt=":spurdo:"></anonymous-stub>',
)
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: false,
greentext: false,
emoji: [{ url: 'about:blank', shortcode: 'spurdo' }],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: false,
greentext: false,
emoji: [{ url: 'about:blank', shortcode: 'spurdo' }],
html,
},
}),
)
expect(wrapper.html().replaceAll('\n', '')).to.eql(compwrap(expected))
})
@ -200,15 +224,18 @@ describe('RichContent', () => {
it("Doesn't add nonexistent emoji to post", () => {
const html = p('Lol :lol:')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: false,
greentext: false,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: false,
greentext: false,
emoji: [],
html,
},
}),
)
expect(wrapper.html().replaceAll('\n', '')).to.eql(compwrap(html))
})
@ -227,15 +254,18 @@ describe('RichContent', () => {
'<span class="greentext">&gt;quote</span>',
].join('\n')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html()).to.eql(compwrap(expected))
})
@ -249,15 +279,18 @@ describe('RichContent', () => {
].join('<br>')
const expected = ['Bruh', 'Bruh', mentionsLine(3), 'Bruh'].join('<br>')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html().replaceAll('\n', '')).to.eql(compwrap(expected))
})
@ -284,15 +317,18 @@ describe('RichContent', () => {
' </p>',
].join('')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html().replaceAll('\n', '')).to.eql(compwrap(expected))
})
@ -330,15 +366,18 @@ describe('RichContent', () => {
p('Testing'),
].join('')
const wrapper = mount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = mount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(
wrapper
@ -402,15 +441,18 @@ describe('RichContent', () => {
'Testing',
].join('')
const wrapper = mount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = mount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(
wrapper
@ -450,15 +492,18 @@ describe('RichContent', () => {
'</p>',
].join('')
const wrapper = shallowMount(RichContent, mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}))
const wrapper = shallowMount(
RichContent,
mountOpts({
props: {
attentions,
handleLinks: true,
greentext: true,
emoji: [],
html,
},
}),
)
expect(wrapper.html().replaceAll('\n', '')).to.eql(compwrap(expected))
})
@ -495,13 +540,16 @@ describe('RichContent', () => {
const ptest = (handleLinks, vhtml) => {
const t0 = performance.now()
const wrapper = mount(TestComponent, mountOpts({
props: {
attentions,
handleLinks,
vhtml,
},
}))
const wrapper = mount(
TestComponent,
mountOpts({
props: {
attentions,
handleLinks,
vhtml,
},
}),
)
const t1 = performance.now()