예제 #1
0
 public function testHtmlKeyWord()
 {
     $jade = new Jade(array('singleQuote' => false, 'prettyprint' => false));
     $actual = trim($jade->render("user Bob\n" . '  img(src="bob.png")'));
     $expected = '<user>Bob<img src="bob.png"></user>';
     $this->assertSame($expected, $actual, 'Before adding keyword, a word render as a tag.');
     $jade->addKeyword('user', function ($args) {
         return array('begin' => '<div class="user" title="' . $args . '">', 'end' => '</div>');
     });
     $actual = trim($jade->render("user Bob\n" . '  img(src="bob.png")'));
     $expected = '<div class="user" title="Bob"><img src="bob.png"></div>';
     $this->assertSame($expected, $actual, 'addKeyword should allow to customize available tags.');
 }