import { describe, it } from '@ephox/bedrock-client'; import { TinyAssertions, TinyHooks } from '@ephox/wrap-mcagar'; import Editor from 'tinymce/core/api/Editor'; import Plugin from 'tinymce/plugins/media/Plugin'; describe('browser.tinymce.plugins.media.ContentFormatsTest', () => { const hook = TinyHooks.bddSetupLight({ plugins: 'media', toolbar: 'media', base_url: '/project/tinymce/js/tinymce', media_live_embeds: false, document_base_url: '/tinymce/tinymce/trunk/tests/', extended_valid_elements: 'script[src|type]', allow_conditional_comments: true }, [ Plugin ]); it('TBA: Object retained as is', () => { const editor = hook.editor(); editor.setContent( '' + '' + '' + '' + '' ); TinyAssertions.assertContent(editor, '

' + '' + '' + '' + '

' ); }); it('TBA: Embed retained as is', () => { const editor = hook.editor(); editor.setContent( 'textlink' ); TinyAssertions.assertContent(editor, '

textlink

' ); }); it('TBA: Video retained as is', () => { const editor = hook.editor(); editor.setContent( '' ); TinyAssertions.assertContent(editor, '

' ); }); // TODO: TINY-4627/TINY-8363 it.skip('TBA: Iframe retained as is', () => { const editor = hook.editor(); editor.setContent( '' ); TinyAssertions.assertContent(editor, '

' ); }); it('TBA: Audio retained as is', () => { const editor = hook.editor(); editor.setContent( '' ); TinyAssertions.assertContent(editor, '

' + '' + '

' ); }); it('TBA: Resize complex object', () => { const editor = hook.editor(); editor.options.set('media_live_embeds', false); editor.setContent( '' ); const placeholderElm = editor.dom.select('img')[0]; placeholderElm.width = 100; placeholderElm.height = 200; editor.dispatch('ObjectResized', { target: placeholderElm, width: placeholderElm.width, height: placeholderElm.height, origin: 'corner-se' }); editor.options.set('media_filter_html', false); TinyAssertions.assertContent(editor, '

' + '' + '

' ); editor.options.unset('media_filter_html'); editor.options.unset('media_live_embeds'); }); it('TBA: XSS content', () => { const editor = hook.editor(); const testXss = (input: string, expectedOutput: string) => { editor.setContent(input); TinyAssertions.assertContent(editor, expectedOutput); }; testXss('', '

'); testXss('', '

'); testXss('', '

'); testXss('

', '

'); testXss('

', '

'); testXss('

', '

'); testXss( '

', '

' ); testXss( '

'); }); });