summaryrefslogtreecommitdiff
path: root/test/HTML5/Parser
diff options
context:
space:
mode:
authorTechnosophos <[email protected]>2013-04-19 17:12:54 -0500
committerTechnosophos <[email protected]>2013-04-19 17:12:54 -0500
commit4e5458898e6d9a73d3eae7b3213187407a940ce8 (patch)
tree2e4c6d5f79ca14574b9ac83e6e36ddb9f5f1904a /test/HTML5/Parser
parentbdbd0e7dabcc7f0567fa5abcb40a5236fc204eb8 (diff)
Added support for raw text.
Diffstat (limited to 'test/HTML5/Parser')
-rw-r--r--test/HTML5/Parser/TokenizerTest.php29
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>&amp;</pre>' => '&amp;',
+ );
+ 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>&amp;</pre' => '&amp;',
+ );
+
+ }
+
public function testText() {
$good = array(
'a<br>b',