config->set('AutoFormat.AutoParagraph', true);
}
function testSingleParagraph() {
$this->assertResult(
'Foobar',
'
Foobar
'
);
}
function testSingleMultiLineParagraph() {
$this->assertResult(
'Par 1
Par 1 still',
'Par 1
Par 1 still
'
);
}
function testTwoParagraphs() {
$this->assertResult(
'Par1
Par2',
"Par1
Par2
"
);
}
function testTwoParagraphsWithLotsOfSpace() {
$this->assertResult(
'Par1
Par2',
'Par1
Par2
'
);
}
function testTwoParagraphsWithInlineElements() {
$this->assertResult(
'Par1
Par2',
'Par1
Par2
'
);
}
function testSingleParagraphThatLooksLikeTwo() {
$this->assertResult(
'Par1
Par2',
'Par1
Par2
'
);
}
function testAddParagraphAdjacentToParagraph() {
$this->assertResult(
'Par1Par2
',
'Par1
Par2
'
);
}
function testParagraphUnclosedInlineElement() {
$this->assertResult(
'Par1',
'Par1
'
);
}
function testPreservePreTags() {
$this->assertResult(
'Par1
Par1
'
);
}
function testIgnoreTrailingWhitespace() {
$this->assertResult(
'Par1
',
'Par1
'
);
}
function testDoNotParagraphBlockElements() {
$this->assertResult(
'Par1
Par2
Par3',
'Par1
Par2
Par3
'
);
}
function testParagraphTextAndInlineNodes() {
$this->assertResult(
'Par1',
'Par1
'
);
}
function testPreserveLeadingWhitespace() {
$this->assertResult(
'
Par',
'
Par
'
);
}
function testPreserveSurroundingWhitespace() {
$this->assertResult(
'
Par
',
'
Par
'
);
}
function testParagraphInsideBlockNode() {
$this->assertResult(
'Par1
Par2
',
''
);
}
function testParagraphInlineNodeInsideBlockNode() {
$this->assertResult(
'Par1
Par2
',
''
);
}
function testNoParagraphWhenOnlyOneInsideBlockNode() {
$this->assertResult('Par1
');
}
function testParagraphTwoInlineNodesInsideBlockNode() {
$this->assertResult(
'Par1
Par2
',
''
);
}
function testPreserveInlineNodesInPreTag() {
$this->assertResult(
'Par1
Par2
'
);
}
function testSplitUpInternalsOfPTagInBlockNode() {
$this->assertResult(
'',
''
);
}
function testSplitUpInlineNodesInPTagInBlockNode() {
$this->assertResult(
'',
''
);
}
function testNoParagraphSingleInlineNodeInBlockNode() {
$this->assertResult( 'Foo
' );
}
function testParagraphInBlockquote() {
$this->assertResult(
'Par1
Par2
',
'Par1
Par2
'
);
}
function testNoParagraphBetweenListItem() {
$this->assertResult(
''
);
}
function testParagraphSingleElementWithSurroundingSpace() {
$this->assertResult(
'
Bar
',
''
);
}
function testIgnoreExtraSpaceWithLeadingInlineNode() {
$this->assertResult(
'Par1a
Par2',
'Par1a
Par2
'
);
}
function testAbsorbExtraEndingPTag() {
$this->assertResult(
'Par1
Par2',
'Par1
Par2
'
);
}
function testAbsorbExtraEndingDivTag() {
$this->assertResult(
'Par1
Par2',
'Par1
Par2
'
);
}
function testDoNotParagraphSingleSurroundingSpaceInBlockNode() {
$this->assertResult(
'
Par1
'
);
}
function testBlockNodeTextDelimeterInBlockNode() {
$this->assertResult(
'',
''
);
}
function testBlockNodeTextDelimeterWithoutDoublespaceInBlockNode() {
$this->assertResult(
''
);
}
function testBlockNodeTextDelimeterWithoutDoublespace() {
$this->assertResult(
'Par1
Par2
',
'Par1
Par2
'
);
}
function testTwoParagraphsOfTextAndInlineNode() {
$this->assertResult(
'Par1
Par2',
'Par1
Par2
'
);
}
function testLeadingInlineNodeParagraph() {
$this->assertResult(
'
Foo',
'
Foo
'
);
}
function testTrailingInlineNodeParagraph() {
$this->assertResult(
'Foo bar'
);
}
function testTwoInlineNodeParagraph() {
$this->assertResult(
'bazbar'
);
}
function testNoParagraphTrailingBlockNodeInBlockNode() {
$this->assertResult(
''
);
}
function testParagraphTrailingBlockNodeWithDoublespaceInBlockNode() {
$this->assertResult(
'',
''
);
}
function testParagraphTwoInlineNodesAndWhitespaceNode() {
$this->assertResult(
'One Two',
'One Two
'
);
}
function testNoParagraphWithInlineRootNode() {
$this->config->set('HTML.Parent', 'span');
$this->assertResult(
'Par
Par2'
);
}
function testInlineAndBlockTagInDivNoParagraph() {
$this->assertResult(
''
);
}
function testInlineAndBlockTagInDivNeedingParagraph() {
$this->assertResult(
'',
''
);
}
function testTextInlineNodeTextThenDoubleNewlineNeedsParagraph() {
$this->assertResult(
'',
''
);
}
function testUpcomingTokenHasNewline() {
$this->assertResult(
'Testfoobarbingbang
boo
',
''
);
}
function testEmptyTokenAtEndOfDiv() {
$this->assertResult(
'',
''
);
}
function testEmptyDoubleLineTokenAtEndOfDiv() {
$this->assertResult(
'',
''
);
}
function testTextState11Root() {
$this->assertResult(' ');
}
function testTextState11Element() {
$this->assertResult(
"");
}
function testTextStateLikeElementState111NoWhitespace() {
$this->assertResult('', '');
}
function testElementState111NoWhitespace() {
$this->assertResult('', '');
}
function testElementState133() {
$this->assertResult(
"",
""
);
}
function testElementState22() {
$this->assertResult(
''
);
}
function testElementState311() {
$this->assertResult(
'Foo
Bar',
'Foo
Bar
'
);
}
function testAutoClose() {
$this->assertResult(
'
'
);
}
function testErrorNeeded() {
$this->config->set('HTML.Allowed', 'b');
$this->expectError('Cannot enable AutoParagraph injector because p is not allowed');
$this->assertResult('foobar');
}
function testParentElement() {
$this->config->set('HTML.Allowed', 'p,ul,li');
$this->assertResult('Foo', "Foo
\n\n");
}
}
// vim: et sw=4 sts=4