From 3761c75e004964cb2b75afedaddd9a3dd3dc426c Mon Sep 17 00:00:00 2001 From: Technosophos Date: Tue, 16 Apr 2013 17:40:24 -0500 Subject: Working on simple tags. --- test/HTML5/Parser/TokenizerTest.php | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'test') diff --git a/test/HTML5/Parser/TokenizerTest.php b/test/HTML5/Parser/TokenizerTest.php index c4c66e7..3065cbb 100644 --- a/test/HTML5/Parser/TokenizerTest.php +++ b/test/HTML5/Parser/TokenizerTest.php @@ -273,6 +273,50 @@ class TokenizerTest extends \HTML5\Tests\TestCase { } } + /** + * This tests just simple tags. + */ + public function testSimpleTags() { + $open = array( + '' => 'foo', + '' => 'foo', + "" => 'foo', + '' => 'foo:bar', + ); + foreach ($open as $test => $expects) { + $events = $this->parse($test); + $this->assertEquals(2, $events->depth(), "Counting events for '$test'" . print_r($events, TRUE)); + $this->assertEventEquals('startTag', $expects, $events->get(0)); + } + $selfClose= array( + '' => 'foo', + '' => 'foo', + "" => 'foo', + '' => 'foo:bar', + ); + foreach ($selfClose as $test => $expects) { + $events = $this->parse($test); + $this->assertEquals(3, $events->depth(), "Counting events for '$test'" . print_r($events, TRUE)); + $this->assertEventEquals('startTag', $expects, $events->get(0)); + $this->assertEventEquals('endTag', $expects, $events->get(1)); + } + + $bad = array( + ' 'foo', + ' 'foo', + ' 'foo', + ' 'foo', + ); + + foreach ($bad as $test => $expects) { + $events = $this->parse($test); + //fprintf(STDOUT, $test . PHP_EOL); + $this->assertEquals(3, $events->depth(), "Counting events for '$test': " . print_r($events, TRUE)); + $this->assertEventError($events->get(0)); + $this->assertEventEquals('startTag', $expects, $events->get(1)); + } + } + public function testText() { $good = array( 'a
b', -- cgit v1.2.3