19 declare(strict_types=1);
21 require_once(__DIR__ .
"/../../../../../libs/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"/../../../Base.php");
23 require_once(__DIR__ .
"/InputTest.php");
42 $df =
new Data\Factory();
43 $language = $this->createMock(ilLanguage::class);
44 return new I\Input\Field\Factory(
56 $textarea =
$f->textarea(
"label",
"byline");
58 $this->assertInstanceOf(Field\Textarea::class, $textarea);
64 $textarea =
$f->textarea(
"label");
66 $this->assertInstanceOf(Field\Textarea::class, $textarea);
73 $textarea =
$f->textarea(
'label')->withMinLimit($limit);
75 $this->assertInstanceOf(Field\Textarea::class, $textarea);
76 $this->assertEquals($textarea->getMinLimit(), $limit);
83 $textarea =
$f->textarea(
'label')->withMaxLimit($limit);
85 $this->assertInstanceOf(Field\Textarea::class, $textarea);
86 $this->assertEquals($textarea->getMaxLimit(), $limit);
94 $textarea =
$f->textarea(
'label')->withMinLimit(5);
95 $this->assertTrue($textarea->isLimited());
98 $textarea =
$f->textarea(
'label')->withMaxLimit(5);
99 $this->assertTrue($textarea->isLimited());
102 $textarea =
$f->textarea(
'label')->withMinLimit(5)->withMaxLimit(20);
103 $this->assertTrue($textarea->isLimited());
106 $textarea =
$f->textarea(
'label');
107 $this->assertFalse($textarea->isLimited());
114 $textarea =
$f->textarea(
'label')->withMinLimit($limit);
115 $this->assertEquals($textarea->getMinLimit(), $limit);
122 $textarea =
$f->textarea(
'label')->withMaxLimit($limit);
123 $this->assertEquals($textarea->getMaxLimit(), $limit);
134 $textarea =
$f->textarea($label, $byline)->withNameFrom($this->name_source);
136 $expected =
"<div class=\"form-group row\">" 137 .
"<label for=\"id_1\" class=\"control-label col-sm-4 col-md-3 col-lg-2\">$label</label>" 138 .
"<div class=\"col-sm-8 col-md-9 col-lg-10\">" 139 .
"<textarea id=\"id_1\" name=\"$name\" class=\"form-control form-control-sm\"></textarea>" 140 .
"<div class=\"help-block\">byline</div>" 157 $byline =
"This is just a byline Min: " . $min;
158 $textarea =
$f->textarea($label, $byline)->withMinLimit($min)->withNameFrom($this->name_source);
160 $expected =
"<div class=\"form-group row\">" 161 .
"<label for=\"id_1\" class=\"control-label col-sm-4 col-md-3 col-lg-2\">$label</label>" 162 .
"<div class=\"col-sm-8 col-md-9 col-lg-10\">" 163 .
"<textarea id=\"$id\" name=\"$name\" class=\"form-control form-control-sm\"></textarea>" 164 .
"<div id=\"textarea_feedback_$id\" data-maxchars=\"\"></div>" 165 .
"<div class=\"help-block\">$byline</div>" 181 $byline =
"This is just a byline Max: " . $max;
182 $textarea =
$f->textarea($label, $byline)->withMaxLimit($max)->withNameFrom($this->name_source);
184 $expected =
"<div class=\"form-group row\">" 185 .
"<label for=\"id_1\" class=\"control-label col-sm-4 col-md-3 col-lg-2\">$label</label>" 186 .
"<div class=\"col-sm-8 col-md-9 col-lg-10\">" 187 .
"<textarea id=\"$id\" name=\"$name\" class=\"form-control form-control-sm\"></textarea>" 188 .
"<div id=\"textarea_feedback_$id\" data-maxchars=\"$max\"></div>" 189 .
"<div class=\"help-block\">$byline</div>" 206 $byline =
"This is just a byline Min: " . $min .
" Max: " . $max;
207 $textarea =
$f->textarea($label, $byline)->withMinLimit($min)->withMaxLimit($max)->withNameFrom($this->name_source);
209 $expected =
"<div class=\"form-group row\">" 210 .
"<label for=\"id_1\" class=\"control-label col-sm-4 col-md-3 col-lg-2\">$label</label>" 211 .
"<div class=\"col-sm-8 col-md-9 col-lg-10\">" 212 .
"<textarea id=\"$id\" name=\"$name\" class=\"form-control form-control-sm\"></textarea>" 213 .
"<div id=\"textarea_feedback_$id\" data-maxchars=\"$max\"></div>" 214 .
"<div class=\"help-block\">$byline</div>" 229 $value =
"Lorem ipsum dolor sit";
230 $textarea =
$f->textarea($label, $byline)->withValue($value)->withNameFrom($this->name_source);
232 $expected =
"<div class=\"form-group row\">" 233 .
"<label for=\"id_1\" class=\"control-label col-sm-4 col-md-3 col-lg-2\">$label</label>" 234 .
"<div class=\"col-sm-8 col-md-9 col-lg-10\">" 235 .
"<textarea id=\"id_1\" name=\"$name\" class=\"form-control form-control-sm\">$value</textarea>" 236 .
"<div class=\"help-block\">byline</div>" 250 $byline =
"This is just a byline Min: " . $min;
252 $textarea =
$f->textarea($label, $byline)->withNameFrom($this->name_source)->withError($error);
255 <div class="form-group row"> 256 <label for="id_1" class="control-label col-sm-4 col-md-3 col-lg-2">label</label> 257 <div class="col-sm-8 col-md-9 col-lg-10"> 258 <div class="help-block alert alert-danger" aria-describedby="id_1" role="alert">an_error</div> 259 <textarea id="id_1" name="name_0" class="form-control form-control-sm"></textarea> 260 <div class="help-block">This is just a byline Min: 5</div> 266 $this->assertEquals($expected, $html);
276 $textarea =
$f->textarea($label, $byline)->withNameFrom($this->name_source)->withDisabled(
true);
278 $expected =
"<div class=\"form-group row\">" 279 .
"<label for=\"id_1\" class=\"control-label col-sm-4 col-md-3 col-lg-2\">$label</label>" 280 .
"<div class=\"col-sm-8 col-md-9 col-lg-10\">" 281 .
"<textarea id=\"id_1\" name=\"$name\" disabled=\"disabled\" class=\"form-control form-control-sm\"></textarea>" 282 .
"<div class=\"help-block\">byline</div>" 294 $text =
$f->textarea(
"")
295 ->withNameFrom($this->name_source)
298 $content = $text->getContent();
299 $this->assertEquals(
"alert()", $content->value());
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
test_renderer_with_min_limit()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
test_renderer_counter_with_value()
test_renderer_with_max_limit()
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
test_renderer_with_disabled()
DefNamesource $name_source
test_implements_factory_interface_without_byline()
Provides common functionality for UI tests.
test_implements_factory_interface()
test_renderer_with_error()
test_renderer_with_min_and_max_limit()
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
normalizeHTML(string $html)