<commit_before><!DOCTYPE html>
<html>
<head>
<title>Forced BRs List Tests</title>
<link rel="stylesheet" href="qunit/qunit.css" type="text/css" media="screen">
<script type="text/javascript" src="qunit/qunit.js"></script>
<script type="text/javascript" src="qunit/runner.js"></script>
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce_dev.js"></script>
<script type="text/javascript" src="js/lists/lists-dsl.js"></script>
<script type="text/javascript" src="js/lists/states.js"></script>
<script type="text/javascript" src="js/lists/actions.js"></script>
<script>
// Expected Results

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() {
	if (!tinymce.isIE) {
		// TODO: Fix the range implementation so that this works correctly on IE.
		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() {
	if (!tinymce.isIE) {
		// TODO: Fix the range implementation so that this works correctly on IE.
		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();
});

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,<commit_msg>MAINTENANCE: Enabled tests on IE now that the selection bug is fixed.<commit_after><!DOCTYPE html>
<html>
<head>
<title>Forced BRs List Tests</title>
<link rel="stylesheet" href="qunit/qunit.css" type="text/css" media="screen">
<script type="text/javascript" src="qunit/qunit.js"></script>
<script type="text/javascript" src="qunit/runner.js"></script>
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce_dev.js"></script>
<script type="text/javascript" src="js/lists/lists-dsl.js"></script>
<script type="text/javascript" src="js/lists/states.js"></script>
<script type="text/javascript" src="js/lists/actions.js"></script>
<script>
// Expected Results

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();
});

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,
{'fraction_non_alphanumeric': 0.2037037037037037, 'fraction_numerical': 0.005723905723905724, 'mean_word_length': 6.36183395291202, 'pattern_counts': {'":': 0, '<': 187, '<?xml version=': 0, '>': 187, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4122934', 'n_tokens_mistral': 2233, 'n_tokens_neox': 2139, 'n_words': 370}