diff options
Diffstat (limited to 'test/HTML5')
-rw-r--r-- | test/HTML5/Parser/TokenizerTest.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/HTML5/Parser/TokenizerTest.php b/test/HTML5/Parser/TokenizerTest.php index aff819e..69f90b9 100644 --- a/test/HTML5/Parser/TokenizerTest.php +++ b/test/HTML5/Parser/TokenizerTest.php @@ -387,6 +387,35 @@ class TokenizerTest extends \HTML5\Tests\TestCase { } } + public function testRawText() { + $good = array( + '<pre>abcd efg hijk lmnop</pre> ' => 'abcd efg hijk lmnop', + '<pre><not/><the/><tag></pre>' => '<not/><the/><tag>', + '<pre><<<<<<<<</pre>' => '<<<<<<<<', + '<pre>hello</pre</pre>' => 'hello</pre', + "<pre>\nhello</pre\n</pre>" => "\nhello</pre\n", + '<pre>&</pre>' => '&', + ); + foreach ($good as $test => $expects) { + list($tok, $events) = $this->createTokenizer($test); + + $tok->setTextMode(Tokenizer::TEXTMODE_RAW, 'pre'); + $tok->parse(); + + //fprintf(STDOUT, "Test: %s\n", $test); + fprintf(STDOUT, "Test: %s %s\n", $test, print_r($events, TRUE)); + + $this->assertEventEquals('startTag', 'pre', $events->get(0)); + $this->assertEventEquals('text', $expects, $events->get(1)); + $this->assertEventEquals('endTag', 'pre', $events->get(2)); + } + + $bad = array( + '<pre>&</pre' => '&', + ); + + } + public function testText() { $good = array( 'a<br>b', |