import { Clipboard } from '@ephox/agar'; import { before, beforeEach, describe, it } from '@ephox/bedrock-client'; import { TinyAssertions, TinyDom, TinyHooks, TinySelections } from '@ephox/wrap-mcagar'; import Editor from 'tinymce/core/api/Editor'; import Env from 'tinymce/core/api/Env'; describe('browser.tinymce.core.paste.PasteStylesTest', () => { before(function () { if (!Env.browser.isChromium() && !Env.browser.isSafari()) { this.skip(); } }); const hook = TinyHooks.bddSetupLight({ valid_styles: 'font-family,color', base_url: '/project/tinymce/js/tinymce' }, []); beforeEach(() => { const editor = hook.editor(); editor.options.unset('paste_remove_styles_if_webkit'); editor.options.unset('paste_webkit_styles'); }); it('TBA: Paste span with encoded style attribute, paste_webkit_styles: font-family', () => { const editor = hook.editor(); editor.options.set('paste_webkit_styles', 'font-family'); editor.setContent('

test

'); TinySelections.setSelection(editor, [ 0, 0 ], 0, [ 0, 0 ], 4); Clipboard.pasteItems(TinyDom.body(editor), { 'text/html': 'b' }); TinyAssertions.assertContent(editor, `

b

`); }); it('TBA: Paste span with encoded style attribute, paste_webkit_styles: all', () => { const editor = hook.editor(); editor.options.set('paste_webkit_styles', 'all'); editor.setContent('

test

'); TinySelections.setSelection(editor, [ 0, 0 ], 0, [ 0, 0 ], 4); Clipboard.pasteItems(TinyDom.body(editor), { 'text/html': 'b' }); TinyAssertions.assertContent(editor, `

b

`); }); it('TBA: Paste span with encoded style attribute, paste_webkit_styles: none', () => { const editor = hook.editor(); editor.options.set('paste_webkit_styles', 'none'); editor.setContent('

test

'); TinySelections.setSelection(editor, [ 0, 0 ], 0, [ 0, 0 ], 4); Clipboard.pasteItems(TinyDom.body(editor), { 'text/html': 'b' }); TinyAssertions.assertContent(editor, '

b

'); }); it('TBA: Paste span with encoded style attribute, paste_remove_styles_if_webkit: false', () => { const editor = hook.editor(); editor.options.set('paste_remove_styles_if_webkit', false); editor.setContent('

test

'); TinySelections.setSelection(editor, [ 0, 0 ], 0, [ 0, 0 ], 4); Clipboard.pasteItems(TinyDom.body(editor), { 'text/html': 'b' }); TinyAssertions.assertContent(editor, `

b

`); }); it('TINY-8163: Paste span with RGB color style, paste_webkit_styles: color', () => { const editor = hook.editor(); editor.options.set('paste_webkit_styles', 'color'); editor.setContent('

test

'); TinySelections.setSelection(editor, [ 0, 0 ], 0, [ 0, 0 ], 4); Clipboard.pasteItems(TinyDom.body(editor), { 'text/html': 'b' }); TinyAssertions.assertContent(editor, `

b

`); }); it('TINY-8525: paste span without any color styles, paste_webkit_styles: color,font-family', () => { const editor = hook.editor(); editor.options.set('paste_webkit_styles', 'color,font-family'); editor.setContent('

test

'); TinySelections.setSelection(editor, [ 0, 0 ], 0, [ 0, 0 ], 4); Clipboard.pasteItems(TinyDom.body(editor), { 'text/html': 'b' }); TinyAssertions.assertContent(editor, `

b

`); }); });