(function() { module("tinymce.plugins.Image", { setupModule: function() { QUnit.stop(); tinymce.init({ selector: 'textarea', add_unload_trigger: false, skin: false, plugins: "image", disable_nodechange: true, init_instance_callback: function(ed) { window.editor = ed; QUnit.start(); } }); }, teardown: function() { delete editor.settings.image_dimensions; delete editor.settings.file_browser_callback; delete editor.settings.image_list; delete editor.settings.image_class_list; var win = Utils.getFontmostWindow(); if (win) { win.close(); } } }); function cleanHtml(html) { return Utils.cleanHtml(html).replace(/
( |
]+>)<\/p>$/, '');
}
function fillAndSubmitWindowForm(data) {
var win = Utils.getFontmostWindow();
win.fromJSON(data);
win.find('form')[0].submit();
win.close();
}
test('Default image dialog on empty editor', function() {
editor.setContent('');
editor.execCommand('mceImage', true);
deepEqual(Utils.getFontmostWindow().toJSON(), {
"alt": "",
"constrain": true,
"height": "",
"src": "",
"width": ""
});
fillAndSubmitWindowForm({
"alt": "alt",
"height": "100",
"src": "src",
"width": "200"
});
equal(
cleanHtml(editor.getContent()),
'