2014-03-24 06:59:45 +01:00
|
|
|
module("tinymce.plugins.Noneditable", {
|
|
|
|
setupModule: function() {
|
|
|
|
QUnit.stop();
|
|
|
|
|
|
|
|
tinymce.init({
|
|
|
|
selector: "textarea",
|
|
|
|
add_unload_trigger: false,
|
|
|
|
skin: false,
|
|
|
|
indent: false,
|
|
|
|
noneditable_regexp: [/\{[^\}]+\}/g],
|
|
|
|
plugins: 'noneditable',
|
|
|
|
convert_fonts_to_spans: false,
|
|
|
|
entities: 'raw',
|
|
|
|
valid_styles: {
|
|
|
|
'*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display'
|
|
|
|
},
|
|
|
|
init_instance_callback: function(ed) {
|
|
|
|
window.editor = ed;
|
|
|
|
QUnit.start();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2014-02-10 02:11:25 +01:00
|
|
|
});
|
|
|
|
|
2014-04-16 00:06:11 +02:00
|
|
|
// Ignore on IE 7, 8 this is a known bug not worth fixing
|
2016-01-20 05:17:22 +01:00
|
|
|
if (tinymce.Env.ceFalse) {
|
|
|
|
test('noneditable class', function() {
|
|
|
|
editor.setContent('<p><span class="mceNonEditable">abc</span></p>');
|
|
|
|
equal(editor.dom.select('span')[0].contentEditable, "false");
|
2014-04-16 00:06:11 +02:00
|
|
|
});
|
|
|
|
|
2016-01-20 05:17:22 +01:00
|
|
|
test('editable class', function() {
|
|
|
|
editor.setContent('<p><span class="mceEditable">abc</span></p>');
|
|
|
|
equal(editor.dom.select('span')[0].contentEditable, "true");
|
2014-04-16 00:06:11 +02:00
|
|
|
});
|
2014-02-10 02:11:25 +01:00
|
|
|
|
2016-01-20 05:17:22 +01:00
|
|
|
test('noneditable regexp', function() {
|
|
|
|
editor.setContent('<p>{test1}{test2}</p>');
|
2014-03-24 06:59:45 +01:00
|
|
|
|
2016-01-20 05:17:22 +01:00
|
|
|
equal(editor.dom.select('span').length, 2);
|
|
|
|
equal(editor.dom.select('span')[0].contentEditable, "false");
|
|
|
|
equal(editor.dom.select('span')[1].contentEditable, "false");
|
|
|
|
equal(editor.getContent(), '<p>{test1}{test2}</p>');
|
2014-04-16 00:06:11 +02:00
|
|
|
});
|
2016-01-20 05:17:22 +01:00
|
|
|
}
|