From 4e5458898e6d9a73d3eae7b3213187407a940ce8 Mon Sep 17 00:00:00 2001 From: Technosophos Date: Fri, 19 Apr 2013 17:12:54 -0500 Subject: Added support for raw text. --- test/HTML5/Parser/TokenizerTest.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'test/HTML5/Parser') 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( + '
abcd efg hijk lmnop
' => 'abcd efg hijk lmnop', + '
' => '', + '
<<<<<<<<
' => '<<<<<<<<', + '
hello' => 'hello\nhello" => "\nhello&
' => '&', + ); + 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( + '
& '&',
+    );
+
+  }
+
   public function testText() {
     $good = array(
       'a
b', -- cgit v1.2.3