fix: authors profile pictute all accross the SPA

This commit is contained in:
Florian Sylvain committed 2026-10-19 00:46:16 +02:00
1 parent 18600ab49d
commit 500ad59458
19 files changed
+265 -16

No files matched your search

@@ -117,6 +117,38 @@ describe('MediaField', () => {
expect(wrapper.findComponent(MediaField).emitted('update:modelValue')![0]).toEqual([null])
})
it('looks up the saved image by id and shows its filename when reopened without an item', async () => {
const request = vi.fn().mockResolvedValue(ITEM)
vi.mocked(useApi).mockReturnValue({ getMe: vi.fn(), request } as unknown as ReturnType<
typeof useApi
>)
await mountInApp(MediaField, { label: 'Avatar', picker: PICKER, modelValue: 55 })
await flushPromises()
expect(request).toHaveBeenCalledWith('/v1/media/55')
expect(text(document.body)).toContain('face.jpg')
expect(text(document.body)).not.toContain('Image #55')
expect(document.body.querySelector('[data-testid="media-thumb"] img')).toBeTruthy()
})
it('does not look the image up when the item is already known', async () => {
const request = vi.fn()
vi.mocked(useApi).mockReturnValue({ getMe: vi.fn(), request } as unknown as ReturnType<
typeof useApi
>)
await mountInApp(MediaField, {
label: 'Avatar',
picker: PICKER,
modelValue: 55,
item: ITEM,
})
await flushPromises()
expect(request).not.toHaveBeenCalled()
})
it('draws the avatar variant as a square with initials when no image is chosen', async () => {
await mountInApp(MediaField, {
label: 'Avatar',