5require_once(__DIR__ .
"/../../../../../libs/composer/vendor/autoload.php");
6require_once(__DIR__ .
"/../../../Base.php");
7require_once(__DIR__ .
"/InputTest.php");
10use \ILIAS\UI\Component\Input\Field;
13use \ILIAS\Transformation;
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);
124 $field =
$f->numeric(
'')->withNameFrom($this->name_source);
125 $field_required = $field->withRequired(
true);
127 $value = $field->withInput($post_data)->getContent();
128 $this->assertTrue($value->isOk());
129 $this->assertNull($value->value());
131 $value = $field_required->withInput($post_data)->getContent();
132 $this->assertTrue($value->isError());
142 $field_required = $field->withRequired(
true);
144 $value = $field->withInput($post_data)->getContent();
145 $this->assertTrue($value->isOk());
146 $this->assertNull($value->value());
147 $this->assertFalse($value->value() ===
'');
149 $value = $field_required->withInput($post_data)->getContent();
150 $this->assertTrue($value->isError());
An exception for terminatinating execution or to throw for unit testing.
Provides common functionality for UI tests.
getDefaultRenderer(JavaScriptBinding $js_binding=null)