ILIAS  release_7 Revision v7.30-3-g800a261c036
DropzoneRendererTest Class Reference

Class FileDropzoneRendererTest. More...

+ Inheritance diagram for DropzoneRendererTest:
+ Collaboration diagram for DropzoneRendererTest:

Public Member Functions

 setUp ()
 
 test_implements_factory_interface ()
 
 testRenderStandardDropzone ()
 should be rendered with the css class .standard and no content inside the dropzone div. More...
 
 testRenderStandardDropzoneWithMessage ()
 should be rendered with the css class .standard and a span-tag with the passed in message inside the dropzone div. More...
 
 testRenderWrapperDropzone ()
 A wrapper dropzone --------------------------------------------------------------—. More...
 
 testRenderMetadata ()
 
 testWithButton ()
 
 testModifiers ()
 
 getUIFactory ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Data Fields

const STANDARD = "ILIAS\\UI\\Component\\Dropzone\\File\\Standard"
 
const WRAPPER = "ILIAS\\UI\\Component\\Dropzone\\File\\Wrapper"
 

Protected Member Functions

 dropzone ()
 
- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML ($html)
 A more radical version of normalizeHTML. More...
 

Detailed Description

Class FileDropzoneRendererTest.

Author
nmaerchy nm@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 16 of file DropzoneRendererTest.php.

Member Function Documentation

◆ dropzone()

DropzoneRendererTest::dropzone ( )
protected

Definition at line 553 of file DropzoneRendererTest.php.

554 {
555 return new I\Component\Dropzone\File\Factory();
556 }

Referenced by test_implements_factory_interface(), testModifiers(), testRenderMetadata(), testRenderStandardDropzone(), testRenderStandardDropzoneWithMessage(), testRenderWrapperDropzone(), and testWithButton().

+ Here is the caller graph for this function:

◆ getUIFactory()

DropzoneRendererTest::getUIFactory ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 518 of file DropzoneRendererTest.php.

519 {
520 $factory = new class extends NoUIFactory {
521 public function button()
522 {
523 return new I\Component\Button\Factory(new I\Component\SignalGenerator());
524 }
525 public function modal()
526 {
527 return new I\Component\Modal\Factory(new I\Component\SignalGenerator());
528 }
529 public function link()
530 {
531 return new I\Component\Link\Factory(new I\Component\SignalGenerator());
532 }
533 public function dropdown()
534 {
535 return new I\Component\Dropdown\Factory(new I\Component\SignalGenerator());
536 }
537 public function symbol() : C\Symbol\Factory
538 {
539 return new I\Component\Symbol\Factory(
540 new I\Component\Symbol\Icon\Factory(),
541 new I\Component\Symbol\Glyph\Factory(),
542 new I\Component\Symbol\Avatar\Factory()
543 );
544 }
545 public function legacy($content)
546 {
547 return new I\Component\Legacy\Legacy($content, new I\Component\SignalGenerator());
548 }
549 };
550 return $factory;
551 }
legacy()
Definition: legacy.php:3
$factory
Definition: metadata.php:58
modal()
This second example shows a scenario in which the Close Button is used in an overlay as indicated in ...
Definition: modal.php:7

References $factory, legacy(), and modal().

+ Here is the call graph for this function:

◆ setUp()

DropzoneRendererTest::setUp ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 23 of file DropzoneRendererTest.php.

23 : void
24 {
25 $sig_gen = new \ILIAS\UI\Implementation\Component\SignalGenerator();
26 $this->legacy_factory = new I\Component\Legacy\Factory($sig_gen);
27 }

◆ test_implements_factory_interface()

DropzoneRendererTest::test_implements_factory_interface ( )

Definition at line 29 of file DropzoneRendererTest.php.

30 {
31 $f = $this->dropzone();
32 $this->assertInstanceOf(self::STANDARD, $f->standard(''));
33 $this->assertInstanceOf(self::WRAPPER, $f->wrapper('', $this->legacy_factory->legacy('')));
34 }

References Vendor\Package\$f, and dropzone().

+ Here is the call graph for this function:

◆ testModifiers()

DropzoneRendererTest::testModifiers ( )

Definition at line 492 of file DropzoneRendererTest.php.

493 {
494 $url = 'https://ilias.de/123?test=8&lorem=ipsum';
495 $message = 'Everything\'s fine here, just drop some files...';
496 $filesize = new DataSize(1024, DataSize::KB);
497 $file_types = array( 'pdf', 'docx' );
498 $allowed_files = 5;
499 $dropzone = $this->dropzone()
500 ->standard($url)
501 ->withMessage($message)
502 ->withUserDefinedFileNamesEnabled(true)
503 ->withUserDefinedDescriptionEnabled(true)
504 ->withAllowedFileTypes($file_types)
505 ->withFileSizeLimit($filesize)
506 ->withMaxFiles($allowed_files);
507
508 $this->assertEquals($url, $dropzone->getUploadUrl());
509 $this->assertEquals($message, $dropzone->getMessage());
510 $this->assertTrue($dropzone->allowsUserDefinedFileNames());
511 $this->assertTrue($dropzone->allowsUserDefinedFileDescriptions());
512 $this->assertEquals($file_types, $dropzone->getAllowedFileTypes());
513 $this->assertEquals($filesize, $dropzone->getFileSizeLimit());
514 $this->assertEquals("1.024 KB", $dropzone->getFileSizeLimit()->__toString());
515 $this->assertEquals($allowed_files, $dropzone->getMaxFiles());
516 }
Class DataSize.
Definition: DataSize.php:16
$url
$message
Definition: xapiexit.php:14

References $message, $url, and dropzone().

+ Here is the call graph for this function:

◆ testRenderMetadata()

DropzoneRendererTest::testRenderMetadata ( )

Definition at line 215 of file DropzoneRendererTest.php.

216 {
217 $with_user_defined_names_html = $this->brutallyTrimHTML('<div id="id_1" class="il-dropzone-base">
218 <div class="clearfix hidden-sm-up"></div>
219 <div class="il-upload-file-list" >
220 <div class="container-fluid il-upload-file-items">
221 <div class="error-messages" style="display: none;">
222 <div class="alert alert-danger" role="alert">
223 <!-- General error messages are inserted here with javascript -->
224 </div>
225 </div>
226 <!-- rows from templates are cloned here with javascript -->
227 </div>
228 <!-- Templates -->
229 <div class="container-fluid" >
230 <!-- hidden Template -->
231 <div class="il-upload-file-item il-upload-file-item-template clearfix row standard hidden">
232 <div class="col-xs-12 col-no-padding">
233 <span class="file-info toggle"><a class="glyph" aria-label="collapse_content"><span class="glyphicon glyphicon-triangle-bottom" aria-hidden="true"></span></a><a class="glyph" aria-label="expand_content"><span class="glyphicon glyphicon-triangle-right" aria-hidden="true"></span></a></span><!-- Display Filename-->
234 <span class="file-info filename">FILENAME<!-- File name is inserted with javascript here -->
235 </span>
236 <!-- Display Filesize-->
237 <span class="file-info filesize">100KB<!-- File size is inserted with javascript here -->
238 </span>
239 <!-- Dropdown with actions-->
240 <span class="pull-right remove">
241 <!--<div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="actions" aria-haspopup="true" aria-expanded="false" > <span class="caret"></span></button><ul class="dropdown-menu"><li><button class="btn btn-link" aria-label="delete_file" data-action="">remove</button></li><li><button class="btn btn-link" aria-label="edit_metadata" data-action="">edit_metadata</button></li></ul></div>-->
242 <button type="button" class="close" aria-label="close"><span aria-hidden="true">&times;</span></button>
243 </span>
244 <!-- Progress Bar-->
245 <div class="progress" style="margin: 10px 0; display: none;">
246 <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="0"aria-valuemin="0"aria-valuemax="100"></div>
247 </div>
248 <!-- Error Messages -->
249 <div class="file-error-message alert alert-danger" role="alert" style="display: none;">
250 <!-- Error message for file is inserted with javascript here -->
251 </div>
252 <div class="file-success-message alert alert-success" role="alert" style="display: none;">
253 <!-- Success message for file is inserted with javascript here -->
254 </div>
255 <br>
256 <div class="form-horizontal metadata" style="display: none;">
257 <div class="form-group">
258 <label class="col-sm-3 control-label">filename</label>
259 <div class="col-sm-9"><input type="text" class="form-control filename-input"></div>
260 </div>
261 </div>
262 </div>
263 </div>
264 <!-- li from templates are cloned here with javascript -->
265 </div>
266 </div>
267 <div class="container-fluid">
268 <div class="il-dropzone standard clearfix row" data-upload-id="id_1">
269 <div class="col-xs-12 col-md-3 col-sm-12 col-lg-3 dz-default dz-message il-dropzone-standard-select-files-wrapper ">
270 <!--col-no-padding--><a href="#" >select_files_from_computer</a>
271 </div>
272 <div class="col-xs-12 col-md-9 col-sm-12 col-lg-9 col-no-padding"><span class="pull-right dz-default dz-message">drag_files_here</span></div>
273 </div>
274 <div class="clearfix hidden-sm-up"></div>
275 </div>
276</div>');
277
278 $with_user_defined_names = $this->dropzone()
279 ->standard('https://ilias.de/ilias.php')
280 ->withUserDefinedFileNamesEnabled(true);
281 $html = $this->brutallyTrimHTML($this->getDefaultRenderer()->render($with_user_defined_names));
282 $this->assertEquals($with_user_defined_names_html, $html);
283
284 $with_user_defined_descriptions_html = $this->brutallyTrimHTML('
285 <div id="id_1" class="il-dropzone-base">
286 <div class="clearfix hidden-sm-up"></div>
287 <div class="il-upload-file-list" >
288 <div class="container-fluid il-upload-file-items">
289 <div class="error-messages" style="display: none;">
290 <div class="alert alert-danger" role="alert">
291 <!-- General error messages are inserted here with javascript -->
292 </div>
293 </div>
294 <!-- rows from templates are cloned here with javascript -->
295 </div>
296 <!-- Templates -->
297 <div class="container-fluid" >
298 <!-- hidden Template -->
299 <div class="il-upload-file-item il-upload-file-item-template clearfix row standard hidden">
300 <div class="col-xs-12 col-no-padding">
301 <span class="file-info toggle"><a class="glyph" aria-label="collapse_content"><span class="glyphicon glyphicon-triangle-bottom" aria-hidden="true"></span></a><a class="glyph" aria-label="expand_content"><span class="glyphicon glyphicon-triangle-right" aria-hidden="true"></span></a></span><!-- Display Filename-->
302 <span class="file-info filename">FILENAME<!-- File name is inserted with javascript here -->
303 </span>
304 <!-- Display Filesize-->
305 <span class="file-info filesize">100KB<!-- File size is inserted with javascript here -->
306 </span>
307 <!-- Dropdown with actions-->
308 <span class="pull-right remove">
309 <!--<div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="actions" aria-haspopup="true" aria-expanded="false" > <span class="caret"></span></button><ul class="dropdown-menu"><li><button class="btn btn-link" aria-label="delete_file" data-action="">remove</button></li><li><button class="btn btn-link" aria-label="edit_metadata" data-action="">edit_metadata</button></li></ul></div>-->
310 <button type="button" class="close" aria-label="close"><span aria-hidden="true">&times;</span></button>
311 </span>
312 <!-- Progress Bar-->
313 <div class="progress" style="margin: 10px 0; display: none;">
314 <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="0"aria-valuemin="0"aria-valuemax="100"></div>
315 </div>
316 <!-- Error Messages -->
317 <div class="file-error-message alert alert-danger" role="alert" style="display: none;">
318 <!-- Error message for file is inserted with javascript here -->
319 </div>
320 <div class="file-success-message alert alert-success" role="alert" style="display: none;">
321 <!-- Success message for file is inserted with javascript here -->
322 </div>
323 <br>
324 <div class="form-horizontal metadata" style="display: none;">
325 <div class="form-group">
326 <label class="col-sm-3 control-label" for="description-input">description</label>
327 <div class="col-sm-9"><textarea class="form-control description-input" id="description-input" rows="3"></textarea></div>
328 </div>
329 </div>
330 </div>
331 </div>
332 <!-- li from templates are cloned here with javascript -->
333 </div>
334 </div>
335 <div class="container-fluid">
336 <div class="il-dropzone standard clearfix row" data-upload-id="id_1">
337 <div class="col-xs-12 col-md-3 col-sm-12 col-lg-3 dz-default dz-message il-dropzone-standard-select-files-wrapper ">
338 <!--col-no-padding--><a href="#" >select_files_from_computer</a>
339 </div>
340 <div class="col-xs-12 col-md-9 col-sm-12 col-lg-9 col-no-padding"><span class="pull-right dz-default dz-message">drag_files_here</span></div>
341 </div>
342 <div class="clearfix hidden-sm-up"></div>
343 </div>
344</div>');
345 $with_user_defined_descriptions = $this->dropzone()
346 ->standard('https://ilias.de/ilias.php')
347 ->withUserDefinedDescriptionEnabled(true);
348 $html = $this->brutallyTrimHTML($this->getDefaultRenderer()
349 ->render($with_user_defined_descriptions));
350 $this->assertEquals($with_user_defined_descriptions_html, $html);
351
352 $with_user_defined_names_and_descriptions_html = $this->brutallyTrimHTML('
353 <div id="id_1" class="il-dropzone-base">
354 <div class="clearfix hidden-sm-up"></div>
355 <div class="il-upload-file-list" >
356 <div class="container-fluid il-upload-file-items">
357 <div class="error-messages" style="display: none;">
358 <div class="alert alert-danger" role="alert">
359 <!-- General error messages are inserted here with javascript -->
360 </div>
361 </div>
362 <!-- rows from templates are cloned here with javascript -->
363 </div>
364 <!-- Templates -->
365 <div class="container-fluid" >
366 <!-- hidden Template -->
367 <div class="il-upload-file-item il-upload-file-item-template clearfix row standard hidden">
368 <div class="col-xs-12 col-no-padding">
369 <span class="file-info toggle"><a class="glyph" aria-label="collapse_content"><span class="glyphicon glyphicon-triangle-bottom" aria-hidden="true"></span></a><a class="glyph" aria-label="expand_content"><span class="glyphicon glyphicon-triangle-right" aria-hidden="true"></span></a></span><!-- Display Filename-->
370 <span class="file-info filename">FILENAME<!-- File name is inserted with javascript here -->
371 </span>
372 <!-- Display Filesize-->
373 <span class="file-info filesize">100KB<!-- File size is inserted with javascript here -->
374 </span>
375 <!-- Dropdown with actions-->
376 <span class="pull-right remove">
377 <!--<div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="actions" aria-haspopup="true" aria-expanded="false" > <span class="caret"></span></button><ul class="dropdown-menu"><li><button class="btn btn-link" aria-label="delete_file" data-action="">remove</button></li><li><button class="btn btn-link" aria-label="edit_metadata" data-action="">edit_metadata</button></li></ul></div>-->
378 <button type="button" class="close" aria-label="close"><span aria-hidden="true">&times;</span></button>
379 </span>
380 <!-- Progress Bar-->
381 <div class="progress" style="margin: 10px 0; display: none;">
382 <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="0"aria-valuemin="0"aria-valuemax="100"></div>
383 </div>
384 <!-- Error Messages -->
385 <div class="file-error-message alert alert-danger" role="alert" style="display: none;">
386 <!-- Error message for file is inserted with javascript here -->
387 </div>
388 <div class="file-success-message alert alert-success" role="alert" style="display: none;">
389 <!-- Success message for file is inserted with javascript here -->
390 </div>
391 <br>
392 <div class="form-horizontal metadata" style="display: none;">
393 <div class="form-group">
394 <label class="col-sm-3 control-label">filename</label>
395 <div class="col-sm-9"><input type="text" class="form-control filename-input"></div>
396 </div>
397 <div class="form-group">
398 <label class="col-sm-3 control-label" for="description-input">description</label>
399 <div class="col-sm-9"><textarea class="form-control description-input" id="description-input" rows="3"></textarea></div>
400 </div>
401 </div>
402 </div>
403 </div>
404 <!-- li from templates are cloned here with javascript -->
405 </div>
406 </div>
407 <div class="container-fluid">
408 <div class="il-dropzone standard clearfix row" data-upload-id="id_1">
409 <div class="col-xs-12 col-md-3 col-sm-12 col-lg-3 dz-default dz-message il-dropzone-standard-select-files-wrapper ">
410 <!--col-no-padding--><a href="#" >select_files_from_computer</a>
411 </div>
412 <div class="col-xs-12 col-md-9 col-sm-12 col-lg-9 col-no-padding"><span class="pull-right dz-default dz-message">drag_files_here</span></div>
413 </div>
414 <div class="clearfix hidden-sm-up"></div>
415 </div>
416</div>');
417 $with_user_defined_names_and_descriptions = $this->dropzone()
418 ->standard('https://ilias.de/ilias.php')
419 ->withUserDefinedDescriptionEnabled(true)
420 ->withUserDefinedFileNamesEnabled(true);
421 $html = $this->brutallyTrimHTML($this->getDefaultRenderer()
422 ->render($with_user_defined_names_and_descriptions));
423 $this->assertEquals($with_user_defined_names_and_descriptions_html, $html);
424 }
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
Definition: Base.php:311
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
Definition: Base.php:392

References ILIAS_UI_TestBase\brutallyTrimHTML(), dropzone(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderStandardDropzone()

DropzoneRendererTest::testRenderStandardDropzone ( )

should be rendered with the css class .standard and no content inside the dropzone div.

Definition at line 41 of file DropzoneRendererTest.php.

42 {
43
44 // setup expected objects
45 $expectedHtml = $this->brutallyTrimHTML('
46<div id="id_1" class="il-dropzone-base">
47 <div class="clearfix hidden-sm-up"></div>
48 <div class="il-upload-file-list" >
49 <div class="container-fluid il-upload-file-items">
50 <div class="error-messages" style="display: none;">
51 <div class="alert alert-danger" role="alert">
52 <!-- General error messages are inserted here with javascript -->
53 </div>
54 </div>
55 <!-- rows from templates are cloned here with javascript -->
56 </div>
57 <!-- Templates -->
58 <div class="container-fluid" >
59 <!-- hidden Template -->
60 <div class="il-upload-file-item il-upload-file-item-template clearfix row standard hidden">
61 <div class="col-xs-12 col-no-padding">
62 <!-- Display Filename-->
63 <span class="file-info filename">FILENAME<!-- File name is inserted with javascript here -->
64 </span>
65 <!-- Display Filesize-->
66 <span class="file-info filesize">100KB<!-- File size is inserted with javascript here -->
67 </span>
68 <!-- Dropdown with actions-->
69 <span class="pull-right remove">
70 <!--<div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="actions" aria-haspopup="true" aria-expanded="false" > <span class="caret"></span></button><ul class="dropdown-menu"><li><button class="btn btn-link" aria-label="delete_file" data-action="">remove</button></li></ul></div>-->
71 <button type="button" class="close" aria-label="close"><span aria-hidden="true">&times;</span></button>
72 </span>
73 <!-- Progress Bar-->
74 <div class="progress" style="margin: 10px 0; display: none;">
75 <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="0"aria-valuemin="0"aria-valuemax="100"></div>
76 </div>
77 <!-- Error Messages -->
78 <div class="file-error-message alert alert-danger" role="alert" style="display: none;">
79 <!-- Error message for file is inserted with javascript here -->
80 </div>
81 <div class="file-success-message alert alert-success" role="alert" style="display: none;">
82 <!-- Success message for file is inserted with javascript here -->
83 </div>
84 </div>
85 </div>
86 <!-- li from templates are cloned here with javascript -->
87 </div>
88 </div>
89 <div class="container-fluid">
90 <div class="il-dropzone standard clearfix row" data-upload-id="id_1">
91 <div class="col-xs-12 col-md-3 col-sm-12 col-lg-3 dz-default dz-message il-dropzone-standard-select-files-wrapper ">
92 <!--col-no-padding--><a href="#" >select_files_from_computer</a>
93 </div>
94 <div class="col-xs-12 col-md-9 col-sm-12 col-lg-9 col-no-padding"><span class="pull-right dz-default dz-message">drag_files_here</span></div>
95 </div>
96 <div class="clearfix hidden-sm-up"></div>
97 </div>
98</div>');
99
100 // start test
101 $standardDropzone = $this->dropzone()->standard('');
102
103 $html = $this->brutallyTrimHTML($this->getDefaultRenderer()->render($standardDropzone));
104
105 $this->assertEquals($expectedHtml, $html);
106 }

References ILIAS_UI_TestBase\brutallyTrimHTML(), dropzone(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderStandardDropzoneWithMessage()

DropzoneRendererTest::testRenderStandardDropzoneWithMessage ( )

should be rendered with the css class .standard and a span-tag with the passed in message inside the dropzone div.

Definition at line 113 of file DropzoneRendererTest.php.

114 {
115
116 // setup expected objects
117 $expectedHtml = $this->brutallyTrimHTML('<div id="id_1" class="il-dropzone-base"><div class="clearfix hidden-sm-up"></div><div class="il-upload-file-list" ><div class="container-fluid il-upload-file-items"><div class="error-messages" style="display: none;"><div class="alert alert-danger" role="alert"><!-- General error messages are inserted here with javascript --></div></div><!-- rows from templates are cloned here with javascript --></div><!-- Templates --><div class="container-fluid" ><!-- hidden Template --><div class="il-upload-file-item il-upload-file-item-template clearfix row standard hidden"><div class="col-xs-12 col-no-padding"><!-- Display Filename--><span class="file-info filename">FILENAME<!-- File name is inserted with javascript here --></span><!-- Display Filesize--><span class="file-info filesize">100KB<!-- File size is inserted with javascript here --></span><!-- Dropdown with actions--><span class="pull-right remove"><!--<div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="actions" aria-haspopup="true" aria-expanded="false" > <span class="caret"></span></button><ul class="dropdown-menu"><li><button class="btn btn-link" aria-label="delete_file" data-action="">remove</button></li></ul></div>--><button type="button" class="close" aria-label="close"><span aria-hidden="true">&times;</span></button></span><!-- Progress Bar--><div class="progress" style="margin: 10px 0; display: none;"><div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="0"aria-valuemin="0"aria-valuemax="100"></div></div><!-- Error Messages --><div class="file-error-message alert alert-danger" role="alert" style="display: none;"><!-- Error message for file is inserted with javascript here --></div><div class="file-success-message alert alert-success" role="alert" style="display: none;"><!-- Success message for file is inserted with javascript here --></div></div></div><!-- li from templates are cloned here with javascript --></div></div><div class="container-fluid"><div class="il-dropzone standard clearfix row" data-upload-id="id_1"><div class="col-xs-12 col-md-3 col-sm-12 col-lg-3 dz-default dz-message il-dropzone-standard-select-files-wrapper "> <!--col-no-padding--><a href="#" >select_files_from_computer</a></div><div class="col-xs-12 col-md-9 col-sm-12 col-lg-9 col-no-padding"><span class="pull-right dz-default dz-message">message</span></div></div><div class="clearfix hidden-sm-up"></div></div></div>');
118
119 // start test
120 $standardDropzone = $this->dropzone()->standard('')->withMessage('message');
121
122 $html = $this->brutallyTrimHTML($this->getDefaultRenderer()->render($standardDropzone));
123
124 $this->assertEquals($expectedHtml, $html);
125 }

References ILIAS_UI_TestBase\brutallyTrimHTML(), dropzone(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderWrapperDropzone()

DropzoneRendererTest::testRenderWrapperDropzone ( )

A wrapper dropzone --------------------------------------------------------------—.

should be rendered with the css class .wrapper and all passed in ILIAS UI components inside the div.

Definition at line 136 of file DropzoneRendererTest.php.

137 {
138 // setup expected objects
139 $expectedHtml = $this->brutallyTrimHTML('
140<div id="id_1" class="il-dropzone-base">
141 <div class="il-dropzone wrapper" data-upload-id="id_1">
142 <p>Pretty smart, isn\'t it?</p>
143 <p>Yeah, this is really smart.</p>
144 </div>
145 <div class="modal fade il-modal-roundtrip" tabindex="-1" role="dialog" id="id_4">
146 <div class="modal-dialog" role="document" data-replace-marker="component">
147 <div class="modal-content">
148 <div class="modal-header">
149 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
150 <span class="modal-title">upload</span>
151 </div>
152 <div class="modal-body">
153 <div class="il-upload-file-list" >
154 <div class="container-fluid il-upload-file-items">
155 <div class="error-messages" style="display: none;">
156 <div class="alert alert-danger" role="alert">
157 <!-- General error messages are inserted here with javascript -->
158 </div>
159 </div>
160 <!-- rows from templates are cloned here with javascript -->
161 </div>
162 <!-- Templates -->
163 <div class="container-fluid" >
164 <!-- hidden Template -->
165 <div class="il-upload-file-item il-upload-file-item-template clearfix row standard hidden">
166 <div class="col-xs-12 col-no-padding">
167 <!-- Display Filename-->
168 <span class="file-info filename">FILENAME<!-- File name is inserted with javascript here -->
169 </span>
170 <!-- Display Filesize-->
171 <span class="file-info filesize">100KB<!-- File size is inserted with javascript here -->
172 </span>
173 <!-- Dropdown with actions-->
174 <span class="pull-right remove">
175 <!--<div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="actions" aria-haspopup="true" aria-expanded="false" > <span class="caret"></span></button><ul class="dropdown-menu"><li><button class="btn btn-link" aria-label="delete_file" data-action="">remove</button></li></ul></div>-->
176 <button type="button" class="close" aria-label="close"><span aria-hidden="true">&times;</span></button>
177 </span>
178 <!-- Progress Bar-->
179 <div class="progress" style="margin: 10px 0; display: none;">
180 <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="0"aria-valuemin="0"aria-valuemax="100"></div>
181 </div>
182 <!-- Error Messages -->
183 <div class="file-error-message alert alert-danger" role="alert" style="display: none;">
184 <!-- Error message for file is inserted with javascript here -->
185 </div>
186 <div class="file-success-message alert alert-success" role="alert" style="display: none;">
187 <!-- Success message for file is inserted with javascript here -->
188 </div>
189 </div>
190 </div>
191 <!-- li from templates are cloned here with javascript -->
192 </div>
193 </div>
194 </div>
195 <div class="modal-footer"><button class="btn btn-default btn-primary" data-action="" disabled="disabled">upload</button><button class="btn btn-default" data-dismiss="modal" aria-label="Close">cancel</button></div>
196 </div>
197 </div>
198 </div>
199</div>');
200
201 // start test
202 $exampleTextQuestion = $this->legacy_factory->legacy("<p>Pretty smart, isn't it?</p>");
203 $exampleTextAnswer = $this->legacy_factory->legacy("<p>Yeah, this is really smart.</p>");
204 $wrapperDropzone = $this->dropzone()->wrapper('', [
205 $exampleTextQuestion,
206 $exampleTextAnswer,
207 ]);
208
209 $html = $this->brutallyTrimHTML($this->getDefaultRenderer()->render($wrapperDropzone));
210
211 $this->assertEquals($expectedHtml, $html);
212 }

References ILIAS_UI_TestBase\brutallyTrimHTML(), dropzone(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ testWithButton()

DropzoneRendererTest::testWithButton ( )

Definition at line 427 of file DropzoneRendererTest.php.

428 {
429 $expected_html = $this->brutallyTrimHTML('
430 <div id="id_1" class="il-dropzone-base">
431 <div class="clearfix hidden-sm-up"></div>
432 <div class="il-upload-file-list" >
433 <div class="container-fluid il-upload-file-items">
434 <div class="error-messages" style="display: none;">
435 <div class="alert alert-danger" role="alert">
436 <!-- General error messages are inserted here with javascript -->
437 </div>
438 </div>
439 <!-- rows from templates are cloned here with javascript -->
440 </div>
441 <!-- Templates -->
442 <div class="container-fluid" >
443 <!-- hidden Template -->
444 <div class="il-upload-file-item il-upload-file-item-template clearfix row standard hidden">
445 <div class="col-xs-12 col-no-padding">
446 <!-- Display Filename-->
447 <span class="file-info filename">FILENAME<!-- File name is inserted with javascript here -->
448 </span>
449 <!-- Display Filesize-->
450 <span class="file-info filesize">100KB<!-- File size is inserted with javascript here -->
451 </span>
452 <!-- Dropdown with actions-->
453 <span class="pull-right remove">
454 <!--<div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="actions" aria-haspopup="true" aria-expanded="false" > <span class="caret"></span></button><ul class="dropdown-menu"><li><button class="btn btn-link" aria-label="delete_file" data-action="">remove</button></li></ul></div>-->
455 <button type="button" class="close" aria-label="close"><span aria-hidden="true">&times;</span></button>
456 </span>
457 <!-- Progress Bar-->
458 <div class="progress" style="margin: 10px 0; display: none;">
459 <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="0"aria-valuemin="0"aria-valuemax="100"></div>
460 </div>
461 <!-- Error Messages -->
462 <div class="file-error-message alert alert-danger" role="alert" style="display: none;">
463 <!-- Error message for file is inserted with javascript here -->
464 </div>
465 <div class="file-success-message alert alert-success" role="alert" style="display: none;">
466 <!-- Success message for file is inserted with javascript here -->
467 </div>
468 </div>
469 </div>
470 <!-- li from templates are cloned here with javascript -->
471 </div>
472 </div>
473 <div class="container-fluid">
474 <div class="il-dropzone standard clearfix row" data-upload-id="id_1">
475 <div class="col-xs-12 col-md-3 col-sm-12 col-lg-3 dz-default dz-message il-dropzone-standard-select-files-wrapper ">
476 <!--col-no-padding--><a href="#" >select_files_from_computer</a>
477 </div>
478 <div class="col-xs-12 col-md-9 col-sm-12 col-lg-9 col-no-padding"><span class="pull-right dz-default dz-message">drag_files_here</span></div>
479 </div>
480 <div class="clearfix hidden-sm-up"></div>
481 </div>
482 <button class="btn btn-default" data-action="#" id="id_2" disabled="disabled">Label</button>
483</div>');
484 $button = new I\Component\Button\Standard('Label', '#');
485 $with_button = $this->dropzone()->standard('')->withUploadButton($button);
486 $html = $this->brutallyTrimHTML($this->getDefaultRenderer()->render($with_button));
487 $this->assertEquals($expected_html, $html);
488 $this->assertEquals($button, $with_button->getUploadButton());
489 }

References ILIAS_UI_TestBase\brutallyTrimHTML(), dropzone(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

Field Documentation

◆ STANDARD

const DropzoneRendererTest::STANDARD = "ILIAS\\UI\\Component\\Dropzone\\File\\Standard"

Definition at line 18 of file DropzoneRendererTest.php.

◆ WRAPPER

const DropzoneRendererTest::WRAPPER = "ILIAS\\UI\\Component\\Dropzone\\File\\Wrapper"

Definition at line 19 of file DropzoneRendererTest.php.


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