Your IP : 216.73.216.65


Current Path : /home/ataenra/www/media/com_jce/editor/tinymce/plugins/lists/tests/
Upload File :
Current File : /home/ataenra/www/media/com_jce/editor/tinymce/plugins/lists/tests/lists_forced_brs.html

<!DOCTYPE html>
<html>
<head>
<title>Forced BRs List Tests</title>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.14.0.css" type="text/css" />
	<script src="http://code.jquery.com/qunit/qunit-1.14.0.js"></script>
	<script src="../../../../../../../../tinymce-muon-retina/tests/qunit/connector.js"></script>
	<script type="text/javascript" src="../../../../../../../../tinymce-muon-retina/tests/qunit/runner.js"></script>
	<script type="text/javascript" src="../../../../../../../../tinymce-muon-retina/tests/js/utils.js"></script>
	<script type="text/javascript" src="../../../tinymce.js"></script>
	<script type="text/javascript" src="../../../../../../../../tinymce-muon-retina/tests/js/dsl/dsl.js"></script>
	<script type="text/javascript" src="../../../../../../../../tinymce-muon-retina/tests/js/dsl/states.js"></script>
	<script type="text/javascript" src="../../../../../../../../tinymce-muon-retina/tests/js/lists/actions.js"></script>
	<script type="text/javascript" src="../plugin.js"></script>
<script>
QUnit.config.reorder = false;
QUnit.config.autostart = false;

module('Lists - Applying', {
	autostart: false,
	setup: function() {
		window.queue = new dsl.Queue();
	}
});

// Tests

asyncTest('Force BRs - Expanded Selection, List Types - Unordered List Action', function() {
	ApplyingUL.to(TextAfterUL).gives('<ul><li>Item</li><li>Test</li></ul>');
	ApplyingUL.to(TextAfterOL).gives('<ol><li>Item</li></ol><ul><li>Test</li></ul>');
	ApplyingUL.to(EmptyContent).gives('<ul><li></li></ul>');
	ApplyingUL.to(PlainText).gives('<ul><li>Test</li></ul>');
	ApplyingUL.to(SingleLiUlSelection).gives('<p>Item 1</p>');
	ApplyingUL.to(MultiLiUlSelection).gives('<p>Item 1<br />Item 2</p>');

	ApplyingUL.to(IndentedUlInUlCorrectSelection).gives('<p>Item 1<br />Indented</p>');
	ApplyingUL.to(IndentedUlInUlIncorrectSelection).gives('<p>Item 1<br />Indented</p>');
	queue.done();
});

asyncTest('Force BRs - Expanded Selection, List Types - Ordered List Action', function() {
	ApplyingOL.to(TextAfterOL).gives('<ol><li>Item</li><li>Test</li></ol>');
	ApplyingOL.to(TextAfterUL).gives('<ul><li>Item</li></ul><ol><li>Test</li></ol>');
	ApplyingOL.to(EmptyContent).gives('<ol><li></li></ol>');
	ApplyingOL.to(PlainText).gives('<ol><li>Test</li></ol>');
	ApplyingOL.to(SingleLiOlSelection).gives('<p>Item 1</p>');
	ApplyingOL.to(MultiLiOlSelection).gives('<p>Item 1<br />Item 2</p>');
	
	ApplyingOL.to(HeadingInOrderedListBeforeParagraph).gives('<h2>Test</h2><p>Content<br />After</p>');
	
	ApplyingOL.to(IndentedOlInOlCorrectSelection).gives('<p>Item 1<br />Indented</p>');
	ApplyingOL.to(IndentedOlInOlIncorrectSelection).gives('<p>Item 1<br />Indented</p>');
	queue.done();
});

asyncTest('Force BRs - Selection boundaries at BR', function() {
	ApplyingOL.to(SelectionEndingAtBr).gives('<ol><li>Item</li></ol><p>After</p>');
	ApplyingUL.to(SelectionEndingAtBr).gives('<ul><li>Item</li></ul><p>After</p>');
	if (!tinymce.isIE) {
		// This type of selection never occurs on IE.
		ApplyingOL.to(SelectionStartingAtBr).gives('<p>Before</p><ol><li>Item</li></ol>');
		ApplyingUL.to(SelectionStartingAtBr).gives('<p>Before</p><ul><li>Item</li></ul>');
	}
	queue.done();
});
var initTinyFunction = function(){
	tinymce.init({
		mode : "exact",
		elements : "elm1",
		theme : "advanced",
		cleanup: true,
		force_br_newlines: true,
		force_p_newlines: false,
		forced_root_block: '',
		// TODO: Determine why TinyMCE defaults to stripping out empty h1,ul,ol and li element since it results in invalid HTML (but only on FF3.0 and IE).
		extended_valid_elements: 'li[style],ul[type|compact|style],ol[type|compact|style],h1',
		// Turn this off because we want the list actions to create the right DOM structure from the start.
		fix_list_elements: false,
		plugins : 'lists',
		add_unload_trigger : false,
		apply_source_formatting : 0,
		init_instance_callback : function(ed) {
			editor = ed;

			ed.onNodeChange.addToTop(function() {
				return false;
			});
		}
	});
};
</script>
</head>
<body>
	<h1 id="qunit-header">Forced BRs List Tests</h1>
	<h2 id="qunit-banner"></h2>
	<div id="qunit-testrunner-toolbar"></div>
	<h2 id="qunit-userAgent"></h2>
	<ol id="qunit-tests"></ol>
	<div id="content">
		<textarea id="elm1" name="elm1"></textarea>
	</div>
	<p><input type="text" id="state"><input type="button" value="Load state" onclick="loadState();"></p>
	<script type="text/javascript" language="JavaScript" src="jsrobot/robot.js"></script>
	<script>
	initWhenTinyAndRobotAreReady(initTinyFunction);

	function loadState() {
		window[document.getElementById('state').value]();
		editor.focus();
	}
	</script>
</body>
</html>