import {test, expect} from '../../fixtures/test'
// editor.dom exposes DOM utilities beyond the mutation API. getOuterHTML()
// serializes elements to string; encode() HTML-escapes text; createHTML()
// builds tag strings; select() queries the document. These are used by Canvas
// plugins to inspect and serialize content without going through getContent().
test.describe('editor.dom query and serialization API', () => {
test.beforeEach(async ({page, rcePage}) => {
await page.goto('/scenarios/basic')
await rcePage.waitForEditor()
})
test('dom.encode() escapes HTML special characters', async ({page}) => {
const result = await page.evaluate(() => {
// @ts-expect-error -- TinyMCE global
const ed = window.tinymce.activeEditor
return ed.dom.encode('')
})
expect(result).toContain('<')
expect(result).toContain('>')
expect(result).not.toContain('