import {test, expect} from '../../fixtures/test' // Modern image loading attributes optimize page performance: // loading="lazy" defers off-screen images, decoding="async" prevents blocking // main thread, fetchpriority="high" prioritizes LCP images. // These appear in course content imported from modern websites and must // survive round-trips for the browser's loading optimization to work. test.describe('image loading, decoding, and fetchpriority attributes', () => { 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('loading="lazy" on img — alt text preserved', async ({page}) => { const content = await setAndGet( page, '

Below the fold image:

Performance chart', ) expect(content).toContain('Performance chart') expect(content).toContain('Below the fold image') }) test('loading="eager" on img — alt text preserved', async ({page}) => { const content = await setAndGet( page, 'Hero banner image', ) expect(content).toContain('Hero banner image') }) test('decoding="async" on img — alt text preserved', async ({page}) => { const content = await setAndGet( page, 'Architecture diagram', ) expect(content).toContain('Architecture diagram') }) test('decoding="sync" on img — alt text preserved', async ({page}) => { const content = await setAndGet( page, 'Critical inline image', ) expect(content).toContain('Critical inline image') }) test('fetchpriority="high" on LCP img — alt text preserved', async ({page}) => { const content = await setAndGet( page, 'Above fold course banner', ) expect(content).toContain('Above fold course banner') }) test('combined lazy + async + data-src — surrounding text preserved', async ({page}) => { const content = await setAndGet( page, '

Gallery images:

Gallery image oneGallery image two', ) expect(content).toContain('Gallery images') expect(content).toContain('Gallery image one') expect(content).toContain('Gallery image two') }) })