2014-06-18 01:49:00 +02:00
|
|
|
(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;
|
2014-12-01 00:27:23 +01:00
|
|
|
delete editor.settings.document_base_url;
|
2015-03-10 20:19:56 +01:00
|
|
|
delete editor.settings.image_advtab;
|
2014-06-18 01:49:00 +02:00
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
var win = Utils.getFrontmostWindow();
|
2014-06-18 01:49:00 +02:00
|
|
|
|
|
|
|
if (win) {
|
|
|
|
win.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
function cleanHtml(html) {
|
|
|
|
return Utils.cleanHtml(html).replace(/<p>( |<br[^>]+>)<\/p>$/, '');
|
|
|
|
}
|
|
|
|
|
|
|
|
function fillAndSubmitWindowForm(data) {
|
2015-07-01 02:51:22 +02:00
|
|
|
var win = Utils.getFrontmostWindow();
|
2014-06-18 01:49:00 +02:00
|
|
|
|
|
|
|
win.fromJSON(data);
|
|
|
|
win.find('form')[0].submit();
|
|
|
|
win.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
test('Default image dialog on empty editor', function() {
|
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2014-06-18 01:49:00 +02:00
|
|
|
"alt": "",
|
|
|
|
"constrain": true,
|
|
|
|
"height": "",
|
|
|
|
"src": "",
|
|
|
|
"width": ""
|
|
|
|
});
|
|
|
|
|
|
|
|
fillAndSubmitWindowForm({
|
|
|
|
"alt": "alt",
|
|
|
|
"height": "100",
|
|
|
|
"src": "src",
|
|
|
|
"width": "200"
|
|
|
|
});
|
|
|
|
|
|
|
|
equal(
|
|
|
|
cleanHtml(editor.getContent()),
|
|
|
|
'<p><img src="src" alt="alt" width="200" height="100" /></p>'
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Image dialog image_dimensions: false', function() {
|
|
|
|
editor.settings.image_dimensions = false;
|
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2014-06-18 01:49:00 +02:00
|
|
|
"alt": "",
|
|
|
|
"src": ""
|
|
|
|
});
|
|
|
|
|
|
|
|
fillAndSubmitWindowForm({
|
|
|
|
"alt": "alt",
|
|
|
|
"src": "src"
|
|
|
|
});
|
|
|
|
|
|
|
|
equal(
|
|
|
|
cleanHtml(editor.getContent()),
|
|
|
|
'<p><img src="src" alt="alt" /></p>'
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
test('All image dialog ui options on empty editor', function() {
|
|
|
|
editor.settings.image_list = [
|
|
|
|
{title: 'link1', value: 'link1'},
|
|
|
|
{title: 'link2', value: 'link2'}
|
|
|
|
];
|
|
|
|
|
|
|
|
editor.settings.image_class_list = [
|
|
|
|
{title: 'class1', value: 'class1'},
|
|
|
|
{title: 'class2', value: 'class2'}
|
|
|
|
];
|
|
|
|
|
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2014-06-18 01:49:00 +02:00
|
|
|
"alt": "",
|
|
|
|
"class": "class1",
|
|
|
|
"constrain": true,
|
|
|
|
"height": "",
|
|
|
|
"src": "",
|
|
|
|
"width": ""
|
|
|
|
});
|
|
|
|
|
|
|
|
fillAndSubmitWindowForm({
|
|
|
|
"alt": "alt",
|
|
|
|
"class": "class1",
|
|
|
|
"constrain": true,
|
|
|
|
"height": "200",
|
|
|
|
"src": "src",
|
|
|
|
"width": "100"
|
|
|
|
});
|
|
|
|
|
|
|
|
equal(
|
|
|
|
cleanHtml(editor.getContent()),
|
|
|
|
'<p><img class="class1" src="src" alt="alt" width="100" height="200" /></p>'
|
|
|
|
);
|
|
|
|
});
|
2014-12-01 00:27:23 +01:00
|
|
|
|
2015-03-10 20:19:56 +01:00
|
|
|
test("Image recognizes relative src url and prepends relative image_prepend_url setting.", function () {
|
2014-12-01 00:27:23 +01:00
|
|
|
var win, elementId, element;
|
|
|
|
|
2015-03-10 20:19:56 +01:00
|
|
|
editor.settings.image_prepend_url = 'testing/images/';
|
2014-12-01 00:27:23 +01:00
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
|
|
|
var data = {
|
|
|
|
"src": "src",
|
|
|
|
"alt": "alt"
|
|
|
|
};
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
win = Utils.getFrontmostWindow();
|
2014-12-01 00:27:23 +01:00
|
|
|
elementId = win.find('#src')[0]._id;
|
|
|
|
element = document.getElementById(elementId).childNodes[0];
|
|
|
|
|
|
|
|
win.fromJSON(data);
|
|
|
|
Utils.triggerElementChange(element);
|
|
|
|
|
|
|
|
win.find('form')[0].submit();
|
|
|
|
win.close();
|
|
|
|
|
|
|
|
equal(
|
|
|
|
cleanHtml(editor.getContent()),
|
2015-03-10 20:19:56 +01:00
|
|
|
'<p><img src="' + editor.settings.image_prepend_url + 'src" alt="alt" /></p>'
|
2014-12-01 00:27:23 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2015-03-10 20:19:56 +01:00
|
|
|
test("Image recognizes relative src url and prepends absolute image_prepend_url setting.", function () {
|
2014-12-01 00:27:23 +01:00
|
|
|
var win, elementId, element;
|
|
|
|
|
2015-10-21 00:05:31 +02:00
|
|
|
editor.settings.image_prepend_url = 'http://localhost/images/';
|
2014-12-01 00:27:23 +01:00
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
|
|
|
var data = {
|
|
|
|
"src": "src",
|
|
|
|
"alt": "alt"
|
|
|
|
};
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
win = Utils.getFrontmostWindow();
|
2014-12-01 00:27:23 +01:00
|
|
|
elementId = win.find('#src')[0]._id;
|
|
|
|
element = document.getElementById(elementId).childNodes[0];
|
|
|
|
|
|
|
|
win.fromJSON(data);
|
|
|
|
Utils.triggerElementChange(element);
|
|
|
|
|
|
|
|
win.find('form')[0].submit();
|
|
|
|
win.close();
|
|
|
|
|
|
|
|
equal(
|
|
|
|
cleanHtml(editor.getContent()),
|
2015-03-10 20:19:56 +01:00
|
|
|
'<p><img src="' + editor.settings.image_prepend_url + 'src" alt="alt" /></p>'
|
2014-12-01 00:27:23 +01:00
|
|
|
);
|
2015-03-10 20:19:56 +01:00
|
|
|
});
|
2014-12-01 00:27:23 +01:00
|
|
|
|
2015-03-10 20:19:56 +01:00
|
|
|
test('Advanced image dialog border option on empty editor', function(){
|
|
|
|
editor.settings.image_advtab = true;
|
|
|
|
editor.settings.image_dimensions = false;
|
2014-12-01 00:27:23 +01:00
|
|
|
|
2015-03-10 20:19:56 +01:00
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "",
|
|
|
|
"src": "",
|
|
|
|
"style": "",
|
|
|
|
"vspace": ""
|
|
|
|
});
|
|
|
|
|
|
|
|
fillAndSubmitWindowForm({
|
|
|
|
"alt": "alt",
|
|
|
|
"border": "10px",
|
|
|
|
"src": "src"
|
|
|
|
});
|
|
|
|
|
|
|
|
equal(
|
|
|
|
cleanHtml(editor.getContent()),
|
|
|
|
'<p><img style="border-width: 10px;" src="src" alt="alt" /></p>'
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Advanced image dialog margin space options on empty editor', function(){
|
|
|
|
editor.settings.image_advtab = true;
|
|
|
|
editor.settings.image_dimensions = false;
|
|
|
|
|
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "",
|
|
|
|
"src": "",
|
|
|
|
"style": "",
|
|
|
|
"vspace": ""
|
|
|
|
});
|
|
|
|
|
|
|
|
fillAndSubmitWindowForm({
|
|
|
|
"alt": "alt",
|
|
|
|
"hspace": "10",
|
|
|
|
"src": "src",
|
|
|
|
"vspace": "10"
|
|
|
|
});
|
|
|
|
|
|
|
|
equal(
|
|
|
|
cleanHtml(editor.getContent()),
|
|
|
|
'<p><img style="margin: 10px;" src="src" alt="alt" /></p>'
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Advanced image dialog border style only options on empty editor', function(){
|
|
|
|
editor.settings.image_advtab = true;
|
|
|
|
editor.settings.image_dimensions = false;
|
|
|
|
|
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "",
|
|
|
|
"src": "",
|
|
|
|
"style": "",
|
|
|
|
"vspace": ""
|
|
|
|
});
|
|
|
|
|
|
|
|
fillAndSubmitWindowForm({
|
|
|
|
"alt": "alt",
|
|
|
|
"src": "src",
|
|
|
|
"style": "border-width: 10px;"
|
|
|
|
});
|
|
|
|
|
|
|
|
equal(
|
|
|
|
cleanHtml(editor.getContent()),
|
|
|
|
'<p><img style="border-width: 10px;" src="src" alt="alt" /></p>'
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Advanced image dialog margin style only options on empty editor', function(){
|
|
|
|
editor.settings.image_advtab = true;
|
|
|
|
editor.settings.image_dimensions = false;
|
|
|
|
|
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "",
|
|
|
|
"src": "",
|
|
|
|
"style": "",
|
|
|
|
"vspace": ""
|
|
|
|
});
|
|
|
|
|
|
|
|
fillAndSubmitWindowForm({
|
|
|
|
"alt": "alt",
|
|
|
|
"src": "src",
|
|
|
|
"style": "margin: 10px;"
|
|
|
|
});
|
|
|
|
|
|
|
|
equal(
|
|
|
|
cleanHtml(editor.getContent()),
|
|
|
|
'<p><img style="margin: 10px;" src="src" alt="alt" /></p>'
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Advanced image dialog overriden border style options on empty editor', function(){
|
|
|
|
editor.settings.image_advtab = true;
|
|
|
|
editor.settings.image_dimensions = false;
|
|
|
|
|
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "",
|
|
|
|
"src": "",
|
|
|
|
"style": "",
|
|
|
|
"vspace": ""
|
|
|
|
});
|
|
|
|
|
|
|
|
fillAndSubmitWindowForm({
|
|
|
|
"alt": "alt",
|
|
|
|
"border": "10",
|
|
|
|
"src": "src",
|
|
|
|
"style": "border-width: 15px;",
|
|
|
|
});
|
|
|
|
|
|
|
|
equal(
|
|
|
|
cleanHtml(editor.getContent()),
|
|
|
|
'<p><img style="border-width: 10px;" src="src" alt="alt" /></p>'
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Advanced image dialog overriden margin style options on empty editor', function(){
|
|
|
|
editor.settings.image_advtab = true;
|
|
|
|
editor.settings.image_dimensions = false;
|
|
|
|
|
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "",
|
|
|
|
"src": "",
|
|
|
|
"style": "",
|
|
|
|
"vspace": ""
|
|
|
|
});
|
|
|
|
|
|
|
|
fillAndSubmitWindowForm({
|
|
|
|
"alt": "alt",
|
|
|
|
"hspace": "10",
|
|
|
|
"src": "src",
|
|
|
|
"style": "margin-left: 15px; margin-top: 20px;",
|
|
|
|
"vspace": "10"
|
|
|
|
});
|
|
|
|
|
|
|
|
equal(
|
|
|
|
cleanHtml(editor.getContent()),
|
|
|
|
'<p><img style="margin: 10px;" src="src" alt="alt" /></p>'
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Advanced image dialog non-shorthand horizontal margin style change test', function(){
|
|
|
|
editor.settings.image_advtab = true;
|
|
|
|
editor.settings.image_dimensions = false;
|
|
|
|
|
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "",
|
|
|
|
"src": "",
|
|
|
|
"style": "",
|
|
|
|
"vspace": ""
|
|
|
|
});
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
Utils.getFrontmostWindow().find('#style').value('margin-left: 15px; margin-right: 15px;').fire('change');
|
2015-03-10 20:19:56 +01:00
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "15",
|
|
|
|
"src": "",
|
|
|
|
"style": "margin-left: 15px; margin-right: 15px;",
|
|
|
|
"vspace": ""
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Advanced image dialog non-shorthand vertical margin style change test', function(){
|
|
|
|
editor.settings.image_advtab = true;
|
|
|
|
editor.settings.image_dimensions = false;
|
|
|
|
|
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "",
|
|
|
|
"src": "",
|
|
|
|
"style": "",
|
|
|
|
"vspace": ""
|
|
|
|
});
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
Utils.getFrontmostWindow().find('#style').value('margin-top: 15px; margin-bottom: 15px;').fire('change');
|
2015-03-10 20:19:56 +01:00
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "",
|
|
|
|
"src": "",
|
|
|
|
"style": "margin-top: 15px; margin-bottom: 15px;",
|
|
|
|
"vspace": "15"
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Advanced image dialog shorthand margin 1 value style change test', function(){
|
|
|
|
editor.settings.image_advtab = true;
|
|
|
|
editor.settings.image_dimensions = false;
|
|
|
|
|
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "",
|
|
|
|
"src": "",
|
|
|
|
"style": "",
|
|
|
|
"vspace": ""
|
|
|
|
});
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
Utils.getFrontmostWindow().find('#style').value('margin: 5px;').fire('change');
|
2015-03-10 20:19:56 +01:00
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "5",
|
|
|
|
"src": "",
|
|
|
|
"style": "margin: 5px;",
|
|
|
|
"vspace": "5"
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Advanced image dialog shorthand margin 2 value style change test', function(){
|
|
|
|
editor.settings.image_advtab = true;
|
|
|
|
editor.settings.image_dimensions = false;
|
|
|
|
|
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "",
|
|
|
|
"src": "",
|
|
|
|
"style": "",
|
|
|
|
"vspace": ""
|
|
|
|
});
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
Utils.getFrontmostWindow().find('#style').value('margin: 5px 10px;').fire('change');
|
2015-03-10 20:19:56 +01:00
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "10",
|
|
|
|
"src": "",
|
|
|
|
"style": "margin: 5px 10px 5px 10px;",
|
|
|
|
"vspace": "5"
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Advanced image dialog shorthand margin 2 value style change test', function(){
|
|
|
|
editor.settings.image_advtab = true;
|
|
|
|
editor.settings.image_dimensions = false;
|
|
|
|
|
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "",
|
|
|
|
"src": "",
|
|
|
|
"style": "",
|
|
|
|
"vspace": ""
|
|
|
|
});
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
Utils.getFrontmostWindow().find('#style').value('margin: 5px 10px;').fire('change');
|
2015-03-10 20:19:56 +01:00
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "10",
|
|
|
|
"src": "",
|
|
|
|
"style": "margin: 5px 10px 5px 10px;",
|
|
|
|
"vspace": "5"
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Advanced image dialog shorthand margin 3 value style change test', function(){
|
|
|
|
editor.settings.image_advtab = true;
|
|
|
|
editor.settings.image_dimensions = false;
|
|
|
|
|
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "",
|
|
|
|
"src": "",
|
|
|
|
"style": "",
|
|
|
|
"vspace": ""
|
|
|
|
});
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
Utils.getFrontmostWindow().find('#style').value('margin: 5px 10px 15px;').fire('change');
|
2015-03-10 20:19:56 +01:00
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "10",
|
|
|
|
"src": "",
|
|
|
|
"style": "margin: 5px 10px 15px 10px;",
|
|
|
|
"vspace": ""
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Advanced image dialog shorthand margin 4 value style change test', function(){
|
|
|
|
editor.settings.image_advtab = true;
|
|
|
|
editor.settings.image_dimensions = false;
|
|
|
|
|
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "",
|
|
|
|
"src": "",
|
|
|
|
"style": "",
|
|
|
|
"vspace": ""
|
|
|
|
});
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
Utils.getFrontmostWindow().find('#style').value('margin: 5px 10px 15px 20px;').fire('change');
|
2015-03-10 20:19:56 +01:00
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "",
|
|
|
|
"src": "",
|
|
|
|
"style": "margin: 5px 10px 15px 20px;",
|
|
|
|
"vspace": ""
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Advanced image dialog shorthand margin 4 value style change test', function(){
|
|
|
|
editor.settings.image_advtab = true;
|
|
|
|
editor.settings.image_dimensions = false;
|
|
|
|
|
|
|
|
editor.setContent('');
|
|
|
|
editor.execCommand('mceImage', true);
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "",
|
|
|
|
"src": "",
|
|
|
|
"style": "",
|
|
|
|
"vspace": ""
|
|
|
|
});
|
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
Utils.getFrontmostWindow().find('#style').value('margin: 5px 10px 15px 20px; margin-top: 15px;').fire('change');
|
2015-03-10 20:19:56 +01:00
|
|
|
|
2015-07-01 02:51:22 +02:00
|
|
|
deepEqual(Utils.getFrontmostWindow().toJSON(), {
|
2015-03-10 20:19:56 +01:00
|
|
|
"alt": "",
|
|
|
|
"border": "",
|
|
|
|
"hspace": "",
|
|
|
|
"src": "",
|
|
|
|
"style": "margin: 15px 10px 15px 20px;",
|
|
|
|
"vspace": "15"
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
2015-07-01 02:51:22 +02:00
|
|
|
})();
|