feat: media picker and image removal
This commit is contained in:
1 parent
008b0dfbb9
commit
b3793d5dbb
54 files changed
+3769
-1412
No files matched your search
@@ -34,7 +34,6 @@ async function mountArticleEditor(body = '<p>Hello</p>') {
|
||||
id: 12,
|
||||
title: 'T',
|
||||
body,
|
||||
images: [],
|
||||
is_online: false,
|
||||
created_at: '2026-01-01T00:00:00Z',
|
||||
updated_at: '2026-01-01T00:00:00Z',
|
||||
@@ -106,3 +105,17 @@ describe('removeImage removes only the node whose data-image-id matches', () =>
|
||||
expect(editor.emitted('update:modelValue')).toBeFalsy()
|
||||
})
|
||||
})
|
||||
|
||||
describe('imageSrc reads the src of the node whose data-image-id matches', () => {
|
||||
it('returns the src of the matching image and null for an unknown id', async () => {
|
||||
const wrapper = await mountArticleEditor(
|
||||
'<p>Hello</p><img src="/static/uploadedImages/a.png" alt="" data-image-id="10">',
|
||||
)
|
||||
const vm = wrapper.findComponent(ArticleEditor).vm as unknown as {
|
||||
imageSrc: (id: number) => string | null
|
||||
}
|
||||
|
||||
expect(vm.imageSrc(10)).toBe('/static/uploadedImages/a.png')
|
||||
expect(vm.imageSrc(999)).toBeNull()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user