1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
<?php
/**
* Test: Nette\Utils\Html::__construct()
*/
declare(strict_types=1);
use Nette\Utils\Html;
use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
Assert::same('<a lang="cs" href="#" title="" selected>click</a>', (string) Html::el('a lang=cs href="#" title="" selected')->setText('click'));
Assert::same('<a lang="hello" world href="hello world" title="hello \'world">click</a>', (string) Html::el('a lang=hello world href="hello world" title="hello \'world"')->setText('click'));
Assert::same('<a lang=\'hello" world\' href="hello " world title="0">click</a>', (string) Html::el('a lang=\'hello" world\' href="hello "world" title=0')->setText('click'));
Assert::type(Html::class, Html::fromHtml('xxx'));
Assert::same('<a href="#">hello"</a>', (string) Html::fromHtml('<a href="#">hello"</a>'));
Assert::type(Html::class, Html::fromText('xxx'));
Assert::same('<a href="#">hello&quot;</a>', (string) Html::fromText('<a href="#">hello"</a>'));
|