19 declare(strict_types=1);
21 require_once(
"vendor/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"/../../Base.php");
35 public function breadcrumbs(array $crumbs): I\Component\Breadcrumbs\Breadcrumbs
37 return new I\Component\Breadcrumbs\Breadcrumbs($crumbs);
46 $this->assertInstanceOf(
"ILIAS\\UI\\Factory",
$f);
47 $this->assertInstanceOf(
48 "ILIAS\\UI\\Component\\Breadcrumbs\\Breadcrumbs",
49 $f->breadcrumbs(array())
61 $c =
$f->breadcrumbs($crumbs);
62 $this->assertEquals($crumbs,
$c->getItems());
68 $crumb =
new I\Component\Link\Standard(
"label2",
'#');
70 $c =
$f->Breadcrumbs(array())
71 ->withAppendedItem($crumb);
72 $this->assertEquals(array($crumb),
$c->getItems());
78 $r = $this->getDefaultRenderer();
84 $c =
$f->Breadcrumbs($crumbs);
86 $html = $this->normalizeHTML(
$r->render(
$c));
87 $expected =
'<nav aria-label="breadcrumbs_aria_label" class="breadcrumb_wrapper">' 88 .
' <div class="breadcrumb">' 89 .
' <span class="crumb">' 90 .
' <a href="#">label</a>' 92 .
' <span class="crumb">' 93 .
' <a href="#">label2</a>' 98 $this->assertHTMLEquals($expected, $html);
104 $r = $this->getDefaultRenderer();
106 $label =
"label without special characters";
107 $label2 =
"label with special characters + –...+}*@ç%#&/($";
110 new I\Component\Link\Standard($label,
'#'),
111 new I\Component\Link\Standard($label2,
'#')
113 $c =
$f->Breadcrumbs($crumbs);
115 $html = $this->brutallyTrimHTML(
$r->render(
$c));
116 $expected =
'<nav aria-label="breadcrumbs_aria_label" class="breadcrumb_wrapper">' 117 .
' <div class="breadcrumb">' 118 .
' <span class="crumb">' 119 .
' <a href="#">label without special characters</a>' 121 .
' <span class="crumb">' 122 .
' <a href="#">label with special characters + –...+}*@ç%#&/($</a>' 128 $this->assertEquals($this->brutallyTrimHTML($expected), $html);
Tests for the Breadcrumbs-component.
testRenderingWithSpecialCharacters()
testImplementsFactoryInterface()
breadcrumbs()
description: > Example showing how to construct Breadcrumbs with an array of Links and extending the...