From f75e8dab8cbf4e293369d2e61f1ad376993425c6 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Mon, 24 Jul 2006 02:43:53 +0000 Subject: [PATCH] Extract FixNestingTest from DefinitionTest. git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@118 48356398-32a2-884e-a903-53898d9a118a --- .../HTMLPurifier/Strategy/FixNestingTest.php | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/HTMLPurifier/Strategy/FixNestingTest.php diff --git a/tests/HTMLPurifier/Strategy/FixNestingTest.php b/tests/HTMLPurifier/Strategy/FixNestingTest.php new file mode 100644 index 00000000..39297935 --- /dev/null +++ b/tests/HTMLPurifier/Strategy/FixNestingTest.php @@ -0,0 +1,51 @@ +Bold text'; + $expect[0] = $inputs[0]; + + // legal inline and block + // as the parent element is considered FLOW + $inputs[1] = 'Blank
Block
'; + $expect[1] = $inputs[1]; + + // illegal block in inline, element -> text + $inputs[2] = '
Illegal div.
'; + $expect[2] = '<div>Illegal div.</div>'; + + // test of empty set that's required, resulting in removal of node + $inputs[3] = ''; + $expect[3] = ''; + + // test illegal text which gets removed + $inputs[4] = ''; + $expect[4] = ''; + + 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