ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
KeyValueNodeTest Class Reference

Tests for the KeyValueNode. More...

+ Inheritance diagram for KeyValueNodeTest:
+ Collaboration diagram for KeyValueNodeTest:

Public Member Functions

 setUp ()
 
 testCreateKeyValueNode ()
 
 testRendering ()
 
 testRenderingWithIcon ()
 
 testRenderingWithAsync ()
 
 testRenderingExpanded ()
 

Private Attributes

I Tree Node Factory $node_factory
 
C Symbol Icon Standard $icon
 

Detailed Description

Tests for the KeyValueNode.

Definition at line 30 of file KeyValueNodeTest.php.

Member Function Documentation

◆ setUp()

KeyValueNodeTest::setUp ( )

Definition at line 35 of file KeyValueNodeTest.php.

35 : void
36 {
37 $this->node_factory = new I\Tree\Node\Factory();
38 $icon_factory = new I\Symbol\Icon\Factory();
39 $this->icon = $icon_factory->standard("", '');
40 }

◆ testCreateKeyValueNode()

KeyValueNodeTest::testCreateKeyValueNode ( )

Definition at line 42 of file KeyValueNodeTest.php.

42 : void
43 {
44 $node = $this->node_factory->keyValue('Label', 'Value', $this->icon);
45 $this->assertEquals('Label', $node->getLabel());
46 $this->assertEquals('Value', $node->getValue());
47 $this->assertEquals($this->icon, $node->getIcon());
48 }

◆ testRendering()

KeyValueNodeTest::testRendering ( )

Definition at line 50 of file KeyValueNodeTest.php.

50 : void
51 {
52 $node = $this->node_factory->keyValue('Label', 'Value');
53
54 $r = $this->getDefaultRenderer();
55 $html = $r->render($node);
56
57 $expected = <<<EOT
58 <li class="c-tree__node c-tree__node--simple" role="treeitem">
59 <span class="c-tree__node__line">
60 <span class="c-tree__node__label">Label</span>
61 <span class="c-tree__node__value">Value</span>
62 </span>
63 </li>
64EOT;
65
66 $this->assertEquals(
67 $this->brutallyTrimHTML($expected),
68 $this->brutallyTrimHTML($html)
69 );
70 }

◆ testRenderingExpanded()

KeyValueNodeTest::testRenderingExpanded ( )

Definition at line 123 of file KeyValueNodeTest.php.

123 : void
124 {
125 $node = $this->node_factory->keyValue('Label', 'Value');
126 $node = $node->withAsyncURL('something.de')->withExpanded(true);
127
128 $r = $this->getDefaultRenderer();
129 $html = $r->render($node);
130
131 $expected = <<<EOT
132 <li class="c-tree__node c-tree__node--simple expandable"
133 role="treeitem" aria-expanded="true"
134 data-async_url="something.de" data-async_loaded="false">
135 <span class="c-tree__node__line">
136 <span class="c-tree__node__label">Label</span>
137 <span class="c-tree__node__value">Value</span>
138 </span>
139 <ul role="group"></ul>
140 </li>
141EOT;
142
143 $this->assertEquals(
144 $this->brutallyTrimHTML($expected),
145 $this->brutallyTrimHTML($html)
146 );
147 }

◆ testRenderingWithAsync()

KeyValueNodeTest::testRenderingWithAsync ( )

Definition at line 97 of file KeyValueNodeTest.php.

97 : void
98 {
99 $node = $this->node_factory->keyValue('Label', 'Value');
100 $node = $node->withAsyncURL('something.de');
101
102 $r = $this->getDefaultRenderer();
103 $html = $r->render($node);
104
105 $expected = <<<EOT
106 <li class="c-tree__node c-tree__node--simple expandable"
107 role="treeitem" aria-expanded="false"
108 data-async_url="something.de" data-async_loaded="false">
109 <span class="c-tree__node__line">
110 <span class="c-tree__node__label">Label</span>
111 <span class="c-tree__node__value">Value</span>
112 </span>
113 <ul role="group"></ul>
114 </li>
115EOT;
116
117 $this->assertEquals(
118 $this->brutallyTrimHTML($expected),
119 $this->brutallyTrimHTML($html)
120 );
121 }

◆ testRenderingWithIcon()

KeyValueNodeTest::testRenderingWithIcon ( )

Definition at line 72 of file KeyValueNodeTest.php.

72 : void
73 {
74 $node = $this->node_factory->keyValue('Label', 'Value', $this->icon);
75
76 $r = $this->getDefaultRenderer();
77 $html = $r->render($node);
78
79 $expected = <<<EOT
80 <li class="c-tree__node c-tree__node--simple" role="treeitem">
81 <span class="c-tree__node__line">
82 <span class="c-tree__node__label">
83 <img class="icon small" src="./assets/images/standard/icon_default.svg" alt=""/>
84 Label
85 </span>
86 <span class="c-tree__node__value">Value</span>
87 </span>
88 </li>
89EOT;
90
91 $this->assertEquals(
92 $this->brutallyTrimHTML($expected),
93 $this->brutallyTrimHTML($html)
94 );
95 }

Field Documentation

◆ $icon

C Symbol Icon Standard KeyValueNodeTest::$icon
private

Definition at line 33 of file KeyValueNodeTest.php.

◆ $node_factory

I Tree Node Factory KeyValueNodeTest::$node_factory
private

Definition at line 32 of file KeyValueNodeTest.php.


The documentation for this class was generated from the following file: