19 declare(strict_types=1);
21 require_once(__DIR__ .
"/../../../../../../../vendor/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"/../../../Base.php");
23 require_once(__DIR__ .
"/InputTest.php");
24 require_once(__DIR__ .
"/CommonFieldRendering.php");
45 $f = $this->getFieldFactory();
46 $cp =
$f->colorpicker(
"label",
"byline");
47 $this->assertInstanceOf(\
ILIAS\
UI\
Component\Input\Container\Form\FormInput::class, $cp);
48 $this->assertInstanceOf(Field\ColorPicker::class, $cp);
53 $f = $this->getFieldFactory();
56 $cp =
$f->colorpicker($label, $byline)->withNameFrom($this->name_source);
58 $expected = $this->getFormWrappedHtml(
59 'color-picker-field-input',
61 '<input id="id_1" type="color" name="name_0" value="" class="c-field-color-picker"/>',
65 $this->assertEquals($expected, $this->render($cp));
70 $f = $this->getFieldFactory();
72 $colorpicker =
$f->colorpicker($label, null)->withNameFrom($this->name_source);
74 $this->testWithError($colorpicker);
75 $this->testWithNoByline($colorpicker);
76 $this->testWithRequired($colorpicker);
77 $this->testWithDisabled($colorpicker);
78 $this->testWithAdditionalOnloadCodeRendersId($colorpicker);
83 $f = $this->getFieldFactory();
87 $cp =
$f->colorpicker($label, $byline)
89 ->withNameFrom($this->name_source);
91 $expected = $this->getFormWrappedHtml(
92 'color-picker-field-input',
94 '<input id="id_1" type="color" name="name_0" value="value_0" class="c-field-color-picker"/>',
98 $this->assertEquals($expected, $this->render($cp));
103 $f = $this->getFieldFactory();
107 $cp =
$f->colorpicker($label, $byline)
108 ->withNameFrom($this->name_source)
109 ->withRequired(
true);
111 $cp1 = $cp->withInput(
new DefInputData([$name =>
"#FFF"]));
112 $value1 = $cp1->getContent();
113 $this->assertTrue($value1->isOk());
115 $cp2 = $cp->withInput(
new DefInputData([$name =>
"#00"]));
116 $value2 = $cp2->getContent();
117 $this->assertTrue($value2->isError());
120 $value2 = $cp3->getContent();
121 $this->assertTrue($value2->isError());
126 $f = $this->getFieldFactory();
127 $colorpicker =
$f->colorpicker(
"label",
"byline");
128 $this->expectException(\InvalidArgumentException::class);
129 $colorpicker->withValue(null);
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...