Файловый менеджер - Редактировать - /home/wuectly/www/media/com_jce/editor/tinymce/plugins/lists/tests/lists_applying.html
Назад
<!DOCTYPE html> <html> <head> <title>Applying and Unapplying List Tests</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <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> // Expected Results var EmptyOLConvertedToP = '<ol><li>Before</li></ol>\n<p> </p>\n<ol><li>After</li></ol>'; var EmptyULConvertedToP = '<ul>\n<li>Before</li>\n</ul>\n<p> </p>\n<ul>\n<li>After</li>\n</ul>'; var NonEmptyOLConvertedToP = '<ol>\n<li>Before</li>\n</ol>\n<p>Test</p>\n<ol>\n<li>After</li>\n</ol>'; var NonEmptyULConvertedToP = '<ul>\n<li>Before</li>\n</ul>\n<p>Test</p>\n<ul>\n<li>After</li>\n</ul>'; QUnit.config.reorder = false; QUnit.config.autostart = false; module('Lists - Applying', { autostart: false, setup: function() { window.queue = new dsl.Queue(); } }); // Tests asyncTest('Collapsed Selection - Apply OL Actions', function() { ApplyingOL.to(EmptyParagraph).gives('<ol>\n<li></li>\n</ol>'); ApplyingOL.to(EmptyHeading).gives('<ol>\n<li>\n<h1></h1>\n</li>\n</ol>'); ApplyingOL.to(NonEmptyParagraph).enablesState('Outdent').andGives('<ol>\n<li>Test</li>\n</ol>'); ApplyingOL.to(NonEmptyHeading).enablesState('Outdent').andGives('<ol>\n<li>\n<h1>Test</h1>\n</li>\n</ol>'); ApplyingOL.to(TableCellWithoutBrs).enablesState('Outdent').andGives('<table><tbody><tr>\n<td><ol>\n<li>Test</li>\n</ol></td>\n<td> </td>\n</tr></tbody></table>'); ApplyingOL.to(TableCellWithBrsFirstLine).enablesState('Outdent').andGives('<table><tbody><tr>\n<td><ol>\n<li>Test</li>\n</ol>Line 2</td>\n<td> </td>\n</tr></tbody></table>'); ApplyingOL.to(TableCellWithBrsMiddleLine).enablesState('Outdent').andGives('<table><tbody><tr>\n<td>Test<ol>\n<li>Line 2</li>\n</ol>Line 3</td>\n<td> </td>\n</tr></tbody></table>'); ApplyingOL.to(TableCellWithBrsLastLine).enablesState('Outdent').andGives('<table><tbody><tr>\n<td>Test<ol>\n<li>Line 2</li>\n</ol></td>\n<td> </td>\n</tr></tbody></table>'); ApplyingOL.to(TableCellWithAdjacentBrsFirstLine).enablesState('Outdent').andGives('<table><tbody><tr>\n<td><ol>\n<li>Test</li>\n</ol><br />Line 2</td>\n<td> </td>\n</tr></tbody></table>'); ApplyingOL.to(HeadingInOrderedList).gives('<h2>Test</h2>'); ApplyingOL.to(HeadingInUnorderedList).gives('<ol>\n<li>\n<h2>Test</h2>\n</li>\n</ol>'); ApplyingOL.to(EndOfParagraphBeforeOL).enablesState('Outdent').andGives('<ol>\n<li>Test</li>\n<li>Item</li>\n</ol>'); ApplyingOL.to(EndOfParagraphBeforeUL).enablesState('Outdent').andGives('<ol>\n<li>Test</li>\n</ol>\n<ul>\n<li>Item</li>\n</ul>'); ApplyingOL.to(EndOfParagraphBeforeOLWithListType).enablesState('Outdent').andGives('<ol style="list-style-type: lower-alpha;">\n<li>Test</li>\n<li>Item</li>\n</ol>'); ApplyingOL.to(StartOfParagraphAfterOL).enablesState('Outdent').andGives('<ol>\n<li>Item</li>\n<li>Test</li>\n</ol>'); ApplyingOL.to(StartOfParagraphAfterUL).enablesState('Outdent').andGives('<ul>\n<li>Item</li>\n</ul>\n<ol>\n<li>Test</li>\n</ol>'); ApplyingOL.to(StartOfParagraphAfterOLWithListType).enablesState('Outdent').andGives('<ol style="list-style-type: lower-alpha;">\n<li>Item</li>\n<li>Test</li>\n</ol>'); ApplyingOL.to(ParagraphBetweenOrderedLists).enablesState('Outdent').andGives('<ol>\n<li>Item1</li>\n<li>Test</li>\n<li>Item2</li>\n</ol>'); ApplyingOL.to(ParagraphBetweenUnorderedLists).enablesState('Outdent').andGives('<ul>\n<li>Item1</li>\n</ul>\n<ol>\n<li>Test</li>\n</ol>\n<ul>\n<li>Item2</li>\n</ul>'); ApplyingOL.to(ParagraphBetweenMixedLists).enablesState('Outdent').andGives('<ol>\n<li>Item1</li>\n<li>Test</li>\n</ol>\n<ul>\n<li>Item2</li>\n</ul>'); ApplyingOL.to(EmptyOrderedListItem).disablesState('Outdent').andGives(EmptyOLConvertedToP); ApplyingOL.to(EmptyUnorderedListItem).gives('<ul>\n<li>Before</li>\n</ul>\n<ol>\n<li> </li>\n</ol>\n<ul>\n<li>After</li>\n</ul>'); ApplyingOL.to(NonEmptyOrderedListItem).disablesState('Outdent').andGives(NonEmptyOLConvertedToP); ApplyingOL.to(NonEmptyUnorderedListItem).gives('<ul>\n<li>Before</li>\n</ul>\n<ol>\n<li>Test</li>\n</ol>\n<ul>\n<li>After</li>\n</ul>'); ApplyingOL.to(OrderedListItemInsideDiv).disablesState('Outdent').andGives('<div id="div">\n<p>Item1</p>\n<ol>\n<li>Item2</li>\n</ol></div>'); ApplyingOL.to(UnorderedListItemInsideDiv).enablesState('Outdent').andGives('<div id="div"><ol>\n<li>Item1</li>\n</ol>\n<ul>\n<li>Item2</li>\n</ul>\n</div>'); ApplyingOL.to(NestedEmptyOrderedListItem).disablesState('Outdent').andGives('<ol>\n<li>Before</li>\n</ol>\n<p> </p>\n<ol>\n<li>After</li>\n</ol>'); ApplyingOL.to(NestedEmptyUnorderedListItem).enablesState('Outdent').andGives('<ul>\n<li>Before<ol>\n<li> </li>\n</ol></li>\n<li>After</li>\n</ul>'); ApplyingOL.to(NestedNonEmptyOrderedListItem).disablesState('Outdent').andGives('<ol>\n<li>Before</li>\n</ol>\n<p>Test</p>\n<ol>\n<li>After</li>\n</ol>'); ApplyingOL.to(NestedNonEmptyUnorderedListItem).enablesState('Outdent').andGives('<ul>\n<li>Before<ol>\n<li>Test</li>\n</ol></li>\n<li>After</li>\n</ul>'); ApplyingOL.to(OrderedListItemWithNestedChild).disablesState('Outdent').andGives('<p>Item1</p>\n<ol>\n<li style="list-style-type: none;"><ol>\n<li>Nested</li>\n</ol></li>\n</ol>'); ApplyingOL.to(UnorderedListItemWithNestedChild).enablesState('Outdent').andGives('<ol>\n<li>Item1\n<ul>\n<li>Nested</li>\n</ul>\n</li>\n</ol>'); // Actually not allowed by HTML. ApplyingOL.to(DefinitionListTerm).enablesState('Outdent').andGives('<dl><dt><ol>\n<li>Term</li>\n</ol></dt><dd>Description</dd></dl>'); ApplyingOL.to(DefinitionListDescription).enablesState('Outdent').andGives('<dl><dt>Term</dt><dd><ol>\n<li>Description</li>\n</ol></dd></dl>'); ApplyingOL.to(ParagraphWithMarginLeft).enablesState('Outdent').andGives('<ol>\n<li style="margin-left: 30px;">Test</li>\n</ol>'); ApplyingOL.to(ParagraphWithPaddingLeft).enablesState('Outdent').andGives('<ol>\n<li style="margin-left: 30px;">Test</li>\n</ol>'); // TODO: Padding-left renders weird, should it be removed? ApplyingOL.to(ParagraphWithMarginAndPaddingLeft).enablesState('Outdent').andGives('<ol>\n<li style="margin-left: 90px;">Test</li>\n</ol>'); queue.done(); }); asyncTest('Collapsed Selection - Apply UL Actions', function() { ApplyingUL.to(EmptyParagraph).gives('<ul>\n<li></li>\n</ul>'); ApplyingUL.to(EmptyHeading).gives('<ul>\n<li>\n<h1></h1>\n</li>\n</ul>'); ApplyingUL.to(NonEmptyParagraph).gives('<ul>\n<li>Test</li>\n</ul>'); ApplyingUL.to(NonEmptyHeading).gives('<ul>\n<li>\n<h1>Test</h1>\n</li>\n</ul>'); ApplyingUL.to(TableCellWithoutBrs).gives('<table><tbody><tr>\n<td>\n<ul>\n<li>Test</li>\n</ul>\n</td>\n<td> </td>\n</tr></tbody></table>'); ApplyingUL.to(TableCellWithBrsFirstLine).gives('<table><tbody><tr>\n<td>\n<ul>\n<li>Test</li>\n</ul>\nLine 2</td>\n<td> </td>\n</tr></tbody></table>'); ApplyingUL.to(TableCellWithBrsMiddleLine).gives('<table><tbody><tr>\n<td>Test\n<ul>\n<li>Line 2</li>\n</ul>\nLine 3</td>\n<td> </td>\n</tr></tbody></table>'); ApplyingUL.to(TableCellWithBrsLastLine).gives('<table><tbody><tr>\n<td>Test\n<ul>\n<li>Line 2</li>\n</ul>\n</td>\n<td> </td>\n</tr></tbody></table>'); ApplyingUL.to(TableCellWithAdjacentBrsFirstLine).gives('<table><tbody><tr>\n<td>\n<ul>\n<li>Test</li>\n</ul>\n<br />Line 2</td>\n<td> </td>\n</tr></tbody></table>'); ApplyingUL.to(HeadingInOrderedList).gives('<ul>\n<li>\n<h2>Test</h2>\n</li>\n</ul>'); ApplyingUL.to(HeadingInUnorderedList).gives('<h2>Test</h2>'); ApplyingUL.to(EndOfParagraphBeforeOL).gives('<ul>\n<li>Test</li>\n</ul>\n<ol>\n<li>Item</li>\n</ol>'); ApplyingUL.to(EndOfParagraphBeforeUL).gives('<ul>\n<li>Test</li>\n<li>Item</li>\n</ul>'); ApplyingUL.to(StartOfParagraphAfterOL).gives('<ol>\n<li>Item</li>\n</ol>\n<ul>\n<li>Test</li>\n</ul>'); ApplyingUL.to(StartOfParagraphAfterUL).gives('<ul>\n<li>Item</li>\n<li>Test</li>\n</ul>'); ApplyingUL.to(ParagraphBetweenOrderedLists).gives('<ol>\n<li>Item1</li>\n</ol>\n<ul>\n<li>Test</li>\n</ul>\n<ol>\n<li>Item2</li>\n</ol>'); ApplyingUL.to(ParagraphBetweenUnorderedLists).gives('<ul>\n<li>Item1</li>\n<li>Test</li>\n<li>Item2</li>\n</ul>'); ApplyingUL.to(ParagraphBetweenMixedLists).gives('<ol>\n<li>Item1</li>\n</ol>\n<ul>\n<li>Test</li>\n<li>Item2</li>\n</ul>'); ApplyingUL.to(EmptyOrderedListItem).gives('<ol>\n<li>Before</li>\n</ol>\n<ul>\n<li> </li>\n</ul>\n<ol>\n<li>After</li>\n</ol>'); ApplyingUL.to(EmptyUnorderedListItem).gives(EmptyULConvertedToP); ApplyingUL.to(NonEmptyOrderedListItem).gives('<ol>\n<li>Before</li>\n</ol>\n<ul>\n<li>Test</li>\n</ul>\n<ol>\n<li>After</li>\n</ol>'); ApplyingUL.to(NonEmptyUnorderedListItem).gives(NonEmptyULConvertedToP); ApplyingUL.to(OrderedListItemInsideDiv).gives('<div id="div">\n<ul>\n<li>Item1</li>\n</ul>\n<ol>\n<li>Item2</li>\n</ol></div>'); ApplyingUL.to(UnorderedListItemInsideDiv).gives('<div id="div">\n<p>Item1</p>\n<ul>\n<li>Item2</li>\n</ul>\n</div>'); ApplyingUL.to(NestedEmptyOrderedListItem).gives('<ol>\n<li>Before\n<ul>\n<li> </li>\n</ul>\n</li>\n<li>After</li>\n</ol>'); ApplyingUL.to(NestedEmptyUnorderedListItem).gives('<ul>\n<li>Before</li>\n</ul>\n<p> </p>\n<ul>\n<li>After</li>\n</ul>'); ApplyingUL.to(NestedNonEmptyOrderedListItem).gives('<ol>\n<li>Before<ul>\n<li>Test</li>\n</ul></li>\n<li>After</li>\n</ol>'); ApplyingUL.to(NestedNonEmptyUnorderedListItem).gives('<ul>\n<li>Before</li>\n</ul>\n<p>Test</p>\n<ul>\n<li>After</li>\n</ul>'); ApplyingUL.to(OrderedListItemWithNestedChild).gives('<ul>\n<li>Item1<ol>\n<li>Nested</li>\n</ol></li>\n</ul>'); ApplyingUL.to(UnorderedListItemWithNestedChild).gives('<p>Item1</p>\n<ul><li style="list-style-type: none;"><ul>\n<li>Nested</li>\n</ul></li>\n</ul>'); // Actually not allowed by HTML ApplyingUL.to(DefinitionListTerm).gives('<dl><dt><ul>\n<li>Term</li>\n</ul></dt><dd>Description</dd></dl>'); ApplyingUL.to(DefinitionListDescription).gives('<dl><dt>Term</dt><dd><ul>\n<li>Description</li>\n</ul></dd></dl>'); ApplyingUL.to(ParagraphWithMarginLeft).gives('<ul><li style="margin-left: 30px;">Test</li>\n</ul>'); ApplyingUL.to(ParagraphWithPaddingLeft).gives('<ul><li style="margin-left: 30px;">Test</li>\n</ul>'); // TODO: Padding-left renders weird, should it be removed? ApplyingUL.to(ParagraphWithMarginAndPaddingLeft).gives('<ul><li style="margin-left: 90px;">Test</li>\n</ul>'); queue.done(); }); asyncTest('Collapsed Selection - Apply OL in Divs', function() { ApplyingOL.to(ParagraphInDiv).gives('\n<div><ol>\n<li>Item</li>\n</ol></div>'); ApplyingOL.to(TextInDiv).gives('\n<div><ol>\n<li>Item</li>\n</ol></div>'); ApplyingOL.to(TextWithBrsInDivFirstLine).gives('\n<div><ol>\n<li>Item1</li>\n</ol>Item2</div>'); ApplyingOL.to(TextWithBrsInDivMiddleLine).gives('\n<div>Item1<ol>\n<li>Item2</li>\n</ol>Item3</div>'); ApplyingOL.to(TextWithBrsInDivLastLine).gives('\n<div>Item1<ol>\n<li>Item2</li>\n</ol></div>'); queue.done(); }); asyncTest('Collapsed Selection - Apply UL in Divs', function() { ApplyingUL.to(ParagraphInDiv).gives('\n<div><ul>\n<li>Item</li>\n</ul></div>'); ApplyingUL.to(TextInDiv).gives('\n<div><ul>\n<li>Item</li>\n</ul></div>'); ApplyingUL.to(TextWithBrsInDivFirstLine).gives('\n<div><ul>\n<li>Item1</li>\n</ul>Item2</div>'); ApplyingUL.to(TextWithBrsInDivMiddleLine).gives('\n<div>Item1<ul>\n<li>Item2</li>\n</ul>Item3</div>'); ApplyingUL.to(TextWithBrsInDivLastLine).gives('\n<div>Item1<ul>\n<li>Item2</li>\n</ul></div>'); queue.done(); }); asyncTest('Collapsed Selection - Type Enter', function() { TypingEnter.inA(EmptyOrderedListItem).gives('<ol>\n<li>Before</li>\n<li></li>\n<li> </li>\n<li>After</li>\n</ol>'); TypingEnter.inA(EmptyUnorderedListItem).gives('<ul>\n<li>Before</li>\n<li></li>\n<li> </li>\n<li>After</li>\n</ul>'); TypingEnter.inA(NonEmptyOrderedListItem).gives('<ol>\n<li>Before</li>\n<li></li>\n<li>Test</li>\n<li>After</li>\n</ol>'); TypingEnter.inA(NonEmptyUnorderedListItem).gives('<ul>\n<li>Before</li>\n<li></li>\n<li>Test</li>\n<li>After</li>\n</ul>'); TypingEnter.inA(NestedNonEmptyOrderedListItem).gives('<ol>\n<li>Before<ol>\n<li></li>\n<li>Test</li>\n</ol></li>\n<li>After</li>\n</ol>'); TypingEnter.inA(NestedNonEmptyUnorderedListItem).gives('<ul>\n<li>Before<ul>\n<li></li>\n<li>Test</li>\n</ul></li>\n<li>After</li>\n</ul>'); // TODO: Typing enter in correctly nested lists queue.done(); }); // TODO: Typing backspace in a paragraph between two lists should merge the lists. asyncTest('Expanded Selection, List Types - Ordered List Action', function() { ApplyingOL.to(SingleLiOlSelection).gives('<p>Item 1</p>'); ApplyingOL.to(MultiLiOlSelection).gives('<p>Item 1</p><p>Item 2</p>'); ApplyingOL.to(SingleLiUlSelection).gives('<ol>\n<li>Item 1</li>\n</ol>'); ApplyingOL.to(MultiLiUlSelection).gives('<ol>\n<li>Item 1</li>\n<li>Item 2</li>\n</ol>'); ApplyingOL.to(IndentedOlInOlCorrectSelection).gives('<p>Item 1</p><p>Indented</p>'); ApplyingOL.to(IndentedOlInOlIncorrectSelection).gives('<p>Item 1</p><p>Indented</p>'); // TODO: Selection only in indented list. ApplyingOL.to(IndentedUlInUlCorrectSelection).gives('<ol>\n<li>Item 1<ol>\n<li>Indented</li>\n</ol></li>\n</ol>'); ApplyingOL.to(IndentedUlInUlIncorrectSelection).gives('<ol>\n<li>Item 1<ol>\n<li>Indented</li>\n</ol></li>\n</ol>'); ApplyingOL.to(IndentedOlInUlCorrectSelection).gives('<ol>\n<li>Item 1<ol>\n<li>Indented</li>\n</ol></li>\n</ol>'); ApplyingOL.to(IndentedUlInOlCorrectSelection).gives('<ol>\n<li>Item 1<ol>\n<li>Indented</li>\n</ol></li>\n</ol>'); ApplyingOL.to(IndentedOlInUlIncorrectSelection).gives('<ol>\n<li>Item 1<ol>\n<li>Indented</li>\n</ol></li>\n</ol>'); ApplyingOL.to(IndentedUlInOlIncorrectSelection).gives('<ol>\n<li>Item 1<ol>\n<li>Indented</li>\n</ol></li>\n</ol>'); queue.done(); }); asyncTest('Expanded Selection, List Types - Unordered List Action', function() { ApplyingUL.to(SingleLiOlSelection).gives('<ul>\n<li>Item 1</li>\n</ul>'); ApplyingUL.to(MultiLiOlSelection).gives('<ul>\n<li>Item 1</li>\n<li>Item 2</li>\n</ul>'); ApplyingUL.to(SingleLiUlSelection).gives('<p>Item 1</p>'); ApplyingUL.to(MultiLiUlSelection).gives('<p>Item 1</p><p>Item 2</p>'); ApplyingUL.to(IndentedOlInOlCorrectSelection).gives('<ul>\n<li>Item 1<ul>\n<li>Indented</li>\n</ul></li>\n</ul>'); ApplyingUL.to(IndentedOlInOlIncorrectSelection).gives('<ul>\n<li>Item 1<ul>\n<li>Indented</li>\n</ul></li>\n</ul>'); // TODO: Selection only in indented list. ApplyingUL.to(IndentedUlInUlCorrectSelection).gives('<p>Item 1</p><p>Indented</p>'); ApplyingUL.to(IndentedUlInUlIncorrectSelection).gives('<p>Item 1</p><p>Indented</p>'); ApplyingUL.to(IndentedOlInUlCorrectSelection).gives('<ul>\n<li>Item 1<ul>\n<li>Indented</li>\n</ul></li>\n</ul>'); ApplyingUL.to(IndentedUlInOlCorrectSelection).gives('<ul>\n<li>Item 1<ul>\n<li>Indented</li>\n</ul></li>\n</ul>'); ApplyingUL.to(IndentedOlInUlIncorrectSelection).gives('<ul>\n<li>Item 1<ul>\n<li>Indented</li>\n</ul></li>\n</ul>'); ApplyingUL.to(IndentedUlInOlIncorrectSelection).gives('<ul>\n<li>Item 1<ul>\n<li>Indented</li>\n</ul></li>\n</ul>'); if (!tinymce.isIE9) { // there is a IE9 selection in tables bug that this test exposes. Don't run the test in IE9 ApplyingUL.to(TableCellWithTextAfterUL).gives('<table><tbody><tr>\n<td><ul>\n<li>Existing</li>\n<li><span id="start">Line1</span></li>\n<li>Line2</li>\n<li>Line3</li>\n</ul>Line4</td>\n</tr></tbody></table>'); } queue.done(); }); asyncTest('Expanded Selection, Paragraph Types - Ordered List Action', function() { ApplyingOL.to(SingleParagraphSelection).gives('<ol>\n<li>This is a test</li>\n</ol>'); ApplyingOL.to(MultipleParagraphSelection).gives('<ol>\n<li>This is a test</li>\n<li>Second paragraph</li>\n</ol>'); ApplyingOL.to(SingleHeadingSelection).gives('<ol>\n<li>\n<h1>This is a test</h1>\n</li>\n</ol>'); ApplyingOL.to(MultipleHeadingSelection).gives('<ol>\n<li>\n<h1>This is a test</h1>\n</li>\n<li>\n<h1>Second paragraph</h1>\n</li>\n</ol>'); ApplyingOL.to(SingleBlockSelection).gives('\n<div><ol>\n<li>This is a test</li>\n</ol></div>'); ApplyingOL.to(SingleBlockWithBrSelection).gives('\n<div><ol>\n<li>Item1</li>\n<li>Item2</li>\n</ol></div>'); ApplyingOL.to(MultipleBlockSelection).gives('<ol>\n<li>This is a test</li>\n<li>Second paragraph</li>\n</ol>'); ApplyingOL.to(MultipleBlockWithBrSelection).gives('<ol>\n<li>Item1</li>\n<li>Item2</li>\n<li>Item3</li>\n</ol>'); ApplyingOL.to(MultipleBlockWithBrPartialSelection).gives('<ol>\n<li>Item1</li>\n<li>Item2</li>\n<li>Item3</li>\n</ol>\n<div>Item4</div>'); ApplyingOL.to(MultipleBlockWithEmptyDivsAllSelected).gives('<div id=\"start\"> </div><ol><li>a</li></ol><div> </div><ol><li>b</li></ol><div> </div><div id=\"end\"> </div>'); ApplyingOL.to(ThreeBoldDivsWithBrSelection).gives('<ol><li><strong>One</strong></li><li><strong>Two</strong></li><li><strong>Three</strong></li></ol>'); ApplyingOL.to(ParagraphToHeadingSelection).gives('<ol>\n<li>This is a test</li>\n<li>\n<h1>Second paragraph</h1>\n</li>\n</ol>'); ApplyingOL.to(ParagraphToBlockSelection).gives('<ol>\n<li>This is a test</li>\n<li>Second paragraph</li>\n</ol>'); ApplyingOL.to(HeadingToParagraphSelection).gives('<ol>\n<li>\n<h1>This is a test</h1>\n</li>\n<li>Second paragraph</li>\n</ol>'); ApplyingOL.to(BlockToParagraphSelection).gives('<ol>\n<li>This is a test</li>\n<li>Second paragraph</li>\n</ol>'); ApplyingOL.to(MultipleParagraphAndHeadingSelection).gives('<ol>\n<li>This is a test</li>\n<li>\n<h1>Second paragraph</h1>\n</li>\n<li>Third paragraph</li>\n</ol>'); ApplyingOL.to(TextWithBrsInFormattingInDiv).gives('<div><strong>Before</strong><ol><li>Item1</li><li>Item2</li><li>Item3</li></ol></div>'); ApplyingOL.to(TextWithBrInsideFormatting).gives('<div><em><strong>Before</strong></em><ol><li><em><strong><span class="foo">Item1</span></strong></em>Item2</li><li>Item3</li></ol></div>'); queue.done(); }); asyncTest('Expanded Selection, Paragraph Types - Unordered List Action', function() { ApplyingUL.to(SingleParagraphSelection).gives('<ul>\n<li>This is a test</li>\n</ul>'); ApplyingUL.to(MultipleParagraphSelection).gives('<ul>\n<li>This is a test</li>\n<li>Second paragraph</li>\n</ul>'); ApplyingUL.to(SingleHeadingSelection).gives('<ul>\n<li>\n<h1>This is a test</h1>\n</li>\n</ul>'); ApplyingUL.to(MultipleHeadingSelection).gives('<ul>\n<li>\n<h1>This is a test</h1>\n</li>\n<li>\n<h1>Second paragraph</h1>\n</li>\n</ul>'); ApplyingUL.to(SingleBlockSelection).gives('\n<div><ul>\n<li>This is a test</li>\n</ul></div>'); ApplyingUL.to(SingleBlockWithBrSelection).gives('\n<div><ul>\n<li>Item1</li>\n<li>Item2</li>\n</ul></div>'); ApplyingUL.to(MultipleBlockSelection).gives('<ul>\n<li>This is a test</li>\n<li>Second paragraph</li>\n</ul>'); ApplyingUL.to(MultipleBlockWithBrSelection).gives('<ul>\n<li>Item1</li>\n<li>Item2</li>\n<li>Item3</li>\n</ul>'); ApplyingUL.to(MultipleBlockWithBrPartialSelection).gives('<ul>\n<li>Item1</li>\n<li>Item2</li>\n<li>Item3</li>\n</ul>\n<div>Item4</div>'); ApplyingUL.to(MultipleBlockWithBrPartialSelectionAtEnd).gives('\n<div>Item1</div>\n<ul>\n<li>Item2</li>\n<li>Item3</li>\n<li>Item4</li>\n</ul>'); ApplyingUL.to(MultipleBlockWithEmptyDivsAllSelected).gives('<div id=\"start\"> </div><ul><li>a</li></ul><div> </div><ul><li>b</li></ul><div> </div><div id=\"end\"> </div>'); ApplyingUL.to(ThreeBoldDivsWithBrSelection).gives('<ul><li><strong>One</strong></li>\n<li><strong>Two</strong></li>\n<li><strong>Three</strong></li></ul>'); // TODO: Divs with BRs and Paragraphs. // TODO: Divs with BRs in paragraphs? Divs with a mix of BRs and paragraph child. ApplyingUL.to(ParagraphToHeadingSelection).gives('<ul>\n<li>This is a test</li>\n<li>\n<h1>Second paragraph</h1>\n</li>\n</ul>'); ApplyingUL.to(ParagraphToBlockSelection).gives('<ul>\n<li>This is a test</li>\n<li>Second paragraph</li>\n</ul>'); ApplyingUL.to(HeadingToParagraphSelection).gives('<ul>\n<li>\n<h1>This is a test</h1>\n</li>\n<li>Second paragraph</li>\n</ul>'); ApplyingUL.to(BlockToParagraphSelection).gives('<ul>\n<li>This is a test</li>\n<li>Second paragraph</li>\n</ul>'); ApplyingUL.to(MultipleParagraphAndHeadingSelection).gives('<ul>\n<li>This is a test</li>\n<li>\n<h1>Second paragraph</h1>\n</li>\n<li>Third paragraph</li>\n</ul>'); ApplyingUL.to(TextWithBrsInFormattingInDiv).gives('<div><strong>Before</strong><ul><li>Item1</li>\n<li>Item2</li>\n<li>Item3</li></ul></div>'); queue.done(); }); asyncTest('Expanded Selection, Table Types - Ordered List Action', function() { ApplyingOL.to(CellWithoutBrSelection).gives('<table><tbody><tr>\n<td><ol>\n<li>Cell 1</li>\n</ol></td>\n</tr></tbody></table>'); // TODO: Cells with BR selection queue.done(); // TODO: Tables with BRs. }); asyncTest('Expanded Selection, Table Types - Unordered List Action', function() { ApplyingUL.to(CellWithoutBrSelection).gives('<table><tbody><tr>\n<td><ul>\n<li>Cell 1</li>\n</ul></td>\n</tr></tbody></table>'); queue.done(); // TODO: Tables with BRs. }); var initTinyFunction = function(){ tinymce.init({ mode: "exact", elements: "elm1", theme: "advanced", add_unload_trigger: false, language_load: false, // 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', schema: 'mixed', compress: { 'css': true, 'javascript': true }, init_instance_callback: function (ed) { editor = ed; QUnit.start(); } }); }; </script> </head> <body> <h1 id="qunit-header">Applying and Unapplying 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> initTinyFunction(); function loadState() { window[document.getElementById('state').value](); editor.focus(); } </script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка