131 lines
3.6 KiB
HTML
131 lines
3.6 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>Unit tests for Media Plugin</title>
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||
|
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css" type="text/css" />
|
||
|
<script src="http://code.jquery.com/qunit/qunit-git.js"></script>
|
||
|
<script src="../js/qunit/reporter.js"></script>
|
||
|
<script src="../js/tinymce_loader.js"></script>
|
||
|
<script src="../js/utils.js"></script>
|
||
|
<script>
|
||
|
var editor;
|
||
|
|
||
|
QUnit.config.reorder = false;
|
||
|
QUnit.config.autostart = false;
|
||
|
|
||
|
module("Legacyoutput plugin", {
|
||
|
autostart: false
|
||
|
});
|
||
|
|
||
|
test("Font color", function() {
|
||
|
editor.setContent('<p>text</p>');
|
||
|
setSelection('p', 0, 'p', 4);
|
||
|
editor.execCommand('forecolor', false, '#FF0000');
|
||
|
equal(editor.getContent().toLowerCase(), '<p><font color="#ff0000">text</font></p>');
|
||
|
});
|
||
|
|
||
|
test("Font size", function() {
|
||
|
editor.setContent('<p>text</p>');
|
||
|
setSelection('p', 0, 'p', 4);
|
||
|
editor.execCommand('fontsize', false, 7);
|
||
|
equal(editor.getContent(), '<p><font size="7">text</font></p>');
|
||
|
});
|
||
|
|
||
|
test("Font face", function() {
|
||
|
editor.setContent('<p>text</p>');
|
||
|
setSelection('p', 0, 'p', 4);
|
||
|
editor.execCommand('fontname', false, "times");
|
||
|
equal(editor.getContent(), '<p><font face="times">text</font></p>');
|
||
|
});
|
||
|
|
||
|
test("Bold", function() {
|
||
|
editor.setContent('<p>text</p>');
|
||
|
setSelection('p', 0, 'p', 4);
|
||
|
editor.execCommand('bold');
|
||
|
equal(editor.getContent(), '<p><b>text</b></p>');
|
||
|
});
|
||
|
|
||
|
test("Italic", function() {
|
||
|
editor.setContent('<p>text</p>');
|
||
|
setSelection('p', 0, 'p', 4);
|
||
|
editor.execCommand('italic');
|
||
|
equal(editor.getContent(), '<p><i>text</i></p>');
|
||
|
});
|
||
|
|
||
|
test("Underline", function() {
|
||
|
editor.setContent('<p>text</p>');
|
||
|
setSelection('p', 0, 'p', 4);
|
||
|
editor.execCommand('underline');
|
||
|
equal(editor.getContent(), '<p><u>text</u></p>');
|
||
|
});
|
||
|
|
||
|
test("Strikethrough", function() {
|
||
|
editor.setContent('<p>text</p>');
|
||
|
setSelection('p', 0, 'p', 4);
|
||
|
editor.execCommand('strikethrough');
|
||
|
equal(editor.getContent(), '<p><strike>text</strike></p>');
|
||
|
});
|
||
|
|
||
|
test("Justifyleft", function() {
|
||
|
editor.setContent('<p>text</p>');
|
||
|
setSelection('p', 0, 'p', 4);
|
||
|
editor.execCommand('justifyleft');
|
||
|
equal(editor.getContent(), '<p align="left">text</p>');
|
||
|
});
|
||
|
|
||
|
test("Justifycenter", function() {
|
||
|
editor.setContent('<p>text</p>');
|
||
|
setSelection('p', 0, 'p', 4);
|
||
|
editor.execCommand('justifycenter');
|
||
|
equal(editor.getContent(), '<p align="center">text</p>');
|
||
|
});
|
||
|
|
||
|
test("Justifyright", function() {
|
||
|
editor.setContent('<p>text</p>');
|
||
|
setSelection('p', 0, 'p', 4);
|
||
|
editor.execCommand('justifyright');
|
||
|
equal(editor.getContent(), '<p align="right">text</p>');
|
||
|
});
|
||
|
|
||
|
test("Justifyfull", function() {
|
||
|
editor.setContent('<p>text</p>');
|
||
|
setSelection('p', 0, 'p', 4);
|
||
|
editor.execCommand('justifyfull');
|
||
|
equal(editor.getContent(), '<p align="justify">text</p>');
|
||
|
});
|
||
|
|
||
|
function initTiny(settings, load) {
|
||
|
var default_settings = {
|
||
|
mode : "exact",
|
||
|
elements : "elm1",
|
||
|
add_unload_trigger : false,
|
||
|
document_base_url : '/tinymce/tinymce/trunk/tests/',
|
||
|
plugins : 'legacyoutput',
|
||
|
init_instance_callback : function(ed) {
|
||
|
editor = ed;
|
||
|
load();
|
||
|
}
|
||
|
};
|
||
|
var settings = tinymce.extend(default_settings, settings);
|
||
|
tinymce.init(settings);
|
||
|
}
|
||
|
|
||
|
initTiny({}, QUnit.start);
|
||
|
</script>
|
||
|
</head>
|
||
|
<body>
|
||
|
<h1 id="qunit-header">Unit tests for Legacyoutput Plugin</h1>
|
||
|
<h2 id="qunit-banner"></h2>
|
||
|
<div id="qunit-testrunner-toolbar"></div>
|
||
|
<h2 id="qunit-userAgent"></h2>
|
||
|
<ol id="qunit-tests"></ol>
|
||
|
|
||
|
<textarea id="elm1" name="elm1"></textarea>
|
||
|
<div>
|
||
|
<a href="javascript:alert(tinymce.EditorManager.get('elm1').getContent({format : 'raw'}));">[getRawContents]</a>
|
||
|
<a href="javascript:alert(tinymce.EditorManager.get('elm1').getContent());">[getContents]</a>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|