From 7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 12 May 2012 17:57:41 -0700 Subject: some important stuff we'll need --- .../HTMLPurifier/ChildDef/StrictBlockquoteTest.php | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 lib/htmlpurifier/tests/HTMLPurifier/ChildDef/StrictBlockquoteTest.php (limited to 'lib/htmlpurifier/tests/HTMLPurifier/ChildDef/StrictBlockquoteTest.php') diff --git a/lib/htmlpurifier/tests/HTMLPurifier/ChildDef/StrictBlockquoteTest.php b/lib/htmlpurifier/tests/HTMLPurifier/ChildDef/StrictBlockquoteTest.php new file mode 100644 index 000000000..52594b1a0 --- /dev/null +++ b/lib/htmlpurifier/tests/HTMLPurifier/ChildDef/StrictBlockquoteTest.php @@ -0,0 +1,83 @@ +obj = new HTMLPurifier_ChildDef_StrictBlockquote('div | p'); + } + + function testEmptyInput() { + $this->assertResult(''); + } + + function testPreserveValidP() { + $this->assertResult('

Valid

'); + } + + function testPreserveValidDiv() { + $this->assertResult('
Still valid
'); + } + + function testWrapTextWithP() { + $this->assertResult('Needs wrap', '

Needs wrap

'); + } + + function testNoWrapForWhitespaceOrValidElements() { + $this->assertResult('

Do not wrap

Whitespace

'); + } + + function testWrapTextNextToValidElements() { + $this->assertResult( + 'Wrap'. '

Do not wrap

', + '

Wrap

Do not wrap

' + ); + } + + function testWrapInlineElements() { + $this->assertResult( + '

Do not

'.'Wrap', + '

Do not

Wrap

' + ); + } + + function testWrapAndRemoveInvalidTags() { + $this->assertResult( + '
  • Not allowed
  • Paragraph.

    Hmm.

    ', + '

    Not allowedParagraph.

    Hmm.

    ' + ); + } + + function testWrapComplicatedSring() { + $this->assertResult( + $var = 'He said
    perhaps
    we should nuke them.', + "

    $var

    " + ); + } + + function testWrapAndRemoveInvalidTagsComplex() { + $this->assertResult( + 'BarPeopleConniving.'. '

    Fools!

    ', + '

    Bar'. 'PeopleConniving.

    Fools!

    ' + ); + } + + function testAlternateWrapper() { + $this->config->set('HTML.BlockWrapper', 'div'); + $this->assertResult('Needs wrap', '
    Needs wrap
    '); + + } + + function testError() { + $this->expectError('Cannot use non-block element as block wrapper'); + $this->obj = new HTMLPurifier_ChildDef_StrictBlockquote('div | p'); + $this->config->set('HTML.BlockWrapper', 'dav'); + $this->config->set('Cache.DefinitionImpl', null); + $this->assertResult('Needs wrap', '

    Needs wrap

    '); + } + +} + +// vim: et sw=4 sts=4 -- cgit v1.2.3