5require_once(__DIR__ .
"/../../../../../libs/composer/vendor/autoload.php");
6require_once(__DIR__ .
"/../../../Base.php");
7require_once(__DIR__ .
"/InputTest.php");
10use \ILIAS\UI\Component\Input\Field;
39 $numeric =
$f->numeric(
"label",
"byline");
41 $this->assertInstanceOf(Field\Input::class, $numeric);
42 $this->assertInstanceOf(Field\Numeric::class, $numeric);
52 $numeric =
$f->numeric($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=\"number\" name=\"$name\" class=\"form-control form-control-sm\" />"
59 .
" <div class=\"help-block\">$byline</div>" .
" " .
" </div>" .
"</div>";
60 $this->assertEquals($expected, $html);
71 $numeric =
$f->numeric($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=\"number\" 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 $numeric =
$f->numeric($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=\"number\" name=\"$name\" class=\"form-control form-control-sm\" />"
97 .
" " .
" " .
" </div>" .
"</div>";
98 $this->assertEquals($expected, $html);
108 $numeric =
$f->numeric($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=\"number\" value=\"$value\" name=\"$name\" class=\"form-control form-control-sm\" />" .
" " .
" "
116 .
" </div>" .
"</div>";
117 $this->assertEquals($expected, $html);
125 $numeric =
$f->numeric($label)->withNameFrom($this->name_source)->withDisabled(
true);
130 $expected =
"<div class=\"form-group row\">" .
" <label for=\"$name\" class=\"control-label col-sm-3\">$label</label>"
131 .
" <div class=\"col-sm-9\">" .
" <input type=\"number\" name=\"$name\" disabled=\"disabled\" class=\"form-control form-control-sm\" />"
132 .
" " .
" " .
" </div>" .
"</div>";
133 $this->assertEquals($expected, $html);
140 $field =
$f->numeric(
'')->withNameFrom($this->name_source);
141 $field_required = $field->withRequired(
true);
143 $value = $field->withInput($post_data)->getContent();
144 $this->assertTrue($value->isOk());
145 $this->assertNull($value->value());
147 $value = $field_required->withInput($post_data)->getContent();
148 $this->assertTrue($value->isError());
158 $field_required = $field->withRequired(
true);
160 $value = $field->withInput($post_data)->getContent();
161 $this->assertTrue($value->isOk());
162 $this->assertNull($value->value());
164 $field_required = $field_required->withInput($post_data);
165 $value = $field_required->getContent();
166 $this->assertTrue($value->isError());
175 $field_required = $field->withRequired(
true);
177 $value = $field->withInput($post_data)->getContent();
178 $this->assertTrue($value->isOk());
179 $this->assertEquals(0, $value->value());
181 $value = $field_required->withInput($post_data)->getContent();
182 $this->assertTrue($value->isOK());
183 $this->assertEquals(0, $value->value());
An exception for terminatinating execution or to throw for unit testing.
Provides common functionality for UI tests.
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Class ChatMainBarProvider \MainMenu\Provider.