feat(media): unify uploads onto modules/album, add batched srcset enrichment and Media Library picker
This commit is contained in:
@@ -108,3 +108,38 @@ describe('untouched value (D-03)', () => {
|
||||
expect(changes).toEqual([edited])
|
||||
})
|
||||
})
|
||||
|
||||
describe('Media Library picker (Phase 37, D-05)', () => {
|
||||
it('dispatches summer-media-pick and inserts clean /media/ img with dimensions on result', () => {
|
||||
const { el, changes } = mount('<p>Intro</p>')
|
||||
const picks: CustomEvent[] = []
|
||||
el.addEventListener('summer-media-pick', (event) => picks.push(event as CustomEvent))
|
||||
|
||||
click(button(el, 'mediaLibrary'))
|
||||
expect(picks).toHaveLength(1)
|
||||
const { id, mode, defaultFolder } = picks[0]!.detail as { id: string; mode: string; defaultFolder: string }
|
||||
expect(typeof id).toBe('string')
|
||||
expect(mode).toBe('image')
|
||||
expect(defaultFolder).toBe('journal')
|
||||
|
||||
el.dispatchEvent(
|
||||
new CustomEvent('summer-media-pick-result', {
|
||||
detail: {
|
||||
id,
|
||||
item: {
|
||||
url: '/media/abc123456789/lion-mane.jpg',
|
||||
alt: 'Lion mane infographic',
|
||||
width: 1200,
|
||||
height: 800,
|
||||
},
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
expect(el.value).toContain('src="/media/abc123456789/lion-mane.jpg"')
|
||||
expect(el.value).toContain('alt="Lion mane infographic"')
|
||||
expect(el.value).toContain('width="1200"')
|
||||
expect(el.value).toContain('height="800"')
|
||||
expect(changes.length).toBeGreaterThan(0)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user