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;
12 use \ILIAS\Validation;
13 use \ILIAS\Transformation;
25 $df =
new Data\Factory();
29 new Validation\
Factory($df, $this->createMock(\ilLanguage::class)),
39 $text =
$f->text(
"label",
"byline");
41 $this->assertInstanceOf(Field\Input::class,
$text);
42 $this->assertInstanceOf(Field\Text::class,
$text);
52 $text =
$f->text($label, $byline)->withNameFrom($this->name_source);
57 $expected =
"<div class=\"form-group row\">" .
" <label for=\"$name\" class=\"control-label col-sm-3\">$label</label>" 58 .
" <div class=\"col-sm-9\">" .
" <input type=\"text\" name=\"$name\" class=\"form-control form-control-sm\" />" 59 .
" <div class=\"help-block\">$byline</div>" .
" " .
" </div>" .
"</div>";
60 $this->assertEquals($expected,
$html);
71 $text =
$f->text($label, $byline)->withNameFrom($this->name_source)->withError($error);
76 $expected =
"<div class=\"form-group row\">" .
" <label for=\"$name\" class=\"control-label col-sm-3\">$label</label>" 77 .
" <div class=\"col-sm-9\">" .
" <input type=\"text\" name=\"$name\" class=\"form-control form-control-sm\" />" 78 .
" <div class=\"help-block\">$byline</div>" .
" <div class=\"help-block alert alert-danger\" role=\"alert\">" 79 .
" <img border=\"0\" src=\"./templates/default/images/icon_alert.svg\" alt=\"alert\" />" .
" $error" 80 .
" </div>" .
" </div>" .
"</div>";
81 $this->assertEquals($expected,
$html);
90 $text =
$f->text($label)->withNameFrom($this->name_source);
95 $expected =
"<div class=\"form-group row\">" .
" <label for=\"$name\" class=\"control-label col-sm-3\">$label</label>" 96 .
" <div class=\"col-sm-9\">" .
" <input type=\"text\" name=\"$name\" class=\"form-control form-control-sm\" />" .
" " 97 .
" " .
" </div>" .
"</div>";
98 $this->assertEquals($expected,
$html);
108 $text =
$f->text($label)->withValue($value)->withNameFrom($this->name_source);
113 $expected =
"<div class=\"form-group row\">" .
" <label for=\"$name\" class=\"control-label col-sm-3\">$label</label>" 114 .
" <div class=\"col-sm-9\">" 115 .
" <input type=\"text\" value=\"$value\" name=\"$name\" class=\"form-control form-control-sm\" />" .
" " .
" " 116 .
" </div>" .
"</div>";
117 $this->assertEquals($expected,
$html);
126 $text =
$f->text($label)->withNameFrom($this->name_source)->withRequired(
true);
131 $expected =
"<div class=\"form-group row\">" .
" <label for=\"$name\" class=\"control-label col-sm-3\">" .
"$label" 132 .
"<span class=\"asterisk\">*</span>" .
"</label>" .
" <div class=\"col-sm-9\">" 133 .
" <input type=\"text\" name=\"$name\" class=\"form-control form-control-sm\" />" .
" " .
" " .
" </div>" 135 $this->assertEquals($expected,
$html);
144 $text =
$f->text($label)->withNameFrom($this->name_source)->withRequired(
true);
147 $value1 = $text1->getContent();
148 $this->assertTrue($value1->isOk());
149 $this->assertEquals(
"0", $value1->value());
152 $value2 = $text2->getContent();
153 $this->assertTrue($value2->isError());
161 ->withNameFrom($this->name_source)
164 $content =
$text->getContent();
165 $this->assertEquals(
"alert()", $content->value());
test_implements_factory_interface()
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Provides common functionality for UI tests.