module("tinymce.plugins.Media", { setupModule: function() { QUnit.stop(); tinymce.init({ selector: "textarea", add_unload_trigger: false, skin: false, plugins: 'media', live_embeds: false, document_base_url: '/tinymce/tinymce/trunk/tests/', extended_valid_elements: 'script[src|type]', media_scripts: [ {filter: 'http://media1.tinymce.com'}, {filter: 'http://media2.tinymce.com', width: 100, height: 200} ], init_instance_callback: function(ed) { window.editor = ed; QUnit.start(); } }); }, teardown: function() { delete editor.settings.media_filter_html; delete editor.settings.media_live_embeds; } }); function fillAndSubmitWindowForm(data) { var win = Utils.getFrontmostWindow(); win.fromJSON(data); win.find('form')[0].submit(); win.close(); } test('Default media dialog on empty editor', function() { editor.settings.media_live_embeds = false; editor.setContent(''); editor.plugins.media.showDialog(); deepEqual(Utils.getFrontmostWindow().toJSON(), { constrain: true, embed: "", height: "", poster: "", source1: "", source2: "", width: "" }); fillAndSubmitWindowForm({ "source1": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }); equal( editor.getContent(), '

' ); }); test("Object retain as is", function() { editor.setContent( '' + '' + '' + '' + '' ); equal(editor.getContent(), '

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

' ); }); test("Embed retain as is", function() { editor.setContent( 'textlink' ); equal( editor.getContent(), '

textlink

' ); }); test("Video retain as is", function() { editor.setContent( '' ); equal( editor.getContent(), '

' ); }); test("Iframe retain as is", function() { editor.setContent( '' ); equal(editor.getContent(), '

' ); }); test("Audio retain as is", function() { editor.setContent( '' ); equal(editor.getContent(), '

' + '' + '

' ); }); test("Resize complex object", function() { editor.setContent( '' ); var placeholderElm = editor.getBody().firstChild.firstChild; placeholderElm.width = 100; placeholderElm.height = 200; editor.fire('objectResized', {target: placeholderElm, width: placeholderElm.width, height: placeholderElm.height}); editor.settings.media_filter_html = false; equal(editor.getContent(), '

' + '' + '

' ); }); test("Media script elements", function() { editor.setContent( '