ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
MarkdownTest Class Reference
+ Inheritance diagram for MarkdownTest:
+ Collaboration diagram for MarkdownTest:

Public Member Functions

 setUp ()
 
 getUIFactory ()
 The rendering of this input requires actual or minimal instances of: More...
 
 testRender ()
 
 testRenderWithByline ()
 
 testRenderWithLimits ()
 
 testRenderWithDisabled ()
 
 testRenderWithRequired ()
 
 testRenderWithError ()
 
 testRenderWithMustacheVariables ()
 

Protected Member Functions

 getRendererWithStubs ()
 
 buildMinimalFieldFactory ()
 
 buildButtonFactory ()
 
 getMarkdownRendererMock ()
 
 getSymbolFactoryMock ()
 
 getViewControlFactoryMock ()
 
 getViewControlModeStub ()
 
 getGlyphStub (string $name)
 

Protected Attributes

const TEST_ASYNC_URL = 'https://localhost'
 
const TEST_PARAMETER_NAME = 'preview'
 
MarkdownRenderer $markdown_renderer
 
DefNamesource $name_source
 
FieldFactory $factory
 
ViewControlMode $view_control_mock
 
Glyph $numberedlist_glyph_mock
 
Glyph $bulledpoint_glyph_mock
 
Glyph $header_glyph_mock
 
Glyph $italic_glyph_mock
 
Glyph $link_glyph_mock
 
Glyph $bold_glyph_mock
 

Detailed Description

Author
Thibeau Fuhrer thibe.nosp@m.au@s.nosp@m.r.sol.nosp@m.utio.nosp@m.ns

Definition at line 44 of file MarkdownTest.php.

Member Function Documentation

◆ buildButtonFactory()

MarkdownTest::buildButtonFactory ( )
protected

Definition at line 485 of file MarkdownTest.php.

485 : ButtonFactory
486 {
487 return new ButtonFactory();
488 }

Referenced by getUIFactory().

+ Here is the caller graph for this function:

◆ buildMinimalFieldFactory()

MarkdownTest::buildMinimalFieldFactory ( )
protected

Definition at line 473 of file MarkdownTest.php.

473 : FieldFactory
474 {
475 return new FieldFactory(
476 $this->createMock(\ILIAS\UI\Implementation\Component\Input\Field\Node\Factory::class),
477 $this->createMock(UploadLimitResolver::class),
478 new SignalGenerator(),
479 $this->createMock(DataFactory::class),
480 $this->createMock(Refinery::class),
481 $this->getLanguage()
482 );
483 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
getLanguage()

References getLanguage().

Referenced by setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGlyphStub()

MarkdownTest::getGlyphStub ( string  $name)
protected

Definition at line 536 of file MarkdownTest.php.

536 : Glyph
537 {
538 $glyph = $this->createMock(Glyph::class);
539 $glyph->method('getCanonicalName')->willReturn($name);
540 // will be called in the rendering process of this input.
541 $glyph->method('withUnavailableAction')->willReturnSelf();
542
543 return $glyph;
544 }

Referenced by setUp().

+ Here is the caller graph for this function:

◆ getMarkdownRendererMock()

MarkdownTest::getMarkdownRendererMock ( )
protected

Definition at line 490 of file MarkdownTest.php.

491 {
492 $markdown_renderer = $this->createMock(MarkdownRenderer::class);
493 $markdown_renderer->method('getAsyncUrl')->willReturn(self::TEST_ASYNC_URL);
494 $markdown_renderer->method('getParameterName')->willReturn(self::TEST_PARAMETER_NAME);
495 $markdown_renderer->method('render')->willReturnCallback(
496 static function ($value) {
497 return $value;
498 }
499 );
500
501 return $markdown_renderer;
502 }
MarkdownRenderer $markdown_renderer

References $markdown_renderer.

Referenced by setUp().

+ Here is the caller graph for this function:

◆ getRendererWithStubs()

MarkdownTest::getRendererWithStubs ( )
protected

Definition at line 460 of file MarkdownTest.php.

461 {
462 return $this->getDefaultRenderer(null, [
463 $this->view_control_mock,
464 $this->header_glyph_mock,
465 $this->italic_glyph_mock,
466 $this->bold_glyph_mock,
467 $this->link_glyph_mock,
468 $this->numberedlist_glyph_mock,
469 $this->bulledpoint_glyph_mock,
470 ]);
471 }

Referenced by testRender(), testRenderWithByline(), testRenderWithDisabled(), testRenderWithError(), testRenderWithLimits(), testRenderWithMustacheVariables(), and testRenderWithRequired().

+ Here is the caller graph for this function:

◆ getSymbolFactoryMock()

MarkdownTest::getSymbolFactoryMock ( )
protected

Definition at line 504 of file MarkdownTest.php.

504 : SymbolFactory
505 {
506 $glyph_factory = $this->createMock(GlyphFactory::class);
507 $glyph_factory->method('header')->willReturn($this->header_glyph_mock);
508 $glyph_factory->method('italic')->willReturn($this->italic_glyph_mock);
509 $glyph_factory->method('bold')->willReturn($this->bold_glyph_mock);
510 $glyph_factory->method('link')->willReturn($this->link_glyph_mock);
511 $glyph_factory->method('numberedlist')->willReturn($this->numberedlist_glyph_mock);
512 $glyph_factory->method('bulletlist')->willReturn($this->bulledpoint_glyph_mock);
513
514 $symbol_factory = $this->createMock(SymbolFactory::class);
515 $symbol_factory->method('glyph')->willReturn($glyph_factory);
516
517 return $symbol_factory;
518 }

Referenced by getUIFactory().

+ Here is the caller graph for this function:

◆ getUIFactory()

MarkdownTest::getUIFactory ( )

The rendering of this input requires actual or minimal instances of:

  • ViewControlFactory
  • ButtonFactory
  • SymbolFactory
See also
ILIAS_UI_TestBase::getDefaultRenderer()

Definition at line 86 of file MarkdownTest.php.

87 {
88 return new class (
90 $this->buildButtonFactory(),
91 $this->getSymbolFactoryMock(),
92 ) extends NoUIFactory {
93 protected ViewControlFactory $view_control_factory;
94 protected ButtonFactory $button_factory;
95 protected SymbolFactory $symbol_factory;
96
97 public function __construct(
98 ViewControlFactory $view_control_factory,
99 ButtonFactory $button_factory,
100 SymbolFactory $symbol_factory,
101 ) {
102 $this->view_control_factory = $view_control_factory;
103 $this->button_factory = $button_factory;
104 $this->symbol_factory = $symbol_factory;
105 }
106
107 public function viewControl(): ViewControlFactory
108 {
109 return $this->view_control_factory;
110 }
111
112 public function button(): ButtonFactory
113 {
114 return $this->button_factory;
115 }
116
117 public function symbol(): SymbolFactory
118 {
119 return $this->symbol_factory;
120 }
121 };
122 }
getViewControlFactoryMock()
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
button(string $caption, string $cmd)

References ILIAS\GlobalScreen\Provider\__construct(), buildButtonFactory(), ILIAS\Repository\button(), getSymbolFactoryMock(), getViewControlFactoryMock(), and ILIAS\Repository\symbol().

+ Here is the call graph for this function:

◆ getViewControlFactoryMock()

MarkdownTest::getViewControlFactoryMock ( )
protected

Definition at line 520 of file MarkdownTest.php.

520 : ViewControlFactory
521 {
522 $view_control_factory = $this->createMock(ViewControlFactory::class);
523 $view_control_factory->method('mode')->willReturn($this->getViewControlModeStub());
524
525 return $view_control_factory;
526 }

References getViewControlModeStub().

Referenced by getUIFactory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getViewControlModeStub()

MarkdownTest::getViewControlModeStub ( )
protected

Definition at line 528 of file MarkdownTest.php.

528 : ViewControlMode
529 {
530 $view_control = $this->createMock(ViewControlMode::class);
531 $view_control->method('getCanonicalName')->willReturn('view_control_mode');
532
533 return $view_control;
534 }

Referenced by getViewControlFactoryMock(), and setUp().

+ Here is the caller graph for this function:

◆ setUp()

MarkdownTest::setUp ( )

Definition at line 61 of file MarkdownTest.php.

61 : void
62 {
63 $this->markdown_renderer = $this->getMarkdownRendererMock();
64 $this->factory = $this->buildMinimalFieldFactory();
65 $this->name_source = new DefNamesource();
66
67 $this->view_control_mock = $this->getViewControlModeStub();
68 $this->numberedlist_glyph_mock = $this->getGlyphStub('numberedlist');
69 $this->bulledpoint_glyph_mock = $this->getGlyphStub('bulletpoint');
70 $this->header_glyph_mock = $this->getGlyphStub('header');
71 $this->italic_glyph_mock = $this->getGlyphStub('italic');
72 $this->link_glyph_mock = $this->getGlyphStub('link');
73 $this->bold_glyph_mock = $this->getGlyphStub('bold');
74
75 parent::setUp();
76 }
factory()
getGlyphStub(string $name)
buildMinimalFieldFactory()

References buildMinimalFieldFactory(), factory(), getGlyphStub(), getMarkdownRendererMock(), and getViewControlModeStub().

+ Here is the call graph for this function:

◆ testRender()

MarkdownTest::testRender ( )

Definition at line 124 of file MarkdownTest.php.

124 : void
125 {
126 $label = 'test_label';
127
128 $input = $this->factory->markdown($this->markdown_renderer, $label)->withNameFrom($this->name_source);
129
130 $expected = $this->brutallyTrimHTML(
131 "
132 <fieldset class=\"c-input\" data-il-ui-component=\"markdown-field-input\" data-il-ui-input-name=\"name_0\" id=\"id_8\" tabindex=\"0\">
133 <label>$label</label>
134 <div class=\"c-input__field\">
135
136 <div class=\"c-field-markdown\">
137 <div class=\"c-field-markdown__controls\">
138 view_control_mode
139 <div class=\"c-field-markdown__actions\">
140 <span data-action=\"insert-heading\">
141 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_2\">header</button>
142 </span>
143 <span data-action=\"insert-link\">
144 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_3\">link</button>
145 </span>
146 <span data-action=\"insert-bold\">
147 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_4\">bold</button>
148 </span>
149 <span data-action=\"insert-italic\">
150 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_5\">italic</button>
151 </span>
152 <span data-action=\"insert-bullet-points\">
153 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_7\">bulletpoint</button>
154 </span>
155 <span data-action=\"insert-enumeration\">
156 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_6\">numberedlist</button>
157 </span>
158 </div>
159 </div>
160 <div class=\"c-field-markdown__preview hidden\"></div>
161 <textarea id=\"id_1\" class=\"c-field-textarea\" name=\"name_0\"></textarea>
162 </div>
163
164 </div>
165 </fieldset>
166 "
167 );
168
169 $html = $this->brutallyTrimHTML($this->getRendererWithStubs()->render($input));
170 $this->assertEquals($expected, $html);
171 }

References factory(), and getRendererWithStubs().

+ Here is the call graph for this function:

◆ testRenderWithByline()

MarkdownTest::testRenderWithByline ( )

Definition at line 173 of file MarkdownTest.php.

173 : void
174 {
175 $label = 'test_label';
176 $byline = 'test_byline';
177
178 $input = $this->factory->markdown(
179 $this->markdown_renderer,
180 $label,
181 $byline
182 )->withNameFrom($this->name_source);
183
184 $expected = $this->brutallyTrimHTML(
185 "
186 <fieldset class=\"c-input\" data-il-ui-component=\"markdown-field-input\" data-il-ui-input-name=\"name_0\" id=\"id_8\" tabindex=\"0\">
187 <label>$label</label>
188 <div class=\"c-input__field\">
189
190 <div class=\"c-field-markdown\">
191 <div class=\"c-field-markdown__controls\">
192 view_control_mode
193 <div class=\"c-field-markdown__actions\">
194 <span data-action=\"insert-heading\">
195 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_2\">header</button>
196 </span>
197 <span data-action=\"insert-link\">
198 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_3\">link</button>
199 </span>
200 <span data-action=\"insert-bold\">
201 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_4\">bold</button>
202 </span>
203 <span data-action=\"insert-italic\">
204 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_5\">italic</button>
205 </span>
206 <span data-action=\"insert-bullet-points\">
207 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_7\">bulletpoint</button>
208 </span>
209 <span data-action=\"insert-enumeration\">
210 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_6\">numberedlist</button>
211 </span>
212 </div>
213 </div>
214
215 <div class=\"c-field-markdown__preview hidden\"></div>
216 <textarea id=\"id_1\" class=\"c-field-textarea\" name=\"name_0\"></textarea>
217
218 </div>
219
220 </div>
221 <div class=\"c-input__help-byline\">$byline</div>
222 </fieldset>
223 "
224 );
225
226 $html = $this->brutallyTrimHTML($this->getRendererWithStubs()->render($input));
227
228 $this->assertEquals($expected, $html);
229 }

References factory(), and getRendererWithStubs().

+ Here is the call graph for this function:

◆ testRenderWithDisabled()

MarkdownTest::testRenderWithDisabled ( )

Definition at line 290 of file MarkdownTest.php.

290 : void
291 {
292 $label = 'test_label';
293 $byline = 'test_byline';
294
295 $input = $this->factory->markdown(
296 $this->markdown_renderer,
297 $label,
298 $byline
299 )->withDisabled(true)->withNameFrom($this->name_source);
300
301 $expected = $this->brutallyTrimHTML(
302 "
303 <fieldset class=\"c-input\" data-il-ui-component=\"markdown-field-input\" data-il-ui-input-name=\"name_0\" disabled=\"disabled\" id=\"id_2\" tabindex=\"0\">
304 <label>$label</label>
305 <div class=\"c-input__field\">
306
307 <div class=\"c-field-markdown\">
308 <div class=\"c-field-markdown__controls\">
309 view_control_mode
310 <div class=\"c-field-markdown__actions\">
311 <span data-action=\"insert-heading\">
312 <button class=\"btn btn-default\" data-action=\"#\" disabled=\"disabled\">header</button>
313 </span>
314 <span data-action=\"insert-link\">
315 <button class=\"btn btn-default\" data-action=\"#\" disabled=\"disabled\">link</button>
316 </span>
317 <span data-action=\"insert-bold\">
318 <button class=\"btn btn-default\" data-action=\"#\" disabled=\"disabled\">bold</button>
319 </span>
320 <span data-action=\"insert-italic\">
321 <button class=\"btn btn-default\" data-action=\"#\" disabled=\"disabled\">italic</button>
322 </span>
323 <span data-action=\"insert-bullet-points\">
324 <button class=\"btn btn-default\" data-action=\"#\" disabled=\"disabled\">bulletpoint</button>
325 </span>
326 <span data-action=\"insert-enumeration\">
327 <button class=\"btn btn-default\" data-action=\"#\" disabled=\"disabled\">numberedlist</button>
328 </span>
329 </div>
330 </div>
331 <div class=\"c-field-markdown__preview hidden\"></div>
332 <textarea id=\"id_1\" class=\"c-field-textarea\" name=\"name_0\"></textarea>
333 </div>
334
335 </div>
336 <div class=\"c-input__help-byline\">$byline</div>
337 </fieldset>
338 "
339 );
340
341 $html = $this->brutallyTrimHTML($this->getRendererWithStubs()->render($input));
342
343 $this->assertEquals($expected, $html);
344 }

References factory(), and getRendererWithStubs().

+ Here is the call graph for this function:

◆ testRenderWithError()

MarkdownTest::testRenderWithError ( )

Definition at line 402 of file MarkdownTest.php.

402 : void
403 {
404 $label = 'test_label';
405 $byline = 'test_byline';
406 $error = 'test_error';
407
408 $input = $this->factory->markdown(
409 $this->markdown_renderer,
410 $label,
411 $byline
412 )->withError($error)->withNameFrom($this->name_source);
413
414 $expected = $this->brutallyTrimHTML(
415 "
416 <fieldset class=\"c-input\" data-il-ui-component=\"markdown-field-input\" data-il-ui-input-name=\"name_0\" aria-describedby=\"id_9\" id=\"id_8\" tabindex=\"0\">
417 <label>$label</label>
418 <div class=\"c-input__field\">
419
420 <div class=\"c-field-markdown\">
421 <div class=\"c-field-markdown__controls\">
422 view_control_mode
423 <div class=\"c-field-markdown__actions\">
424 <span data-action=\"insert-heading\">
425 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_2\">header</button>
426 </span>
427 <span data-action=\"insert-link\">
428 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_3\">link</button>
429 </span>
430 <span data-action=\"insert-bold\">
431 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_4\">bold</button>
432 </span>
433 <span data-action=\"insert-italic\">
434 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_5\">italic</button>
435 </span>
436 <span data-action=\"insert-bullet-points\">
437 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_7\">bulletpoint</button>
438 </span>
439 <span data-action=\"insert-enumeration\">
440 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_6\">numberedlist</button>
441 </span>
442 </div>
443 </div>
444 <div class=\"c-field-markdown__preview hidden\"></div>
445 <textarea id=\"id_1\" class=\"c-field-textarea\" name=\"name_0\"></textarea>
446 </div>
447
448 </div>
449 <div class=\"c-input__error-msg alert alert-danger\" id=\"id_9\"><span class=\"sr-only\">ui_error:</span>$error</div>
450 <div class=\"c-input__help-byline\">$byline</div>
451 </fieldset>
452 "
453 );
454
455 $html = $this->brutallyTrimHTML($this->getRendererWithStubs()->render($input));
456
457 $this->assertEquals($expected, $html);
458 }

References factory(), and getRendererWithStubs().

+ Here is the call graph for this function:

◆ testRenderWithLimits()

MarkdownTest::testRenderWithLimits ( )

Definition at line 231 of file MarkdownTest.php.

231 : void
232 {
233 $label = 'test_label';
234 $byline = 'test_byline';
235 $min = 1;
236 $max = 9;
237
238 $input = $this->factory->markdown(
239 $this->markdown_renderer,
240 $label,
241 $byline
242 )->withMinLimit($min)->withMaxLimit($max)->withNameFrom($this->name_source);
243
244 $expected = $this->brutallyTrimHTML(
245 "
246 <fieldset class=\"c-input\" data-il-ui-component=\"markdown-field-input\" data-il-ui-input-name=\"name_0\" id=\"id_8\" tabindex=\"0\">
247 <label>$label</label>
248 <div class=\"c-input__field\">
249
250 <div class=\"c-field-markdown\">
251 <div class=\"c-field-markdown__controls\">
252 view_control_mode
253 <div class=\"c-field-markdown__actions\">
254 <span data-action=\"insert-heading\">
255 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_2\">header</button>
256 </span>
257 <span data-action=\"insert-link\">
258 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_3\">link</button>
259 </span>
260 <span data-action=\"insert-bold\">
261 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_4\">bold</button>
262 </span>
263 <span data-action=\"insert-italic\">
264 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_5\">italic</button>
265 </span>
266 <span data-action=\"insert-bullet-points\">
267 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_7\">bulletpoint</button>
268 </span>
269 <span data-action=\"insert-enumeration\">
270 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_6\">numberedlist</button>
271 </span>
272 </div>
273 </div>
274 <div class=\"c-field-markdown__preview hidden\"></div>
275 <textarea id=\"id_1\" class=\"c-field-textarea\" name=\"name_0\" minlength=\"$min\" maxlength=\"$max\"></textarea>
276 <div class=\"ui-input-textarea-remainder\"> ui_chars_remaining<span data-action=\"remainder\">$max</span></div>
277 </div>
278
279 </div>
280 <div class=\"c-input__help-byline\">$byline</div>
281 </fieldset>
282 "
283 );
284
285 $html = $this->brutallyTrimHTML($this->getRendererWithStubs()->render($input));
286
287 $this->assertEquals($expected, $html);
288 }

References factory(), and getRendererWithStubs().

+ Here is the call graph for this function:

◆ testRenderWithMustacheVariables()

MarkdownTest::testRenderWithMustacheVariables ( )

Definition at line 546 of file MarkdownTest.php.

546 : void
547 {
548 $label = 'test_label';
549
550 $input = $this->factory->markdown($this->markdown_renderer, $label)
551 ->withNameFrom($this->name_source)
552 ->withMustacheVariables(
553 [
554 'var1' => 'Test Variable 1',
555 'var2' => 'Test Variable 2'
556 ],
557 'Also, some more info could be added here as well.'
558 )
559 ;
560
561 $expected = $this->brutallyTrimHTML(
562 "
563 <fieldset class=\"c-input\" data-il-ui-component=\"markdown-field-input\" data-il-ui-input-name=\"name_0\" id=\"id_8\" tabindex=\"0\">
564 <label>$label</label>
565 <div class=\"c-input__field\">
566
567 <div class=\"c-field-markdown\">
568 <div class=\"c-field-markdown__controls\">
569 view_control_mode
570 <div class=\"c-field-markdown__actions\">
571 <span data-action=\"insert-heading\">
572 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_2\">header</button>
573 </span>
574 <span data-action=\"insert-link\">
575 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_3\">link</button>
576 </span>
577 <span data-action=\"insert-bold\">
578 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_4\">bold</button>
579 </span>
580 <span data-action=\"insert-italic\">
581 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_5\">italic</button>
582 </span>
583 <span data-action=\"insert-bullet-points\">
584 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_7\">bulletpoint</button>
585 </span>
586 <span data-action=\"insert-enumeration\">
587 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_6\">numberedlist</button>
588 </span>
589 </div>
590 </div>
591 <div class=\"c-field-markdown__preview hidden\"></div>
592 <textarea id=\"id_1\" class=\"c-field-textarea\" name=\"name_0\"></textarea>
593 <div class=\"c-input--has-mustache-variables\">
594 <span>Also, some more info could be added here as well.</span>
595 <ul class=\"c-input--has-mustache-variables__definitions\">
596 <li><a href=\"#\">&lcub;&lcub;var1&rcub;&rcub;</a> Test Variable 1</li>
597 <li><a href=\"#\">&lcub;&lcub;var2&rcub;&rcub;</a> Test Variable 2</li>
598 </ul>
599 </div>
600 </div>
601
602 </div>
603 </fieldset>
604 "
605 );
606 $html = $this->brutallyTrimHTML($this->getRendererWithStubs()->render($input));
607 $this->assertEquals($expected, $html);
608 }

References factory(), and getRendererWithStubs().

+ Here is the call graph for this function:

◆ testRenderWithRequired()

MarkdownTest::testRenderWithRequired ( )

Definition at line 346 of file MarkdownTest.php.

346 : void
347 {
348 $label = 'test_label';
349 $byline = 'test_byline';
350
351 $input = $this->factory->markdown(
352 $this->markdown_renderer,
353 $label,
354 $byline
355 )->withRequired(true)->withNameFrom($this->name_source);
356
357 $expected = $this->brutallyTrimHTML(
358 "
359 <fieldset class=\"c-input\" data-il-ui-component=\"markdown-field-input\" data-il-ui-input-name=\"name_0\" id=\"id_8\" tabindex=\"0\">
360 <label>$label<span class=\"asterisk\" aria-label=\"required_field\">*</span></label>
361 <div class=\"c-input__field\">
362
363 <div class=\"c-field-markdown\">
364 <div class=\"c-field-markdown__controls\">
365 view_control_mode
366 <div class=\"c-field-markdown__actions\">
367 <span data-action=\"insert-heading\">
368 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_2\">header</button>
369 </span>
370 <span data-action=\"insert-link\">
371 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_3\">link</button>
372 </span>
373 <span data-action=\"insert-bold\">
374 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_4\">bold</button>
375 </span>
376 <span data-action=\"insert-italic\">
377 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_5\">italic</button>
378 </span>
379 <span data-action=\"insert-bullet-points\">
380 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_7\">bulletpoint</button>
381 </span>
382 <span data-action=\"insert-enumeration\">
383 <button class=\"btn btn-default\" data-action=\"#\" id=\"id_6\">numberedlist</button>
384 </span>
385 </div>
386 </div>
387 <div class=\"c-field-markdown__preview hidden\"></div>
388 <textarea id=\"id_1\" class=\"c-field-textarea\" name=\"name_0\"></textarea>
389 </div>
390
391 </div>
392 <div class=\"c-input__help-byline\">$byline</div>
393 </fieldset>
394 "
395 );
396
397 $html = $this->brutallyTrimHTML($this->getRendererWithStubs()->render($input));
398
399 $this->assertEquals($expected, $html);
400 }

References factory(), and getRendererWithStubs().

+ Here is the call graph for this function:

Field Documentation

◆ $bold_glyph_mock

Glyph MarkdownTest::$bold_glyph_mock
protected

Definition at line 59 of file MarkdownTest.php.

◆ $bulledpoint_glyph_mock

Glyph MarkdownTest::$bulledpoint_glyph_mock
protected

Definition at line 55 of file MarkdownTest.php.

◆ $factory

FieldFactory MarkdownTest::$factory
protected

Definition at line 51 of file MarkdownTest.php.

◆ $header_glyph_mock

Glyph MarkdownTest::$header_glyph_mock
protected

Definition at line 56 of file MarkdownTest.php.

◆ $italic_glyph_mock

Glyph MarkdownTest::$italic_glyph_mock
protected

Definition at line 57 of file MarkdownTest.php.

◆ $link_glyph_mock

Glyph MarkdownTest::$link_glyph_mock
protected

Definition at line 58 of file MarkdownTest.php.

◆ $markdown_renderer

MarkdownRenderer MarkdownTest::$markdown_renderer
protected

Definition at line 49 of file MarkdownTest.php.

Referenced by getMarkdownRendererMock().

◆ $name_source

DefNamesource MarkdownTest::$name_source
protected

Definition at line 50 of file MarkdownTest.php.

◆ $numberedlist_glyph_mock

Glyph MarkdownTest::$numberedlist_glyph_mock
protected

Definition at line 54 of file MarkdownTest.php.

◆ $view_control_mock

ViewControlMode MarkdownTest::$view_control_mock
protected

Definition at line 53 of file MarkdownTest.php.

◆ TEST_ASYNC_URL

const MarkdownTest::TEST_ASYNC_URL = 'https://localhost'
protected

Definition at line 46 of file MarkdownTest.php.

◆ TEST_PARAMETER_NAME

const MarkdownTest::TEST_PARAMETER_NAME = 'preview'
protected

Definition at line 47 of file MarkdownTest.php.


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