|
1 | 1 | <?php |
2 | 2 |
|
3 | 3 | use Html\Delegator\HTMLDocumentDelegator; |
| 4 | +use Html\Element\Block\Division; |
4 | 5 | use Html\Enum\AutoCapitalizeEnum; |
5 | 6 | use Html\Enum\ContentEditableEnum; |
6 | 7 | use Html\Enum\DirectionEnum; |
7 | 8 | use Html\Enum\SpellCheckEnum; |
8 | 9 |
|
9 | | -// uses(\Html\Trait\GlobalAttributesTrait::class); |
10 | | - |
11 | 10 | beforeEach(function () { |
12 | 11 | $this->document = HTMLDocumentDelegator::createEmpty(); |
13 | | - $this->element = $this->document->createElement('div'); |
| 12 | + $this->element = Division::create($this->document); |
14 | 13 | }); |
15 | 14 |
|
16 | 15 | test('set and get access key', function () { |
|
115 | 114 | ->toEqual(true); |
116 | 115 | }); |
117 | 116 |
|
118 | | -test('set and get inert', function () { |
119 | | - $this->element->setInert(true); |
120 | | - expect($this->element->getInert()) |
121 | | - ->toEqual(true); |
122 | | -}); |
123 | | - |
124 | 117 | test('set and get input mode', function () { |
125 | 118 | $this->element->setInputMode('numeric'); |
126 | 119 | expect($this->element->getInputMode()->value) |
|
137 | 130 | $this->element->setInputMode('phone'); |
138 | 131 | }); |
139 | 132 |
|
140 | | -test('set and get is', function () { |
141 | | - $this->element->setIs('custom-element'); |
142 | | - expect($this->element->getIs()) |
143 | | - ->toEqual('custom-element'); |
144 | | -}); |
145 | | - |
146 | 133 | test('set and get lang', function () { |
147 | 134 | $this->element->setLang('en'); |
148 | 135 | expect($this->element->getLang()) |
149 | 136 | ->toEqual('en'); |
150 | 137 | }); |
151 | 138 |
|
152 | | -test('set and get nonce', function () { |
153 | | - $this->element->setNonce('random-nonce'); |
154 | | - expect($this->element->getNonce()) |
155 | | - ->toEqual('random-nonce'); |
156 | | -}); |
157 | | - |
158 | | -test('set and get part', function () { |
159 | | - $this->element->setPart('part-name'); |
160 | | - expect($this->element->getPart()) |
161 | | - ->toEqual('part-name'); |
162 | | -}); |
163 | | - |
164 | 139 | test('set and get popover', function () { |
165 | 140 | $this->element->setPopover('auto'); |
166 | | - expect($this->element->getPopover()) |
| 141 | + expect($this->element->getPopover()->value) |
167 | 142 | ->toEqual('auto'); |
| 143 | + expect($this->element->getPopover()) |
| 144 | + ->toEqual(\Html\Enum\PopoverEnum::AUTO); |
168 | 145 | }); |
169 | 146 |
|
170 | 147 | test('set and get role', function () { |
171 | 148 | $this->element->setRole('button'); |
172 | | - expect($this->element->getRole()) |
| 149 | + expect($this->element->getRole()->value) |
173 | 150 | ->toEqual('button'); |
| 151 | + expect($this->element->getRole()) |
| 152 | + ->toEqual(\Html\Enum\RoleEnum::BUTTON); |
174 | 153 | }); |
175 | 154 |
|
176 | 155 | test('set and get slot', function () { |
|
180 | 159 | }); |
181 | 160 |
|
182 | 161 | test('set and get spell check', function () { |
183 | | - $this->element->setSpellCheck(true); |
184 | | - expect($this->element->getSpellCheck()) |
| 162 | + $this->element->setSpellcheck(true); |
| 163 | + expect($this->element->getSpellcheck()) |
185 | 164 | ->toBeInstanceOf(SpellCheckEnum::class); |
186 | | - expect($this->element->getSpellCheck()->value) |
| 165 | + expect($this->element->getSpellcheck()->value) |
187 | 166 | ->toEqual('true'); |
188 | 167 | expect($this->element->delegated->getAttribute('spellcheck')) |
189 | 168 | ->toEqual('true'); |
190 | 169 |
|
191 | 170 | $this->expectException(InvalidArgumentException::class); |
192 | 171 | $this->expectExceptionMessage('Invalid value for spellcheck'); |
193 | | - $this->element->setSpellCheck('invalid-value'); |
| 172 | + $this->element->setSpellcheck('invalid-value'); |
194 | 173 |
|
195 | | - $this->element->setSpellCheck('true'); |
196 | | - expect($this->element->getSpellCheck()) |
| 174 | + $this->element->setSpellcheck('true'); |
| 175 | + expect($this->element->getSpellcheck()) |
197 | 176 | ->toBeInstanceOf(SpellCheckEnum::class); |
198 | 177 | }); |
199 | 178 |
|
|
217 | 196 |
|
218 | 197 | test('set and get translate', function () { |
219 | 198 | $this->element->setTranslate('yes'); |
220 | | - expect($this->element->getTranslate()) |
| 199 | + expect($this->element->getTranslate()->value) |
221 | 200 | ->toEqual('yes'); |
| 201 | + expect($this->element->getTranslate()) |
| 202 | + ->toEqual(\Html\Enum\TranslateEnum::YES); |
222 | 203 | }); |
223 | 204 |
|
224 | 205 | test('test setDataAttribute', function () { |
|
0 commit comments