File: Html.construct.phpt

package info (click to toggle)
php-nette-utils 4.0.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,420 kB
  • sloc: php: 4,069; xml: 12; makefile: 4
file content (25 lines) | stat: -rw-r--r-- 996 bytes parent folder | download | duplicates (3)
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&quot;</a>', (string) Html::fromHtml('<a href="#">hello&quot;</a>'));

Assert::type(Html::class, Html::fromText('xxx'));
Assert::same('&lt;a href="#"&gt;hello&amp;quot;&lt;/a&gt;', (string) Html::fromText('<a href="#">hello&quot;</a>'));