* @author Kornel LesiƄski * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License * @version SVN: $Id: HTML5ModeTest.php 665 2009-07-10 23:11:17Z kornel $ * @link http://phptal.org/ */ require_once dirname(__FILE__)."/config.php"; class HTML5ModeTest extends PHPTAL_TestCase { function testCDATAScript() { $tpl = $this->newPHPTAL(); $tpl->setOutputMode(PHPTAL::HTML5); $tpl->setSource(''); $this->assertEquals(trim_string(''),trim_string($tpl->execute())); } function testCDATAContent() { $tpl = $this->newPHPTAL(); $tpl->setOutputMode(PHPTAL::HTML5); $tpl->setSource('

]]>

'); $this->assertEquals(trim_string('

<hello>

'),trim_string($tpl->execute())); } function testRemovesXHTMLNS() { $tpl = $this->newPHPTAL()->setOutputMode(PHPTAL::HTML5)->setSource(' '); $this->assertEquals(trim_string(''),trim_string($tpl->execute())); } function testDoctype() { $tpl = $this->newPHPTAL(); $tpl->setOutputMode(PHPTAL::HTML5); $tpl->setSource('

]]>

'); $this->assertEquals(trim_string('

<hello>

'),trim_string($tpl->execute())); } function testProlog() { $tpl = $this->newPHPTAL(); $tpl->setOutputMode(PHPTAL::HTML5); $tpl->setSource('

]]>

'); $this->assertEquals(trim_string('

<hello>

'),trim_string($tpl->execute())); } function testEmpty() { $tpl = $this->newPHPTAL(); $tpl->setOutputMode(PHPTAL::HTML5); $tpl->setSource(' <base href="http://example.com/"></base> <basefont face="Helvetica" /> <meta name="test" content=""></meta> <link rel="test"></link> </head> <body> <br/> <br /> <br></br> <hr/> <img src="test"></img> <form> <textarea /> <textarea tal:content="\'\'" /> <textarea tal:content="nonexistant | nothing" /> </form> </body> </html>'); $res = $tpl->execute(); $res = trim_string($res); $exp = trim_string('<!DOCTYPE html><html> <head> <title>



'); $this->assertEquals($exp, $res); } function testBoolean() { $tpl = $this->newPHPTAL(); $tpl->setOutputMode(PHPTAL::HTML5); $tpl->setSource(' '); $res = $tpl->execute(); $res = trim_string($res); $exp = trim_string(' '); $this->assertEquals($exp, $res); } function testMixedModes() { $tpl = $this->newPHPTAL(); $tpl->setOutputMode(PHPTAL::HTML5); $tpl->setSource(''); $this->assertEquals('',$tpl->execute()); $tpl->setOutputMode(PHPTAL::XHTML); $this->assertEquals('',$tpl->execute()); } }