biome format --write
This commit is contained in:
parent
8372348148
commit
9262e803ec
415 changed files with 54076 additions and 17419 deletions
|
|
@ -14,10 +14,16 @@ const autoSaveOrNot = (caseFn, caseTitle, runFn) => {
|
|||
}
|
||||
|
||||
const saveManually = async (wrapper) => {
|
||||
const morePostActions = wrapper.findByText('button', $t('post_status.more_post_actions'))
|
||||
const morePostActions = wrapper.findByText(
|
||||
'button',
|
||||
$t('post_status.more_post_actions'),
|
||||
)
|
||||
await morePostActions.trigger('click')
|
||||
|
||||
const btn = wrapper.findByText('button', $t('post_status.save_to_drafts_button'))
|
||||
const btn = wrapper.findByText(
|
||||
'button',
|
||||
$t('post_status.save_to_drafts_button'),
|
||||
)
|
||||
await btn.trigger('click')
|
||||
}
|
||||
|
||||
|
|
@ -28,28 +34,34 @@ afterEach(() => {
|
|||
})
|
||||
|
||||
describe('Draft saving', () => {
|
||||
autoSaveOrNot(it, 'should save when the button is clicked', async (autoSave) => {
|
||||
const wrapper = mount(PostStatusForm, mountOpts())
|
||||
await wrapper.vm.$store.dispatch('setOption', {
|
||||
name: 'autoSaveDraft',
|
||||
value: autoSave
|
||||
})
|
||||
expect(wrapper.vm.$store.getters.draftCount).to.equal(0)
|
||||
autoSaveOrNot(
|
||||
it,
|
||||
'should save when the button is clicked',
|
||||
async (autoSave) => {
|
||||
const wrapper = mount(PostStatusForm, mountOpts())
|
||||
await wrapper.vm.$store.dispatch('setOption', {
|
||||
name: 'autoSaveDraft',
|
||||
value: autoSave,
|
||||
})
|
||||
expect(wrapper.vm.$store.getters.draftCount).to.equal(0)
|
||||
|
||||
const textarea = wrapper.get('textarea')
|
||||
await textarea.setValue('mew mew')
|
||||
const textarea = wrapper.get('textarea')
|
||||
await textarea.setValue('mew mew')
|
||||
|
||||
await saveManually(wrapper)
|
||||
expect(wrapper.vm.$store.getters.draftCount).to.equal(1)
|
||||
expect(wrapper.vm.$store.getters.draftsArray[0].status).to.equal('mew mew')
|
||||
})
|
||||
await saveManually(wrapper)
|
||||
expect(wrapper.vm.$store.getters.draftCount).to.equal(1)
|
||||
expect(wrapper.vm.$store.getters.draftsArray[0].status).to.equal(
|
||||
'mew mew',
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
it('should auto-save if it is enabled', async function () {
|
||||
vi.useFakeTimers()
|
||||
const wrapper = mount(PostStatusForm, mountOpts())
|
||||
await wrapper.vm.$store.dispatch('setOption', {
|
||||
name: 'autoSaveDraft',
|
||||
value: true
|
||||
value: true,
|
||||
})
|
||||
expect(wrapper.vm.$store.getters.draftCount).to.equal(0)
|
||||
const textarea = wrapper.get('textarea')
|
||||
|
|
@ -62,14 +74,17 @@ describe('Draft saving', () => {
|
|||
})
|
||||
|
||||
it('should auto-save when close if auto-save is on', async () => {
|
||||
const wrapper = mount(PostStatusForm, mountOpts({
|
||||
props: {
|
||||
closeable: true
|
||||
}
|
||||
}))
|
||||
const wrapper = mount(
|
||||
PostStatusForm,
|
||||
mountOpts({
|
||||
props: {
|
||||
closeable: true,
|
||||
},
|
||||
}),
|
||||
)
|
||||
await wrapper.vm.$store.dispatch('setOption', {
|
||||
name: 'autoSaveDraft',
|
||||
value: true
|
||||
value: true,
|
||||
})
|
||||
expect(wrapper.vm.$store.getters.draftCount).to.equal(0)
|
||||
const textarea = wrapper.get('textarea')
|
||||
|
|
@ -80,18 +95,21 @@ describe('Draft saving', () => {
|
|||
})
|
||||
|
||||
it('should save when close if auto-save is off, and unsavedPostAction is save', async () => {
|
||||
const wrapper = mount(PostStatusForm, mountOpts({
|
||||
props: {
|
||||
closeable: true
|
||||
}
|
||||
}))
|
||||
const wrapper = mount(
|
||||
PostStatusForm,
|
||||
mountOpts({
|
||||
props: {
|
||||
closeable: true,
|
||||
},
|
||||
}),
|
||||
)
|
||||
await wrapper.vm.$store.dispatch('setOption', {
|
||||
name: 'autoSaveDraft',
|
||||
value: false
|
||||
value: false,
|
||||
})
|
||||
await wrapper.vm.$store.dispatch('setOption', {
|
||||
name: 'unsavedPostAction',
|
||||
value: 'save'
|
||||
value: 'save',
|
||||
})
|
||||
expect(wrapper.vm.$store.getters.draftCount).to.equal(0)
|
||||
const textarea = wrapper.get('textarea')
|
||||
|
|
@ -102,18 +120,21 @@ describe('Draft saving', () => {
|
|||
})
|
||||
|
||||
it('should discard when close if auto-save is off, and unsavedPostAction is discard', async () => {
|
||||
const wrapper = mount(PostStatusForm, mountOpts({
|
||||
props: {
|
||||
closeable: true
|
||||
}
|
||||
}))
|
||||
const wrapper = mount(
|
||||
PostStatusForm,
|
||||
mountOpts({
|
||||
props: {
|
||||
closeable: true,
|
||||
},
|
||||
}),
|
||||
)
|
||||
await wrapper.vm.$store.dispatch('setOption', {
|
||||
name: 'autoSaveDraft',
|
||||
value: false
|
||||
value: false,
|
||||
})
|
||||
await wrapper.vm.$store.dispatch('setOption', {
|
||||
name: 'unsavedPostAction',
|
||||
value: 'discard'
|
||||
value: 'discard',
|
||||
})
|
||||
expect(wrapper.vm.$store.getters.draftCount).to.equal(0)
|
||||
const textarea = wrapper.get('textarea')
|
||||
|
|
@ -124,25 +145,31 @@ describe('Draft saving', () => {
|
|||
})
|
||||
|
||||
it('should confirm when close if auto-save is off, and unsavedPostAction is confirm', async () => {
|
||||
const wrapper = mount(PostStatusForm, mountOpts({
|
||||
props: {
|
||||
closeable: true
|
||||
}
|
||||
}))
|
||||
const wrapper = mount(
|
||||
PostStatusForm,
|
||||
mountOpts({
|
||||
props: {
|
||||
closeable: true,
|
||||
},
|
||||
}),
|
||||
)
|
||||
await wrapper.vm.$store.dispatch('setOption', {
|
||||
name: 'autoSaveDraft',
|
||||
value: false
|
||||
value: false,
|
||||
})
|
||||
await wrapper.vm.$store.dispatch('setOption', {
|
||||
name: 'unsavedPostAction',
|
||||
value: 'confirm'
|
||||
value: 'confirm',
|
||||
})
|
||||
expect(wrapper.vm.$store.getters.draftCount).to.equal(0)
|
||||
const textarea = wrapper.get('textarea')
|
||||
await textarea.setValue('mew mew')
|
||||
wrapper.vm.requestClose()
|
||||
await nextTick()
|
||||
const saveButton = wrapper.findByText('button', $t('post_status.close_confirm_save_button'))
|
||||
const saveButton = wrapper.findByText(
|
||||
'button',
|
||||
$t('post_status.close_confirm_save_button'),
|
||||
)
|
||||
expect(saveButton).to.be.ok
|
||||
await saveButton.trigger('click')
|
||||
console.info('clicked')
|
||||
|
|
|
|||
|
|
@ -11,33 +11,33 @@ const generateInput = (value, padEmoji = true) => {
|
|||
$store: {
|
||||
getters: {
|
||||
mergedConfig: {
|
||||
padEmoji
|
||||
}
|
||||
}
|
||||
padEmoji,
|
||||
},
|
||||
},
|
||||
},
|
||||
$t: (msg) => msg
|
||||
$t: (msg) => msg,
|
||||
},
|
||||
stubs: {
|
||||
FAIcon: true,
|
||||
Popover: {
|
||||
template: `<div><slot trigger /></div>`,
|
||||
methods: {
|
||||
updateStyles () {}
|
||||
}
|
||||
}
|
||||
updateStyles() {},
|
||||
},
|
||||
},
|
||||
},
|
||||
directives: {
|
||||
'click-outside': vClickOutside
|
||||
}
|
||||
'click-outside': vClickOutside,
|
||||
},
|
||||
},
|
||||
props: {
|
||||
suggest: () => [],
|
||||
enableEmojiPicker: true,
|
||||
modelValue: value
|
||||
modelValue: value,
|
||||
},
|
||||
slots: {
|
||||
default: () => h('input', '')
|
||||
}
|
||||
default: () => h('input', ''),
|
||||
},
|
||||
})
|
||||
return wrapper
|
||||
}
|
||||
|
|
@ -85,7 +85,9 @@ describe('EmojiInput', () => {
|
|||
wrapper.setData({ caret: 6 })
|
||||
wrapper.vm.insert({ insertion: ':ebin:', keepOpen: false })
|
||||
const inputEvents = wrapper.emitted()['update:modelValue']
|
||||
expect(inputEvents[inputEvents.length - 1][0]).to.eql('Spurdo :ebin: Sparde')
|
||||
expect(inputEvents[inputEvents.length - 1][0]).to.eql(
|
||||
'Spurdo :ebin: Sparde',
|
||||
)
|
||||
})
|
||||
|
||||
it('inserts string between words without creating extra spaces (other caret)', () => {
|
||||
|
|
@ -96,7 +98,9 @@ describe('EmojiInput', () => {
|
|||
wrapper.setData({ caret: 7 })
|
||||
wrapper.vm.insert({ insertion: ':ebin:', keepOpen: false })
|
||||
const inputEvents = wrapper.emitted()['update:modelValue']
|
||||
expect(inputEvents[inputEvents.length - 1][0]).to.eql('Spurdo :ebin: Sparde')
|
||||
expect(inputEvents[inputEvents.length - 1][0]).to.eql(
|
||||
'Spurdo :ebin: Sparde',
|
||||
)
|
||||
})
|
||||
|
||||
it('inserts string without any padding if padEmoji setting is set to false', () => {
|
||||
|
|
@ -107,7 +111,9 @@ describe('EmojiInput', () => {
|
|||
wrapper.setData({ caret: initialString.length, keepOpen: false })
|
||||
wrapper.vm.insert({ insertion: ':spam:' })
|
||||
const inputEvents = wrapper.emitted()['update:modelValue']
|
||||
expect(inputEvents[inputEvents.length - 1][0]).to.eql('Eat some spam!:spam:')
|
||||
expect(inputEvents[inputEvents.length - 1][0]).to.eql(
|
||||
'Eat some spam!:spam:',
|
||||
)
|
||||
})
|
||||
|
||||
it('correctly sets caret after insertion at beginning', async () => {
|
||||
|
|
|
|||
|
|
@ -21,53 +21,44 @@ describe('Gallery', () => {
|
|||
|
||||
it('one audio attachment', () => {
|
||||
local = {
|
||||
attachments: [
|
||||
{ mimetype: 'audio/mpeg' }
|
||||
]
|
||||
attachments: [{ mimetype: 'audio/mpeg' }],
|
||||
}
|
||||
|
||||
expect(Gallery.computed.rows.call(local)).to.eql([
|
||||
{ audio: true, items: [{ mimetype: 'audio/mpeg' }] }
|
||||
{ audio: true, items: [{ mimetype: 'audio/mpeg' }] },
|
||||
])
|
||||
})
|
||||
|
||||
it('one image attachment', () => {
|
||||
local = {
|
||||
attachments: [
|
||||
{ mimetype: 'image/png' }
|
||||
]
|
||||
attachments: [{ mimetype: 'image/png' }],
|
||||
}
|
||||
|
||||
expect(Gallery.computed.rows.call(local)).to.eql([
|
||||
{ items: [{ mimetype: 'image/png' }] }
|
||||
{ items: [{ mimetype: 'image/png' }] },
|
||||
])
|
||||
})
|
||||
|
||||
it('one audio attachment and one image attachment', () => {
|
||||
local = {
|
||||
attachments: [
|
||||
{ mimetype: 'audio/mpeg' },
|
||||
{ mimetype: 'image/png' }
|
||||
]
|
||||
attachments: [{ mimetype: 'audio/mpeg' }, { mimetype: 'image/png' }],
|
||||
}
|
||||
|
||||
expect(Gallery.computed.rows.call(local)).to.eql([
|
||||
{ audio: true, items: [{ mimetype: 'audio/mpeg' }] },
|
||||
{ items: [{ mimetype: 'image/png' }] }
|
||||
{ items: [{ mimetype: 'image/png' }] },
|
||||
])
|
||||
})
|
||||
|
||||
it('has "size" key set to "hide"', () => {
|
||||
let local
|
||||
local = {
|
||||
attachments: [
|
||||
{ mimetype: 'audio/mpeg' }
|
||||
],
|
||||
size: 'hide'
|
||||
attachments: [{ mimetype: 'audio/mpeg' }],
|
||||
size: 'hide',
|
||||
}
|
||||
|
||||
expect(Gallery.computed.rows.call(local)).to.eql([
|
||||
{ minimal: true, items: [{ mimetype: 'audio/mpeg' }] }
|
||||
{ minimal: true, items: [{ mimetype: 'audio/mpeg' }] },
|
||||
])
|
||||
|
||||
local = {
|
||||
|
|
@ -80,9 +71,9 @@ describe('Gallery', () => {
|
|||
{ mimetype: 'audio/mpeg' },
|
||||
{ mimetype: 'image/jpg' },
|
||||
{ mimetype: 'image/png' },
|
||||
{ mimetype: 'image/jpg' }
|
||||
{ mimetype: 'image/jpg' },
|
||||
],
|
||||
size: 'hide'
|
||||
size: 'hide',
|
||||
}
|
||||
|
||||
// When defining `size: hide`, the `items` aren't
|
||||
|
|
@ -96,7 +87,7 @@ describe('Gallery', () => {
|
|||
{ minimal: true, items: [{ mimetype: 'audio/mpeg' }] },
|
||||
{ minimal: true, items: [{ mimetype: 'image/jpg' }] },
|
||||
{ minimal: true, items: [{ mimetype: 'image/png' }] },
|
||||
{ minimal: true, items: [{ mimetype: 'image/jpg' }] }
|
||||
{ minimal: true, items: [{ mimetype: 'image/jpg' }] },
|
||||
])
|
||||
})
|
||||
|
||||
|
|
@ -104,12 +95,10 @@ describe('Gallery', () => {
|
|||
it('non-image/audio', () => {
|
||||
let local
|
||||
local = {
|
||||
attachments: [
|
||||
{ mimetype: 'plain/text' }
|
||||
]
|
||||
attachments: [{ mimetype: 'plain/text' }],
|
||||
}
|
||||
expect(Gallery.computed.rows.call(local)).to.eql([
|
||||
{ minimal: true, items: [{ mimetype: 'plain/text' }] }
|
||||
{ minimal: true, items: [{ mimetype: 'plain/text' }] },
|
||||
])
|
||||
|
||||
// No grouping of non-image/audio items
|
||||
|
|
@ -117,13 +106,13 @@ describe('Gallery', () => {
|
|||
attachments: [
|
||||
{ mimetype: 'plain/text' },
|
||||
{ mimetype: 'plain/text' },
|
||||
{ mimetype: 'plain/text' }
|
||||
]
|
||||
{ mimetype: 'plain/text' },
|
||||
],
|
||||
}
|
||||
expect(Gallery.computed.rows.call(local)).to.eql([
|
||||
{ minimal: true, items: [{ mimetype: 'plain/text' }] },
|
||||
{ minimal: true, items: [{ mimetype: 'plain/text' }] },
|
||||
{ minimal: true, items: [{ mimetype: 'plain/text' }] }
|
||||
{ minimal: true, items: [{ mimetype: 'plain/text' }] },
|
||||
])
|
||||
|
||||
local = {
|
||||
|
|
@ -131,8 +120,8 @@ describe('Gallery', () => {
|
|||
{ mimetype: 'image/png' },
|
||||
{ mimetype: 'plain/text' },
|
||||
{ mimetype: 'image/jpg' },
|
||||
{ mimetype: 'audio/mpeg' }
|
||||
]
|
||||
{ mimetype: 'audio/mpeg' },
|
||||
],
|
||||
}
|
||||
// NOTE / TODO: When defining `size: hide`, the `items` aren't
|
||||
// grouped and `audio` isn't set
|
||||
|
|
@ -140,7 +129,7 @@ describe('Gallery', () => {
|
|||
{ items: [{ mimetype: 'image/png' }] },
|
||||
{ minimal: true, items: [{ mimetype: 'plain/text' }] },
|
||||
{ items: [{ mimetype: 'image/jpg' }] },
|
||||
{ audio: true, items: [{ mimetype: 'audio/mpeg' }] }
|
||||
{ audio: true, items: [{ mimetype: 'audio/mpeg' }] },
|
||||
])
|
||||
})
|
||||
|
||||
|
|
@ -153,15 +142,22 @@ describe('Gallery', () => {
|
|||
{ mimetype: 'image/jpg' },
|
||||
{ mimetype: 'image/png' },
|
||||
{ mimetype: 'image/jpg' },
|
||||
{ mimetype: 'image/jpg' }
|
||||
]
|
||||
{ mimetype: 'image/jpg' },
|
||||
],
|
||||
}
|
||||
|
||||
expect(Gallery.computed.rows.call(local)).to.eql([
|
||||
{ audio: true, items: [{ mimetype: 'audio/mpeg' }] },
|
||||
{ items: [{ mimetype: 'image/png' }] },
|
||||
{ audio: true, items: [{ mimetype: 'audio/mpeg' }] },
|
||||
{ items: [{ mimetype: 'image/jpg' }, { mimetype: 'image/png' }, { mimetype: 'image/jpg' }, { mimetype: 'image/jpg' }] }
|
||||
{
|
||||
items: [
|
||||
{ mimetype: 'image/jpg' },
|
||||
{ mimetype: 'image/png' },
|
||||
{ mimetype: 'image/jpg' },
|
||||
{ mimetype: 'image/jpg' },
|
||||
],
|
||||
},
|
||||
])
|
||||
|
||||
local = {
|
||||
|
|
@ -172,16 +168,22 @@ describe('Gallery', () => {
|
|||
{ mimetype: 'image/jpg' },
|
||||
{ mimetype: 'audio/mpeg' },
|
||||
{ mimetype: 'image/png' },
|
||||
{ mimetype: 'audio/mpeg' }
|
||||
]
|
||||
{ mimetype: 'audio/mpeg' },
|
||||
],
|
||||
}
|
||||
|
||||
expect(Gallery.computed.rows.call(local)).to.eql([
|
||||
{ items: [{ mimetype: 'image/jpg' }, { mimetype: 'image/png' }, { mimetype: 'image/jpg' }] },
|
||||
{
|
||||
items: [
|
||||
{ mimetype: 'image/jpg' },
|
||||
{ mimetype: 'image/png' },
|
||||
{ mimetype: 'image/jpg' },
|
||||
],
|
||||
},
|
||||
{ items: [{ mimetype: 'image/jpg' }] },
|
||||
{ audio: true, items: [{ mimetype: 'audio/mpeg' }] },
|
||||
{ items: [{ mimetype: 'image/png' }] },
|
||||
{ audio: true, items: [{ mimetype: 'audio/mpeg' }] }
|
||||
{ audio: true, items: [{ mimetype: 'audio/mpeg' }] },
|
||||
])
|
||||
|
||||
local = {
|
||||
|
|
@ -192,15 +194,28 @@ describe('Gallery', () => {
|
|||
{ mimetype: 'image/jpg' },
|
||||
{ mimetype: 'image/png' },
|
||||
{ mimetype: 'image/png' },
|
||||
{ mimetype: 'image/jpg' }
|
||||
]
|
||||
{ mimetype: 'image/jpg' },
|
||||
],
|
||||
}
|
||||
|
||||
// Group by three-per-row, unless there's one dangling, then stick it on the end of the last row
|
||||
// https://git.pleroma.social/pleroma/pleroma-fe/-/merge_requests/1785#note_98514
|
||||
expect(Gallery.computed.rows.call(local)).to.eql([
|
||||
{ items: [{ mimetype: 'image/jpg' }, { mimetype: 'image/png' }, { mimetype: 'image/jpg' }] },
|
||||
{ items: [{ mimetype: 'image/jpg' }, { mimetype: 'image/png' }, { mimetype: 'image/png' }, { mimetype: 'image/jpg' }] }
|
||||
{
|
||||
items: [
|
||||
{ mimetype: 'image/jpg' },
|
||||
{ mimetype: 'image/png' },
|
||||
{ mimetype: 'image/jpg' },
|
||||
],
|
||||
},
|
||||
{
|
||||
items: [
|
||||
{ mimetype: 'image/jpg' },
|
||||
{ mimetype: 'image/png' },
|
||||
{ mimetype: 'image/png' },
|
||||
{ mimetype: 'image/jpg' },
|
||||
],
|
||||
},
|
||||
])
|
||||
|
||||
local = {
|
||||
|
|
@ -212,14 +227,26 @@ describe('Gallery', () => {
|
|||
{ mimetype: 'image/png' },
|
||||
{ mimetype: 'image/png' },
|
||||
{ mimetype: 'image/jpg' },
|
||||
{ mimetype: 'image/png' }
|
||||
]
|
||||
{ mimetype: 'image/png' },
|
||||
],
|
||||
}
|
||||
|
||||
expect(Gallery.computed.rows.call(local)).to.eql([
|
||||
{ items: [{ mimetype: 'image/jpg' }, { mimetype: 'image/png' }, { mimetype: 'image/jpg' }] },
|
||||
{ items: [{ mimetype: 'image/jpg' }, { mimetype: 'image/png' }, { mimetype: 'image/png' }] },
|
||||
{ items: [{ mimetype: 'image/jpg' }, { mimetype: 'image/png' }] }
|
||||
{
|
||||
items: [
|
||||
{ mimetype: 'image/jpg' },
|
||||
{ mimetype: 'image/png' },
|
||||
{ mimetype: 'image/jpg' },
|
||||
],
|
||||
},
|
||||
{
|
||||
items: [
|
||||
{ mimetype: 'image/jpg' },
|
||||
{ mimetype: 'image/png' },
|
||||
{ mimetype: 'image/png' },
|
||||
],
|
||||
},
|
||||
{ items: [{ mimetype: 'image/jpg' }, { mimetype: 'image/png' }] },
|
||||
])
|
||||
})
|
||||
|
||||
|
|
@ -231,13 +258,13 @@ describe('Gallery', () => {
|
|||
{ mimetype: 'image/jpg' },
|
||||
{ mimetype: 'image/png' },
|
||||
{ mimetype: 'image/jpg' },
|
||||
{ mimetype: 'image/jpg' }
|
||||
{ mimetype: 'image/jpg' },
|
||||
]
|
||||
|
||||
local = { grid: true, attachments }
|
||||
|
||||
expect(Gallery.computed.rows.call(local)).to.eql([
|
||||
{ grid: true, items: attachments }
|
||||
{ grid: true, items: attachments },
|
||||
])
|
||||
})
|
||||
|
||||
|
|
@ -247,7 +274,7 @@ describe('Gallery', () => {
|
|||
{ mimetype: 'image/png' },
|
||||
{ mimetype: 'image/jpg' },
|
||||
{ mimetype: 'audio/mpeg' },
|
||||
{ mimetype: 'image/jpg' }
|
||||
{ mimetype: 'image/jpg' },
|
||||
]
|
||||
|
||||
let local
|
||||
|
|
@ -255,14 +282,14 @@ describe('Gallery', () => {
|
|||
|
||||
expect(Gallery.computed.rows.call(local)).to.eql([
|
||||
{ audio: true, items: [{ mimetype: 'audio/mpeg' }] },
|
||||
{ items: [{ mimetype: 'image/png' }] }
|
||||
{ items: [{ mimetype: 'image/png' }] },
|
||||
])
|
||||
|
||||
local = { attachments, limit: 3 }
|
||||
|
||||
expect(Gallery.computed.rows.call(local)).to.eql([
|
||||
{ audio: true, items: [{ mimetype: 'audio/mpeg' }] },
|
||||
{ items: [{ mimetype: 'image/png' }, { mimetype: 'image/jpg' }] }
|
||||
{ items: [{ mimetype: 'image/png' }, { mimetype: 'image/jpg' }] },
|
||||
])
|
||||
|
||||
local = { attachments, limit: 4 }
|
||||
|
|
@ -270,7 +297,7 @@ describe('Gallery', () => {
|
|||
expect(Gallery.computed.rows.call(local)).to.eql([
|
||||
{ audio: true, items: [{ mimetype: 'audio/mpeg' }] },
|
||||
{ items: [{ mimetype: 'image/png' }, { mimetype: 'image/jpg' }] },
|
||||
{ audio: true, items: [{ mimetype: 'audio/mpeg' }] }
|
||||
{ audio: true, items: [{ mimetype: 'audio/mpeg' }] },
|
||||
])
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -8,15 +8,15 @@ const global = {
|
|||
state: {},
|
||||
getters: {
|
||||
mergedConfig: () => ({
|
||||
mentionLinkShowTooltip: true
|
||||
mentionLinkShowTooltip: true,
|
||||
}),
|
||||
findUserByUrl: () => null
|
||||
}
|
||||
}
|
||||
findUserByUrl: () => null,
|
||||
},
|
||||
},
|
||||
},
|
||||
stubs: {
|
||||
FAIcon: true
|
||||
}
|
||||
FAIcon: true,
|
||||
},
|
||||
}
|
||||
|
||||
const makeMention = (who, noClass) => {
|
||||
|
|
@ -26,12 +26,14 @@ const makeMention = (who, noClass) => {
|
|||
: `<span class="h-card"><a class="u-url mention" href="https://fake.tld/@${who}">@<span>${who}</span></a></span>`
|
||||
}
|
||||
const p = (...data) => `<p>${data.join('')}</p>`
|
||||
const compwrap = (...data) => `<span class="RichContent">${data.join('')}</span>`
|
||||
const mentionsLine = (times) => [
|
||||
'<mentions-line-stub mentions="',
|
||||
new Array(times).fill('[object Object]').join(','),
|
||||
'"></mentions-line-stub>'
|
||||
].join('')
|
||||
const compwrap = (...data) =>
|
||||
`<span class="RichContent">${data.join('')}</span>`
|
||||
const mentionsLine = (times) =>
|
||||
[
|
||||
'<mentions-line-stub mentions="',
|
||||
new Array(times).fill('[object Object]').join(','),
|
||||
'"></mentions-line-stub>',
|
||||
].join('')
|
||||
|
||||
describe('RichContent', () => {
|
||||
it('renders simple post without exploding', () => {
|
||||
|
|
@ -43,22 +45,16 @@ describe('RichContent', () => {
|
|||
handleLinks: true,
|
||||
greentext: true,
|
||||
emoji: [],
|
||||
html
|
||||
}
|
||||
html,
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.html().replace(/\n/g, '')).to.eql(compwrap(html))
|
||||
})
|
||||
|
||||
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 html = [p('Testing 'em all'), 'Testing 'em all'].join('')
|
||||
const expected = [p("Testing 'em all"), "Testing 'em all"].join('')
|
||||
const wrapper = shallowMount(RichContent, {
|
||||
global,
|
||||
props: {
|
||||
|
|
@ -66,18 +62,15 @@ describe('RichContent', () => {
|
|||
handleLinks: true,
|
||||
greentext: true,
|
||||
emoji: [],
|
||||
html
|
||||
}
|
||||
html,
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.html().replace(/\n/g, '')).to.eql(compwrap(expected))
|
||||
})
|
||||
|
||||
it('replaces mention with mentionsline', () => {
|
||||
const html = p(
|
||||
makeMention('John'),
|
||||
' how are you doing today?'
|
||||
)
|
||||
const html = p(makeMention('John'), ' how are you doing today?')
|
||||
const wrapper = shallowMount(RichContent, {
|
||||
global,
|
||||
props: {
|
||||
|
|
@ -85,37 +78,30 @@ describe('RichContent', () => {
|
|||
handleLinks: true,
|
||||
greentext: true,
|
||||
emoji: [],
|
||||
html
|
||||
}
|
||||
html,
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.html().replace(/\n/g, '')).to.eql(compwrap(p(
|
||||
mentionsLine(1),
|
||||
' how are you doing today?'
|
||||
)))
|
||||
expect(wrapper.html().replace(/\n/g, '')).to.eql(
|
||||
compwrap(p(mentionsLine(1), ' how are you doing today?')),
|
||||
)
|
||||
})
|
||||
|
||||
it('replaces mentions at the end of the hellpost', () => {
|
||||
const html = [
|
||||
p('How are you doing today, fine gentlemen?'),
|
||||
p(
|
||||
makeMention('John'),
|
||||
makeMention('Josh'),
|
||||
makeMention('Jeremy')
|
||||
)
|
||||
p(makeMention('John'), makeMention('Josh'), makeMention('Jeremy')),
|
||||
].join('')
|
||||
const expected = [
|
||||
p(
|
||||
'How are you doing today, fine gentlemen?'
|
||||
),
|
||||
p('How are you doing today, fine gentlemen?'),
|
||||
// TODO fix this extra line somehow?
|
||||
p(
|
||||
'<mentions-line-stub mentions="',
|
||||
'[object Object],',
|
||||
'[object Object],',
|
||||
'[object Object]',
|
||||
'"></mentions-line-stub>'
|
||||
)
|
||||
'"></mentions-line-stub>',
|
||||
),
|
||||
].join('')
|
||||
|
||||
const wrapper = shallowMount(RichContent, {
|
||||
|
|
@ -125,8 +111,8 @@ describe('RichContent', () => {
|
|||
handleLinks: true,
|
||||
greentext: true,
|
||||
emoji: [],
|
||||
html
|
||||
}
|
||||
html,
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.html().replace(/\n/g, '')).to.eql(compwrap(expected))
|
||||
|
|
@ -134,26 +120,24 @@ describe('RichContent', () => {
|
|||
|
||||
it('Does not touch links if link handling is disabled', () => {
|
||||
const html = [
|
||||
[
|
||||
makeMention('Jack'),
|
||||
'let\'s meet up with ',
|
||||
makeMention('Janet')
|
||||
].join(''),
|
||||
[
|
||||
makeMention('John'),
|
||||
makeMention('Josh'), makeMention('Jeremy')
|
||||
].join('')
|
||||
[makeMention('Jack'), "let's meet up with ", makeMention('Janet')].join(
|
||||
'',
|
||||
),
|
||||
[makeMention('John'), makeMention('Josh'), makeMention('Jeremy')].join(
|
||||
'',
|
||||
),
|
||||
].join('\n')
|
||||
const strippedHtml = [
|
||||
[
|
||||
makeMention('Jack', true),
|
||||
'let\'s meet up with ',
|
||||
makeMention('Janet', true)
|
||||
"let's meet up with ",
|
||||
makeMention('Janet', true),
|
||||
].join(''),
|
||||
[
|
||||
makeMention('John', true),
|
||||
makeMention('Josh', true), makeMention('Jeremy', true)
|
||||
].join('')
|
||||
makeMention('Josh', true),
|
||||
makeMention('Jeremy', true),
|
||||
].join(''),
|
||||
].join('\n')
|
||||
|
||||
const wrapper = shallowMount(RichContent, {
|
||||
|
|
@ -163,21 +147,18 @@ describe('RichContent', () => {
|
|||
handleLinks: false,
|
||||
greentext: true,
|
||||
emoji: [],
|
||||
html
|
||||
}
|
||||
html,
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.html()).to.eql(compwrap(strippedHtml))
|
||||
})
|
||||
|
||||
it('Adds greentext and cyantext to the post', () => {
|
||||
const html = [
|
||||
'>preordering videogames',
|
||||
'>any year'
|
||||
].join('\n')
|
||||
const html = ['>preordering videogames', '>any year'].join('\n')
|
||||
const expected = [
|
||||
'<span class="greentext">>preordering videogames</span>',
|
||||
'<span class="greentext">>any year</span>'
|
||||
'<span class="greentext">>any year</span>',
|
||||
].join('\n')
|
||||
|
||||
const wrapper = shallowMount(RichContent, {
|
||||
|
|
@ -187,18 +168,15 @@ describe('RichContent', () => {
|
|||
handleLinks: false,
|
||||
greentext: true,
|
||||
emoji: [],
|
||||
html
|
||||
}
|
||||
html,
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.html()).to.eql(compwrap(expected))
|
||||
})
|
||||
|
||||
it('Does not add greentext and cyantext if setting is set to false', () => {
|
||||
const html = [
|
||||
'>preordering videogames',
|
||||
'>any year'
|
||||
].join('\n')
|
||||
const html = ['>preordering videogames', '>any year'].join('\n')
|
||||
|
||||
const wrapper = shallowMount(RichContent, {
|
||||
global,
|
||||
|
|
@ -207,8 +185,8 @@ describe('RichContent', () => {
|
|||
handleLinks: false,
|
||||
greentext: false,
|
||||
emoji: [],
|
||||
html
|
||||
}
|
||||
html,
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.html()).to.eql(compwrap(html))
|
||||
|
|
@ -218,7 +196,7 @@ describe('RichContent', () => {
|
|||
const html = p('Ebin :DDDD :spurdo:')
|
||||
const expected = p(
|
||||
'Ebin :DDDD ',
|
||||
'<anonymous-stub shortcode="spurdo" islocal="true" class="emoji img" src="about:blank" title=":spurdo:" alt=":spurdo:"></anonymous-stub>'
|
||||
'<anonymous-stub shortcode="spurdo" islocal="true" class="emoji img" src="about:blank" title=":spurdo:" alt=":spurdo:"></anonymous-stub>',
|
||||
)
|
||||
|
||||
const wrapper = shallowMount(RichContent, {
|
||||
|
|
@ -228,14 +206,14 @@ describe('RichContent', () => {
|
|||
handleLinks: false,
|
||||
greentext: false,
|
||||
emoji: [{ url: 'about:blank', shortcode: 'spurdo' }],
|
||||
html
|
||||
}
|
||||
html,
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.html().replace(/\n/g, '')).to.eql(compwrap(expected))
|
||||
})
|
||||
|
||||
it('Doesn\'t add nonexistent emoji to post', () => {
|
||||
it("Doesn't add nonexistent emoji to post", () => {
|
||||
const html = p('Lol :lol:')
|
||||
|
||||
const wrapper = shallowMount(RichContent, {
|
||||
|
|
@ -245,8 +223,8 @@ describe('RichContent', () => {
|
|||
handleLinks: false,
|
||||
greentext: false,
|
||||
emoji: [],
|
||||
html
|
||||
}
|
||||
html,
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.html().replace(/\n/g, '')).to.eql(compwrap(html))
|
||||
|
|
@ -257,13 +235,13 @@ describe('RichContent', () => {
|
|||
'>quote',
|
||||
makeMention('lol'),
|
||||
'>quote',
|
||||
'>quote'
|
||||
'>quote',
|
||||
].join('\n')
|
||||
const expected = [
|
||||
'<span class="greentext">>quote</span>',
|
||||
mentionsLine(1),
|
||||
'<span class="greentext">>quote</span>',
|
||||
'<span class="greentext">>quote</span>'
|
||||
'<span class="greentext">>quote</span>',
|
||||
].join('\n')
|
||||
|
||||
const wrapper = shallowMount(RichContent, {
|
||||
|
|
@ -273,8 +251,8 @@ describe('RichContent', () => {
|
|||
handleLinks: true,
|
||||
greentext: true,
|
||||
emoji: [],
|
||||
html
|
||||
}
|
||||
html,
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.html()).to.eql(compwrap(expected))
|
||||
|
|
@ -284,19 +262,10 @@ describe('RichContent', () => {
|
|||
const html = [
|
||||
'Bruh',
|
||||
'Bruh',
|
||||
[
|
||||
makeMention('foo'),
|
||||
makeMention('bar'),
|
||||
makeMention('baz')
|
||||
].join(''),
|
||||
'Bruh'
|
||||
].join('<br>')
|
||||
const expected = [
|
||||
[makeMention('foo'), makeMention('bar'), makeMention('baz')].join(''),
|
||||
'Bruh',
|
||||
'Bruh',
|
||||
mentionsLine(3),
|
||||
'Bruh'
|
||||
].join('<br>')
|
||||
const expected = ['Bruh', 'Bruh', mentionsLine(3), 'Bruh'].join('<br>')
|
||||
|
||||
const wrapper = shallowMount(RichContent, {
|
||||
global,
|
||||
|
|
@ -305,8 +274,8 @@ describe('RichContent', () => {
|
|||
handleLinks: true,
|
||||
greentext: true,
|
||||
emoji: [],
|
||||
html
|
||||
}
|
||||
html,
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.html().replace(/\n/g, '')).to.eql(compwrap(expected))
|
||||
|
|
@ -321,7 +290,7 @@ describe('RichContent', () => {
|
|||
'#nou</a>',
|
||||
' <a class="hashtag" data-tag="screencap" href="https://shitposter.club/tag/screencap">',
|
||||
'#screencap</a>',
|
||||
' </p>'
|
||||
' </p>',
|
||||
].join('')
|
||||
const expected = [
|
||||
'<p>',
|
||||
|
|
@ -331,7 +300,7 @@ describe('RichContent', () => {
|
|||
'</hashtag-link-stub>',
|
||||
' <hashtag-link-stub url="https://shitposter.club/tag/screencap" content="#screencap" tag="screencap">',
|
||||
'</hashtag-link-stub>',
|
||||
' </p>'
|
||||
' </p>',
|
||||
].join('')
|
||||
|
||||
const wrapper = shallowMount(RichContent, {
|
||||
|
|
@ -341,8 +310,8 @@ describe('RichContent', () => {
|
|||
handleLinks: true,
|
||||
greentext: true,
|
||||
emoji: [],
|
||||
html
|
||||
}
|
||||
html,
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.html().replace(/\n/g, '')).to.eql(compwrap(expected))
|
||||
|
|
@ -359,11 +328,9 @@ describe('RichContent', () => {
|
|||
'lol.tld/</span>',
|
||||
'<span>',
|
||||
'</span>',
|
||||
'</a>'
|
||||
'</a>',
|
||||
),
|
||||
p(
|
||||
'Testing'
|
||||
)
|
||||
p('Testing'),
|
||||
].join('')
|
||||
const expected = [
|
||||
p(
|
||||
|
|
@ -378,11 +345,9 @@ describe('RichContent', () => {
|
|||
'</span>',
|
||||
'</a>',
|
||||
'</span>',
|
||||
'</span>'
|
||||
'</span>',
|
||||
),
|
||||
p(
|
||||
'Testing'
|
||||
)
|
||||
p('Testing'),
|
||||
].join('')
|
||||
|
||||
const wrapper = mount(RichContent, {
|
||||
|
|
@ -392,11 +357,16 @@ describe('RichContent', () => {
|
|||
handleLinks: true,
|
||||
greentext: true,
|
||||
emoji: [],
|
||||
html
|
||||
}
|
||||
html,
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.html().replace(/\n/g, '').replace(/<!--.*?-->/g, '')).to.eql(compwrap(expected))
|
||||
expect(
|
||||
wrapper
|
||||
.html()
|
||||
.replace(/\n/g, '')
|
||||
.replace(/<!--.*?-->/g, ''),
|
||||
).to.eql(compwrap(expected))
|
||||
})
|
||||
|
||||
it('rich contents of nested mentions are handled properly', () => {
|
||||
|
|
@ -422,7 +392,7 @@ describe('RichContent', () => {
|
|||
'</a>',
|
||||
' ',
|
||||
'</span>',
|
||||
'Testing'
|
||||
'Testing',
|
||||
].join('')
|
||||
const expected = [
|
||||
'<span>',
|
||||
|
|
@ -450,7 +420,7 @@ describe('RichContent', () => {
|
|||
'</span>',
|
||||
' ',
|
||||
'</span>',
|
||||
'Testing'
|
||||
'Testing',
|
||||
].join('')
|
||||
|
||||
const wrapper = mount(RichContent, {
|
||||
|
|
@ -460,11 +430,16 @@ describe('RichContent', () => {
|
|||
handleLinks: true,
|
||||
greentext: true,
|
||||
emoji: [],
|
||||
html
|
||||
}
|
||||
html,
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.html().replace(/\n/g, '').replace(/<!--.*?-->/g, '')).to.eql(compwrap(expected))
|
||||
expect(
|
||||
wrapper
|
||||
.html()
|
||||
.replace(/\n/g, '')
|
||||
.replace(/<!--.*?-->/g, ''),
|
||||
).to.eql(compwrap(expected))
|
||||
})
|
||||
|
||||
it('rich contents of a link are handled properly', () => {
|
||||
|
|
@ -480,7 +455,7 @@ describe('RichContent', () => {
|
|||
'<span>',
|
||||
'</span>',
|
||||
'</a>',
|
||||
'</p>'
|
||||
'</p>',
|
||||
].join('')
|
||||
const expected = [
|
||||
'<p>',
|
||||
|
|
@ -494,7 +469,7 @@ describe('RichContent', () => {
|
|||
'<span>',
|
||||
'</span>',
|
||||
'</a>',
|
||||
'</p>'
|
||||
'</p>',
|
||||
].join('')
|
||||
|
||||
const wrapper = shallowMount(RichContent, {
|
||||
|
|
@ -504,8 +479,8 @@ describe('RichContent', () => {
|
|||
handleLinks: true,
|
||||
greentext: true,
|
||||
emoji: [],
|
||||
html
|
||||
}
|
||||
html,
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.html().replace(/\n/g, '')).to.eql(compwrap(expected))
|
||||
|
|
@ -525,7 +500,7 @@ describe('RichContent', () => {
|
|||
makeMention('Lain'),
|
||||
makeMention('Lain'),
|
||||
makeMention('Lain'),
|
||||
' i just landed in l a where are you'
|
||||
' i just landed in l a where are you',
|
||||
)
|
||||
|
||||
const TestComponent = {
|
||||
|
|
@ -537,7 +512,7 @@ describe('RichContent', () => {
|
|||
${new Array(amount).fill(`<div v-html="${onePost}"/>`)}
|
||||
</div>
|
||||
`,
|
||||
props: ['handleLinks', 'attentions', 'vhtml']
|
||||
props: ['handleLinks', 'attentions', 'vhtml'],
|
||||
}
|
||||
|
||||
const ptest = (handleLinks, vhtml) => {
|
||||
|
|
@ -548,8 +523,8 @@ describe('RichContent', () => {
|
|||
props: {
|
||||
attentions,
|
||||
handleLinks,
|
||||
vhtml
|
||||
}
|
||||
vhtml,
|
||||
},
|
||||
})
|
||||
|
||||
const t1 = performance.now()
|
||||
|
|
|
|||
|
|
@ -5,39 +5,39 @@ import backendInteractorService from 'src/services/backend_interactor_service/ba
|
|||
import { getters } from 'src/modules/users.js'
|
||||
|
||||
const mutations = {
|
||||
clearTimeline: () => {}
|
||||
clearTimeline: () => {},
|
||||
}
|
||||
|
||||
const actions = {
|
||||
fetchUser: () => {},
|
||||
fetchUserByScreenName: () => {}
|
||||
fetchUserByScreenName: () => {},
|
||||
}
|
||||
|
||||
const testGetters = {
|
||||
findUser: state => getters.findUser(state.users),
|
||||
findUserByName: state => getters.findUserByName(state.users),
|
||||
relationship: state => getters.relationship(state.users),
|
||||
findUser: (state) => getters.findUser(state.users),
|
||||
findUserByName: (state) => getters.findUserByName(state.users),
|
||||
relationship: (state) => getters.relationship(state.users),
|
||||
mergedConfig: () => ({
|
||||
colors: '',
|
||||
highlight: {},
|
||||
customTheme: {
|
||||
colors: []
|
||||
}
|
||||
})
|
||||
colors: [],
|
||||
},
|
||||
}),
|
||||
}
|
||||
|
||||
const localUser = {
|
||||
id: 100,
|
||||
is_local: true,
|
||||
screen_name: 'testUser',
|
||||
screen_name_ui: 'testUser'
|
||||
screen_name_ui: 'testUser',
|
||||
}
|
||||
|
||||
const extUser = {
|
||||
id: 100,
|
||||
is_local: false,
|
||||
screen_name: 'testUser@test.instance',
|
||||
screen_name_ui: 'testUser@test.instance'
|
||||
screen_name_ui: 'testUser@test.instance',
|
||||
}
|
||||
|
||||
const externalProfileStore = createStore({
|
||||
|
|
@ -47,13 +47,13 @@ const externalProfileStore = createStore({
|
|||
state: {
|
||||
api: {
|
||||
fetchers: {},
|
||||
backendInteractor: backendInteractorService('')
|
||||
backendInteractor: backendInteractorService(''),
|
||||
},
|
||||
interface: {
|
||||
browserSupport: ''
|
||||
browserSupport: '',
|
||||
},
|
||||
instance: {
|
||||
hideUserStats: true
|
||||
hideUserStats: true,
|
||||
},
|
||||
statuses: {
|
||||
timelines: {
|
||||
|
|
@ -71,7 +71,7 @@ const externalProfileStore = createStore({
|
|||
friends: [],
|
||||
viewing: 'statuses',
|
||||
userId: 100,
|
||||
flushMarker: 0
|
||||
flushMarker: 0,
|
||||
},
|
||||
media: {
|
||||
statuses: [],
|
||||
|
|
@ -87,20 +87,20 @@ const externalProfileStore = createStore({
|
|||
friends: [],
|
||||
viewing: 'statuses',
|
||||
userId: 100,
|
||||
flushMarker: 0
|
||||
}
|
||||
}
|
||||
flushMarker: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
users: {
|
||||
currentUser: {
|
||||
credentials: ''
|
||||
credentials: '',
|
||||
},
|
||||
usersObject: { 100: extUser },
|
||||
usersByNameObject: {},
|
||||
users: [extUser],
|
||||
relationships: {}
|
||||
}
|
||||
}
|
||||
relationships: {},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const localProfileStore = createStore({
|
||||
|
|
@ -110,20 +110,20 @@ const localProfileStore = createStore({
|
|||
state: {
|
||||
api: {
|
||||
fetchers: {},
|
||||
backendInteractor: backendInteractorService('')
|
||||
backendInteractor: backendInteractorService(''),
|
||||
},
|
||||
interface: {
|
||||
browserSupport: ''
|
||||
browserSupport: '',
|
||||
},
|
||||
config: {
|
||||
colors: '',
|
||||
highlight: {},
|
||||
customTheme: {
|
||||
colors: []
|
||||
}
|
||||
colors: [],
|
||||
},
|
||||
},
|
||||
instance: {
|
||||
hideUserStats: true
|
||||
hideUserStats: true,
|
||||
},
|
||||
statuses: {
|
||||
timelines: {
|
||||
|
|
@ -141,7 +141,7 @@ const localProfileStore = createStore({
|
|||
friends: [],
|
||||
viewing: 'statuses',
|
||||
userId: 100,
|
||||
flushMarker: 0
|
||||
flushMarker: 0,
|
||||
},
|
||||
media: {
|
||||
statuses: [],
|
||||
|
|
@ -157,20 +157,20 @@ const localProfileStore = createStore({
|
|||
friends: [],
|
||||
viewing: 'statuses',
|
||||
userId: 100,
|
||||
flushMarker: 0
|
||||
}
|
||||
}
|
||||
flushMarker: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
users: {
|
||||
currentUser: {
|
||||
credentials: ''
|
||||
credentials: '',
|
||||
},
|
||||
usersObject: { 100: localUser },
|
||||
usersByNameObject: { testuser: localUser },
|
||||
users: [localUser],
|
||||
relationships: {}
|
||||
}
|
||||
}
|
||||
relationships: {},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// https://github.com/vuejs/test-utils/issues/1382
|
||||
|
|
@ -182,14 +182,16 @@ describe.skip('UserProfile', () => {
|
|||
mocks: {
|
||||
$route: {
|
||||
params: { id: 100 },
|
||||
name: 'external-user-profile'
|
||||
name: 'external-user-profile',
|
||||
},
|
||||
$t: (msg) => msg
|
||||
}
|
||||
}
|
||||
$t: (msg) => msg,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.find('.user-screen-name').text()).to.eql('@testUser@test.instance')
|
||||
expect(wrapper.find('.user-screen-name').text()).to.eql(
|
||||
'@testUser@test.instance',
|
||||
)
|
||||
})
|
||||
|
||||
it('renders local profile', () => {
|
||||
|
|
@ -199,11 +201,11 @@ describe.skip('UserProfile', () => {
|
|||
mocks: {
|
||||
$route: {
|
||||
params: { name: 'testUser' },
|
||||
name: 'user-profile'
|
||||
name: 'user-profile',
|
||||
},
|
||||
$t: (msg) => msg
|
||||
}
|
||||
}
|
||||
$t: (msg) => msg,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.find('.user-screen-name').text()).to.eql('@testUser')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue