5 require_once(__DIR__ .
"/../../../../../libs/composer/vendor/autoload.php");
6 require_once(__DIR__ .
"/../../../Base.php");
7 require_once(__DIR__ .
"/InputTest.php");
12 use \ILIAS\UI\Component\Input\Field;
23 return 'some alternative value';
37 $df =
new Data\Factory();
38 $language = $this->createMock(\ilLanguage::class);
50 $f = $this->buildFactory();
51 $pwd =
$f->password(
"label",
"byline");
52 $this->assertInstanceOf(Field\Input::class, $pwd);
53 $this->assertInstanceOf(Field\Password::class, $pwd);
59 $f = $this->buildFactory();
63 $pwd =
$f->password($label, $byline)->withNameFrom($this->name_source);
65 $r = $this->getDefaultRenderer();
67 .
"<div class=\"form-group row\">" 68 .
"<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>" 69 .
"<div class=\"col-sm-9\">" 70 .
"<div class=\"il-input-password\">" 71 .
"<input type=\"password\" name=\"$name\" class=\"form-control form-control-sm\" />" 73 .
"<div class=\"help-block\">$byline</div>" 76 $this->assertHTMLEquals($expected, $r->render($pwd));
82 $f = $this->buildFactory();
87 $pwd =
$f->password($label, $byline)->withNameFrom($this->name_source)->withError($error);
89 $r = $this->getDefaultRenderer();
90 $html = $this->normalizeHTML($r->render($pwd));
92 .
"<div class=\"form-group row\">" 93 .
" <label for=\"$name\" class=\"control-label col-sm-3\">$label</label>" 94 .
" <div class=\"col-sm-9\">" 95 .
" <div class=\"il-input-password\">" 96 .
" <input type=\"password\" name=\"$name\" class=\"form-control form-control-sm\" />" 98 .
" <div class=\"help-block\">$byline</div>" 99 .
" <div class=\"help-block alert alert-danger\" role=\"alert\">" 100 .
" <img border=\"0\" src=\"./templates/default/images/icon_alert.svg\" alt=\"alert\" />" 106 $html = preg_replace(
'!\s+!',
' ', $html);
107 $expected = preg_replace(
'!\s+!',
' ', $expected);
108 $html = explode(
' ', $html);
109 $expected = explode(
' ', $expected);
110 $this->assertEquals($expected, $html);
116 $f = $this->buildFactory();
119 $pwd =
$f->password($label)->withNameFrom($this->name_source);
121 $r = $this->getDefaultRenderer();
123 .
"<div class=\"form-group row\">" 124 .
"<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>" 125 .
"<div class=\"col-sm-9\">" 126 .
"<div class=\"il-input-password\">" 127 .
"<input type=\"password\" name=\"$name\" class=\"form-control form-control-sm\" />" 131 $this->assertHTMLEquals($expected, $r->render($pwd));
137 $f = $this->buildFactory();
141 $pwd =
$f->password($label)->withValue($value)->withNameFrom($this->name_source);
143 $r = $this->getDefaultRenderer();
145 .
"<div class=\"form-group row\">" 146 .
"<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>" 147 .
"<div class=\"col-sm-9\">" 148 .
"<div class=\"il-input-password\">" 149 .
"<input type=\"password\" name=\"$name\" value=\"$value\" class=\"form-control form-control-sm\" />" 153 $this->assertHTMLEquals($expected, $r->render($pwd));
159 $f = $this->buildFactory();
162 $pwd =
$f->password($label)->withNameFrom($this->name_source)->withRequired(
true);
164 $r = $this->getDefaultRenderer();
165 $html = $r->render($pwd);
168 .
"<div class=\"form-group row\">" 169 .
"<label for=\"$name\" class=\"control-label col-sm-3\">" .
"$label" 170 .
"<span class=\"asterisk\">*</span>" 172 .
"<div class=\"col-sm-9\">" 173 .
"<div class=\"il-input-password\">" 174 .
"<input type=\"password\" name=\"$name\" class=\"form-control form-control-sm\" />" 178 $this->assertHTMLEquals($expected, $html);
184 $f = $this->buildFactory();
187 $pwd =
$f->password($label)->withNameFrom($this->name_source)->withDisabled(
true);
189 $r = $this->getDefaultRenderer();
190 $html = $r->render($pwd);
193 .
"<div class=\"form-group row\">" 194 .
"<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>" 195 .
"<div class=\"col-sm-9\">" 196 .
"<div class=\"il-input-password\">" 197 .
"<input type=\"password\" name=\"$name\" disabled=\"disabled\" class=\"form-control form-control-sm\" />" 201 $this->assertHTMLEquals($expected, $html);
207 $f = $this->buildFactory();
210 $pwd =
$f->password($label)->withNameFrom($this->name_source)->withRequired(
true);
213 $value1 = $pwd1->getContent();
214 $this->assertTrue($value1->isOk());
217 $value2 = $pwd2->getContent();
218 $this->assertTrue($value2->isError());
223 $f = $this->buildFactory();
225 $pwd =
$f->password($label)->withNameFrom($this->name_source);
226 $this->assertNull($pwd->getValue());
229 $pwd = $pwd->withInput($post);
230 $this->assertEquals($post->getOr(
'',
''), $pwd->getValue());
231 $this->assertInstanceOf(PWD::class, $pwd->getContent()->value());
Class ChatMainBarProvider .
Provides common functionality for UI tests.