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 class=\"control-label col-sm-3\">$label</label>" 69 .
"<div class=\"col-sm-9\">" 70 .
"<div class=\"il-input-password\" id=\"id_1\">" 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->brutallyTrimHTML($r->render($pwd));
91 $expected = $this->brutallyTrimHTML(
' 92 <div class="form-group row"> 93 <label class="control-label col-sm-3">label</label> 94 <div class="col-sm-9"> 95 <div class="help-block alert alert-danger" role="alert">an_error</div> 96 <div class="il-input-password" id="id_1"><input type="password" name="name_0" class="form-control form-control-sm" /></div> 97 <div class="help-block">byline</div> 101 $this->assertEquals($expected, $html);
107 $f = $this->buildFactory();
110 $pwd =
$f->password($label)->withNameFrom($this->name_source);
112 $r = $this->getDefaultRenderer();
114 .
"<div class=\"form-group row\">" 115 .
"<label class=\"control-label col-sm-3\">$label</label>" 116 .
"<div class=\"col-sm-9\">" 117 .
"<div class=\"il-input-password\" id=\"id_1\">" 118 .
"<input type=\"password\" name=\"$name\" class=\"form-control form-control-sm\" />" 122 $this->assertHTMLEquals($expected, $r->render($pwd));
128 $f = $this->buildFactory();
132 $pwd =
$f->password($label)->withValue($value)->withNameFrom($this->name_source);
134 $r = $this->getDefaultRenderer();
136 .
"<div class=\"form-group row\">" 137 .
"<label class=\"control-label col-sm-3\">$label</label>" 138 .
"<div class=\"col-sm-9\">" 139 .
"<div class=\"il-input-password\" id=\"id_1\">" 140 .
"<input type=\"password\" name=\"$name\" value=\"$value\" class=\"form-control form-control-sm\" />" 144 $this->assertHTMLEquals($expected, $r->render($pwd));
150 $f = $this->buildFactory();
153 $pwd =
$f->password($label)->withNameFrom($this->name_source)->withRequired(
true);
155 $r = $this->getDefaultRenderer();
156 $html = $r->render($pwd);
159 .
"<div class=\"form-group row\">" 160 .
"<label class=\"control-label col-sm-3\">" .
"$label" 161 .
"<span class=\"asterisk\">*</span>" 163 .
"<div class=\"col-sm-9\">" 164 .
"<div class=\"il-input-password\" id=\"id_1\">" 165 .
"<input type=\"password\" name=\"$name\" class=\"form-control form-control-sm\" />" 169 $this->assertHTMLEquals($expected, $html);
175 $f = $this->buildFactory();
178 $pwd =
$f->password($label)->withNameFrom($this->name_source)->withDisabled(
true);
180 $r = $this->getDefaultRenderer();
181 $html = $r->render($pwd);
184 .
"<div class=\"form-group row\">" 185 .
"<label class=\"control-label col-sm-3\">$label</label>" 186 .
"<div class=\"col-sm-9\">" 187 .
"<div class=\"il-input-password\" id=\"id_1\">" 188 .
"<input type=\"password\" name=\"$name\" disabled=\"disabled\" class=\"form-control form-control-sm\" />" 192 $this->assertHTMLEquals($expected, $html);
198 $f = $this->buildFactory();
201 $pwd =
$f->password($label)->withNameFrom($this->name_source)->withRequired(
true);
204 $value1 = $pwd1->getContent();
205 $this->assertTrue($value1->isOk());
208 $value2 = $pwd2->getContent();
209 $this->assertTrue($value2->isError());
214 $f = $this->buildFactory();
216 $pwd =
$f->password($label)->withNameFrom($this->name_source);
217 $this->assertNull($pwd->getValue());
220 $pwd = $pwd->withInput($post);
221 $this->assertEquals($post->getOr(
'',
''), $pwd->getValue());
222 $this->assertInstanceOf(PWD::class, $pwd->getContent()->value());
Class ChatMainBarProvider .
Provides common functionality for UI tests.