diff --git a/tests/HTMLPurifier/Strategy/MakeWellFormedTest b/tests/HTMLPurifier/Strategy/MakeWellFormedTest new file mode 100644 index 00000000..1d787204 --- /dev/null +++ b/tests/HTMLPurifier/Strategy/MakeWellFormedTest @@ -0,0 +1,64 @@ +bold text.'; + $expect[1] = $inputs[1]; + + $inputs[2] = 'Unclosed tag, gasp!'; + $expect[2] = 'Unclosed tag, gasp!'; + + $inputs[3] = 'Bold and italic?'; + $expect[3] = 'Bold and italic?'; + + // CHANGE THIS BEHAVIOR! + $inputs[4] = 'Unused end tags... recycle!'; + $expect[4] = 'Unused end tags... recycle!</b>'; + + $inputs[5] = '
'; + $expect[5] = '
'; + + $inputs[6] = '
'; + $expect[6] = '
'; + + // test automatic paragraph closing + + $inputs[7] = '

Paragraph 1

Paragraph 2'; + $expect[7] = '

Paragraph 1

Paragraph 2

'; + + $inputs[8] = '

Paragraphs

In

A

Div

'; + $expect[8] = '

Paragraphs

In

A

Div

'; + + // automatic list closing + + $inputs[9] = '
  1. Item 1
  2. Item 2
'; + $expect[9] = '
  1. Item 1
  2. Item 2
'; + + foreach ($inputs as $i => $input) { + $tokens = $this->lex->tokenizeHTML($input); + $result_tokens = $strategy->execute($tokens); + $result = $this->gen->generateFromTokens($result_tokens); + $this->assertEqual($expect[$i], $result, "Test $i: %s"); + paintIf($result, $result != $expect[$i]); + } + + } + +} + +?> \ No newline at end of file