import {test, expect} from '../../fixtures/test' // and are HTML5 responsive image elements. Canvas // content generated by modern authoring tools may include them. // TinyMCE may strip or preserve ; the fallback text // (alt attribute) and surrounding paragraph text must always survive. test.describe(' and responsive images', () => { test.beforeEach(async ({page, rcePage}) => { await page.goto('/scenarios/basic') await rcePage.waitForEditor() }) async function setAndGet(page: any, html: string): Promise { return page.evaluate((content: string) => { // @ts-expect-error -- TinyMCE global window.tinymce.activeEditor.setContent(content) // @ts-expect-error -- TinyMCE global return window.tinymce.activeEditor.getContent() }, html) } test('paragraph text around is preserved', async ({page}) => { const content = await setAndGet( page, '

Before.

Course diagram

After.

', ) expect(content).toContain('Before') expect(content).toContain('After') }) test(' alt text inside is preserved', async ({page}) => { const content = await setAndGet( page, 'Responsive image', ) expect(content).toContain('alt') expect(content).toContain('Responsive image') }) test(' with multiple sources — no crash', async ({page}) => { const content = await setAndGet( page, 'Multi-format image

Caption below

', ) expect(content).toContain('Caption below') expect(typeof content).toBe('string') }) test('content around with srcset-only img', async ({page}) => { const content = await setAndGet( page, '

See figure:

Figure

End of figure.

', ) expect(content).toContain('See figure') expect(content).toContain('End of figure') }) })