3 class HTMLPurifier_Injector_AutoParagraphTest
extends HTMLPurifier_InjectorHarness
8 $this->config
->set('AutoFormat.AutoParagraph', true);
11 function testSingleParagraph() {
18 function testSingleMultiLineParagraph() {
27 function testTwoParagraphs() {
38 function testTwoParagraphsWithLotsOfSpace() {
51 function testTwoParagraphsWithInlineElements() {
62 function testSingleParagraphThatLooksLikeTwo() {
73 function testAddParagraphAdjacentToParagraph() {
82 function testParagraphUnclosedInlineElement() {
89 function testPreservePreTags() {
97 function testIgnoreTrailingWhitespace() {
108 function testDoNotParagraphBlockElements() {
123 function testParagraphTextAndInlineNodes() {
130 function testPreserveLeadingWhitespace() {
141 function testPreserveSurroundingWhitespace() {
156 function testParagraphInsideBlockNode() {
167 function testParagraphInlineNodeInsideBlockNode() {
172 '<div><p><b>Par1</b></p>
178 function testNoParagraphWhenOnlyOneInsideBlockNode() {
179 $this->assertResult('<div>Par1</div>');
182 function testParagraphTwoInlineNodesInsideBlockNode() {
187 '<div><p><b>Par1</b></p>
189 <p><i>Par2</i></p></div>'
193 function testPreserveInlineNodesInPreTag() {
201 function testSplitUpInternalsOfPTagInBlockNode() {
212 function testSplitUpInlineNodesInPTagInBlockNode() {
216 <i>Bar</i></p></div>',
217 '<div><p><b>Foo</b></p>
219 <p><i>Bar</i></p></div>'
223 function testNoParagraphSingleInlineNodeInBlockNode() {
224 $this->assertResult( '<div><b>Foo</b></div>' );
227 function testParagraphInBlockquote() {
232 '<blockquote><p>Par1</p>
234 <p>Par2</p></blockquote>'
238 function testNoParagraphBetweenListItem() {
246 function testParagraphSingleElementWithSurroundingSpace() {
261 function testIgnoreExtraSpaceWithLeadingInlineNode() {
274 function testAbsorbExtraEndingPTag() {
285 function testAbsorbExtraEndingDivTag() {
296 function testDoNotParagraphSingleSurroundingSpaceInBlockNode() {
304 function testBlockNodeTextDelimeterInBlockNode() {
308 <div>Par2</div></div>',
311 <div>Par2</div></div>'
315 function testBlockNodeTextDelimeterWithoutDoublespaceInBlockNode() {
318 <div>Par2</div></div>'
322 function testBlockNodeTextDelimeterWithoutDoublespace() {
333 function testTwoParagraphsOfTextAndInlineNode() {
344 function testLeadingInlineNodeParagraph() {
351 function testTrailingInlineNodeParagraph() {
353 '<li>Foo <a>bar</a></li>'
357 function testTwoInlineNodeParagraph() {
359 '<li><b>baz</b><a>bar</a></li>'
363 function testNoParagraphTrailingBlockNodeInBlockNode() {
365 '<div><div>asdf</div><b>asdf</b></div>'
369 function testParagraphTrailingBlockNodeWithDoublespaceInBlockNode() {
371 '<div><div>asdf</div>
374 '<div><div>asdf</div>
376 <p><b>asdf</b></p></div>'
380 function testParagraphTwoInlineNodesAndWhitespaceNode() {
382 '<b>One</b> <i>Two</i>',
383 '<p><b>One</b> <i>Two</i></p>'
387 function testNoParagraphWithInlineRootNode() {
388 $this->config
->set('HTML.Parent', 'span');
396 function testInlineAndBlockTagInDivNoParagraph() {
398 '<div><code>bar</code> mmm <pre>asdf</pre></div>'
402 function testInlineAndBlockTagInDivNeedingParagraph() {
404 '<div><code>bar</code> mmm
406 <pre>asdf</pre></div>',
407 '<div><p><code>bar</code> mmm</p>
409 <pre>asdf</pre></div>'
413 function testTextInlineNodeTextThenDoubleNewlineNeedsParagraph() {
415 '<div>asdf <code>bar</code> mmm
417 <pre>asdf</pre></div>',
418 '<div><p>asdf <code>bar</code> mmm</p>
420 <pre>asdf</pre></div>'
424 function testUpcomingTokenHasNewline() {
426 '<div>Test<b>foo</b>bar<b>bing</b>bang
429 '<div><p>Test<b>foo</b>bar<b>bing</b>bang</p>
435 function testEmptyTokenAtEndOfDiv() {
444 function testEmptyDoubleLineTokenAtEndOfDiv() {
455 function testTextState11Root() {
456 $this->assertResult('<div></div> ');
459 function testTextState11Element() {
466 function testTextStateLikeElementState111NoWhitespace() {
467 $this->assertResult('<div><p>P</p>Boo</div>', '<div><p>P</p>Boo</div>');
470 function testElementState111NoWhitespace() {
471 $this->assertResult('<div><p>P</p><b>Boo</b></div>', '<div><p>P</p><b>Boo</b></div>');
474 function testElementState133() {
476 "<div><b>B</b><pre>Ba</pre>
479 "<div><b>B</b><pre>Ba</pre>
485 function testElementState22() {
487 '<ul><li>foo</li></ul>'
491 function testElementState311() {
493 '<p>Foo</p><b>Bar</b>',
500 function testErrorNeeded() {
501 $this->config
->set('HTML.Allowed', 'b');
502 $this->expectError('Cannot enable AutoParagraph injector because p is not allowed');
503 $this->assertResult('<b>foobar</b>');
508 // vim: et sw=4 sts=4