5 require_once(__DIR__ .
"/../../../../../libs/composer/vendor/autoload.php");
6 require_once(__DIR__ .
"/../../../Base.php");
7 require_once(__DIR__ .
"/InputTest.php");
10 use \ILIAS\UI\Component\Input\Field;
30 $df =
new Data\Factory();
31 $language = $this->createMock(\ilLanguage::class);
44 $textarea =
$f->textarea(
"label",
"byline");
45 $this->assertInstanceOf(Field\Input::class, $textarea);
46 $this->assertInstanceOf(Field\Textarea::class, $textarea);
53 $textarea =
$f->textarea(
"label");
54 $this->assertInstanceOf(Field\Input::class, $textarea);
55 $this->assertInstanceOf(Field\Textarea::class, $textarea);
63 $textarea =
$f->textarea(
'label')->withMinLimit($limit);
64 $this->assertInstanceOf(Field\Input::class, $textarea);
65 $this->assertInstanceOf(Field\Textarea::class, $textarea);
66 $this->assertEquals($textarea->getMinLimit(), $limit);
74 $textarea =
$f->textarea(
'label')->withMaxLimit($limit);
75 $this->assertInstanceOf(Field\Input::class, $textarea);
76 $this->assertInstanceOf(Field\Textarea::class, $textarea);
77 $this->assertEquals($textarea->getMaxLimit(), $limit);
86 $textarea =
$f->textarea(
'label')->withMinLimit(5);
87 $this->assertTrue($textarea->isLimited());
90 $textarea =
$f->textarea(
'label')->withMaxLimit(5);
91 $this->assertTrue($textarea->isLimited());
94 $textarea =
$f->textarea(
'label')->withMinLimit(5)->withMaxLimit(20);
95 $this->assertTrue($textarea->isLimited());
98 $textarea =
$f->textarea(
'label');
99 $this->assertFalse($textarea->isLimited());
107 $textarea =
$f->textarea(
'label')->withMinLimit($limit);
108 $this->assertEquals($textarea->getMinLimit(), $limit);
116 $textarea =
$f->textarea(
'label')->withMaxLimit($limit);
117 $this->assertEquals($textarea->getMaxLimit(), $limit);
129 $textarea =
$f->textarea($label, $byline)->withNameFrom($this->name_source);
131 $expected =
"<div class=\"form-group row\">" 132 .
"<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>" 133 .
"<div class=\"col-sm-9\">" 134 .
"<textarea name=\"$name\" class=\"form-control form-control-sm\"></textarea>" 135 .
"<div class=\"help-block\">byline</div>" 152 $byline =
"This is just a byline Min: " . $min;
153 $textarea =
$f->textarea($label, $byline)->withMinLimit($min)->withNameFrom($this->name_source);
155 $expected =
"<div class=\"form-group row\">" 156 .
"<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>" 157 .
"<div class=\"col-sm-9\">" 158 .
"<textarea name=\"$name\" class=\"form-control form-control-sm\" id=\"$id\"></textarea>" 159 .
"<div id=\"textarea_feedback_$id\" data-maxchars=\"\"></div>" 160 .
"<div class=\"help-block\">$byline</div>" 176 $byline =
"This is just a byline Max: " . $max;
177 $textarea =
$f->textarea($label, $byline)->withMaxLimit($max)->withNameFrom($this->name_source);
179 $expected =
"<div class=\"form-group row\">" 180 .
"<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>" 181 .
"<div class=\"col-sm-9\">" 182 .
"<textarea name=\"$name\" class=\"form-control form-control-sm\" id=\"$id\"></textarea>" 183 .
"<div id=\"textarea_feedback_$id\" data-maxchars=\"$max\"></div>" 184 .
"<div class=\"help-block\">$byline</div>" 201 $byline =
"This is just a byline Min: " . $min .
" Max: " . $max;
202 $textarea =
$f->textarea($label, $byline)->withMinLimit($min)->withMaxLimit($max)->withNameFrom($this->name_source);
204 $expected =
"<div class=\"form-group row\">" 205 .
"<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>" 206 .
"<div class=\"col-sm-9\">" 207 .
"<textarea name=\"$name\" class=\"form-control form-control-sm\" id=\"$id\"></textarea>" 208 .
"<div id=\"textarea_feedback_$id\" data-maxchars=\"$max\"></div>" 209 .
"<div class=\"help-block\">$byline</div>" 224 $value =
"Lorem ipsum dolor sit";
225 $textarea =
$f->textarea($label, $byline)->withValue($value)->withNameFrom($this->name_source);
227 $expected =
"<div class=\"form-group row\">" 228 .
"<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>" 229 .
"<div class=\"col-sm-9\">" 230 .
"<textarea name=\"$name\" class=\"form-control form-control-sm\">$value</textarea>" 231 .
"<div class=\"help-block\">byline</div>" 246 $byline =
"This is just a byline Min: " . $min;
248 $textarea =
$f->textarea($label, $byline)->withNameFrom($this->name_source)->withError($error);
250 $expected =
"<div class=\"form-group row\">" 251 .
"<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>" 252 .
"<div class=\"col-sm-9\">" 253 .
"<textarea name=\"$name\" class=\"form-control form-control-sm\"></textarea>" 254 .
"<div class=\"help-block\">$byline</div>" 255 .
"<div class=\"help-block alert alert-danger\" role=\"alert\">" 256 .
"<img border=\"0\" src=\"./templates/default/images/icon_alert.svg\" alt=\"alert\" />" 257 .
"$error</div></div></div>";
260 $html = trim(preg_replace(
'/\t+/',
'', $html));
261 $expected = trim(preg_replace(
'/\t+/',
'', $expected));
262 $this->assertEquals($expected, $html);
272 $textarea =
$f->textarea($label, $byline)->withNameFrom($this->name_source)->withDisabled(
true);
274 $expected =
"<div class=\"form-group row\">" 275 .
"<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>" 276 .
"<div class=\"col-sm-9\">" 277 .
"<textarea name=\"$name\" disabled=\"disabled\" class=\"form-control form-control-sm\"></textarea>" 278 .
"<div class=\"help-block\">byline</div>" 290 $text =
$f->textarea(
"")
291 ->withNameFrom($this->name_source)
294 $content = $text->getContent();
295 $this->assertEquals(
"alert()", $content->value());
test_renderer_with_min_limit()
Class ChatMainBarProvider .
test_renderer_counter_with_value()
test_renderer_with_max_limit()
getDefaultRenderer(JavaScriptBinding $js_binding=null)
test_renderer_with_disabled()
test_implements_factory_interface_without_byline()
Provides common functionality for UI tests.
test_implements_factory_interface()
assertHTMLEquals($expected_html_as_string, $html_as_string)
test_renderer_with_error()
test_renderer_with_min_and_max_limit()